????
Current Path : C:/inetpub/vhost/binhdinhinvest.gdtvietnam.com/www/ |
Current File : C:/inetpub/vhost/binhdinhinvest.gdtvietnam.com/www/43.4b64b0b66c64ae34ea4d.js |
(function(){var e={"esri/arcade/featureset/support/OrderbyClause":"+nnH","esri/arcade/functions/featuresetbase":"1+78","esri/arcade/featureSetCollection":"1FvL","esri/arcade/featureset/sources/Empty":"20W2","esri/arcade/featureset/actions/GroupBy":"25uz","esri/arcade/functions/featuresetgeom":"59NQ","esri/arcade/featureset/support/FeatureSet":"88sq","esri/arcade/featureset/support/StatsField":"8wKU","esri/core/MD5":"CaYo","esri/arcade/featureset/actions/OrderBy":"G0SM","esri/arcade/functions/featuresetstring":"IvL0","esri/arcade/featureset/support/stats":"PMeB","esri/arcade/featureset/sources/FeatureLayerRelated":"PNLr","esri/arcade/featureset/support/IdSet":"Q4uJ","esri/arcade/featureset/sources/FeatureLayerDynamic":"QA8M","esri/arcade/featureset/support/sqlUtils":"SqzB","esri/arcade/featureset/actions/SpatialFilter":"VM5u","esri/arcade/featureset/sources/FeatureLayerMemory":"bBZx","esri/arcade/featureSetUtils":"eLe6","esri/arcade/featureset/actions/Adapted":"gub2","esri/arcade/featureset/actions/Top":"ijuC","esri/arcade/functions/featuresetstats":"mHvT","esri/arcade/featureset/actions/AttributeFilter":"ufnL","esri/geometry/geometryEngineAsync":"wfTL","esri/arcade/featureset/support/cache":"x/o6","esri/arcade/featureset/support/FeatureSetIterator":"ydXo"},t=this||window,r=t.webpackJsonp=t.webpackJsonp||[];r.registerAbsMids?r.registerAbsMids(e):(r.absMidsWaiting=r.absMidsWaiting||[]).push(e)})(),(window.webpackJsonp=window.webpackJsonp||[]).push([[43],{"+nnH":function(e,t,r){var n,a;n=[r.dj.c(e.i),t],void 0===(a=(function(e,t){function r(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}return function(){function e(e){var t=e.split(",");this._fields=[],this._directions=[];for(var r=0;r<t.length;r++){var n=t[r].match(/\S+/g);this._fields.push(n[0]),2===n.length?"asc"===n[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}return e.prototype.constructClause=function(){for(var e="",t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],e+=1===this._directions[t]?" ASC":" DESC";return e},e.prototype.order=function(e){var t=this;e.sort((function(e,n){for(var a=0;a<t._fields.length;a++){var i,s=t.featureValue(e.feature,t._fields[a],a),o=t.featureValue(n.feature,t._fields[a],a);if(0!==(i=1===t._directions[a]?r(s,o):-1*r(s,o)))return i}return 0}))},e.prototype.scanForField=function(e){for(var t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1},e.prototype.replaceFields=function(t){for(var r="",n=0;n<this._fields.length;n++){0!==n&&(r+=",");for(var a=this._fields[n],i=0,s=t;i<s.length;i++){var o=s[i];if(a.toLowerCase()===o.field.toLowerCase()){a=o.newfield;break}}r+=a,r+=1===this._directions[n]?" ASC":" DESC"}return new e(r)},e.prototype.featureValue=function(e,t,r){var n=e.attributes[t];if(void 0!==n)return n;for(var a in e.attributes)if(t.toLowerCase()===a.toLowerCase())return this._fields[r]=a,e.attributes[a];return null},e}()}).apply(null,n))||(e.exports=a)},"1+78":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("rChG"),r("B2KM"),r("B2KM"),r("T8lH"),r("1FvL"),r("eLe6"),r("gfOZ"),r("gub2"),r("ufnL"),r("G0SM"),r("ijuC"),r("20W2"),r("bBZx"),r("+nnH"),r("tq6K"),r("SqzB"),r("lT9l"),r("qMld"),r("1eyA"),r("Zvuv"),r("KQcO")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d,f,p,h,_,y,g,v,m,S,F,w){function b(e,t,r){var n=e.getVariables();if(n.length>0){for(var a=[],i=0;i<n.length;i++)a.push(t.evaluateIdentifier(r,{name:n[i]}));return m.all(a).then((function(t){for(var r={},a=0;a<n.length;a++)r[n[a]]=t[a];return e.parameters=r,e}))}return m.resolve(e)}function I(e,t,r){for(var n in void 0===r&&(r=null),e)if(n.toLowerCase()===t.toLowerCase())return e[n];return r}function T(e){if(null===e)return null;var t={type:I(e,"type",""),name:I(e,"name","")};if("range"===t.type)t.range=I(e,"range",[]);else{t.codedValues=[];for(var r=0,n=I(e,"codedValues",[]);r<n.length;r++){var a=n[r];t.codedValues.push({name:I(a,"name",""),code:I(a,"code",null)})}}return t}function D(e){if(null===e)return null;var t={},r=I(e,"wkt",null);null!==r&&(t.wkt=r);var n=I(e,"wkid",null);return null!==n&&(t.wkid=n),t}function C(e){if(null===e)return null;var t={hasZ:I(e,"hasz",!1),hasM:I(e,"hasm",!1)},r=I(e,"spatialreference",null);r&&(t.spatialReference=D(r));var n=I(e,"x",null);if(null!==n)return t.x=n,t.y=I(e,"y",null),t;var a=I(e,"rings",null);if(null!==a)return t.rings=a,t;var i=I(e,"paths",null);if(null!==i)return t.paths=i,t;var s=I(e,"points",null);if(null!==s)return t.points=s,t;for(var o=0,l=["xmin","xmax","ymin","ymax","zmin","zmax","mmin","mmax"];o<l.length;o++){var u=l[o],c=I(e,u,null);null!==c&&(t[u]=c)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.registerFunctions=function(e){"async"===e.mode&&(e.functions.featuresetbyid=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(l.pcCheck(r,2,4),r[0]instanceof s){var n=l.toString(r[1]),a=l.defaultUndefined(r[2],null),i=l.toBoolean(l.defaultUndefined(r[3],!0));if(null===a&&(a=["*"]),!1===l.isArray(a))throw new Error("Invalid Parameter");return r[0].featureSetById(n,i,a)}throw new Error("Invalid Parameter")}))},e.signatures.push({name:"featuresetbyid",min:"2",max:"4"}),e.functions.featuresetbyportalitem=function(t,n){return e.standardFunctionAsync(t,n,(function(e,n,a){if(l.pcCheck(a,2,5),null===a[0])throw new Error("Portal is required");if(a[0]instanceof r){var i=l.toString(a[1]),s=l.toString(a[2]),u=l.defaultUndefined(a[3],null),c=l.toBoolean(l.defaultUndefined(a[4],!0));if(null===u&&(u=["*"]),!1===l.isArray(u))throw new Error("Invalid Parameter");var d=null;return t.services&&t.services.portal&&(d=t.services.portal),d=o.getPortal(a[0],d),o.constructFeatureSetFromPortalItem(i,s,t.spatialReference,u,c,d,t.lrucache)}if(!1===l.isString(a[0]))throw new Error("Portal is required");var f=l.toString(a[0]),p=l.toString(a[1]),h=l.defaultUndefined(a[2],null),_=l.toBoolean(l.defaultUndefined(a[3],!0));if(null===h&&(h=["*"]),!1===l.isArray(h))throw new Error("Invalid Parameter");if(t.services&&t.services.portal)return o.constructFeatureSetFromPortalItem(f,p,t.spatialReference,h,_,t.services.portal,t.lrucache);throw new Error("Portal is required")}))},e.signatures.push({name:"featuresetbyportalitem",min:"2",max:"5"}),e.functions.featuresetbyname=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(l.pcCheck(r,2,4),r[0]instanceof s){var n=l.toString(r[1]),a=l.defaultUndefined(r[2],null),i=l.toBoolean(l.defaultUndefined(r[3],!0));if(null===a&&(a=["*"]),!1===l.isArray(a))throw new Error("Invalid Parameter");return r[0].featureSetByName(n,i,a)}throw new Error("Invalid Parameter")}))},e.signatures.push({name:"featuresetbyname",min:"2",max:"4"}),e.functions.featureset=function(t,r){return e.standardFunction(t,r,(function(e,r,a){l.pcCheck(a,1,1);var i,s=a[0],o={layerDefinition:{geometryType:"",objectIdField:"",typeIdField:"",fields:[]},featureSet:{geometryType:"",features:[]}};if(l.isString(s))void 0!==(s=JSON.parse(s)).layerDefinition?(o.layerDefinition=s.layerDefinition,o.featureSet=s.featureSet,s.layerDefinition.spatialReference&&(o.layerDefinition.spatialReference=s.layerDefinition.spatialReference)):(o.featureSet.features=s.features,o.featureSet.geometryType=s.geometryType,o.layerDefinition.geometryType=o.featureSet.geometryType,o.layerDefinition.objectIdField=s.objectIdFieldName,o.layerDefinition.typeIdField=s.typeIdFieldName,o.layerDefinition.fields=s.fields,s.spatialReference&&(o.layerDefinition.spatialReference=s.spatialReference));else{if(!(a[0]instanceof n))throw new Error("Invalid Parameter");var u=I(s=JSON.parse(a[0].castToText()),"layerdefinition");if(null!==u){o.layerDefinition.geometryType=I(u,"geometrytype",""),o.featureSet.geometryType=o.layerDefinition.geometryType,o.layerDefinition.objectIdField=I(u,"objectidfield",""),o.layerDefinition.typeIdField=I(u,"typeidfield",""),(b=I(u,"spatialreference",null))&&(o.layerDefinition.spatialReference=D(b));for(var c=0,d=I(u,"fields",[]);c<d.length;c++){var f={name:I(A=d[c],"name",""),alias:I(A,"alias",""),type:I(A,"type",""),nullable:I(A,"nullable",!0),editable:I(A,"editable",!0),length:I(A,"length",null),domain:T(I(A,"domain"))};o.layerDefinition.fields.push(f)}var p=I(s,"featureset",null);if(p){for(var _={},y=0,g=o.layerDefinition.fields;y<g.length;y++)_[(w=g[y]).name.toLowerCase()]=w.name;for(var v=0,m=I(p,"features",[]);v<m.length;v++){var S={},F=I(O=m[v],"attributes",{});for(var w in F)S[_[w.toLowerCase()]]=F[w];o.featureSet.features.push({attributes:S,geometry:C(I(O,"geometry",null))})}}}else{var b;o.layerDefinition.geometryType=I(s,"geometrytype",""),o.featureSet.geometryType=o.layerDefinition.geometryType,o.layerDefinition.objectIdField=I(s,"objectidfieldname",""),o.layerDefinition.typeIdField=I(s,"typeidfieldname",""),(b=I(s,"spatialreference",null))&&(o.layerDefinition.spatialReference=D(b));for(var x=0,E=I(s,"fields",[]);x<E.length;x++){var A;f={name:I(A=E[x],"name",""),alias:I(A,"alias",""),type:I(A,"type",""),nullable:I(A,"nullable",!0),editable:I(A,"editable",!0),length:I(A,"length",null),domain:T(I(A,"domain"))},o.layerDefinition.fields.push(f)}_={};for(var R=0,N=o.layerDefinition.fields;R<N.length;R++)_[(w=N[R]).name.toLowerCase()]=w.name;for(var k=0,P=I(s,"features",[]);k<P.length;k++){var O;for(var w in S={},F=I(O=P[k],"attributes",{}))S[_[w.toLowerCase()]]=F[w];o.featureSet.features.push({attributes:S,geometry:C(I(O,"geometry",null))})}}}if(0==(!!(i=o).layerDefinition&&!!i.featureSet&&!1!==function(e,t){for(var r=0,n=["","esriGeometryPoint","esriGeometryPolyline","esriGeometryPolygon","esriGeometryMultipoint","esriGeometryEnvelope"];r<n.length;r++)if(n[r]===e)return!0;return!1}(i.layerDefinition.geometryType)&&null!==i.layerDefinition.objectIdField&&""!==i.layerDefinition.objectIdField&&!1!==l.isArray(i.layerDefinition.fields)&&!1!==l.isArray(i.featureSet.features)))throw new Error("Invalid Parameter");return h.create(o,t.spatialReference)}))},e.signatures.push({name:"featureset",min:"1",max:"1"}),e.functions.filter=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return l.pcCheck(a,2,2),l.isFeatureSet(a[0])?a[0].load().then((function(r){var n=S.WhereClause.create(a[1],r.getFieldsIndex()),i=n.getVariables();if(i.length>0){for(var s=[],o=0;o<i.length;o++)s.push(e.evaluateIdentifier(t,{name:i[o]}));return m.all(s).then((function(e){for(var t={},r=0;r<i.length;r++)t[i[r]]=e[r];return n.parameters=t,new c({parentfeatureset:a[0],whereclause:n})}))}return m.resolve(new c({parentfeatureset:a[0],whereclause:n}))})):e.failDefferred("Filter cannot accept this parameter type")}))},e.signatures.push({name:"filter",min:"2",max:"2"}),e.functions.orderby=function(t,r){return e.standardFunctionAsync(t,r,(function(t,r,n){if(l.pcCheck(n,2,2),l.isFeatureSet(n[0])){var a=new _(n[1]);return m.resolve(new d({parentfeatureset:n[0],orderbyclause:a}))}return e.failDefferred("Order cannot accept this parameter type")}))},e.signatures.push({name:"orderby",min:"2",max:"2"}),e.functions.top=function(t,r){return e.standardFunctionAsync(t,r,(function(t,r,n){return l.pcCheck(n,2,2),l.isFeatureSet(n[0])?m.resolve(new f({parentfeatureset:n[0],topnum:n[1]})):l.isArray(n[0])?l.toNumber(n[1])>=n[0].length?n[0].slice(0):n[0].slice(0,l.toNumber(n[1])):l.isImmutableArray(n[0])?l.toNumber(n[1])>=n[0].length()?n[0].slice(0):n[0].slice(0,l.toNumber(n[1])):e.failDefferred("Top cannot accept this parameter type")}))},e.signatures.push({name:"top",min:"2",max:"2"}),e.functions.first=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){return l.pcCheck(r,1,1),l.isFeatureSet(r[0])?r[0].first(e.abortSignal).then((function(e){if(null!==e){var t=i.createFromGraphicLikeObject(e.geometry,e.attributes,r[0]);t._underlyingGraphic=e,e=t}return e})):l.isArray(r[0])?m.resolve(0===r[0].length?null:r[0][0]):l.isImmutableArray(r[0])?0===r[0].length()?m.resolve(null):m.resolve(r[0].get(0)):null}))},e.signatures.push({name:"first",min:"1",max:"1"}),e.functions.attachments=function(t,r){return e.standardFunctionAsync(t,r,(function(e,r,a){l.pcCheck(a,1,2);var s={minsize:-1,maxsize:-1,types:null};if(a.length>1)if(a[1]instanceof n){if(a[1].hasField("minsize")&&(s.minsize=l.toNumber(a[1].field("minsize"))),a[1].hasField("maxsize")&&(s.maxsize=l.toNumber(a[1].field("maxsize"))),a[1].hasField("types")){var u=l.toStringArray(a[1].field("types"),!1);u.length>0&&(s.types=u)}}else if(null!==a[1])throw new Error("Invalid Parameter");if(a[0]instanceof i){var c=a[0]._layer;return c instanceof F&&(c=o.constructFeatureSet(c,t.spatialReference,["*"],!0,t.lrucache)),null===c||!1===l.isFeatureSet(c)?[]:c.load().then((function(){return c.queryAttachments(a[0].field(c.objectIdField),s.minsize,s.maxsize,s.types)}))}if(null===a[0])return[];throw new Error("Invalid Parameter")}))},e.signatures.push({name:"attachments",min:"1",max:"2"}),e.functions.featuresetbyrelationshipname=function(t,r){return e.standardFunctionAsync(t,r,(function(e,r,n){l.pcCheck(n,2,4);var a=n[0],s=l.toString(n[1]),u=l.defaultUndefined(n[2],null),c=l.toBoolean(l.defaultUndefined(n[3],!0));if(null===u&&(u=["*"]),!1===l.isArray(u))throw new Error("Invalid Parameter");if(null===n[0])return null;if(!(n[0]instanceof i))throw new Error("Invalid Parameter");var d=a._layer;return d instanceof F&&(d=o.constructFeatureSet(d,t.spatialReference,["*"],!0,t.lrucache)),null===d||!1===l.isFeatureSet(d)?null:d.load().then((function(e){var r=e.relationshipMetaData().filter((function(e){return e.name===s}));if(0===r.length)return null;if(null!=r[0].relationshipTableId&&r[0].relationshipTableId>-1)return o.constructFeatureSetFromRelationship(e,r[0],a.field(e.objectIdField),e.spatialReference,u,c,t.lrucache);var n=e.serviceUrl();return n?(n="/"===n.charAt(n.length-1)?n+r[0].relatedTableId.toString():n+"/"+r[0].relatedTableId.toString(),o.constructFeatureSetFromUrl(n,e.spatialReference,u,c,t.lrucache).then((function(t){return t.load().then((function(){return t.relationshipMetaData()})).then((function(n){if(n=n.filter((function(e){return e.id===r[0].id})),!1===a.hasField(r[0].keyField)||null===a.field(r[0].keyField))return e.getFeatureByObjectId(a.field(e.objectIdField),[r[0].keyField]).then((function(e){if(e){var a=S.WhereClause.create(n[0].keyField+"= @id",t.getFieldsIndex());return a.parameters={id:e.attributes[r[0].keyField]},t.filter(a)}return new p({parentfeatureset:t})}));var i=S.WhereClause.create(n[0].keyField+"= @id",t.getFieldsIndex());return i.parameters={id:a.field(r[0].keyField)},t.filter(i)}))}))):null}))}))},e.signatures.push({name:"featuresetbyrelationshipname",min:"2",max:"4"}),e.functions.featuresetbyassociation=function(t,r){return e.standardFunctionAsync(t,r,(function(e,r,n){l.pcCheck(n,2,3);var a=n[0],s=l.toString(l.defaultUndefined(n[1],"")).toLowerCase(),c=l.isString(n[2])?l.toString(n[2]):null;if(null===n[0])return null;if(!(n[0]instanceof i))throw new Error("Invalid Parameter");var d=a._layer;return d instanceof F&&(d=o.constructFeatureSet(d,t.spatialReference,["*"],!0,t.lrucache)),null===d||!1===l.isFeatureSet(d)?null:d.load().then((function(){var e=d.serviceUrl();return o.constructAssociationMetaDataFeatureSetFromUrl(e,t.spatialReference)})).then((function(e){var t=null,r=null,n=!1;if(null!==c&&""!==c&&void 0!==c){for(var i=0,o=e.terminals;i<o.length;i++){var f=o[i];f.terminalName===c&&(r=f.terminalId)}null===r&&(n=!0)}for(var p=e.associations.getFieldsIndex(),h=p.get("TOGLOBALID").name,_=p.get("FROMGLOBALID").name,g=p.get("TOTERMINALID").name,v=p.get("FROMTERMINALID").name,m=p.get("FROMNETWORKSOURCEID").name,F=p.get("TONETWORKSOURCEID").name,b=p.get("ASSOCIATIONTYPE").name,I=p.get("ISCONTENTVISIBLE").name,T=p.get("OBJECTID").name,D=0,C=d.fields;D<C.length;D++){var x=C[D];if("global-id"===x.type){t=a.field(x.name);break}}var E=null,A=new u.SqlExpressionAdapted(new w({name:"percentalong",alias:"percentalong",type:"double"}),S.WhereClause.create("0",e.associations.getFieldsIndex())),R=new u.SqlExpressionAdapted(new w({name:"side",alias:"side",type:"string"}),S.WhereClause.create("''",e.associations.getFieldsIndex())),N={};for(var k in e.lkp)N[k]=e.lkp[k].sourceId;var P=new u.StringToCodeAdapted(new w({name:"classname",alias:"classname",type:"string"}),null,N),O="";switch(s){case"midspan":O="(("+h+"='"+t+"') OR ( "+_+"='"+t+"')) AND ("+b+" IN (5))",P.codefield=S.WhereClause.create("CASE WHEN ("+h+"='"+t+"') THEN "+m+" ELSE "+F+" END",e.associations.getFieldsIndex());var L=y.cloneField(u.AdaptedFeatureSet.findField(e.associations.fields,_));L.name="globalid",L.alias="globalid",E=new u.SqlExpressionAdapted(L,S.WhereClause.create("CASE WHEN ("+_+"='"+t+"') THEN "+h+" ELSE "+_+" END",e.associations.getFieldsIndex())),A=e.unVersion>=4?new u.OriginalField(u.AdaptedFeatureSet.findField(e.associations.fields,p.get("PERCENTALONG").name)):new u.SqlExpressionAdapted(new w({name:"percentalong",alias:"percentalong",type:"double"}),S.WhereClause.create("0",e.associations.getFieldsIndex()));break;case"junctionedge":O="(("+h+"='"+t+"') OR ( "+_+"='"+t+"')) AND ("+b+" IN (4,6))",P.codefield=S.WhereClause.create("CASE WHEN ("+h+"='"+t+"') THEN "+m+" ELSE "+F+" END",e.associations.getFieldsIndex());var j=y.cloneField(u.AdaptedFeatureSet.findField(e.associations.fields,_));j.name="globalid",j.alias="globalid",E=new u.SqlExpressionAdapted(j,S.WhereClause.create("CASE WHEN ("+_+"='"+t+"') THEN "+h+" ELSE "+_+" END",e.associations.getFieldsIndex())),R=new u.SqlExpressionAdapted(new w({name:"side",alias:"side",type:"string"}),S.WhereClause.create("CASE WHEN ("+b+"=4) THEN 'from' ELSE 'to' END",e.associations.getFieldsIndex()));break;case"connected":var G=h+"='@T'",q=_+"='@T'";null!==r&&(G+=" AND "+g+"=@A",q+=" AND "+v+"=@A"),O=l.multiReplace(O="(("+G+") OR ("+q+"))","@T",t),G=l.multiReplace(G,"@T",t),null!==r&&(G=l.multiReplace(G,"@A",r.toString()),O=l.multiReplace(O,"@A",r.toString())),P.codefield=S.WhereClause.create("CASE WHEN "+G+" THEN "+m+" ELSE "+F+" END",e.associations.getFieldsIndex());var M=y.cloneField(u.AdaptedFeatureSet.findField(e.associations.fields,_));M.name="globalid",M.alias="globalid",E=new u.SqlExpressionAdapted(M,S.WhereClause.create("CASE WHEN "+G+" THEN "+_+" ELSE "+h+" END",e.associations.getFieldsIndex()));break;case"container":O=h+"='"+t+"' AND "+b+" = 2",null!==r&&(O+=" AND "+g+" = "+r.toString()),P.codefield=m,O="( "+O+" )",E=new u.FieldRename(u.AdaptedFeatureSet.findField(e.associations.fields,_),"globalid","globalid");case"content":O="("+_+"='"+t+"' AND "+b+" = 2)",null!==r&&(O+=" AND "+v+" = "+r.toString()),P.codefield=F,O="( "+O+" )",E=new u.FieldRename(u.AdaptedFeatureSet.findField(e.associations.fields,h),"globalid","globalid");break;case"structure":O="("+h+"='"+t+"' AND "+b+" = 3)",null!==r&&(O+=" AND "+g+" = "+r.toString()),P.codefield=m,O="( "+O+" )",E=new u.FieldRename(u.AdaptedFeatureSet.findField(e.associations.fields,_),"globalid","globalId");break;case"attached":O="("+_+"='"+t+"' AND "+b+" = 3)",null!==r&&(O+=" AND "+v+" = "+r.toString()),P.codefield=F,O="( "+O+" )",E=new u.FieldRename(u.AdaptedFeatureSet.findField(e.associations.fields,h),"globalid","globalId");break;default:throw new Error("Invalid Parameter")}return n&&(O="1 <> 1"),new u.AdaptedFeatureSet({parentfeatureset:e.associations,adaptedFields:[new u.OriginalField(u.AdaptedFeatureSet.findField(e.associations.fields,T)),new u.OriginalField(u.AdaptedFeatureSet.findField(e.associations.fields,I)),E,R,P,A],extraFilter:O?S.WhereClause.create(O,e.associations.getFieldsIndex()):null})}))}))},e.signatures.push({name:"featuresetbyassociation",min:"2",max:"6"}),e.functions.groupby=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,i){return l.pcCheck(i,3,3),l.isFeatureSet(i[0])?i[0].load().then((function(r){var n=[],s=[],o=!1,u=[];if(l.isString(i[1]))u.push(i[1]);else if(i[1]instanceof a)u.push(i[1]);else if(l.isArray(i[1]))u=i[1];else{if(!l.isImmutableArray(i[1]))return e.failDefferred("Illegal Value: GroupBy");u=i[1].toArray()}for(var c=0,d=u;c<d.length;c++){var f=d[c];if(l.isString(f)){var p=S.WhereClause.create(l.toString(f),r.getFieldsIndex()),h=!0===g.isSingleField(p)?l.toString(f):"%%%%FIELDNAME";n.push({name:h,expression:p}),"%%%%FIELDNAME"===h&&(o=!0)}else{if(!(f instanceof a))return e.failDefferred("Illegal Value: GroupBy");var _=f.hasField("name")?f.field("name"):"%%%%FIELDNAME";if(p=f.hasField("expression")?f.field("expression"):"","%%%%FIELDNAME"===_&&(o=!0),!_)return e.failDefferred("Illegal Value: GroupBy");n.push({name:_,expression:S.WhereClause.create(p||_,r.getFieldsIndex())})}}if(u=[],l.isString(i[2]))u.push(i[2]);else if(l.isArray(i[2]))u=i[2];else if(l.isImmutableArray(i[2]))u=i[2].toArray();else{if(!(i[2]instanceof a))return e.failDefferred("Illegal Value: GroupBy");u.push(i[2])}for(var y=0,v=u;y<v.length;y++){if(!((f=v[y])instanceof a))return e.failDefferred("Illegal Value: GroupBy");var F=f.hasField("name")?f.field("name"):"",w=f.hasField("statistic")?f.field("statistic"):"";if(p=f.hasField("expression")?f.field("expression"):"",!F||!w||!p)return e.failDefferred("Illegal Value: GroupBy");s.push({name:F,statistic:w.toLowerCase(),expression:S.WhereClause.create(p,r.getFieldsIndex())})}if(o){for(var I={},T=0,D=r.fields;T<D.length;T++)I[(P=D[T]).name.toLowerCase()]=1;for(var C=0,x=n;C<x.length;C++)"%%%%FIELDNAME"!==(P=x[C]).name&&(I[P.name.toLowerCase()]=1);for(var E=0,A=s;E<A.length;E++)"%%%%FIELDNAME"!==(P=A[E]).name&&(I[P.name.toLowerCase()]=1);for(var R=0,N=0,k=n;N<k.length;N++){var P;if("%%%%FIELDNAME"===(P=k[N]).name){for(;1===I["field_"+R.toString()];)R++;I["field_"+R.toString()]=1,P.name="FIELD_"+R.toString()}}}for(var O=[],L=0,j=n;L<j.length;L++){var G=j[L];O.push(b(G.expression,e,t))}for(var q=0,M=s;q<M.length;q++)O.push(b((G=M[q]).expression,e,t));return O.length>0?m.all(O).then((function(){return m.resolve(i[0].groupby(n,s))})):m.resolve(i[0].groupby(n,s))})):e.failDefferred("Illegal Value: GroupBy")}))},e.signatures.push({name:"groupby",min:"3",max:"3"}),e.functions.distinct=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,i){return l.isFeatureSet(i[0])?(l.pcCheck(i,2,2),i[0].load().then((function(r){var n=[],s=[];if(l.isString(i[1]))s.push(i[1]);else if(i[1]instanceof a)s.push(i[1]);else if(l.isArray(i[1]))s=i[1];else{if(!l.isImmutableArray(i[1]))return e.failDefferred("Illegal Value: GroupBy");s=i[1].toArray()}for(var o=!1,u=0,c=s;u<c.length;u++){var d=c[u];if(l.isString(d)){var f=S.WhereClause.create(l.toString(d),r.getFieldsIndex()),p=!0===g.isSingleField(f)?l.toString(d):"%%%%FIELDNAME";n.push({name:p,expression:f}),"%%%%FIELDNAME"===p&&(o=!0)}else{if(!(d instanceof a))return e.failDefferred("Illegal Value: GroupBy");var h=d.hasField("name")?d.field("name"):"%%%%FIELDNAME";if(f=d.hasField("expression")?d.field("expression"):"","%%%%FIELDNAME"===h&&(o=!0),!h)return e.failDefferred("Illegal Value: GroupBy");n.push({name:h,expression:S.WhereClause.create(f||h,r.getFieldsIndex())})}}if(o){for(var _={},y=0,v=r.fields;y<v.length;y++)_[(C=v[y]).name.toLowerCase()]=1;for(var F=0,w=n;F<w.length;F++)"%%%%FIELDNAME"!==(C=w[F]).name&&(_[C.name.toLowerCase()]=1);for(var I=0,T=0,D=n;T<D.length;T++){var C;if("%%%%FIELDNAME"===(C=D[T]).name){for(;1===_["field_"+I.toString()];)I++;_["field_"+I.toString()]=1,C.name="FIELD_"+I.toString()}}}for(var x=[],E=0,A=n;E<A.length;E++)x.push(b(A[E].expression,e,t));return x.length>0?m.all(x).then((function(){return m.resolve(i[0].groupby(n,[]))})):m.resolve(i[0].groupby(n,[]))}))):function(e,t,r,n){if(1===n.length){if(l.isArray(n[0]))return v.calculateStat(e,n[0],-1);if(l.isImmutableArray(n[0]))return v.calculateStat(e,n[0].toArray(),-1)}return v.calculateStat(e,n,-1)}("distinct",0,0,i)}))})}}).apply(null,n))||(e.exports=a)},"1FvL":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("qMld")],void 0===(a=(function(e,t,r){return function(){function e(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}return e.prototype.add=function(e,t,r){this._layerById[t]=r,this._layerByName[e]=r},e.prototype.featureSetByName=function(e,t,r){return void 0===t&&(t=!0),void 0===r&&(r=["*"]),this.resolvePromise(void 0===this._layerByName[e]?null:this._layerByName[e])},e.prototype.featureSetById=function(e,t,r){return void 0===t&&(t=!0),void 0===r&&(r=["*"]),this.resolvePromise(void 0===this._layerById[e]?null:this._layerById[e])},e.prototype.castToText=function(){return"object, FeatureSetCollection"},e.prototype.resolvePromise=function(e){return r.resolve(e)},e}()}).apply(null,n))||(e.exports=a)},"20W2":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("88sq"),r("Q4uJ"),r("tq6K"),r("qMld")],void 0===(a=(function(e,t,r,n,a,i,s){return function(e){function t(t){var r=e.call(this,t)||this;return r.declaredClass="esri.layers.featureset.sources.Empty",r._maxProcessing=1e3,r._wset=new a([],[],!1,null),r._parent=t.parentfeatureset,r._databaseType=i.FeatureServiceDatabaseType.Standardised,r}return r.__extends(t,e),t.prototype._getSet=function(){return s.resolve(this._wset)},t.prototype.optimisePagingFeatureQueries=function(){},t.prototype._isInFeatureSet=function(){return i.IdState.NotInFeatureSet},t.prototype._getFeature=function(){return s.reject(new Error("No Feature Found in EmptySet"))},t.prototype.queryAttachments=function(){return s.resolve([])},t.prototype._getFeatures=function(){return s.resolve("success")},t.prototype._featureFromCache=function(){return null},t.prototype._fetchAndRefineFeatures=function(){return s.reject(new Error("Fetch and Refine should not be called in this featureset"))},t.prototype._getFilteredSet=function(){return s.resolve(new a([],[],!1,null))},t.prototype._stat=function(e,t,r,n,a,i,s){return this._manualStat(e,t,i,s)},t.prototype._canDoAggregates=function(){return s.resolve(!1)},t}(n)}).apply(null,n))||(e.exports=a)},"25uz":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("jZlN"),r("gfOZ"),r("gub2"),r("ufnL"),r("G0SM"),r("88sq"),r("Q4uJ"),r("+nnH"),r("tq6K"),r("SqzB"),r("SqzB"),r("PMeB"),r("8wKU"),r("CaYo"),r("qMld"),r("1eyA"),r("Z4y+"),r("KQcO"),r("I90O")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d,f,p,h,_,y,g,v,m,S,F){function w(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}var b=function(e){function t(t){var r=e.call(this,t)||this;return r._decodedStatsfield=[],r._decodedGroupbyfield=[],r._candosimplegroupby=!0,r.phsyicalgroupbyfields=[],r.objectIdField="ROW__ID",r._internalObjectIdField="ROW__ID",r._adaptedFields=[],r.declaredClass="esri.arcade.featureset.actions.Aggregate",r._uniqueIds=1,r._maxQuery=10,r._maxProcessing=10,r._parent=t.parentfeatureset,r._config=t,r}return r.__extends(t,e),t.prototype.isTable=function(){return!0},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._getFilteredSet("",null,null,null,e).then((function(e){return t._wset=e,t._wset})):g.resolve(this._wset)},t.prototype._isInFeatureSet=function(){return d.IdState.InFeatureSet},t.prototype.nextUniqueName=function(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;var t="T"+this._uniqueIds.toString();return e[t]=1,t},t.prototype.convertToEsriFieldType=function(e){return e},t.prototype._initialiseFeatureSet=function(){var e={},t=!1,r=1,n=this._parent?this._parent.getFieldsIndex():new F([]);for(this.objectIdField="ROW__ID";!1===t;){for(var a=!1,s=0;s<this._config.groupbyfields.length;s++)if(this._config.groupbyfields[s].name.toLowerCase()===this.objectIdField.toLowerCase()){a=!0;break}if(!1===a)for(s=0;s<this._config.statsfields.length;s++)if(this._config.statsfields[s].name.toLowerCase()===this.objectIdField.toLowerCase()){a=!0;break}!1===a?t=!0:(this.objectIdField="ROW__ID"+r.toString(),r++)}for(var o=0,l=this._config.statsfields;o<l.length;o++){var u=l[o],c=new _;c.field=u.name,c.tofieldname=u.name,c.workingexpr=u.expression instanceof v.WhereClause?u.expression:v.WhereClause.create(u.expression,n),c.typeofstat=w(u.statistic),this._decodedStatsfield.push(c)}this._decodedGroupbyfield=[];for(var h=0,y=this._config.groupbyfields;h<y.length;h++){var g={name:(u=y[h]).name,singlefield:null,tofieldname:u.name,expression:u.expression instanceof v.WhereClause?u.expression:v.WhereClause.create(u.expression,n)};this._decodedGroupbyfield.push(g)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(var b=0,I=this._parent.fields;b<I.length;b++)e[(u=I[b]).name.toUpperCase()]=1;this.types=null}else this.geometryType=d.layerGeometryEsriConstants.point,this.typeIdField="",this.types=null,this.spatialReference=new m({wkid:4326});this.fields=[];var T=new _;T.field=this.nextUniqueName(e),T.tofieldname=this.objectIdField,T.workingexpr=v.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex()),T.typeofstat="MIN",this._decodedStatsfield.push(T);for(var D=0,C=this._decodedGroupbyfield;D<C.length;D++){var x=C[D],E=new S;if(x.name=this.nextUniqueName(e),E.name=x.tofieldname,E.alias=E.name,f.isSingleField(x.expression)){if(!(k=this._parent.getField(p.toWhereClause(x.expression,d.FeatureServiceDatabaseType.Standardised))))throw new Error("Field is not present for Aggregation");x.name=k.name,x.singlefield=k.name,this.phsyicalgroupbyfields.push(k.name),E.type=k.type}else{E.type=this.convertToEsriFieldType(p.predictType(x.expression,this._parent.fields));var A=new S;A.name=x.name,A.alias=A.name,this.phsyicalgroupbyfields.push(x.name),this._adaptedFields.push(new i.SqlExpressionAdapted(A,x.expression)),this._candosimplegroupby=!1}this.fields.push(E)}if(this._adaptedFields.length>0)for(var R=0,N=this._parent.fields;R<N.length;R++)this._adaptedFields.push(new i.OriginalField(u=N[R]));for(s=0;s<this._decodedStatsfield.length;s++){E=new S;var k=null;(x=this._decodedStatsfield[s]).field=this.nextUniqueName(e),x.tofieldname===this.objectIdField&&(this._internalObjectIdField=x.field),E.name=x.tofieldname,E.alias=E.name;var P=null!==x.workingexpr&&f.isSingleField(x.workingexpr)?p.toWhereClause(x.workingexpr,d.FeatureServiceDatabaseType.Standardised):"";switch(this._decodedStatsfield[s].typeofstat){case"SUM":if(""!==P){if(!(k=this._parent.getField(P)))throw new Error("Field is not present for Aggregation");E.type=k.type}else E.type="double";break;case"MIN":case"MAX":if(""!==P){if(!(k=this._parent.getField(P)))throw new Error("Field is not present for Aggregation");E.type=k.type}else E.type="double";break;case"COUNT":E.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==P&&!(k=this._parent.getField(P)))throw new Error("Field is not present for Aggregation");E.type="double"}this.fields.push(E)}},t.prototype._canDoAggregates=function(){return g.resolve(!1)},t.prototype._getFeatures=function(e,t,r,n){var a=this;-1!==t&&void 0===this._featureCache[t]&&[].push(t);var i=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,i)?this._expandPagedSet(e,i,0,0,n).then((function(){return a._getFeatures(e,t,r,n)})):g.resolve("success")},t.prototype._getFilteredSet=function(e,t,r,n,a){var l=this;if(""!==e)return g.resolve(new u([],[],!0,null));var d=null,p={ordered:!1,nowhereclause:!1};return this._ensureLoaded().then((function(){if(null!==r)for(var e=0;e<l._decodedStatsfield.length;e++)if(!0===f.scanForField(r,l._decodedStatsfield[e].tofieldname)){p.nowhereclause=!0,r=null;break}if(null!==n){for(p.ordered=!0,e=0;e<l._decodedStatsfield.length;e++)if(!0===n.scanForField(l._decodedStatsfield[e].tofieldname)){n=null,p.ordered=!1;break}if(null!==n)for(var t=0,a=l._decodedGroupbyfield;t<a.length;t++){var i=a[t];if(null===i.singlefield&&!0===n.scanForField(i.tofieldname)){n=null,p.ordered=!1;break}}}return!1===l._candosimplegroupby?g.resolve(!1):l._parent._canDoAggregates(l.phsyicalgroupbyfields,l._decodedStatsfield,"",null,null)})).then((function(e){if(e){var t=null;r&&(t=l._reformulateWhereClauseWithoutGroupByFields(r));var f=null;return n&&(f=l._reformulateOrderClauseWithoutGroupByFields(n)),l._parent._getAggregatePagesDataSourceDefinition(l.phsyicalgroupbyfields,l._decodedStatsfield,"",null,t,f,l._internalObjectIdField).then((function(e){return l._checkCancelled(a),d=!0===p.nowhereclause?new u(e._candidates.slice(0).concat(e._known.slice(0)),[],!0===p.ordered&&e._ordered,l._clonePageDefinition(e.pagesDefinition)):new u(e._candidates.slice(0),e._known.slice(0),!0===p.ordered&&e._ordered,l._clonePageDefinition(e.pagesDefinition))}))}var h=l._parent;if(l._adaptedFields.length>0&&(h=new i.AdaptedFeatureSet({parentfeatureset:l._parent,adaptedFields:l._adaptedFields,extraFilter:null})),!0===p.nowhereclause)d=new u(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:l._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:h,orderbyclause:new c(l.phsyicalgroupbyfields.join(",")+","+l._parent.objectIdField+" ASC")})}});else{var _=h;if(null!==r){var y=null;r&&(y=l._reformulateWhereClauseWithoutGroupByFields(r)),_=new s({parentfeatureset:_,whereclause:y})}d=new u(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:l._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:_,orderbyclause:new c(l.phsyicalgroupbyfields.join(",")+","+l._parent.objectIdField+" ASC")})}})}return d}))},t.prototype._reformulateWhereClauseWithoutStatsFields=function(e){for(var t=0,r=this._decodedStatsfield;t<r.length;t++){var n=r[t];e=p.reformulateWithoutField(e,n.tofieldname,p.toWhereClause(n.workingexpr,d.FeatureServiceDatabaseType.Standardised),this._parent.getFieldsIndex())}return e},t.prototype._reformulateWhereClauseWithoutGroupByFields=function(e){for(var t=0,r=this._decodedGroupbyfield;t<r.length;t++){var n=r[t];n.tofieldname!==n.name&&(e=p.reformulateWithoutField(e,n.tofieldname,p.toWhereClause(n.expression,d.FeatureServiceDatabaseType.Standardised),this._parent.getFieldsIndex()))}return e},t.prototype._reformulateOrderClauseWithoutGroupByFields=function(e){for(var t=[],r=0,n=this._decodedGroupbyfield;r<n.length;r++){var a=n[r];a.tofieldname!==a.name&&t.push({field:a.tofieldname,newfield:a.name})}return t.length>0?e.replaceFields(t):e},t.prototype._clonePageDefinition=function(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)},t.prototype._refineSetBlock=function(e,t,r){var n=this;try{return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?this._expandPagedSet(e,this._maxQuery,0,0,r).then((function(){return n._refineSetBlock(e,t,r)})):(this._checkCancelled(r),this._refineKnowns(e,t),g.resolve(e))}catch(e){return g.reject(e)}},t.prototype._expandPagedSet=function(e,t,r,n,a){return this._expandPagedSetFeatureSet(e,t,r,n,a)},t.prototype._getPhysicalPage=function(e,t,r){var a=this;return!0===e.pagesDefinition.aggregatefeaturesetpagedefinition?g.create((function(t,n){a._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,r,[]).then((function(e){t(e)}),n)})):this._getAgregagtePhysicalPage(e,t,r).then((function(e){for(var t=0,r=e;t<r.length;t++){for(var i=r[t],s={geometry:i.geometry,attributes:{}},o=0,l=a._decodedGroupbyfield;o<l.length;o++){var u=l[o];s.attributes[u.tofieldname]=i.attributes[u.name]}for(var c=0,d=a._decodedStatsfield;c<d.length;c++)s.attributes[(u=d[c]).tofieldname]=i.attributes[u.field];a._featureCache[s.attributes[a.objectIdField]]=new n(s)}return e.length}))},t.prototype._sequentialGetPhysicalItem=function(e,t,r,n){var a=this;return g.create((function(i,s){null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(r)),!0===e.pagesDefinition.internal.fullyResolved||0===t?i(n.length):a._nextAggregateItem(e,t,r,n,(function(s){i(null===s?n.length:a._sequentialGetPhysicalItem(e,t-=1,r,n))}),s)}))},t.prototype._nextAggregateItem=function(e,t,r,n,i,s){var o=this;try{a.tick(e.pagesDefinition.internal.iterator.next()).then((function(a){if(null===a)if(null!==e.pagesDefinition.internal.workingItem){var l=o._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);n.push(l),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(l.attributes[o.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,i(null)}else e.pagesDefinition.internal.fullyResolved=!0,i(null);else{var u=o._generateAggregateHash(a);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[a],id:u};else{if(u!==e.pagesDefinition.internal.workingItem.id)return l=o._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem),n.push(l),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(l.attributes[o.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[a],id:u},void i(l);e.pagesDefinition.internal.workingItem.features.push(a)}o._nextAggregateItem(e,t,r,n,i,s)}}),s)}catch(e){s(e)}},t.prototype._calculateFieldStat=function(e,t,r){for(var n=[],a=0;a<e.features.length;a++)if(null!==t.workingexpr){var i=t.workingexpr.calculateValue(e.features[a]);null!==i&&n.push(i)}else n.push(null);switch(t.typeofstat){case"MIN":r.attributes[t.tofieldname]=h.calculateStat("min",n,-1);break;case"MAX":r.attributes[t.tofieldname]=h.calculateStat("max",n,-1);break;case"SUM":r.attributes[t.tofieldname]=h.calculateStat("sum",n,-1);break;case"COUNT":r.attributes[t.tofieldname]=n.length;break;case"VAR":r.attributes[t.tofieldname]=h.calculateStat("var",n,-1);break;case"STDDEV":r.attributes[t.tofieldname]=h.calculateStat("stddev",n,-1);break;case"AVG":r.attributes[t.tofieldname]=h.calculateStat("avg",n,-1)}return!0},t.prototype._calculateAndAppendAggregateItem=function(e){for(var t={attributes:{},geometry:null},r=0,a=this._decodedGroupbyfield;r<a.length;r++){var i=a[r],s=i.singlefield?e.features[0].attributes[i.singlefield]:i.expression.calculateValue(e.features[0]);t.attributes[i.tofieldname]=s}for(var o=0,l=this._decodedStatsfield;o<l.length;o++)this._calculateFieldStat(e,l[o],t);for(var u=[],c=0;c<this._decodedStatsfield.length;c++)u.push(this._calculateFieldStat(e,this._decodedStatsfield[c],t));return this._featureCache[t.attributes[this.objectIdField]]=new n({attributes:t.attributes,geometry:t.geometry}),t},t.prototype._generateAggregateHash=function(e){for(var t="",r=0,n=this._decodedGroupbyfield;r<n.length;r++){var a=n[r],i=a.singlefield?e.attributes[a.singlefield]:a.expression.calculateValue(e);t+=null==i?":":":"+i.toString()}return y.createMD5Hash(t,y.outputTypes.String)},t.prototype._stat=function(){return g.resolve({calculated:!1})},t.prototype.getFeatureByObjectId=function(){return g.resolve(null)},t}(l);return l._featuresetFunctions.groupby=function(e,t){return new b({parentfeatureset:this,groupbyfields:e,statsfields:t})},b}).apply(null,n))||(e.exports=a)},"59NQ":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("WoOE"),r("gfOZ"),r("VM5u"),r("20W2"),r("qMld"),r("YADd"),r("wfTL")],void 0===(a=(function(e,t,r,n,a,i,s,o,l){function u(e){return e instanceof o}function c(e,t,c,d,f){return f(e,t,(function(e,t,f){if(f.length<2)return d(new Error("Missing Parameters"));if(null===(f=n.autoCastFeatureToGeometry(f))[0]&&null===f[1])return s.resolve(!1);if(n.isFeatureSet(f[0]))return f[1]instanceof o?s.resolve(new a({parentfeatureset:f[0],relation:c,relationGeom:f[1]})):null===f[1]?s.resolve(new i({parentfeatureset:f[0]})):d("Spatial Relation cannot accept this parameter type");if(u(f[0])){if(u(f[1])){var p=null;switch(c){case"esriSpatialRelEnvelopeIntersects":p=l.intersects(r.shapeExtent(f[0]),r.shapeExtent(f[1]));break;case"esriSpatialRelIntersects":p=l.intersects(f[0],f[1]);break;case"esriSpatialRelContains":p=l.contains(f[0],f[1]);break;case"esriSpatialRelOverlaps":p=l.overlaps(f[0],f[1]);break;case"esriSpatialRelWithin":p=l.within(f[0],f[1]);break;case"esriSpatialRelTouches":p=l.touches(f[0],f[1]);break;case"esriSpatialRelCrosses":p=l.crosses(f[0],f[1])}return null!==p?p:s.reject(new Error("Unrecognised Relationship"))}return n.isFeatureSet(f[1])?s.resolve(new a({parentfeatureset:f[1],relation:c,relationGeom:f[0]})):null===f[1]?s.resolve(!1):d("Spatial Relation cannot accept this parameter type")}return null!==f[0]?d("Spatial Relation cannot accept this parameter type"):n.isFeatureSet(f[1])?s.resolve(new i({parentfeatureset:f[1]})):f[1]instanceof o||null===f[1]?s.resolve(!1):void 0}))}Object.defineProperty(t,"__esModule",{value:!0}),t.registerFunctions=function(e){"async"===e.mode&&(e.functions.intersects=function(t,r){return c(t,r,"esriSpatialRelIntersects",e.failDefferred,e.standardFunctionAsync)},e.functions.envelopeintersects=function(t,r){return c(t,r,"esriSpatialRelEnvelopeIntersects",e.failDefferred,e.standardFunctionAsync)},e.signatures.push({name:"envelopeintersects",min:"2",max:"2"}),e.functions.contains=function(t,r){return c(t,r,"esriSpatialRelContains",e.failDefferred,e.standardFunctionAsync)},e.functions.overlaps=function(t,r){return c(t,r,"esriSpatialRelOverlaps",e.failDefferred,e.standardFunctionAsync)},e.functions.within=function(t,r){return c(t,r,"esriSpatialRelWithin",e.failDefferred,e.standardFunctionAsync)},e.functions.touches=function(t,r){return c(t,r,"esriSpatialRelTouches",e.failDefferred,e.standardFunctionAsync)},e.functions.crosses=function(t,r){return c(t,r,"esriSpatialRelCrosses",e.failDefferred,e.standardFunctionAsync)},e.functions.relate=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(r=n.autoCastFeatureToGeometry(r),n.pcCheck(r,3,3),u(r[0])&&u(r[1]))return l.relate(r[0],r[1],n.toString(r[2]));if(r[0]instanceof o&&null===r[1])return!1;if(r[1]instanceof o&&null===r[0])return!1;if(n.isFeatureSet(r[0])&&null===r[1])return new i({parentfeatureset:r[0]});if(n.isFeatureSet(r[1])&&null===r[0])return new i({parentfeatureset:r[1]});if(n.isFeatureSet(r[0])&&r[1]instanceof o)return r[0].relate(r[1],n.toString(r[2]));if(n.isFeatureSet(r[1])&&r[0]instanceof o)return r[1].relate(r[0],n.toString(r[2]));if(null===r[0]&&null===r[1])return!1;throw new Error("Illegal Argument")}))})}}).apply(null,n))||(e.exports=a)},"88sq":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("ydXo"),r("Q4uJ"),r("tq6K"),r("x/o6"),r("PMeB"),r("qMld"),r("1eyA"),r("wfTL"),r("Z4y+"),r("I90O")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d){return function(){function e(e){this.recentlyUsedQueries=null,this._idstates=[],this._parent=null,this._wset=null,this._mainSetInUse=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=a.FeatureServiceDatabaseType.NotEvaluated,this._databaseTypeProbed=null,this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._featureCache=[],this.types=null,this.fields=null,this.geometryType="",this.objectIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1,this._transparent=!1,this.loaded=!1,this._loadPromise=null,this._fieldsIndex=null,e&&e.lrucache&&(this.recentlyUsedQueries=e.lrucache)}return e.prototype.optimisePagingFeatureQueries=function(e){this._parent&&this._parent.optimisePagingFeatureQueries(e)},e.prototype._hasMemorySource=function(){return!0},e.prototype.prop=function(e,t){return void 0===t?this[e]:(void 0!==this[e]&&(this[e]=t),this)},e.prototype.end=function(){return null!==this._parent&&!0===this._parent._transparent?this._parent.end():this._parent},e.prototype._ensureLoaded=function(){return this.load()},e.prototype.load=function(){var e=this;return null===this._loadPromise&&(this._loadPromise=o.create((function(t,r){if(!0===e._parent.loaded)return e._initialiseFeatureSet(),void t(e);e._parent.load().then((function(){try{e._initialiseFeatureSet(),t(e)}catch(e){r(e)}}),r)}))),this._loadPromise},e.prototype._initialiseFeatureSet=function(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.spatialReference=new c({wkid:4326}),this.geometryType=a.layerGeometryEsriConstants.point)},e.prototype.getField=function(e,t){var r;return(t=t||this.fields)&&(e=e.toLowerCase(),t.some((function(t){return t&&t.name.toLowerCase()===e&&(r=t),!!r}))),r},e.prototype.getFieldsIndex=function(){return null===this._fieldsIndex&&(this._fieldsIndex=new d(this.fields)),this._fieldsIndex},e.prototype._maxProcessingRate=function(){return null!==this._parent?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())},e.prototype._maxQueryRate=function(){return null!==this._parent?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery},e.prototype._checkCancelled=function(e){if(null!==e&&e.aborted)throw new Error("Operation has been cancelled.")},e.prototype.nativeCapabilities=function(){return this._parent.nativeCapabilities()},e.prototype._canDoAggregates=function(e,t,r,n,a){return null===this._parent?o.resolve(!1):this._parent._canDoAggregates(e,t,r,n,a)},e.prototype._getAggregatePagesDataSourceDefinition=function(e,t,r,n,a,i,s){return null===this._parent?o.reject(new Error("Should never be called")):this._parent._getAggregatePagesDataSourceDefinition(e,t,r,n,a,i,s)},e.prototype._getAgregagtePhysicalPage=function(e,t,r){return null===this._parent?o.reject(new Error("Should never be called")):this._parent._getAgregagtePhysicalPage(e,t,r)},e.prototype.databaseType=function(){var e=this;if(this._databaseType===a.FeatureServiceDatabaseType.NotEvaluated){if(null!==i.applicationCache){var t=i.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==t)return t}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;var r=[{thetype:a.FeatureServiceDatabaseType.SqlServer,testwhere:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{thetype:a.FeatureServiceDatabaseType.Oracle,testwhere:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{thetype:a.FeatureServiceDatabaseType.StandardisedNoInterval,testwhere:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}],n=o.create((function(t,n){e._getDatabaseTypeImpl(r,0).then((function(r){e._databaseType=r,t(e._databaseType)}),(function(e){n(e)}))}));return null!==i.applicationCache&&(i.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),n),n=n.catch((function(t){throw i.applicationCache.clearDatabaseType(e._cacheableFeatureSetSourceKey()),t}))),this._databaseTypeProbed=n,this._databaseTypeProbed}return o.resolve(this._databaseType)},e.prototype._cacheableFeatureSetSourceKey=function(){return"MUSTBESET"},e.prototype._getDatabaseTypeImpl=function(e,t){var r=this;return t>=e.length?o.resolve(a.FeatureServiceDatabaseType.StandardisedNoInterval):this._runDatabaseProbe(e[t].testwhere).then((function(n){return!0===n?e[t].thetype:r._getDatabaseTypeImpl(e,t+1)}))},e.prototype._runDatabaseProbe=function(e){return null!==this._parent?this._parent._runDatabaseProbe(e):o.reject(new Error("Not Implemented"))},e.prototype.isTable=function(){return this._parent.isTable()},e.prototype._featureFromCache=function(e){if(void 0!==this._featureCache[e])return this._featureCache[e]},e.prototype._isInFeatureSet=function(e){return a.IdState.Unknown},e.prototype._getSet=function(e){throw new Error("Not implemented in abstract class")},e.prototype._getFeature=function(e,t,r){var n=this;try{return this._checkCancelled(r),void 0!==this._featureFromCache(t)?o.resolve(this._featureFromCache(t)):this._getFeatures(e,t,this._maxProcessingRate(),r).then((function(){return n._checkCancelled(r),void 0!==n._featureFromCache(t)?n._featureFromCache(t):o.reject(new Error("Feature Not Found"))}))}catch(e){return o.reject(e)}},e.prototype._getFeatureBatch=function(e,t){var r=this;try{this._checkCancelled(t);var a=new n([],e,!1,null),i=[];return this._getFeatures(a,-1,e.length,t).then((function(){r._checkCancelled(t);for(var n=0,a=e;n<a.length;n++){var s=a[n];void 0!==r._featureFromCache(s)&&i.push(r._featureFromCache(s))}return i}))}catch(e){return o.reject(e)}},e.prototype._getFeatures=function(e,t,r,n){return o.resolve("success")},e.prototype._getFilteredSet=function(e,t,r,n,a){throw new Error("Not implemented in abstract class")},e.prototype._refineSetBlock=function(e,t,r){var n=this;try{if(!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQueryRate()))return this._expandPagedSet(e,this._maxQueryRate(),0,0,r).then((function(){return n._refineSetBlock(e,t,r)}));this._checkCancelled(r);var a=e._candidates.length;this._refineKnowns(e,t);var i=a-e._candidates.length;return 0===e._candidates.length||i>=t?o.resolve(e):this._refineIfParentKnown(e,t-i,r).then((function(){if(n._checkCancelled(r),n._refineKnowns(e,t-i),(i=a-e._candidates.length)<t&&e._candidates.length>0){var s=t-i,o=n._prepareFetchAndRefineSet(e._candidates);return n._fetchAndRefineFeatures(o,o.length>s?s:e._candidates.length,r).then((function(){return n._checkCancelled(r),n._refineKnowns(e,t-i),e}))}return e}))}catch(e){return o.reject(e)}},e.prototype._fetchAndRefineFeatures=function(e,t,r){return null},e.prototype._prepareFetchAndRefineSet=function(e){for(var t=[],r=0;r<e.length;r++)this._isPhysicalFeature(e[r])&&t.push(e[r]);return t},e.prototype._isPhysicalFeature=function(e){return null===this._parent||this._parent._isPhysicalFeature(e)},e.prototype._refineKnowns=function(e,t){var r=0,n=null,i=[];t=this._maxQueryRate();for(var s=0;s<e._candidates.length&&"GETPAGES"!==e._candidates[s];s++){var o=!1,l=this._candidateIdTransform(e._candidates[s]);l!==e._candidates[s]&&(o=!0);var u=this._isInFeatureSet(l);if(u===a.IdState.InFeatureSet)!0===o?e._known.indexOf(l)<0&&(e._known.push(l),r+=1):(e._known.push(e._candidates[s]),r+=1),null===n?n={start:s,end:s}:n.end===s-1?n.end=s:(i.push(n),n={start:s,end:s});else if(u===a.IdState.NotInFeatureSet)null===n?n={start:s,end:s}:n.end===s-1?n.end=s:(i.push(n),n={start:s,end:s}),r+=1;else if(u===a.IdState.Unknown&&(r+=1,!0===e._ordered))break;if(r>=t)break}null!==n&&i.push(n);for(var c=i.length-1;c>=0;c--)e._candidates.splice(i[c].start,i[c].end-i[c].start+1)},e.prototype._refineIfParentKnown=function(e,t,r){var a=new n([],[],e._ordered,null);return a._candidates=e._candidates.slice(0),this._parent._refineSetBlock(a,t,r)},e.prototype._candidateIdTransform=function(e){return this._parent._candidateIdTransform(e)},e.prototype._checkIfNeedToExpandKnownPage=function(e,t){if(null===e.pagesDefinition)return!1;for(var r=0,n=e._lastFetchedIndex;n<e._known.length;n++){if("GETPAGES"===e._known[n])return!0;if(void 0===this._featureCache[e._known[n]]&&(r+=1)>=t)break}return!1},e.prototype._checkIfNeedToExpandCandidatePage=function(e,t){if(null===e.pagesDefinition)return!1;for(var r=0,n=0;n<e._candidates.length;n++){if("GETPAGES"===e._candidates[n])return!0;if((r+=1)>=t)break}return!1},e.prototype._expandPagedSet=function(e,t,r,n,a){return null===this._parent?o.reject(new Error("Parent Paging not implemented")):this._parent._expandPagedSet(e,t,r,n,a)},e.prototype._expandPagedSetFeatureSet=function(e,t,r,n,a){var i=this;return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]&&(n=1),0===n&&e._candidates.length>0&&"GETPAGES"===e._candidates[e._candidates.length-1]&&(n=2),0===n?o.resolve("finished"):this._getPage(e,n,a).then((function(n){return r+n<t?i._expandPagedSet(e,t,r+n,0,a):"success"}))},e.prototype._getPage=function(e,t,r){var n=this,a=1===t?e._known:e._candidates;if(e.pagesDefinition.internal.set.length>e.pagesDefinition.resultOffset||!0===e.pagesDefinition.internal.fullyResolved){a.length=a.length-1;for(var i=0,s=0;s<e.pagesDefinition.resultRecordCount&&!(e.pagesDefinition.resultOffset+s>=e.pagesDefinition.internal.set.length);s++)a[a.length]=e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset+s],i++;e.pagesDefinition.resultOffset+=i;var l=!1;return!0===e.pagesDefinition.internal.fullyResolved&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset&&(l=!0),!1===l&&a.push("GETPAGES"),o.resolve(i)}return this._getPhysicalPage(e,t,r).then((function(){return n._getPage(e,t,r)}))},e.prototype._getPhysicalPage=function(e,t,r){return null},e.prototype._clonePageDefinition=function(e){return null===this._parent?null:this._parent._clonePageDefinition(e)},e.prototype._first=function(e){return this.iterator(e).next()},e.prototype.first=function(e){return this._first(e)},e.prototype.calculateStatistic=function(e,t,r,n){var a=this;return this._ensureLoaded().then((function(){return a._stat(e,t,"",null,null,r,n).then((function(i){return!1===i.calculated?a._manualStat(e,t,r,n).then((function(e){return e.result})):i.result}))}))},e.prototype._manualStat=function(e,t,r,n){switch(e.toLowerCase()){case"count":return s.count(this,n).then((function(e){return{calculated:!0,result:e}}));case"distinct":return s.distinct(this,t,r).then((function(e){return{calculated:!0,result:e}}));case"avg":case"mean":return s.mean(this,t,n).then((function(e){return{calculated:!0,result:e}}));case"stdev":return s.stdev(this,t,n).then((function(e){return{calculated:!0,result:e}}));case"variance":return s.variance(this,t,n).then((function(e){return{calculated:!0,result:e}}));case"sum":return s.sum(this,t,n).then((function(e){return{calculated:!0,result:e}}));case"min":return s.min(this,t,n).then((function(e){return{calculated:!0,result:e}}));case"max":return s.max(this,t,n).then((function(e){return{calculated:!0,result:e}}));default:return o.resolve({calculated:!0,result:0})}},e.prototype._stat=function(e,t,r,n,a,i,s){var o=this;return this._parent._stat(e,t,r,n,a,i,s).then((function(l){return!1===l.calculated?null===a&&""===r&&null===n?o._manualStat(e,t,i,s):{calculated:!1}:l}))},e.prototype._unionAllGeomSelf=function(e){var t=this,r=this.iterator(this._defaultTracker(e)),n=[];return o.create((function(e,a){t._unionShapeInBatches(n,r,e,a)}))},e.prototype._unionAllGeom=function(e){var t=this;return o.create((function(r,n){var a=t.iterator(t._defaultTracker(e));t._unionShapeInBatches([],a,r,n)}))},e.prototype._unionShapeInBatches=function(e,t,r,n){var a=this;t.next().then((function(i){try{null!==i&&null!==i.geometry&&e.push(i.geometry),e.length>30||null===i&&e.length>1?u.union(e).then((function(s){try{null===i?r(s):a._unionShapeInBatches(e=[s],t,r,n)}catch(e){n(e)}}),n):null===i?r(1===e.length?e[0]:null):a._unionShapeInBatches(e,t,r,n)}catch(e){n(e)}}),n)},e.prototype.iterator=function(e){return new r(this,e)},e.prototype.intersection=function(t,r){return void 0===r&&(r=!1),e._featuresetFunctions.intersection.bind(this)(t,r)},e.prototype.difference=function(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!0),e._featuresetFunctions.difference.bind(this)(t,r,n)},e.prototype.symmetricDifference=function(t,r,n){return void 0===r&&(r=!1),void 0===n&&(n=!0),e._featuresetFunctions.symmetricDifference.bind(this)(t,r,n)},e.prototype.morphShape=function(t,r,n,a){return void 0===n&&(n="unknown"),void 0===a&&(a=null),e._featuresetFunctions.morphShape.bind(this)(t,r,n,a)},e.prototype.morphShapeAndAttributes=function(t,r,n){return void 0===n&&(n="unknown"),e._featuresetFunctions.morphShapeAndAttributes.bind(this)(t,r,n)},e.prototype.union=function(t,r){return void 0===r&&(r=!1),e._featuresetFunctions.union.bind(this)(t,r)},e.prototype.intersects=function(t){return e._featuresetFunctions.intersects.bind(this)(t)},e.prototype.envelopeIntersects=function(t){return e._featuresetFunctions.envelopeIntersects.bind(this)(t)},e.prototype.contains=function(t){return e._featuresetFunctions.contains.bind(this)(t)},e.prototype.overlaps=function(t){return e._featuresetFunctions.overlaps.bind(this)(t)},e.prototype.relate=function(t,r){return e._featuresetFunctions.relate.bind(this)(t,r)},e.prototype.within=function(t){return e._featuresetFunctions.within.bind(this)(t)},e.prototype.touches=function(t){return e._featuresetFunctions.touches.bind(this)(t)},e.prototype.top=function(t){return e._featuresetFunctions.top.bind(this)(t)},e.prototype.crosses=function(t){return e._featuresetFunctions.crosses.bind(this)(t)},e.prototype.buffer=function(t,r,n,a){return void 0===a&&(a=!0),e._featuresetFunctions.buffer.bind(this)(t,r,n,a)},e.prototype.filter=function(t,r){return void 0===r&&(r=null),e._featuresetFunctions.filter.bind(this)(t,r)},e.prototype.orderBy=function(t){return e._featuresetFunctions.orderBy.bind(this)(t)},e.prototype.dissolve=function(t,r){return e._featuresetFunctions.dissolve.bind(this)(t,r)},e.prototype.groupby=function(t,r){return e._featuresetFunctions.groupby.bind(this)(t,r)},e.prototype.reduce=function(e,t,r){var n=this;return void 0===t&&(t=null),o.create((function(a,i){n._reduceImpl(n.iterator(n._defaultTracker(r)),e,t,0,a,i,0)}))},e.prototype._reduceImpl=function(e,t,r,n,a,i,s){var l=this;try{if(++s>1e3)return void setTimeout((function(){l._reduceImpl(e,t,r,n,a,i,s=0)}));e.next().then((function(u){try{if(null===u)a(r);else{var c=t(r,u,n,l);o.isPromiseLike(c)?c.then((function(r){l._reduceImpl(e,t,r,n+1,a,i,s)}),i):l._reduceImpl(e,t,c,n+1,a,i,s)}}catch(e){i(e)}}),i)}catch(e){i(e)}},e.prototype.removeField=function(t){return e._featuresetFunctions.removeField.bind(this)(t)},e.prototype.addField=function(t,r,n){return void 0===n&&(n=null),e._featuresetFunctions.addField.bind(this)(t,r,n)},e.prototype.sumArea=function(e,t,r){void 0===t&&(t=!1);var n=a.convertSquareUnitsToCode(e);return this.reduce((function(e,r){return null===r.geometry?0:t?u.geodesicArea(r.geometry,n).then((function(t){return e+t})):u.planarArea(r.geometry,n).then((function(t){return e+t}))}),0,r)},e.prototype.sumLength=function(e,t,r){void 0===t&&(t=!1);var n=a.convertLinearUnitsToCode(e);return this.reduce((function(e,r){return null===r.geometry?0:t?u.geodesicLength(r.geometry,n).then((function(t){return e+t})):u.planarLength(r.geometry,n).then((function(t){return e+t}))}),0,r)},e.prototype._substituteVars=function(e,t){if(null!==t){var r={};for(var n in t)r[n.toLowerCase()]=t[n];e.parameters=r}},e.prototype.distinct=function(e,t,r,n){var a=this;return void 0===t&&(t=1e3),void 0===r&&(r=null),this.load().then((function(){var i=l.WhereClause.create(e,a.getFieldsIndex());return a._substituteVars(i,r),a.calculateStatistic("distinct",i,t,a._defaultTracker(n))}))},e.prototype.min=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("min",a,-1,n._defaultTracker(r))}))},e.prototype.max=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("max",a,-1,n._defaultTracker(r))}))},e.prototype.avg=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("avg",a,-1,n._defaultTracker(r))}))},e.prototype.sum=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("sum",a,-1,n._defaultTracker(r))}))},e.prototype.stdev=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("stdev",a,-1,n._defaultTracker(r))}))},e.prototype.variance=function(e,t,r){var n=this;return void 0===t&&(t=null),this.load().then((function(){var a=l.WhereClause.create(e,n.getFieldsIndex());return n._substituteVars(a,t),n.calculateStatistic("variance",a,-1,n._defaultTracker(r))}))},e.prototype.count=function(e){var t=this;return this.load().then((function(){return t.calculateStatistic("count",l.WhereClause.create("1",t.getFieldsIndex()),-1,t._defaultTracker(e))}))},e.prototype._defaultTracker=function(e){return e||{aborted:!1}},e.prototype.forEach=function(e,t){var r=this;return o.create((function(n,a){r._forEachImpl(r.iterator(r._defaultTracker(t)),e,r,n,a,0)}))},e.prototype._forEachImpl=function(e,t,r,n,a,i){var s=this;try{if(++i>1e3)return void setTimeout((function(){s._forEachImpl(e,t,r,n,a,i=0)}),0);e.next().then((function(l){try{if(null===l)n(r);else{var u=t(l);null==u?s._forEachImpl(e,t,r,n,a,i):o.isPromiseLike(u)?u.then((function(){try{s._forEachImpl(e,t,r,n,a,i)}catch(e){a(e)}}),a):s._forEachImpl(e,t,r,n,a,i)}}catch(e){a(e)}}),a)}catch(e){a(e)}},e.prototype.convertToJSON=function(e){for(var t={layerDefinition:{geometryType:this.geometryType,fields:[]},featureSet:{features:[],geometryType:this.geometryType}},r=0;r<this.fields.length;r++)t.layerDefinition.fields.push(a.esriFieldToJson(this.fields[r]));return this.reduce((function(e,r){var n={geometry:r.geometry&&r.geometry.toJSON(),attributes:{}};for(var a in r.attributes)n.attributes[a]=r.attributes[a];return t.featureSet.features.push(n),1}),0,e).then((function(){return t}))},e.prototype.castToText=function(){return"object, FeatureSet"},e.prototype.queryAttachments=function(e,t,r,n){return this._parent.queryAttachments(e,t,r,n)},e.prototype.serviceUrl=function(){return this._parent.serviceUrl()},e.prototype.subtypes=function(){return this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map((function(e){return{name:e.name,code:e.id}})):[]}:null},e.prototype.relationshipMetaData=function(){return this._parent.relationshipMetaData()},e.prototype.schema=function(){for(var e=[],t=0,r=this.fields;t<r.length;t++)e.push(a.esriFieldToJson(r[t]));return{objectIdField:this.objectIdField,typeIdField:this.typeIdField,geometryType:void 0===a.layerGeometryEsriRestConstants[this.geometryType]?"":a.layerGeometryEsriRestConstants[this.geometryType],hasZ:!0===this.hasZ,hasM:!0===this.hasM,fields:e}},e.prototype.convertToText=function(e,t){var r=this;return"schema"===e?this._ensureLoaded().then((function(){return JSON.stringify(r.schema())})):"featureset"===e?this._ensureLoaded().then((function(){var e=[];return r.reduce((function(t,r){var n={geometry:r.geometry?r.geometry.toJSON():null,attributes:r.attributes};return null!==n.geometry&&n.geometry.spatialReference&&delete n.geometry.spatialReference,e.push(n),1}),0,t).then((function(){var t=r.schema();return t.features=e,t.spatialReference=r.spatialReference.toJSON(),JSON.stringify(t)}))})):o.resolve(this.castToText())},e.prototype.getFeatureByObjectId=function(e,t){return this._parent.getFeatureByObjectId(e,t)},e._featuresetFunctions={},e}()}).apply(null,n))||(e.exports=a)},"8wKU":function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("tq6K"),r("SqzB"),r("1eyA")],void 0===(a=(function(e,t,r,n,a){return function(){function e(){}return e.prototype.clone=function(){var t=new e;return t.field=this.field,t.tofieldname=this.tofieldname,t.typeofstat=this.typeofstat,t.workingexpr=this.workingexpr,t},e.parseStatField=function(t,i,s){var o=new e;o.field=t;var l=a.WhereClause.create(i,s),u=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new Error("Statistic does not have 1 or 0 Parameters");var t=a.WhereClause.create(n.toWhereClauseFromTree(e.parseTree.args.value[0],r.FeatureServiceDatabaseType.Standardised,e.parameters),e.fieldsIndex);return{name:e.parseTree.name,expr:t}}return null}(l);if(null===u)throw new Error("Invalid Statistic Function");var c=u.name.toUpperCase().trim();if("MIN"===c){if(o.typeofstat="MIN",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else if("MAX"===c){if(o.typeofstat="MAX",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else if("COUNT"===c)o.typeofstat="COUNT",o.workingexpr=u.expr;else if("STDEV"===c){if(o.typeofstat="STDDEV",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else if("SUM"===c){if(o.typeofstat="SUM",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else if("MEAN"===c){if(o.typeofstat="AVG",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else if("AVG"===c){if(o.typeofstat="AVG",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}else{if("VAR"!==c)throw new Error("Invalid Statistic Function");if(o.typeofstat="VAR",o.workingexpr=u.expr,null===l)throw new Error("Invalid Statistic Function Parameters")}return o},e.prototype.toStatisticsName=function(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}},e}()}).apply(null,n))||(e.exports=a)},CaYo:function(e,t,r){var n,a;n=[r.dj.c(e.i),t],void 0===(a=(function(e,t){function r(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function n(e,t,n,a,i,s){return r((o=r(r(t,e),r(a,s)))<<(l=i)|o>>>32-l,n);var o,l}function a(e,t,r,a,i,s,o){return n(t&r|~t&a,e,t,i,s,o)}function i(e,t,r,a,i,s,o){return n(t&a|r&~a,e,t,i,s,o)}function s(e,t,r,a,i,s,o){return n(t^r^a,e,t,i,s,o)}function o(e,t,r,a,i,s,o){return n(r^(t|~a),e,t,i,s,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.outputTypes={Base64:0,Hex:1,String:2,Raw:3},t.createMD5Hash=function(e,n){void 0===n&&(n=t.outputTypes.Hex);var l=n||t.outputTypes.Base64,u=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,l=-271733879,u=-1732584194,c=271733878,d=0;d<e.length;d+=16){var f=n,p=l,h=u,_=c;n=a(n,l,u,c,e[d+0],7,-680876936),c=a(c,n,l,u,e[d+1],12,-389564586),u=a(u,c,n,l,e[d+2],17,606105819),l=a(l,u,c,n,e[d+3],22,-1044525330),n=a(n,l,u,c,e[d+4],7,-176418897),c=a(c,n,l,u,e[d+5],12,1200080426),u=a(u,c,n,l,e[d+6],17,-1473231341),l=a(l,u,c,n,e[d+7],22,-45705983),n=a(n,l,u,c,e[d+8],7,1770035416),c=a(c,n,l,u,e[d+9],12,-1958414417),u=a(u,c,n,l,e[d+10],17,-42063),l=a(l,u,c,n,e[d+11],22,-1990404162),n=a(n,l,u,c,e[d+12],7,1804603682),c=a(c,n,l,u,e[d+13],12,-40341101),u=a(u,c,n,l,e[d+14],17,-1502002290),n=i(n,l=a(l,u,c,n,e[d+15],22,1236535329),u,c,e[d+1],5,-165796510),c=i(c,n,l,u,e[d+6],9,-1069501632),u=i(u,c,n,l,e[d+11],14,643717713),l=i(l,u,c,n,e[d+0],20,-373897302),n=i(n,l,u,c,e[d+5],5,-701558691),c=i(c,n,l,u,e[d+10],9,38016083),u=i(u,c,n,l,e[d+15],14,-660478335),l=i(l,u,c,n,e[d+4],20,-405537848),n=i(n,l,u,c,e[d+9],5,568446438),c=i(c,n,l,u,e[d+14],9,-1019803690),u=i(u,c,n,l,e[d+3],14,-187363961),l=i(l,u,c,n,e[d+8],20,1163531501),n=i(n,l,u,c,e[d+13],5,-1444681467),c=i(c,n,l,u,e[d+2],9,-51403784),u=i(u,c,n,l,e[d+7],14,1735328473),n=s(n,l=i(l,u,c,n,e[d+12],20,-1926607734),u,c,e[d+5],4,-378558),c=s(c,n,l,u,e[d+8],11,-2022574463),u=s(u,c,n,l,e[d+11],16,1839030562),l=s(l,u,c,n,e[d+14],23,-35309556),n=s(n,l,u,c,e[d+1],4,-1530992060),c=s(c,n,l,u,e[d+4],11,1272893353),u=s(u,c,n,l,e[d+7],16,-155497632),l=s(l,u,c,n,e[d+10],23,-1094730640),n=s(n,l,u,c,e[d+13],4,681279174),c=s(c,n,l,u,e[d+0],11,-358537222),u=s(u,c,n,l,e[d+3],16,-722521979),l=s(l,u,c,n,e[d+6],23,76029189),n=s(n,l,u,c,e[d+9],4,-640364487),c=s(c,n,l,u,e[d+12],11,-421815835),u=s(u,c,n,l,e[d+15],16,530742520),n=o(n,l=s(l,u,c,n,e[d+2],23,-995338651),u,c,e[d+0],6,-198630844),c=o(c,n,l,u,e[d+7],10,1126891415),u=o(u,c,n,l,e[d+14],15,-1416354905),l=o(l,u,c,n,e[d+5],21,-57434055),n=o(n,l,u,c,e[d+12],6,1700485571),c=o(c,n,l,u,e[d+3],10,-1894986606),u=o(u,c,n,l,e[d+10],15,-1051523),l=o(l,u,c,n,e[d+1],21,-2054922799),n=o(n,l,u,c,e[d+8],6,1873313359),c=o(c,n,l,u,e[d+15],10,-30611744),u=o(u,c,n,l,e[d+6],15,-1560198380),l=o(l,u,c,n,e[d+13],21,1309151649),n=o(n,l,u,c,e[d+4],6,-145523070),c=o(c,n,l,u,e[d+11],10,-1120210379),u=o(u,c,n,l,e[d+2],15,718787259),l=o(l,u,c,n,e[d+9],21,-343485551),n=r(n,f),l=r(l,p),u=r(u,h),c=r(c,_)}return[n,l,u,c]}(function(e){for(var t=[],r=0,n=8*e.length;r<n;r+=8)t[r>>5]|=(255&e.charCodeAt(r/8))<<r%32;return t}(e),8*e.length);switch(l){case t.outputTypes.Raw:return u;case t.outputTypes.Hex:return function(e){for(var t="0123456789abcdef",r=[],n=0,a=4*e.length;n<a;n++)r.push(t.charAt(e[n>>2]>>n%4*8+4&15)+t.charAt(e[n>>2]>>n%4*8&15));return r.join("")}(u);case t.outputTypes.String:return function(e){for(var t=[],r=0,n=32*e.length;r<n;r+=8)t.push(String.fromCharCode(e[r>>5]>>>r%32&255));return t.join("")}(u);case t.outputTypes.Base64:return function(e){for(var t=[],r=0,n=4*e.length;r<n;r+=3)for(var a=(e[r>>2]>>r%4*8&255)<<16|(e[r+1>>2]>>(r+1)%4*8&255)<<8|e[r+2>>2]>>(r+2)%4*8&255,i=0;i<4;i++)t.push(8*r+6*i>32*e.length?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>6*(3-i)&63));return t.join("")}(u)}}}).apply(null,n))||(e.exports=a)},G0SM:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("gfOZ"),r("88sq"),r("Q4uJ"),r("+nnH"),r("qMld")],void 0===(a=(function(e,t,r,n,a,i,s,o){var l=function(e){function t(t){var r=e.call(this,t)||this;return r._orderbyclause=null,r.declaredClass="esri.arcade.featureset.actions.OrderBy",r._maxProcessing=100,r._orderbyclause=t.orderbyclause,r._parent=t.parentfeatureset,r}return r.__extends(t,e),t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._getFilteredSet("",null,null,t._orderbyclause,e)})).then((function(r){return t._checkCancelled(e),t._wset=r,t._wset})):o.resolve(this._wset)},t.prototype.manualOrderSet=function(e,t){var r=this;return this.getIdColumnDictionary(e,[],-1,t).then((function(e){r._orderbyclause.order(e);for(var t=new i([],[],!0,null),n=0;n<e.length;n++)t._known.push(e[n].id);return t}))},t.prototype.getIdColumnDictionary=function(e,t,r,a){var i=this;if(r<e._known.length-1){var s=this._maxQueryRate();if("GETPAGES"===e._known[r+1])return n.tick(this._parent._expandPagedSet(e,s,0,0,a)).then((function(){return i.getIdColumnDictionary(e,t,r,a)}));for(var l=r+1,u=[];l<e._known.length&&"GETPAGES"!==e._known[l];)u.push(e._known[l]),l++;return r+=u.length,n.tick(this._parent._getFeatureBatch(u,a)).then((function(n){i._checkCancelled(a);for(var s=0,o=n;s<o.length;s++){var l=o[s];t.push({id:l.attributes[i.objectIdField],feature:l})}return i.getIdColumnDictionary(e,t,r,a)}))}return e._candidates.length>0?n.tick(this._refineSetBlock(e,this._maxProcessingRate(),a)).then((function(){return i._checkCancelled(a),i.getIdColumnDictionary(e,t,r,a)})):o.resolve(t)},t.prototype._isInFeatureSet=function(e){return this._parent._isInFeatureSet(e)},t.prototype._getFeatures=function(e,t,r,n){return this._parent._getFeatures(e,t,r,n)},t.prototype._featureFromCache=function(e){if(void 0===this._featureCache[e]){var t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]},t.prototype._fetchAndRefineFeatures=function(){return o.reject(new Error("Fetch and Refine should not be called in this featureset"))},t.prototype._getFilteredSet=function(e,t,r,n,a){var s=this;return this._ensureLoaded().then((function(){return s._parent._getFilteredSet(e,t,r,null===n?s._orderbyclause:n,a)})).then((function(e){var n;s._checkCancelled(a),n=new i(e._candidates.slice(0),e._known.slice(0),e._ordered,s._clonePageDefinition(e.pagesDefinition));var o=!0;return e._candidates.length>0&&(o=!1),!1===n._ordered?s.manualOrderSet(n,a).then((function(e){return!1===o&&(null===t&&null===r||(e=new i(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,s._clonePageDefinition(e.pagesDefinition)))),e})):n}))},t}(a);return a._featuresetFunctions.orderBy=function(e){return""===e?this:new l({parentfeatureset:this,orderbyclause:new s(e)})},l}).apply(null,n))||(e.exports=a)},IvL0:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("B2KM"),r("T8lH"),r("gfOZ"),r("tq6K")],void 0===(a=(function(e,t,r,n,a,i){function s(e){return e&&e.domain?r.convertObjectToArcadeDictionary("coded-value"===e.domain.type||"codedValue"===e.domain.type?{type:"codedValue",name:e.domain.name,dataType:i.layerFieldEsriConstants[e.field.type],codedValues:e.domain.codedValues.map((function(e){return{name:e.name,code:e.code}}))}:{type:"range",name:e.domain.name,dataType:i.layerFieldEsriConstants[e.field.type],min:e.domain.min,max:e.domain.max}):null}Object.defineProperty(t,"__esModule",{value:!0}),t.registerFunctions=function(e){"async"===e.mode&&(e.functions.domain=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(a.pcCheck(r,2,3),r[0]instanceof n)return s(r[0].fullDomain(a.toString(r[1]),void 0===r[2]?void 0:a.toNumber(r[2])));if(a.isFeatureSet(r[0]))return r[0]._ensureLoaded().then((function(){return s(a.getDomain(a.toString(r[1]),r[0],null,void 0===r[2]?void 0:a.toNumber(r[2])))}));throw new Error("Invalid Parameter")}))},e.functions.subtypes=function(t,i){return e.standardFunctionAsync(t,i,(function(e,t,i){if(a.pcCheck(i,1,1),i[0]instanceof n){var s=i[0].subtypes();return s?r.convertObjectToArcadeDictionary(s):null}if(a.isFeatureSet(i[0]))return i[0]._ensureLoaded().then((function(){var e=i[0].subtypes();return e?r.convertObjectToArcadeDictionary(e):null}));throw new Error("Invalid Parameter")}))},e.functions.domainname=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(a.pcCheck(r,2,4),r[0]instanceof n)return r[0].domainValueLookup(a.toString(r[1]),r[2],void 0===r[3]?void 0:a.toNumber(r[3]));if(a.isFeatureSet(r[0]))return r[0]._ensureLoaded().then((function(){var e=a.getDomain(a.toString(r[1]),r[0],null,void 0===r[3]?void 0:a.toNumber(r[3]));return a.getDomainValue(e,r[2])}));throw new Error("Invalid Parameter")}))},e.signatures.push({name:"domainname",min:"2",max:"4"}),e.functions.domaincode=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(a.pcCheck(r,2,4),r[0]instanceof n)return r[0].domainCodeLookup(a.toString(r[1]),r[2],void 0===r[3]?void 0:a.toNumber(r[3]));if(a.isFeatureSet(r[0]))return r[0]._ensureLoaded().then((function(){var e=a.getDomain(a.toString(r[1]),r[0],null,void 0===r[3]?void 0:a.toNumber(r[3]));return a.getDomainCode(e,r[2])}));throw new Error("Invalid Parameter")}))},e.signatures.push({name:"domaincode",min:"2",max:"4"})),e.functions.text=function(t,r){return e.standardFunctionAsync(t,r,(function(e,t,r){if(a.pcCheck(r,1,2),!a.isFeatureSet(r[0]))return a.toStringExplicit(r[0],r[1]);var n=a.defaultUndefined(r[1],"");return""===n?r[0].castToText():"schema"===n.toLowerCase()?r[0].convertToText("schema",e.abortSignal):"featureset"===n.toLowerCase()?r[0].convertToText("featureset",e.abortSignal):void 0}))},e.functions.schema=function(t,i){return e.standardFunctionAsync(t,i,(function(e,t,i){if(a.pcCheck(i,1,1),a.isFeatureSet(i[0]))return i[0].load().then((function(){return r.convertObjectToArcadeDictionary(i[0].schema())}));if(i[0]instanceof n){var s=i[0].schema();return s?r.convertObjectToArcadeDictionary(s):null}throw new Error("Invalid Parameter")}))}}}).apply(null,n))||(e.exports=a)},PMeB:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("gfOZ"),r("tq6K"),r("SqzB"),r("qMld")],void 0===(a=(function(e,t,r,n,a,i){function s(e){for(var t=0,r=0;r<e.length;r++)t+=e[r];return t/e.length}function o(e){for(var t=s(e),r=0,n=0;n<e.length;n++)r+=Math.pow(t-e[n],2);return r/e.length}function l(e){for(var t=s(e),r=0,n=0;n<e.length;n++)r+=Math.pow(t-e[n],2);return r/(e.length-1)}function u(e){for(var t=0,r=0;r<e.length;r++)t+=e[r];return t}function c(e,t,n,a){void 0===a&&(a=!1);try{var s=e.iterator(n);return i.create((function(e,n){!function e(t,n,a,i,s,o){r.tick(t.next().then((function(r){try{if(null!==r){var l=a.calculateValue(r);return null===l?!1===i&&(n[n.length]=l):n[n.length]=l,e(t,n,a,i,s,o)}s(n)}catch(e){o(e)}}),o))}(s,[],t,a,e,n)}))}catch(e){return i.reject(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.decodeStatType=function(e){switch(e.toLowerCase()){case"distinct":return"distinct";case"avg":case"mean":return"avg";case"min":return"min";case"sum":return"sum";case"max":return"max";case"stdev":case"stddev":return"stddev";case"var":case"variance":return"var";case"count":return"count"}return""},t.calculateStat=function(e,t,r){switch(void 0===r&&(r=1e3),e.toLowerCase()){case"distinct":return function(e,t){for(var r=[],a={},i=[],s=0;s<e.length;s++){if(null!=e[s]){var o=e[s];if(n.isNumber(o)||n.isString(o))void 0===a[o]&&(r.push(o),a[o]=1);else{for(var l=!1,u=0;u<i.length;u++)!0===n.equalityTest(i[u],o)&&(l=!0);!1===l&&(i.push(o),r.push(o))}}if(r.length>=t&&-1!==t)return r}return r}(t,r);case"avg":case"mean":return s(t);case"min":return Math.min.apply(Math,t);case"sum":return u(t);case"max":return Math.max.apply(Math,t);case"stdev":case"stddev":return Math.sqrt(o(t));case"var":case"variance":return o(t);case"count":return t.length}return 0},t.min=function(e,t,r){return c(e,t,r,!0).then((function(e){return 0===e.length?null:Math.min.apply(Math,e)}))},t.max=function(e,t,r){return c(e,t,r,!0).then((function(e){return 0===e.length?null:Math.max.apply(Math,e)}))},t.mean=function(e,t,r){var n="";return!1===a.isSingleField(t)&&(n=a.predictType(t,e.fields,null)),c(e,t,r,!0).then((function(e){if(0===e.length)return null;var t,r=s(e);return null===r?r:"integer"===n?(t=+(t=r),isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t):r}))},t.variance=function(e,t,r){return c(e,t,r,!0).then((function(e){return 0===e.length?null:l(e)}))},t.stdev=function(e,t,r){return c(e,t,r,!0).then((function(e){return 0===e.length?null:Math.sqrt(l(e))}))},t.sum=function(e,t,r){return c(e,t,r,!0).then((function(e){return 0===e.length?null:u(e)}))},t.count=function(e,t){try{return e.iterator(t).count()}catch(e){return i.reject(e)}},t.distinct=function(e,t,r,n){return void 0===r&&(r=1e3),void 0===n&&(n=null),function(e,t,r,n){try{return function e(t,r,n,a,i){return t.next().then((function(s){if(null!==s){var o=a.calculateValue(s);return null!=o&&void 0===r[o]&&(n.push(o),r[o]=1),n.length>=i&&-1!==i?n:e(t,r,n,a,i)}return n}))}(e.iterator(n),{},[],t,r)}catch(e){return i.reject(e)}}(e,t,r,n)}}).apply(null,n))||(e.exports=a)},PNLr:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("jZlN"),r("88sq"),r("Q4uJ"),r("tq6K"),r("qMld"),r("531e")],void 0===(a=(function(e,t,r,n,a,i,s,o,l){return function(e){function t(t){var r=e.call(this,t)||this;return r.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",r._findObjectId=-1,r._requestStandardised=!1,r._removeGeometry=!1,r._overrideFields=null,r.featureObjectId=null,r.relatedLayer=null,r.relationship=null,t.spatialReference&&(r.spatialReference=t.spatialReference),r._transparent=!0,r._maxProcessing=1e3,r._layer=t.layer,r._wset=null,r._findObjectId=t.objectId,r.featureObjectId=t.objectId,r.relationship=t.relationship,r.relatedLayer=t.relatedLayer,void 0!==t.outFields&&(r._overrideFields=t.outFields),void 0!==t.includeGeometry&&(r._removeGeometry=!1===t.includeGeometry),r}return r.__extends(t,e),t.prototype._maxQueryRate=function(){return s.defaultMaxRecords},t.prototype.end=function(){return this._layer},t.prototype.optimisePagingFeatureQueries=function(){},t.prototype.load=function(){var e=this;return null===this._loadPromise&&(this._loadPromise=o.create((function(t,r){o.all([e._layer.load(),e.relatedLayer.load()]).then((function(){e._initialiseFeatureSet(),t(e)}),r)}))),this._loadPromise},t.prototype.nativeCapabilities=function(){return this.relatedLayer.nativeCapabilities()},t.prototype._initialiseFeatureSet=function(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this.relatedLayer.geometryType,this.fields=this.relatedLayer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{for(var e=[],t=[],r=0,n=this.fields;r<n.length;r++){var a=n[r];if("oid"===a.type)e.push(a),t.push(a.name);else for(var i=0,s=this._overrideFields;i<s.length;i++)if(s[i].toLowerCase()===a.name.toLowerCase()){e.push(a),t.push(a.name);break}}this.fields=e,this._overrideFields=t}var o=this._layer.nativeCapabilities();o&&(this._databaseType=o.databaseType,this._requestStandardised=o.requestStandardised),this.objectIdField=this.relatedLayer.objectIdField,this.hasM=this.relatedLayer.supportsM,this.hasZ=this.relatedLayer.supportsZ,this.typeIdField=this.relatedLayer.typeIdField,this.types=this.relatedLayer.types},t.prototype.databaseType=function(){var e=this;return this.relatedLayer.databaseType().then((function(){return e._databaseType=e.relatedLayer._databaseType,e._databaseType}))},t.prototype.isTable=function(){return this.relatedLayer.isTable()},t.prototype._isInFeatureSet=function(){return s.IdState.InFeatureSet},t.prototype._candidateIdTransform=function(e){return e},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._getFilteredSet("",null,null,null,e)})).then((function(e){return t._wset=e,e})):o.resolve(this._wset)},t.prototype._changeFeature=function(e){for(var t={},r=0,a=this.fields;r<a.length;r++){var i=a[r];t[i.name]=e.attributes[i.name]}return new n({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})},t.prototype._getFilteredSet=function(e,t,r,n,a){var s=this;return this.databaseType().then((function(){if(s.isTable()&&t&&null!==e&&""!==e)return new i([],[],!0,null);var o=s._layer.nativeCapabilities();if(!1===o.canQueryRelated)return new i([],[],!0,null);if(o.capabilities.queryRelated&&o.capabilities.queryRelated.supportsPagination)return s._getFilteredSetUsingPaging(e,t,r,n,a);var u="",c=!1;null!==n&&o.capabilities&&o.capabilities.queryRelated&&!0===o.capabilities.queryRelated.supportsOrderBy&&(u=n.constructClause(),c=!0);var d=new l;d.objectIds=[s._findObjectId];var f=null!==s._overrideFields?s._overrideFields:s._fieldsIncludingObjectId(s.relatedLayer.fields?s.relatedLayer.fields.map((function(e){return e.name})):["*"]);d.outFields=f,d.relationshipId=s.relationship.id,d.where="1=1";var p=!0;return!0===s._removeGeometry&&(p=!1),d.returnGeometry=p,s._requestStandardised&&(d.sqlFormat="standard"),d.outSpatialReference=s.spatialReference,d.orderByFields=""!==u?u.split(","):null,o.source.queryRelatedFeatures(d).then((function(n){s._checkCancelled(a);for(var o=n[s._findObjectId]?n[s._findObjectId].features:[],l=[],u=0;u<o.length;u++)s._featureCache[o[u].attributes[s._layer.objectIdField]]=o[u],l.push(o[u].attributes[s._layer.objectIdField]);var d=t&&null!==e&&""!==e,f=null!=r;return new i(d||f?l:[],d||f?[]:l,c,null)}))}))},t.prototype._fieldsIncludingObjectId=function(e){if(null===e)return[this.objectIdField];var t=e.slice(0);if(t.indexOf("*")>-1)return t;for(var r=!1,n=0,a=t;n<a.length;n++)if(a[n].toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t},t.prototype._getFilteredSetUsingPaging=function(e,t,r,n,a){var s=this;try{var l="",u=!1,c=this._layer.nativeCapabilities();return null!==n&&c&&c.capabilities.queryRelated&&!0===c.capabilities.queryRelated.supportsOrderBy&&(l=n.constructClause(),u=!0),this.databaseType().then((function(){var n=s._maxQueryRate(),o=c.capabilities.query.maxRecordCount;void 0!==o&&o<n&&(n=o);var d,f=t&&null!==e&&""!==e,p=null!=r,h=!0;!0===s._removeGeometry&&(h=!1);var _=null!==s._overrideFields?s._overrideFields:s._fieldsIncludingObjectId(s.relatedLayer.fields?s.relatedLayer.fields.map((function(e){return e.name})):["*"]);return d=new i(f||p?["GETPAGES"]:[],f||p?[]:["GETPAGES"],u,{outFields:_.join(","),resultRecordCount:n,resultOffset:0,objectIds:[s._findObjectId],where:"1=1",orderByFields:l,returnGeometry:h,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),s._expandPagedSet(d,n,0,0,a).then((function(){return d}))}))}catch(e){return o.reject(e)}},t.prototype._expandPagedSet=function(e,t,r,n,a){return this._expandPagedSetFeatureSet(e,t,r,n,a)},t.prototype._clonePageDefinition=function(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}},t.prototype._getPhysicalPage=function(e,t,r){var n=this;try{var a=e.pagesDefinition.internal.lastRetrieved,i=a,s=e.pagesDefinition.internal.lastPage,u=this._layer.nativeCapabilities(),c=new l;return!0===this._requestStandardised&&(c.sqlFormat="standard"),c.relationshipId=this.relationship.id,c.objectIds=e.pagesDefinition.objectIds,c.resultOffset=e.pagesDefinition.internal.lastPage,c.resultRecordCount=e.pagesDefinition.resultRecordCount,c.outFields=e.pagesDefinition.outFields.split(","),c.where=e.pagesDefinition.where,c.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,c.returnGeometry=e.pagesDefinition.returnGeometry,c.outSpatialReference=this.spatialReference,u.source.queryRelatedFeatures(c).then((function(t){if(n._checkCancelled(r),e.pagesDefinition.internal.lastPage!==s)return 0;for(var o=t[n._findObjectId]?t[n._findObjectId].features:[],l=0;l<o.length;l++)e.pagesDefinition.internal.set[i+l]=o[l].attributes[n._layer.objectIdField];for(l=0;l<o.length;l++)n._featureCache[o[l].attributes[n._layer.objectIdField]]=o[l];return o.length!==e.pagesDefinition.resultRecordCount&&(!t[n._findObjectId]||!1===t[n._findObjectId].exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=a+o.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,o.length}))}catch(e){return o.reject(e)}},t.prototype._getFeatures=function(e,t,r,n){var a=this,i=[];-1!==t&&void 0===this._featureCache[t]&&i.push(t);var s=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,s))return this._expandPagedSet(e,s,0,0,n).then((function(){return a._getFeatures(e,t,r,n)}));for(var l=0,u=e._lastFetchedIndex;u<e._known.length&&(++l<=r&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[u]&&void 0===this._featureCache[e._known[u]]&&(e._known[u]!==t&&i.push(e._known[u]),i.length>r)))&&!(l>=r&&0===i.length);u++);return 0===i.length?o.resolve("success"):o.reject(new Error("Unaccounted for Features. Not in Feature Collection"))},t.prototype._refineSetBlock=function(e,t,r){return o.resolve(e)},t.prototype._stat=function(e,t,r,n,a,i,s){return o.resolve({calculated:!1})},t.prototype._canDoAggregates=function(e,t,r,n,a){return o.resolve(!1)},t.prototype.relationshipMetaData=function(){return this.relatedLayer.relationshipMetaData()},t.prototype.serviceUrl=function(){return this.relatedLayer.serviceUrl()},t.prototype.queryAttachments=function(e,t,r,n){return this.relatedLayer.queryAttachments(e,t,r,n)},t.prototype.getFeatureByObjectId=function(e,t){return this.relatedLayer.getFeatureByObjectId(e,t)},t}(a)}).apply(null,n))||(e.exports=a)},Q4uJ:function(e,t,r){var n,a;n=[r.dj.c(e.i),t],void 0===(a=(function(e,t){return function(e,t,r,n){this._candidates=null,this._known=null,this._lastFetchedIndex=0,this._ordered=!1,this.pagesDefinition=null,this._candidates=e,this._known=t,this._ordered=r,this.pagesDefinition=n}}).apply(null,n))||(e.exports=a)},QA8M:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("jZlN"),r("zp6E"),r("HKXX"),r("88sq"),r("Q4uJ"),r("tq6K"),r("SqzB"),r("SqzB"),r("PMeB"),r("CaYo"),r("qMld"),r("Lzvl"),r("Zvuv"),r("+6sX"),r("uajq"),r("B16N"),r("w1v0"),r("IpeC"),r("aZmZ")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d,f,p,h,_,y,g,v,m,S,F){return function(e){function t(t){var r=e.call(this,t)||this;return r.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",r._removeGeometry=!1,r._overrideFields=null,r.formulaCredential=null,r._pageJustIds=!1,r._requestStandardised=!1,t.spatialReference&&(r.spatialReference=t.spatialReference),r._transparent=!0,r._maxProcessing=1e3,r._layer=t.layer,r._wset=null,void 0!==t.outFields&&(r._overrideFields=t.outFields),void 0!==t.includeGeometry&&(r._removeGeometry=!1===t.includeGeometry),r}return r.__extends(t,e),t.prototype._maxQueryRate=function(){return l.defaultMaxRecords},t.prototype.end=function(){return this._layer},t.prototype.optimisePagingFeatureQueries=function(e){this._pageJustIds=e},t.prototype.convertQueryToLruCacheKey=function(e){var t=l.stableStringify(e.toJSON());return f.createMD5Hash(t,f.outputTypes.String)},t.prototype.load=function(){var e=this;return null===this._loadPromise&&(this._loadPromise=p.create((function(t,r){try{if(!0===e._layer.loaded)return e._initialiseFeatureSet(),void t(e);e._layer.when().then((function(){try{e._initialiseFeatureSet(),t(e)}catch(e){r(e)}}),r),e._layer.load()}catch(e){r(e)}}))),this._loadPromise},t.prototype._initialiseFeatureSet=function(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{for(var e=[],t=0,r=this.fields;t<r.length;t++)if("oid"===(u=r[t]).type)e.push(u);else for(var n=0,a=this._layer.outFields;n<a.length;n++)if(a[n].toLowerCase()===u.name.toLowerCase()){e.push(u);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{e=[];for(var i=[],s=0,o=this.fields;s<o.length;s++){var u;if("oid"===(u=o[s]).type)e.push(u),i.push(u.name);else for(var c=0,d=this._overrideFields;c<d.length;c++)if(d[c].toLowerCase()===u.name.toLowerCase()){e.push(u),i.push(u.name);break}}this.fields=e,this._overrideFields=i}if(this._layer.source&&this._layer.source.sourceJSON){var f=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=l.FeatureServiceDatabaseType.StandardisedNoInterval,null!=f&&f>=10.61&&(this._databaseType=l.FeatureServiceDatabaseType.Standardised)):null!=f&&(f>=10.5&&(this._databaseType=l.FeatureServiceDatabaseType.StandardisedNoInterval,this._requestStandardised=!0),f>=10.61&&(this._databaseType=l.FeatureServiceDatabaseType.Standardised))}this.objectIdField=this._layer.objectIdField,this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types},t.prototype._isInFeatureSet=function(){return l.IdState.InFeatureSet},t.prototype._refineSetBlock=function(e){return p.resolve(e)},t.prototype._candidateIdTransform=function(e){return e},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._getFilteredSet("",null,null,null,e)})).then((function(e){return t._wset=e,e})):p.resolve(this._wset)},t.prototype._runDatabaseProbe=function(e){var t=this;return p.create((function(r,n){try{t._ensureLoaded().then((function(){try{var a=new S;a.where=e.replace("OBJECTID",t._layer.objectIdField),t._layer.queryObjectIds(a).then((function(){r(!0)}),(function(){try{r(!1)}catch(e){n(e)}}))}catch(e){n(e)}}))}catch(e){n(e)}}))},t.prototype._canUsePagination=function(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)},t.prototype._cacheableFeatureSetSourceKey=function(){return this._layer.url},t.prototype.pbfSupportedForQuery=function(e){return!e.outStatistics&&this._layer&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsFormatPBF&&!0===this._layer.capabilities.query.supportsQuantizationEditMode},t.prototype.queryPBF=function(e){return e.quantizationParameters={mode:"edit"},v.executeQueryPBF(this._layer.parsedUrl,e,{type:"optimized"}).then((function(e){return m.fromJSON(y.convertToFeatureSet(e.data)).unquantize()}))},t.prototype.nativeCapabilities=function(){return{title:this._layer.title,source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}},t.prototype.executeQuery=function(e,t){var r=this,n=new g({url:this._layer.parsedUrl.path}),a="execute"===t&&this.pbfSupportedForQuery(e),i=null;if(this.recentlyUsedQueries){var s=this.convertQueryToLruCacheKey(e);null===(i=this.recentlyUsedQueries.getFromCache(s))&&(i=!0!==a?n[t](e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(s,i),i=i.catch((function(e){throw r.recentlyUsedQueries.removeFromCache(s),e})))}return null===i&&(i=!0!==a?n[t](e):this.queryPBF(e)),i},t.prototype._getFilteredSet=function(e,t,r,n,a){var i=this;return this.databaseType().then((function(s){if(i.isTable()&&t&&null!==e&&""!==e)return new o([],[],!0,null);if(i._canUsePagination())return i._getFilteredSetUsingPaging(e,t,r,n,a);var l="",c=!1;null!==n&&i._layer.capabilities&&i._layer.capabilities.query&&!0===i._layer.capabilities.query.supportsOrderBy&&(l=n.constructClause(),c=!0);var d=new S;return d.where=null===r?null===t?"1=1":"":u.toWhereClause(r,s),i._requestStandardised&&(d.sqlFormat="standard"),d.spatialRelationship=i._makeRelationshipEnum(e),d.outSpatialReference=i.spatialReference,d.orderByFields=""!==l?l.split(","):null,d.geometry=null===t?null:t,d.relationParameter=i._makeRelationshipParam(e),i.executeQuery(d,"executeForIds").then((function(e){return null===e&&(e=[]),i._checkCancelled(a),new o([],e,c,null)}))}))},t.prototype._expandPagedSet=function(e,t,r,n,a){return this._expandPagedSetFeatureSet(e,t,r,n,a)},t.prototype._getFilteredSetUsingPaging=function(e,t,r,n,a){var i=this;try{var s="",l=!1;return null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(s=n.constructClause(),l=!0),this.databaseType().then((function(n){var c=null===r?null===t?"1=1":"":u.toWhereClause(r,n);i._layer.definitionExpression&&(c=""!==c?"(("+i._layer.definitionExpression+") AND ("+c+"))":i._layer.definitionExpression);var d=i._maxQueryRate(),f=i._layer.capabilities.query.maxRecordCount;void 0!==f&&f<d&&(d=f);var p=null;if(!0===i._pageJustIds)p=new o([],["GETPAGES"],l,{spatialRel:i._makeRelationshipEnum(e),relationParam:i._makeRelationshipParam(e),outFields:i._layer.objectIdField,resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:c,orderByFields:s,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{var h=!0;!0===i._removeGeometry&&(h=!1);var _=null!==i._overrideFields?i._overrideFields:i._fieldsIncludingObjectId(i._layer.outFields?i._layer.outFields:["*"]);p=new o([],["GETPAGES"],l,{spatialRel:i._makeRelationshipEnum(e),relationParam:i._makeRelationshipParam(e),outFields:_.join(","),resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:c,orderByFields:s,returnGeometry:h,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return i._expandPagedSet(p,d,0,1,a).then((function(){return p}))}))}catch(e){return p.reject(e)}},t.prototype._clonePageDefinition=function(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}},t.prototype._getPhysicalPage=function(e,t,r){var n=this;try{var a=e.pagesDefinition.internal.lastRetrieved,i=a,s=e.pagesDefinition.internal.lastPage,o=new S;return this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields.split(","),o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.geometry=e.pagesDefinition.geometry,o.where=e.pagesDefinition.where,o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,o.returnGeometry=e.pagesDefinition.returnGeometry,o.outSpatialReference=this.spatialReference,this.executeQuery(o,"execute").then((function(t){if(n._checkCancelled(r),e.pagesDefinition.internal.lastPage!==s)return"done";for(var o=0;o<t.features.length;o++)e.pagesDefinition.internal.set[i+o]=t.features[o].attributes[n._layer.objectIdField];if(!1===n._pageJustIds)for(o=0;o<t.features.length;o++)n._featureCache[t.features[o].attributes[n._layer.objectIdField]]=t.features[o];return(void 0===t.exceededTransferLimit&&t.features.length!==e.pagesDefinition.resultRecordCount||!1===t.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=a+t.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}))}catch(e){return p.reject(e)}},t.prototype._fieldsIncludingObjectId=function(e){if(null===e)return[this.objectIdField];var t=e.slice(0);if(t.indexOf("*")>-1)return t;for(var r=!1,n=0,a=t;n<a.length;n++)if(a[n].toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t},t.prototype._getFeatures=function(e,t,r,n){var a=this,i=[];try{if(-1!==t&&void 0===this._featureCache[t]&&i.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return this._expandPagedSet(e,this._maxProcessingRate(),0,0,n).then((function(){return a._getFeatures(e,t,r,n)}));for(var s=0,o=e._lastFetchedIndex;o<e._known.length;o++){if(e._lastFetchedIndex+=1,s++,void 0===this._featureCache[e._known[o]]){var l=!1;if(null!=this._layer._mode){var u=this._layer._mode;if(void 0!==u._featureMap[e._known[o]]){var c=u._featureMap[e._known[o]];null!==c&&(l=!0,this._featureCache[e._known[o]]=c)}}if(!1===l&&(e._known[o]!==t&&i.push(e._known[o]),i.length>=this._maxProcessingRate()-1))break}if(s>=r&&0===i.length)break}if(0===i.length)return p.resolve("success");try{var d=new S;return this._requestStandardised&&(d.sqlFormat="standard"),d.objectIds=i,d.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._layer.outFields?this._layer.outFields:["*"]),d.returnGeometry=!0,!0===this._removeGeometry&&(d.returnGeometry=!1),d.outSpatialReference=this.spatialReference,this.executeQuery(d,"execute").then((function(e){if(a._checkCancelled(n),void 0!==e.error)return p.reject(new Error(e.error));for(var t=0;t<e.features.length;t++)a._featureCache[e.features[t].attributes[a._layer.objectIdField]]=e.features[t];return"success"}))}catch(e){return p.reject(e)}}catch(e){return p.reject(e)}},t.prototype._getDistinctPages=function(e,t,r,n,a,i,s,o,l){var c=this;return this._ensureLoaded().then((function(){return c.databaseType()})).then((function(d){for(var f=r.parseTree.column,h=0;h<c._layer.fields.length;h++)if(c._layer.fields[h].name.toLowerCase()===f.toLowerCase()){f=c._layer.fields[h].name;break}var _=new S;c._requestStandardised&&(_.sqlFormat="standard");var y=null===i?null===a?"1=1":"":u.toWhereClause(i,d);return c._layer.definitionExpression&&(y=""!==y?"(("+c._layer.definitionExpression+") AND ("+y+"))":c._layer.definitionExpression),_.where=y,_.spatialRelationship=c._makeRelationshipEnum(n),_.relationParameter=c._makeRelationshipParam(n),_.geometry=null===a?null:a,_.returnDistinctValues=!0,_.returnGeometry=!1,_.outFields=[f],c.executeQuery(_,"execute").then((function(u){if(c._checkCancelled(l),!u.hasOwnProperty("features"))return p.reject(new Error("Unnexected Result querying statistics from layer"));for(var d=!1,h=0;h<c._layer.fields.length;h++)if(c._layer.fields[h].name===f){"date"===c._layer.fields[h].type&&(d=!0);break}for(h=0;h<u.features.length;h++){if(d){var _=u.features[h].attributes[f];o.push(null!==_?new Date(_):_)}else o.push(u.features[h].attributes[f]);if(o.length>=s)break}return 0===u.features.length?o:u.features.length===c._layer.capabilities.query.maxRecordCount&&o.length<s?c._getDistinctPages(e+u.features.length,t,r,n,a,i,s,o,l).then((function(e){return{calculated:!0,result:e}})):o}))}))},t.prototype._distinctStat=function(e,t,r,n,a,i,s){return this._getDistinctPages(0,e,t,r,n,a,i,[],s).then((function(e){return{calculated:!0,result:e}}))},t.prototype.isTable=function(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType},t.prototype._countstat=function(e,t,r,n){var a=this;return this.databaseType().then((function(e){var i=new S;if(a._requestStandardised&&(i.sqlFormat="standard"),a.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};var s=null===n?null===r?"1=1":"":u.toWhereClause(n,e);return a._layer.definitionExpression&&(s=""!==s?"(("+a._layer.definitionExpression+") AND ("+s+"))":a._layer.definitionExpression),i.where=s,i.where=s,i.spatialRelationship=a._makeRelationshipEnum(t),i.relationParameter=a._makeRelationshipParam(t),i.geometry=null===r?null:r,i.returnGeometry=!1,a.executeQuery(i,"executeForCount").then((function(e){return{calculated:!0,result:e}}))}))},t.prototype._stats=function(e,t,r,n,a,i,s){var o=this;return this._ensureLoaded().then((function(){var l=o._layer.capabilities&&o._layer.capabilities.query&&!0===o._layer.capabilities.query.supportsSqlExpression,f=o._layer.capabilities&&o._layer.capabilities.query&&!0===o._layer.capabilities.query.supportsStatistics,h=o._layer.capabilities&&o._layer.capabilities.query&&!0===o._layer.capabilities.query.supportsDistinct;return"count"===e?h?o._countstat(e,r,n,a):{calculated:!1}:!1===f||!1===c.isSingleField(t)&&!1===l||!1===t.isStandardized?""!==r||null!==a?{calculated:!1}:o._manualStat(e,t,i,s):"distinct"===e?!1===h?""!==r||null!==a?{calculated:!1}:o._manualStat(e,t,i,s):o._distinctStat(e,t,r,n,a,i,s):o.databaseType().then((function(i){if(o.isTable()&&n&&null!==r&&""!==r)return{calculated:!0,result:null};var s=new S;o._requestStandardised&&(s.sqlFormat="standard");var l=null===a?null===n?"1=1":"":u.toWhereClause(a,i);o._layer.definitionExpression&&(l=""!==l?"(("+o._layer.definitionExpression+") AND ("+l+"))":o._layer.definitionExpression),s.where=l,s.spatialRelationship=o._makeRelationshipEnum(r),s.relationParameter=o._makeRelationshipParam(r),s.geometry=null===n?null:n;var c=new F;c.statisticType=d.decodeStatType(e),c.onStatisticField=u.toWhereClause(t,i),c.outStatisticFieldName="ARCADE_STAT_RESULT",s.returnGeometry=!1;var f="ARCADE_STAT_RESULT";return s.outStatistics=[c],o.executeQuery(s,"execute").then((function(e){if(!e.hasOwnProperty("features")||0===e.features.length)return p.reject(new Error("Unnexected Result querying statistics from layer"));for(var t=!1,r=0;r<e.fields.length;r++)if("ARCADE_STAT_RESULT"===e.fields[r].name.toUpperCase()){f=e.fields[r].name,"date"===e.fields[r].type&&(t=!0);break}if(t){var n=e.features[0].attributes[f];return null!==n&&(n=new Date(e.features[0].attributes[f])),{calculated:!0,result:n}}return{calculated:!0,result:e.features[0].attributes[f]}}))}))}))},t.prototype._stat=function(e,t,r,n,a,i,s){return this._stats(e,t,r,n,a,i,s)},t.prototype._canDoAggregates=function(e,t){var r=this;return this._ensureLoaded().then((function(){var e=!1,n=r._layer.capabilities&&r._layer.capabilities.query&&!0===r._layer.capabilities.query.supportsSqlExpression;if(void 0!==r._layer.capabilities&&null!==r._layer.capabilities.query&&!0===r._layer.capabilities.query.supportsStatistics&&!0===r._layer.capabilities.query.supportsOrderBy&&(e=!0),e)for(var a=0;a<t.length-1;a++)null!==t[a].workingexpr&&(!1===t[a].workingexpr.isStandardized||!1===c.isSingleField(t[a].workingexpr)&&!1===n)&&(e=!1);return!1!==e}))},t.prototype._makeRelationshipEnum=function(e){if(e.indexOf("esriSpatialRelRelation")>=0)return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e},t.prototype._makeRelationshipParam=function(e){return e.indexOf("esriSpatialRelRelation")>=0?e.split(":")[1]:""},t.prototype._getAggregatePagesDataSourceDefinition=function(e,t,r,n,a,i,s){var l=this;return this._ensureLoaded().then((function(){return l.databaseType()})).then((function(c){var d="",f=!1,p=!1;null!==i&&l._layer.capabilities&&l._layer.capabilities.query&&!0===l._layer.capabilities.query.supportsOrderBy&&(d=i.constructClause(),p=!0),l._layer.capabilities&&l._layer.capabilities.query&&!1===l._layer.capabilities.query.supportsPagination&&(p=!1,f=!0,d=l._layer.objectIdField);for(var h=[],_=0;_<t.length;_++){var y=new F;y.onStatisticField=null!==t[_].workingexpr?u.toWhereClause(t[_].workingexpr,c):"",y.outStatisticFieldName=t[_].field,y.statisticType=t[_].toStatisticsName(),h.push(y)}""===d&&(d=e.join(","));var g=l._maxQueryRate(),v=l._layer.capabilities.query.maxRecordCount;void 0!==v&&v<g&&(g=v);var m=null===a?null===n?"1=1":"":u.toWhereClause(a,c);return l._layer.definitionExpression&&(m=""!==m?"(("+l._layer.definitionExpression+") AND ("+m+"))":l._layer.definitionExpression),new o([],["GETPAGES"],p,{groupbypage:!0,spatialRel:l._makeRelationshipEnum(r),relationParam:l._makeRelationshipParam(r),outFields:["*"],useOIDpagination:f,generatedOid:s,resultRecordCount:g,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:h,geometry:null===n?null:n,where:m,orderByFields:d,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}))},t.prototype._getAgregagtePhysicalPage=function(e,t,r){var a=this;try{var i=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(i=""!==i?"("+i+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());var s=e.pagesDefinition.internal.lastRetrieved,o=s,l=e.pagesDefinition.internal.lastPage,u=new S;return this._requestStandardised&&(u.sqlFormat="standard"),u.where=i,u.spatialRelationship=e.pagesDefinition.spatialRel,u.relationParameter=e.pagesDefinition.relationParam,u.outFields=e.pagesDefinition.outFields,u.outStatistics=e.pagesDefinition.outStatistics,u.geometry=e.pagesDefinition.geometry,u.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,u.num=e.pagesDefinition.resultRecordCount,u.start=e.pagesDefinition.internal.lastPage,u.returnGeometry=e.pagesDefinition.returnGeometry,u.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&u.geometry&&u.spatialRelationship?p.resolve([]):this.executeQuery(u,"execute").then((function(t){if(a._checkCancelled(r),!t.hasOwnProperty("features"))return p.reject(new Error("Unnexected Result querying aggregates from layer"));var i=[];if(e.pagesDefinition.internal.lastPage!==l)return[];for(var u=0;u<t.features.length;u++)e.pagesDefinition.internal.set[o+u]=t.features[u].attributes[e.pagesDefinition.generatedOid];for(u=0;u<t.features.length;u++)i.push(new n({attributes:t.features[u].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===t.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=t.features[t.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===t.exceededTransferLimit&&t.features.length!==e.pagesDefinition.resultRecordCount||!1===t.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+t.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,i}))}catch(e){return p.reject(e)}},t.create=function(e,r,n,a){return new t({layer:new _({url:e,outFields:null===r?["*"]:r}),spatialReference:n,lrucache:a})},t.prototype.relationshipMetaData=function(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON&&this._layer.source.sourceJSON.relationships?this._layer.source.sourceJSON.relationships:[]},t.prototype.serviceUrl=function(){return l.extractServiceUrl(this._layer.parsedUrl.path)},t.prototype.queryAttachments=function(e,t,r,n){var a=this;if(this._layer.capabilities.data.supportsAttachment&&this._layer.capabilities.operations.supportsQueryAttachments){var s={objectIds:[e]};return(t&&t>0||r&&r>0)&&(s.size=[t&&t>0?t:0,r&&r>0?r:t+1]),n&&n.length>0&&(s.attachmentTypes=n),this._layer.queryAttachments(s).then((function(t){var r=[];return t&&t[e]&&t[e].forEach((function(t){var n=a._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();r.push(new i(t.id,t.name,t.contentType,t.size,n))})),r}))}return p.resolve([])},t.prototype.queryRelatedFeatures=function(e){var t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields.join(","),returnGeometry:e.returnGeometry.toString()};return null!=e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),null!=e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=JSON.stringify(e.outSpatialReference.toJSON())),a(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t}).then((function(e){if(e.data){var t={},r=e.data;if(r&&r.relatedRecordGroups)for(var a=r.spatialReference,i=0,s=r.relatedRecordGroups;i<s.length;i++){for(var o=s[i],l=o.objectId,u=[],c=0,d=o.relatedRecords;c<d.length;c++){var f=d[c];f.geometry&&(f.geometry.spatialReference=a);var _=new n({geometry:f.geometry?h.fromJSON(f.geometry):null,attributes:f.attributes});u.push(_)}t[l]={features:u,exceededTransferLimit:!0===r.exceededTransferLimit}}return t}return p.reject("Invalid Request")}))},t.prototype.getFeatureByObjectId=function(e,t){var r=new g({url:this._layer.parsedUrl.path}),n=new S;return n.outFields=t,n.returnGeometry=!1,n.outSpatialReference=this.spatialReference,n.where=this.objectIdField+"="+e.toString(),r.execute(n).then((function(e){return 1===e.features.length?e.features[0]:null}))},t}(s)}).apply(null,n))||(e.exports=a)},SqzB:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("gfOZ"),r("tq6K"),r("1eyA")],void 0===(a=(function(e,t,r,n,a){function i(e,t){return s(e.parseTree,t,e.parameters)}function s(e,t,r,n,a){var i,c,d,f;switch(void 0===n&&(n=null),void 0===a&&(a=null),e.type){case"interval":return p(s(e.value,t,r,n,a),e.qualifier,e.op);case"case_expression":var h=" CASE ";"simple"===e.format&&(h+=s(e.operand,t,r,n,a));for(var _=0;_<e.clauses.length;_++)h+=" WHEN "+s(e.clauses[_].operand,t,r,n,a)+" THEN "+s(e.clauses[_].value,t,r,n,a);return null!==e.else&&(h+=" ELSE "+s(e.else,t,r,n,a)),h+" END ";case"param":var y=r[e.value.toLowerCase()];if("string"==typeof y)return"'"+r[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'";if(y instanceof Date)return l(y,t);if(y instanceof Array){var g=[];for(_=0;_<y.length;_++)"string"==typeof y[_]?g.push("'"+y[_].toString().replace(/'/g,"''")+"'"):y[_]instanceof Date?g.push(l(y[_],t)):g.push(y[_].toString());return g}return y.toString();case"expr_list":c=[];for(var v=0,m=e.value;v<m.length;v++)c.push(s(m[v],t,r,n,a));return c;case"unary_expr":return" ( NOT "+s(e.expr,t,r,n,a)+" ) ";case"binary_expr":switch(e.operator){case"AND":return" ("+s(e.left,t,r,n,a)+" AND "+s(e.right,t,r,n,a)+") ";case"OR":return" ("+s(e.left,t,r,n,a)+" OR "+s(e.right,t,r,n,a)+") ";case"IS":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+s(e.left,t,r,n,a)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+s(e.left,t,r,n,a)+" IS NOT NULL )";case"IN":return i=[],"expr_list"===e.right.type?(i=s(e.right,t,r,n,a)," ("+s(e.left,t,r,n,a)+" IN ("+i.join(",")+")) "):(f=s(e.right,t,r,n,a))instanceof Array?" ("+s(e.left,t,r,n,a)+" IN ("+f.join(",")+")) ":" ("+s(e.left,t,r,n,a)+" IN ("+f+")) ";case"NOT IN":return i=[],"expr_list"===e.right.type?(i=s(e.right,t,r,n,a)," ("+s(e.left,t,r,n,a)+" NOT IN ("+i.join(",")+")) "):(f=s(e.right,t,r,n,a))instanceof Array?" ("+s(e.left,t,r,n,a)+" NOT IN ("+f.join(",")+")) ":" ("+s(e.left,t,r,n,a)+" NOT IN ("+f+")) ";case"BETWEEN":return d=s(e.right,t,r,n,a)," ("+s(e.left,t,r,n,a)+" BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"NOTBETWEEN":return d=s(e.right,t,r,n,a)," ("+s(e.left,t,r,n,a)+" NOT BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"LIKE":return""!==e.escape?" ("+s(e.left,t,r,n,a)+" LIKE "+s(e.right,t,r,n,a)+" ESCAPE '"+e.escape+"') ":" ("+s(e.left,t,r,n,a)+" LIKE "+s(e.right,t,r,n,a)+") ";case"NOT LIKE":return""!==e.escape?" ("+s(e.left,t,r,n,a)+" NOT LIKE "+s(e.right,t,r,n,a)+" ESCAPE '"+e.escape+"') ":" ("+s(e.left,t,r,n,a)+" NOT LIKE "+s(e.right,t,r,n,a)+") ";case"<>":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+s(e.left,t,r,n,a)+" "+e.operator+" "+s(e.right,t,r,n,a)+") "}throw new Error("Not Supported Operator "+e.operator);case"null":return"null";case"bool":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return l(e.value,t);case"number":return e.value.toString();case"current_time":return u("date"===e.mode,t);case"column_ref":return n&&n.toLowerCase()===e.column.toLowerCase()?"("+a+")":e.column;case"function":var S=s(e.args,t,r,n,a);return o(e.name,S,t)}throw new Error("Unsupported sql syntax "+e.type)}function o(e,t,r){switch(e.toLowerCase().trim()){case"abs":if(1!==t.length)throw new Error("Invalid Parameter for call to ABS");return"abs("+t[0]+")";case"ceiling":case"ceil":if(1!==t.length)throw new Error("Invalid Parameter for call to CEILING");return"CEILING("+t[0]+")";case"floor":if(1!==t.length)throw new Error("Invalid Parameter for call to Floor");return"FLOOR("+t[0]+")";case"log":if(1!==t.length)throw new Error("Invalid Parameter for call to LOG");return"LOG("+t[0]+")";case"log10":if(1!==t.length)throw new Error("Invalid Parameter for call to LOG10");return"LOG10("+t[0]+")";case"power":if(2!==t.length)throw new Error("Invalid Parameter for call to POWER");return"POWER("+t[0]+","+t[1]+")";case"round":if(2===t.length)return"ROUND("+t[0]+","+t[1]+")";if(1===t.length)return"ROUND("+t[0]+")";throw new Error("Invalid Parameter for call to ROUND");case"truncate":if(t.length<1||t.length>2)throw new Error("Invalid Parameter for TRUNCATE function");return r===n.FeatureServiceDatabaseType.SqlServer?"ROUND("+t[0]+(1===t.length?"0":","+t[1])+",1)":"TRUNCATE("+t[0]+(1===t.length?")":","+t[1]+")");case"char_length":case"len":if(1!==t.length)throw new Error("Invalid Parameter for CHAR_LENGTH function");switch(r){case n.FeatureServiceDatabaseType.SqlServer:return"LEN("+t[0]+")";case n.FeatureServiceDatabaseType.Oracle:return"LENGTH("+t[0]+")";default:return"CHAR_LENGTH("+t[0]+")"}case"concat":if(t.length<1)throw new Error("Invalid Parameter for CONCAT function");for(var a="CONCAT(",i=0;i<t.length;i++)0!==i&&(a+=","),a+=t[i];return a+")";case"lower":case"lcase":if(1!==t.length)throw new Error("Invalid Parameter for Lower function");return"LOWER("+t[0]+")";case"upper":case"ucase":if(1!==t.length)throw new Error("Invalid Parameter for Upper function");return"UPPER("+t[0]+")";case"substring":var s="";switch(r){case n.FeatureServiceDatabaseType.Oracle:return s="SUBSTR("+t[0]+","+t[1],3===t.length&&(s+=","+t[2]),s+")";case n.FeatureServiceDatabaseType.SqlServer:return 3===t.length?"SUBSTRING("+t[0]+","+t[1]+","+t[2]+")":"SUBSTRING("+t[0]+", "+t[1]+", LEN("+t[0]+") - "+t[1]+")";default:return s="SUBSTRING("+t[0]+" FROM "+t[1],3===t.length&&(s+=" FOR "+t[2]),s+")"}case"extract":return"EXTRACT("+t[0].replace(/\'/g,"")+" FROM "+t[1]+")"}throw new Error("Function Not Recognised")}function l(e,t){var a=r.MomentLibrary.Moment(e),i=0===a.minute()&&0===a.hour()&&0===a.second()&&0===a.millisecond();switch(t){case n.FeatureServiceDatabaseType.FILEGDB:case n.FeatureServiceDatabaseType.Standardised:case n.FeatureServiceDatabaseType.StandardisedNoInterval:return i?"date '"+a.format("YYYY-MM-DD")+"'":"date '"+a.format("YYYY-MM-DD HH:mm:ss")+"'";case n.FeatureServiceDatabaseType.Oracle:return i?"TO_DATE('"+a.format("YYYY-MM-DD")+"','YYYY-MM-DD')":"TO_DATE('"+a.format("YYYY-MM-DD HH:mm:ss")+"','YYYY-MM-DD HH24:MI:SS')";case n.FeatureServiceDatabaseType.SqlServer:return"'"+a.format(i?"YYYY-MM-DD":"YYYY-MM-DD HH:mm:ss")+"'";case n.FeatureServiceDatabaseType.PGDB:return"#"+a.format(i?"MM-DD-YYYY":"MM-DD-YYYY HH:mm:ss")+"#";case n.FeatureServiceDatabaseType.Postgres:return"TIMESTAMP '"+a.format(i?"YYYY-MM-DD":"YYYY-MM-DD HH:mm:ss")+"'";default:return"date '"+a.format("YYYY-MM-DD HH:mm:ss")+"'"}}function u(e,t){switch(t){case n.FeatureServiceDatabaseType.FILEGDB:case n.FeatureServiceDatabaseType.Standardised:case n.FeatureServiceDatabaseType.StandardisedNoInterval:case n.FeatureServiceDatabaseType.Oracle:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP";case n.FeatureServiceDatabaseType.SqlServer:return e?"CAST(GETDATE() AS DATE)":"GETDATE()";default:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP"}}Object.defineProperty(t,"__esModule",{value:!0}),t.toWhereClause=i,t.toWhereClauseFromTree=function(e,t,r){return s(e,t,r)},t.reformulateWithoutField=function(e,t,r,i){return a.WhereClause.create(s(e.parseTree,n.FeatureServiceDatabaseType.Standardised,e.parameters,t,r),i)},t.combine=function(e,t,r){return void 0===r&&(r="AND"),a.WhereClause.create("(("+i(e,n.FeatureServiceDatabaseType.Standardised)+")"+r+"("+i(t,n.FeatureServiceDatabaseType.Standardised)+"))",e.fieldsIndex)},t.translateFunctionToDatabaseSpecific=o,t.makeDateString=l,t.makeToday=u,t.predictType=function(e,t,r){void 0===r&&(r={});for(var n={},a={},i={esriFieldTypeSmallInteger:"integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"double",esriFieldTypeDouble:"double",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"integer",oid:"integer",long:"integer","small-integer":"integer",integer:"integer",single:"double",double:"double",date:"date",string:"string"},s=0,o=t;s<o.length;s++){var l=i[(u=o[s]).type];n[u.name.toLowerCase()]=void 0===l?"":l}for(var u in r)l=i[r[u]],a[u.toLowerCase()]=void 0===l?"":l;switch(function e(t,r,n,a){var i;switch(r.type){case"interval":return"integer";case"case_expression":var s=[];if("simple"===r.format){for(var o=0;o<r.clauses.length;o++)s.push(e(t,r.clauses[o].value,n,a));null!==r.else&&s.push(e(t,r.else,n,a))}else{for(o=0;o<r.clauses.length;o++)s.push(e(t,r.else,n,a));null!==r.else&&s.push(e(t,r.else,n,a))}return d(s);case"param":var l=a[r.value.toLowerCase()];if(void 0===l&&n){var u=n[r.value.toLowerCase()];if(void 0===u)return"";if(null===u)return"";if("string"==typeof u||u instanceof String)return"string";if("boolean"==typeof u)return"boolean";if(u instanceof Date)return"date";if("number"==typeof u)return u%1==0?"integer":"double"}return void 0===l?"":l;case"expr_list":for(var c=[],f=0,p=r.value;f<p.length;f++)c.push(e(t,p[f],n,a));return c;case"unary_expr":return"boolean";case"binary_expr":switch(r.operator){case"AND":case"OR":case"IN":case"NOT IN":case"BETWEEN":case"NOTBETWEEN":case"LIKE":case"NOT LIKE":case"<>":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if("null"!==r.right.type)throw new Error("Unsupported RHS for IS");return"boolean";case"*":case"-":case"+":case"/":return d([e(t,r.left,n,a),e(t,r.right,n,a)]);default:throw new Error("Not Supported Operator "+r.operator)}case"null":return"";case"bool":return"boolean";case"string":return"string";case"number":return null===r.value?"":r.value%1==0?"integer":"double";case"date":case"timestamp":case"current_time":return"date";case"column_ref":var h=t[r.column.toLowerCase()];return void 0===h?"":h;case"function":switch(r.name.toLowerCase()){case"position":case"extract":case"char_length":return"integer";case"round":case"round":return(i=e(t,r.args,n,a))instanceof Array?i.length>0?i[0]:"":i;case"sign":return(i=e(t,r.args,n,a))instanceof Array&&(i=d(i)),"integer"===i||"double"===i?i:"double";case"ceiling":case"floor":case"abs":var _=e(t,r.args,n,a);return _ instanceof Array?d(_):_;case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"power":case"truncate":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string"}return""}throw new Error("Unsupported sql syntax "+r.type)}(n,e.parseTree,e.parameters,a)){case"double":case"double":return"double";case"integer":return"integer";case"date":return"date";case"string":return"string"}return""};var c={boolean:1,string:2,integer:3,double:4,date:5};function d(e){if(e){for(var t="",r=0,n=e;r<n.length;r++){var a=n[r];""!==a&&(t=""===t||c[t]<c[a]?a:t)}return t}return""}function f(e){return""+e.period.toUpperCase()}function p(e,t,r){return"INTERVAL "+r+" "+e+" "+("interval-period"===t.type?f(t):f(t.start)+" TO "+f(t.end))}t.scanForField=function(e,t){return function e(t,r){if(null==t)return!1;switch(t.type){case"when_clause":return e(t.operand,r)||e(t.value,r);case"case_expression":for(var n=0,a=t.clauses;n<a.length;n++){var i=a[n];if(e(i,r))return!0}return!("simple"!==t.format||!e(t.operand,r))||!(null===t.else||!e(t.else,r));case"param":case"null":case"bool":case"date":case"timestamp":case"string":case"number":return!1;case"expr_list":for(var s=0,o=t.value;s<o.length;s++)if(e(i=o[s],r))return!0;return!1;case"unary_expr":return e(t.expr,r);case"binary_expr":return e(t.left,r)||e(t.right,r);case"column_ref":return r.toLowerCase()===t.column.toLowerCase();case"function":return e(t.args,r)}return!1}(e.parseTree,t)},t.isSingleField=function(e){return"column_ref"===e.parseTree.type},t.convertIntervalToSql=p}).apply(null,n))||(e.exports=a)},VM5u:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("20W2"),r("88sq"),r("Q4uJ"),r("tq6K"),r("qMld"),r("wfTL")],void 0===(a=(function(e,t,r,n,a,i,s,o,l){var u=function(e){function t(t){var r=e.call(this,t)||this;return r._relation="",r._relationGeom=null,r._relationString="",r.declaredClass="esri.arcade.featureset.actions.SpatialFilter",r._relationString=t.relationString,r._parent=t.parentfeatureset,r._maxProcessing=40,r._relation=t.relation,r._relationGeom=t.relationGeom,r}return r.__extends(t,e),t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._parent._getFilteredSet("esriSpatialRelRelation"!==t._relation?t._relation:t._relation+":"+t._relationString,t._relationGeom,null,null,e)})).then((function(r){return t._checkCancelled(e),t._wset=new i(r._candidates.slice(0),r._known.slice(0),r._ordered,t._clonePageDefinition(r.pagesDefinition)),t._wset})):o.resolve(this._wset)},t.prototype._isInFeatureSet=function(e){var t=this._parent._isInFeatureSet(e);return t===s.IdState.NotInFeatureSet?t:void 0===(t=this._idstates[e])?s.IdState.Unknown:t},t.prototype._getFeature=function(e,t,r){return this._parent._getFeature(e,t,r)},t.prototype._getFeatures=function(e,t,r,n){return this._parent._getFeatures(e,t,r,n)},t.prototype._featureFromCache=function(e){return this._parent._featureFromCache(e)},t.prototype.executeSpatialRelationTest=function(e){if(null===e.geometry)return o.resolve(!1);switch(this._relation){case"esriSpatialRelEnvelopeIntersects":var t=s.shapeExtent(this._relationGeom),r=s.shapeExtent(e.geometry);return l.intersects(t,r);case"esriSpatialRelIntersects":return l.intersects(this._relationGeom,e.geometry);case"esriSpatialRelContains":return l.contains(this._relationGeom,e.geometry);case"esriSpatialRelOverlaps":return l.overlaps(this._relationGeom,e.geometry);case"esriSpatialRelWithin":return l.within(this._relationGeom,e.geometry);case"esriSpatialRelTouches":return l.touches(this._relationGeom,e.geometry);case"esriSpatialRelCrosses":return l.crosses(this._relationGeom,e.geometry);case"esriSpatialRelRelation":return l.relate(this._relationGeom,e.geometry,this._relationString)}},t.prototype._fetchAndRefineFeatures=function(e,t,r){var n=this,a=new i([],e,!1,null),l=Math.min(t,e.length);return this._parent._getFeatures(a,-1,l,r).then((function(){n._checkCancelled(r);for(var t=[],a=0;a<l;a++){var i=n._parent._featureFromCache(e[a]);t.push(n.executeSpatialRelationTest(i))}return o.all(t)})).then((function(r){for(var a=0;a<t;a++)n._idstates[e[a]]=!0===r[a]?s.IdState.InFeatureSet:s.IdState.NotInFeatureSet;return"success"}))},t.prototype._getFilteredSet=function(e,t,r,n,a){var s=this;return this._ensureLoaded().then((function(){return s._parent._getFilteredSet("esriSpatialRelRelation"!==s._relation?s._relation:s._relation+":"+s._relationString,s._relationGeom,r,n,a)})).then((function(e){return s._checkCancelled(a),null!==t?new i(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,s._clonePageDefinition(e.pagesDefinition)):new i(e._candidates.slice(0),e._known.slice(0),e._ordered,s._clonePageDefinition(e.pagesDefinition))}))},t.prototype._stat=function(e,t,r,n,a,i,s){var l=this;return""!==r?o.resolve({calculated:!1}):this._parent._stat(e,t,"esriSpatialRelRelation"!==this._relation?this._relation:this._relation+":"+this._relationString,this._relationGeom,a,i,s).then((function(o){return!1===o.calculated?null===a&&""===r&&null===n?l._manualStat(e,t,i,s):{calculated:!1}:o}))},t.prototype._canDoAggregates=function(e,t,r,n,a){return""!==r||null!==n||null===this._parent?o.resolve(!1):this._parent._canDoAggregates(e,t,"esriSpatialRelRelation"!==this._relation?this._relation:this._relation+":"+this._relationString,this._relationGeom,a)},t.prototype._getAggregatePagesDataSourceDefinition=function(e,t,r,n,a,i,s){return null===this._parent?o.reject(new Error("Should never be called")):this._parent._getAggregatePagesDataSourceDefinition(e,t,"esriSpatialRelRelation"!==this._relation?this._relation:this._relation+":"+this._relationString,this._relationGeom,a,i,s)},t}(a);return a._featuresetFunctions.intersects=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelIntersects",relationGeom:e})},a._featuresetFunctions.envelopeIntersects=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelEnvelopeIntersects",relationGeom:e})},a._featuresetFunctions.contains=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelContains",relationGeom:e})},a._featuresetFunctions.overlaps=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelOverlaps",relationGeom:e})},a._featuresetFunctions.within=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelWithin",relationGeom:e})},a._featuresetFunctions.touches=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelTouches",relationGeom:e})},a._featuresetFunctions.crosses=function(e){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelCrosses",relationGeom:e})},a._featuresetFunctions.relate=function(e,t){return null==e?new n({parentfeatureset:this}):new u({parentfeatureset:this,relation:"esriSpatialRelRelation",relationGeom:e,relationString:t})},u}).apply(null,n))||(e.exports=a)},bBZx:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("jZlN"),r("88sq"),r("Q4uJ"),r("tq6K"),r("SqzB"),r("qMld"),r("YADd"),r("Zvuv"),r("V+oH"),r("KQcO"),r("IpeC")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d,f,p){return function(e){function t(t){var r=e.call(this,t)||this;return r.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",r._removeGeometry=!1,r._overrideFields=null,r._forceIsTable=!1,t.spatialReference&&(r.spatialReference=t.spatialReference),r._transparent=!0,r._maxProcessing=1e3,r._layer=t.layer,r._wset=null,!0===t.isTable&&(r._forceIsTable=!0),void 0!==t.outFields&&(r._overrideFields=t.outFields),void 0!==t.includeGeometry&&(r._removeGeometry=!1===t.includeGeometry),r}return r.__extends(t,e),t.prototype._maxQueryRate=function(){return s.defaultMaxRecords},t.prototype.end=function(){return this._layer},t.prototype.optimisePagingFeatureQueries=function(){},t.prototype.load=function(){var e=this;return null===this._loadPromise&&(this._loadPromise=l.create((function(t,r){if(!0===e._layer.loaded)return e._initialiseFeatureSet(),void t(e);e._layer.when().then((function(){try{e._initialiseFeatureSet(),t(e)}catch(e){r(e)}}),r),e._layer.load()}))),this._loadPromise},t.prototype._initialiseFeatureSet=function(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{for(var e=[],t=0,r=this.fields;t<r.length;t++)if("oid"===(u=r[t]).type)e.push(u);else for(var n=0,a=this._layer.outFields;n<a.length;n++)if(a[n].toLowerCase()===u.name.toLowerCase()){e.push(u);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{e=[];for(var i=[],o=0,l=this.fields;o<l.length;o++){var u;if("oid"===(u=l[o]).type)e.push(u),i.push(u.name);else for(var c=0,d=this._overrideFields;c<d.length;c++)if(d[c].toLowerCase()===u.name.toLowerCase()){e.push(u),i.push(u.name);break}}this.fields=e,this._overrideFields=i}this.objectIdField=this._layer.objectIdField,this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this._databaseType=s.FeatureServiceDatabaseType.Standardised,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types},t.prototype.isTable=function(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType},t.prototype._isInFeatureSet=function(){return s.IdState.InFeatureSet},t.prototype._candidateIdTransform=function(e){return e},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._getFilteredSet("",null,null,null,e)})).then((function(e){return t._wset=e,e})):l.resolve(this._wset)},t.prototype._changeFeature=function(e){for(var t={},r=0,a=this.fields;r<a.length;r++){var i=a[r];t[i.name]=e.attributes[i.name]}return new n({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})},t.prototype._getFilteredSet=function(e,t,r,n,a){var u=this,c="",d=!1;if(null!==n&&(c=n.constructClause(),d=!0),this.isTable()&&t&&null!==e&&""!==e){var f=new i([],[],!0,null);return l.resolve(f)}var h=new p;return h.where=null===r?null===t?"1=1":"":o.toWhereClause(r,s.FeatureServiceDatabaseType.Standardised),h.spatialRelationship=this._makeRelationshipEnum(e),h.outSpatialReference=this.spatialReference,h.orderByFields=""!==c?c.split(","):null,h.geometry=null===t?null:t,h.returnGeometry=!0,h.relationParameter=this._makeRelationshipParam(e),this._layer.queryFeatures(h).then((function(e){if(null===e)return new i([],[],d,null);u._checkCancelled(a);var t=[];return e.features.forEach((function(e){var r=e.attributes[u._layer.objectIdField];t.push(r),u._featureCache[r]=u._changeFeature(e)})),new i([],t,d,null)}))},t.prototype._makeRelationshipEnum=function(e){if(e.indexOf("esriSpatialRelRelation")>=0)return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e},t.prototype._makeRelationshipParam=function(e){return e.indexOf("esriSpatialRelRelation")>=0?e.split(":")[1]:""},t.prototype._queryAllFeatures=function(){var e=this;if(this._wset)return l.resolve(this._wset);var t=new p;return t.where="1=1",this._ensureLoaded().then((function(){if(e._layer.source&&e._layer.source.items){var r=[];return e._layer.source.items.forEach((function(t){var n=t.attributes[e._layer.objectIdField];r.push(n),e._featureCache[n]=e._changeFeature(t)})),e._wset=new i([],r,!1,null),e._wset}return e._layer.queryFeatures(t).then((function(t){var r=[];return t.features.forEach((function(t){var n=t.attributes[e._layer.objectIdField];r.push(n),e._featureCache[n]=e._changeFeature(t)})),e._wset=new i([],r,!1,null),e._wset}))}))},t.prototype._getFeatures=function(e,t,r){var n=[];-1!==t&&void 0===this._featureCache[t]&&n.push(t);for(var a=e._lastFetchedIndex;a<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[a]]&&(e._known[a]!==t&&n.push(e._known[a]),n.length>r)));a++);return 0===n.length?l.resolve("success"):l.reject(new Error("Unaccounted for Features. Not in Feature Collection"))},t.prototype._refineSetBlock=function(e){return l.resolve(e)},t.prototype._stat=function(){return l.resolve({calculated:!1})},t.prototype._canDoAggregates=function(){return l.resolve(!1)},t.prototype.relationshipMetaData=function(){return[]},t._cloneAttr=function(e){var t={};for(var r in e)t[r]=e[r];return t},t.prototype.nativeCapabilities=function(){return{title:this._layer.title,canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}},t.create=function(e,r){var n=e.layerDefinition.objectIdField,a=e.layerDefinition.typeIdField?e.layerDefinition.typeIdField:"",i=[];if(e.layerDefinition.types)for(var s=0,o=e.layerDefinition.types;s<o.length;s++)i.push(d.fromJSON(o[s]));var l=e.layerDefinition.geometryType;void 0===l&&(l=e.featureSet.geometryType||"");var p=e.featureSet.features,h=r.toJSON();if(""===n||void 0===n){for(var _=!1,y=0,g=e.layerDefinition.fields;y<g.length;y++)if("oid"===(N=g[y]).type||"esriFieldTypeOID"===N.type){n=N.name,_=!0;break}if(!1===_){for(var v="FID",m=!0,S=0;m;){for(var F=!0,w=0,b=e.layerDefinition.fields;w<b.length;w++)if((N=b[w]).name===v){F=!1;break}!0===F?m=!1:v="FID"+(++S).toString()}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:v,alias:v});for(var I=[],T=0;T<p.length;T++)I.push({geometry:e.featureSet.features[T].geometry,attributes:e.featureSet.features[T].attributes?this._cloneAttr(e.featureSet.features[T].attributes):{}}),I[T].attributes[v]=T;p=I,n=v}}for(var D=[],C=0,x=e.layerDefinition.fields;C<x.length;C++)(N=x[C])instanceof f?D.push(N):D.push(f.fromJSON(N));var E=l;switch(E){case"esriGeometryPoint":E="point";break;case"esriGeometryPolyline":E="polyline";break;case"esriGeometryPolygon":E="polygon";break;case"esriGeometryExtent":E="extent";break;case"esriGeometryMultipoint":E="multipoint"}for(var A=0,R=p;A<R.length;A++){var N;(N=R[A]).geometry&&N.geometry instanceof u==0&&(N.geometry.type=E,void 0===N.geometry.spatialReference&&(N.geometry.spatialReference=h))}var k={outFields:["*"],source:p,fields:D,types:i,typeIdField:a,objectIdField:n,spatialReference:r};return k.geometryType=E||"point",new t({layer:new c(k),spatialReference:r,isTable:null===E||""===E})},t.prototype.queryAttachments=function(){return l.resolve([])},t.prototype.getFeatureByObjectId=function(e){var t=new p;return t.where=this.objectIdField+"="+e.toString(),this._layer.queryFeatures(t).then((function(e){return 1===e.features.length?e.features[0]:null}))},t}(a)}).apply(null,n))||(e.exports=a)},eLe6:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("zp6E"),r("1FvL"),r("QA8M"),r("bBZx"),r("PNLr"),r("x/o6"),r("tq6K"),r("qMld"),r("1eyA"),r("Zvuv"),r("Qwus"),r("QmTF"),r("G0SM"),r("ijuC"),r("VM5u"),r("ufnL"),r("25uz")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d,f,p,h){function _(e,t){if(l.applicationCache){var r=l.applicationCache.getLayerInfo(e);if(r)return r.then((function(r){return c.resolve(new f({url:e,outFields:t,sourceJSON:r}))}));var n=new f({url:e,outFields:t}),a=c.create((function(e,t){n.load().then((function(){e(n.sourceJSON)}),(function(e){t(e)}))}));return l.applicationCache&&(l.applicationCache.setLayerInfo(e,a),a=a.catch((function(t){throw l.applicationCache.clearLayerInfo(e),t}))),a.then((function(){return c.resolve(n)}))}return c.resolve(new f({url:e,outFields:t}))}function y(e,t,r,n,a){return _(e,["*"]).then((function(e){return c.resolve(g(e,t,r,n,a))}))}function g(e,t,r,n,a){return void 0===t&&(t=null),void 0===r&&(r=null),void 0===n&&(n=!0),void 0===a&&(a=null),!0===e._hasMemorySource()?new s({layer:e,spatialReference:t,outFields:r,includeGeometry:n,lrucache:a}):new i({layer:e,spatialReference:t,outFields:r,includeGeometry:n,lrucache:a})}function v(e){if(null!==l.applicationCache){var t=l.applicationCache.getLayerInfo(e);if(null!==t)return t}var r=n(e,{responseType:"json",query:{f:"json"}}).then((function(e){if(e.data){var t=e.data;return t.layers||(t.layers=[]),t.tables||(t.tables=[]),c.resolve(t)}return c.resolve({layers:[],tables:[]})}));return null!==l.applicationCache&&(l.applicationCache.setLayerInfo(e,r),r=r.catch((function(t){throw l.applicationCache.clearLayerInfo(e),t}))),r}Object.defineProperty(t,"__esModule",{value:!0}),t.initialiseMetaDataCache=function(){null===l.applicationCache&&(l.applicationCache=new l)},t.constructFeatureSetFromUrl=y,t.constructFeatureSet=g,t.constructAssociationMetaDataFeatureSetFromUrl=function(e,t){var a={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null};return v(e).then((function(i){if(a.metadata=i,i.controllerDatasetLayers&&null!=i.controllerDatasetLayers.utilityNetworkLayerId){if(i.layers)for(var s=0,o=i.layers;s<o.length;s++){var u=o[s];a.layerNameLkp[u.id]=u.name}if(i.tables)for(var f=0,p=i.tables;f<p.length;f++)a.layerNameLkp[(u=p[f]).id]=u.name;var h=i.controllerDatasetLayers.utilityNetworkLayerId;return a.networkId=h,function(e,t){var r="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==l.applicationCache){var a=l.applicationCache.getLayerInfo(r);if(null!==a)return a}var i=n(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}}).then((function(e){if(e.data){var t=e.data;if(t.layerDataElements&&t.layerDataElements[0])return t.layerDataElements[0]}throw new Error("Not Found")}));return null!==l.applicationCache&&(l.applicationCache.setLayerInfo(r,i),i=i.catch((function(e){throw l.applicationCache.clearLayerInfo(r),e}))),i}(e,h).then((function(i){if(i){a.queryelem=i,a.queryelem&&a.queryelem.dataElement&&void 0!==a.queryelem.dataElement.schemaGeneration&&(a.unVersion=a.queryelem.dataElement.schemaGeneration),a.lkp={},a.queryelem.dataElement.domainNetworks||(a.queryelem.dataElement.domainNetworks=[]);for(var s=0,o=a.queryelem.dataElement.domainNetworks;s<o.length;s++){for(var u=o[s],f=0,p=u.edgeSources?u.edgeSources:[];f<p.length;f++)(m={layerId:(v=p[f]).layerId,sourceId:v.sourceId,className:a.layerNameLkp[v.layerId]?a.layerNameLkp[v.layerId]:null}).className&&(a.lkp[m.className]=m);for(var _=0,g=u.junctionSources?u.junctionSources:[];_<g.length;_++){var v,m;(m={layerId:(v=g[_]).layerId,sourceId:v.sourceId,className:a.layerNameLkp[v.layerId]?a.layerNameLkp[v.layerId]:null}).className&&(a.lkp[m.className]=m)}}if(a.queryelem.dataElement.terminalConfigurations)for(var S=0,F=a.queryelem.dataElement.terminalConfigurations;S<F.length;S++)for(var w=0,b=F[S].terminals;w<b.length;w++){var I=b[w];a.terminals.push({terminalId:I.terminalId,terminalName:I.terminalName})}return function(e){if(null!==l.applicationCache){var t=l.applicationCache.getLayerInfo(e);if(null!==t)return t}var r=n(e,{responseType:"json",query:{f:"json"}}).then((function(e){return c.resolve(e.data?e.data:null)}));return null!==l.applicationCache&&(l.applicationCache.setLayerInfo(e,r),r=r.catch((function(t){throw l.applicationCache.clearLayerInfo(e),t}))),r}(e+"/"+h).then((function(n){if(n.systemLayers&&null!=n.systemLayers.associationsTableId){var i=[];return a.unVersion>=4&&(i.push("STATUS"),i.push("PERCENTALONG")),y(e+"/"+n.systemLayers.associationsTableId.toString(),t,r.__spreadArrays(["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID"],i),!1,null).then((function(e){return e.load()})).then((function(e){return a.unVersion>=4?(e=e.filter(d.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)",e.getFieldsIndex()))).load():e})).then((function(e){return{lkp:a.lkp,associations:e,unVersion:a.unVersion,terminals:a.terminals}}))}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}))}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}))}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}))},t.constructFeatureSetFromRelationship=function(e,t,r,n,a,i,s){void 0===n&&(n=null),void 0===a&&(a=null),void 0===i&&(i=!0),void 0===s&&(s=null);var l=e.serviceUrl();return l?y(l="/"===l.charAt(l.length-1)?l+t.relatedTableId.toString():l+"/"+t.relatedTableId.toString(),n,a,i,s).then((function(l){return new o({layer:e,relatedLayer:l,relationship:t,objectId:r,spatialReference:n,outFields:a,includeGeometry:i,lrucache:s})})):null};var m=function(e){function t(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=e.call(this)||this;return a._map=t,a._overridespref=r,a.lrucache=n,a._instantLayers=[],a}return r.__extends(t,e),t.prototype.makeAndAddFeatureSet=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=null);var n=g(e,this._overridespref,null===r?["*"]:r,t,this.lrucache);return this._instantLayers.push({featureset:n,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),n},t.prototype.featureSetByName=function(e,t,n){var a=this;if(void 0===t&&(t=!0),void 0===n&&(n=null),void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return this._map.load().then((function(){try{return a.featureSetByName(e,t,n)}catch(e){return c.reject(e)}}));null===n&&(n=["*"]),n=(n=n.slice(0)).sort();for(var i=JSON.stringify(n),s=0;s<this._instantLayers.length;s++){var o=this._instantLayers[s];if(o.opitem.title===e&&o.includeGeometry===t&&o.outFields===i)return this.resolvePromise(this._instantLayers[s].featureset)}var l=this._map.layers.find((function(t){return t instanceof f&&t.title===e}));if(l)return this.resolvePromise(this.makeAndAddFeatureSet(l,t,n));if(this._map.tables){var u=this._map.tables.find((function(t){return!!(t.title&&t.title===e||t.title&&t.title===e)}));if(u){if(u._materializedTable);else{var d=u.outFields?u:r.__assign(r.__assign({},u),{outFields:["*"]});u._materializedTable=new f(d)}return u._materializedTable.load().then((function(){return a.resolvePromise(a.makeAndAddFeatureSet(u._materializedTable,t,n))}))}}return this.resolvePromise(null)},t.prototype.featureSetById=function(e,t,n){var a=this;if(void 0===t&&(t=!0),void 0===n&&(n=["*"]),void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return this._map.load().then((function(){try{return a.featureSetById(e,t,n)}catch(e){return c.reject(e)}}));null===n&&(n=["*"]),n=(n=n.slice(0)).sort();for(var i=JSON.stringify(n),s=0;s<this._instantLayers.length;s++){var o=this._instantLayers[s];if(o.opitem.id===e&&o.includeGeometry===t&&o.outFields===i)return this.resolvePromise(this._instantLayers[s].featureset)}var l=this._map.layers.find((function(t){return t instanceof f&&t.id===e}));if(l)return this.resolvePromise(this.makeAndAddFeatureSet(l,t,n));if(this._map.tables){var u=this._map.tables.find((function(t){return t.id===e}));if(u){if(u._materializedTable);else{var d=r.__assign(r.__assign({},u),{outFields:["*"]});u._materializedTable=new f(d)}return u._materializedTable.load().then((function(){return a.resolvePromise(a.makeAndAddFeatureSet(u._materializedTable,t,n))}))}}return this.resolvePromise(null)},t}(a),S=function(e){function t(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=e.call(this)||this;return a._url=t,a._overridespref=r,a.lrucache=n,a.metadata=null,a._instantLayers=[],a}return r.__extends(t,e),Object.defineProperty(t.prototype,"url",{get:function(){return this._url},enumerable:!0,configurable:!0}),t.prototype.makeAndAddFeatureSet=function(e,t,r){void 0===t&&(t=!0),void 0===r&&(r=null);var n=g(e,this._overridespref,null===r?["*"]:r,t,this.lrucache);return this._instantLayers.push({featureset:n,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),n},t.prototype._loadMetaData=function(){var e=this;return v(this._url).then((function(t){return e.metadata=t,t}))},t.prototype.load=function(){return this._loadMetaData()},t.prototype.clone=function(){return new t(this._url,this._overridespref,this.lrucache)},t.prototype.featureSetByName=function(e,t,r){var n=this;void 0===t&&(t=!0),void 0===r&&(r=null),null===r&&(r=["*"]),r=(r=r.slice(0)).sort();for(var a=JSON.stringify(r),i=0;i<this._instantLayers.length;i++){var s=this._instantLayers[i];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===a)return this.resolvePromise(this._instantLayers[i].featureset)}return this._loadMetaData().then((function(a){for(var i=null,s=0,o=a.layers?a.layers:[];s<o.length;s++)(c=o[s]).name===e&&(i=c);if(!i)for(var l=0,u=a.tables?a.tables:[];l<u.length;l++){var c;(c=u[l]).name===e&&(i=c)}return i?_(n._url+"/"+i.id,["*"]).then((function(e){return n.makeAndAddFeatureSet(e,t,r)})):n.resolvePromise(null)}))},t.prototype.featureSetById=function(e,t,r){var n=this;void 0===t&&(t=!0),void 0===r&&(r=["*"]),null===r&&(r=["*"]),r=(r=r.slice(0)).sort();var a=JSON.stringify(r);e=null!=e?e.toString():"";for(var i=0;i<this._instantLayers.length;i++){var s=this._instantLayers[i];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===a)return this.resolvePromise(this._instantLayers[i].featureset)}return this._loadMetaData().then((function(a){for(var i=null,s=0,o=a.layers?a.layers:[];s<o.length;s++)null!==(c=o[s]).id&&void 0!==c.id&&c.id.toString()===e&&(i=c);if(!i)for(var l=0,u=a.tables?a.tables:[];l<u.length;l++){var c;null!==(c=u[l]).id&&void 0!==c.id&&c.id.toString()===e&&(i=c)}return i?_(n._url+"/"+i.id,["*"]).then((function(e){return n.makeAndAddFeatureSet(e,t,r)})):n.resolvePromise(null)}))},t}(a);t.createFeatureSetCollectionFromMap=function(e,t,r){return void 0===r&&(r=null),new m(e,t,r)},t.createFeatureSetCollectionFromService=function(e,t,r){return void 0===r&&(r=null),new S(e,t,r)},t.getPortal=function(e,t){return null===e?t:new p({url:e.field("url")})},t.constructFeatureSetFromPortalItem=function(e,t,r,n,a,i,s){if(l.applicationCache){var o=l.applicationCache.getLayerInfo(e+":"+i.url);if(o)return o.then((function(e){try{var i=new f({url:u.extractServiceUrl(e.url)+"/"+t,outFields:["*"]});return c.resolve(g(i,r,n,a,s))}catch(e){return c.reject(e)}}),(function(e){return c.reject(e)}))}return c.create((function(o,c){var d=new h({id:e,portal:i}).load();l.applicationCache&&l.applicationCache.setLayerInfo(e+":"+i.url,d),d.then((function(e){try{var i=new f({url:u.extractServiceUrl(e.url)+"/"+t,outFields:["*"]});o(g(i,r,n,a,s))}catch(e){c(e)}}),(function(t){l.applicationCache&&l.applicationCache.clearLayerInfo(e+":"+i.url),c(t)}))}))}}).apply(null,n))||(e.exports=a)},gub2:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("jZlN"),r("WoOE"),r("88sq"),r("Q4uJ"),r("tq6K"),r("SqzB"),r("qMld"),r("1eyA"),r("Z4y+")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u,c,d){Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(){this.sqlRewritable=!1}return e.prototype.postInitialization=function(e,t){},e}();t.AdaptedField=f;var p=function(e){function t(t){var r=e.call(this)||this;return r.field=t,r.sqlRewritable=!0,r}return r.__extends(t,e),t.prototype.extractValue=function(e){return e.attributes[this.field.name]},t.prototype.rewriteSql=function(e){return{rewritten:this.sqlRewritable,where:e}},t}(f);t.OriginalField=p;var h=function(e){function t(t,r,n){var a=e.call(this)||this;return a.originalField=t,a.sqlRewritable=!0,a.field=o.cloneField(t),a.field.name=r,a.field.alias=n,a}return r.__extends(t,e),t.prototype.rewriteSql=function(e,t){return{rewritten:this.sqlRewritable,where:l.reformulateWithoutField(e,this.field.name,this.originalField.name,t.getFieldsIndex())}},t.prototype.extractValue=function(e){return e.attributes[this.originalField.name]},t}(f);t.FieldRename=h;var _=function(e){function t(t,r,n){var a=e.call(this)||this;for(var i in a.field=t,a.codefield=r,a.lkp=n,a.reverseLkp={},n)a.reverseLkp[n[i]]=i;return a.sqlRewritable=!0,a}return r.__extends(t,e),t.prototype.rewriteSql=function(e,r){var n=this.evaluateNodeToWhereClause(e.parseTree,o.FeatureServiceDatabaseType.Standardised,this.field.name,this.codefield instanceof c.WhereClause?l.toWhereClause(this.codefield,o.FeatureServiceDatabaseType.Standardised):this.codefield,e.parameters);return n.indexOf(t.BADNESS)>=0?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:c.WhereClause.create(n,r._parent.getFieldsIndex())}},t.prototype.evaluateNodeToWhereClause=function(e,r,n,a,i){var s,o,u,c;switch(void 0===n&&(n=null),void 0===a&&(a=null),e.type){case"interval":return l.convertIntervalToSql(this.evaluateNodeToWhereClause(e.value,r,n,a,i),e.qualifier,e.op);case"case_expression":var d=" CASE ";"simple"===e.format&&(d+=this.evaluateNodeToWhereClause(e.operand,r,n,t.BADNESS,i));for(var f=0;f<e.clauses.length;f++)d+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[f].operand,r,n,t.BADNESS,i)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[f].value,r,n,t.BADNESS,i);return null!==e.else&&(d+=" ELSE "+this.evaluateNodeToWhereClause(e.else,r,n,t.BADNESS,i)),d+" END ";case"param":var p=i[e.value.toLowerCase()];if("string"==typeof p)return"'"+i[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'";if(p instanceof Date)return l.makeDateString(p,r);if(p instanceof Array){var h=[];for(f=0;f<p.length;f++)"string"==typeof p[f]?h.push("'"+p[f].toString().replace(/'/g,"''")+"'"):p[f]instanceof Date?h.push(l.makeDateString(p[f],r)):h.push(p[f].toString());return h}return p.toString();case"expr_list":o=[];for(var _=0,y=e.value;_<y.length;_++)o.push(this.evaluateNodeToWhereClause(y[_],r,n,a,i));return o;case"unary_expr":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,r,n,t.BADNESS,i)+" ) ";case"binary_expr":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" AND "+this.evaluateNodeToWhereClause(e.right,r,n,a,i)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" OR "+this.evaluateNodeToWhereClause(e.right,r,n,a,i)+") ";case"IS":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IS NOT NULL )";case"IN":if(s=[],"expr_list"===e.right.type){if("column_ref"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){for(var g=[],v=!0,m=0,S=e.right.value;m<S.length;m++){if("string"!==(b=S[m]).type){v=!1;break}if(void 0===this.lkp[b.value]){v=!1;break}g.push(this.lkp[b.value].toString())}if(v)return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IN ("+g.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,r,n,a,i)," ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IN ("+s.join(",")+")) "}return(c=this.evaluateNodeToWhereClause(e.right,r,n,a,i))instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" IN ("+c+")) ";case"NOT IN":if(s=[],"expr_list"===e.right.type){if("column_ref"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){g=[],v=!0;for(var F=0,w=e.right.value;F<w.length;F++){var b;if("string"!==(b=w[F]).type){v=!1;break}if(void 0===this.lkp[b.value]){v=!1;break}g.push(this.lkp[b.value].toString())}if(v)return" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" NOT IN ("+g.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,r,n,a,i)," ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" NOT IN ("+s.join(",")+")) "}return(c=this.evaluateNodeToWhereClause(e.right,r,n,a,i))instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,n,a,i)+" NOT IN ("+c+")) ";case"BETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)," ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"NOTBETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)," ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" NOT BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+") ";case"<>":case"=":if("column_ref"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+a+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column_ref"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+a+") ";return" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":return" ("+this.evaluateNodeToWhereClause(e.left,r,n,t.BADNESS,i)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,n,t.BADNESS,i)+") "}throw new Error("Not Supported Operator "+e.operator);case"null":return"null";case"bool":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return l.makeDateString(e.value,r);case"number":return e.value.toString();case"current_time":return l.makeToday("date"===e.mode,r);case"column_ref":return n&&n.toLowerCase()===e.column.toLowerCase()?"("+a+")":e.column;case"function":var I=this.evaluateNodeToWhereClause(e.args,r,n,t.BADNESS,i);return l.translateFunctionToDatabaseSpecific(e.name,I,r)}throw new Error("Unsupported sql syntax "+e.type)},t.prototype.extractValue=function(e){return this.codefield instanceof c.WhereClause?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]},t.BADNESS="_!!!_BAD_LKP_!!!!",t}(f);t.StringToCodeAdapted=_;var y=function(e){function t(t,r){var n=e.call(this)||this;return n.field=t,n.sql=r,n}return r.__extends(t,e),t.prototype.rewriteSql=function(e,t){return{rewritten:!0,where:l.reformulateWithoutField(e,this.field.name,l.toWhereClause(this.sql,o.FeatureServiceDatabaseType.Standardised),t.getFieldsIndex())}},t.prototype.extractValue=function(e){return this.sql.calculateValueCompiled(e)},t}(f);t.SqlExpressionAdapted=y;var g=function(e){function t(t){var r=e.call(this,t)||this;return r._calcFunc=null,r.declaredClass="esri.arcade.featureset.actions.Adapted",r.adaptedFields=null,r._extraFilter=null,r._extraFilter=t.extraFilter,r._parent=t.parentfeatureset,r._maxProcessing=30,r.adaptedFields=t.adaptedFields,r}return r.__extends(t,e),t.findField=function(e,t){for(var r=0,n=e;r<n.length;r++){var a=n[r];if(a.name.toLowerCase()===t.toString().toLowerCase())return a}return null},t.prototype._initialiseFeatureSet=function(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new d({wkid:4326}),this.objectIdField="",this.geometryType=o.layerGeometryEsriConstants.point,this.typeIdField="",this.types=null),this.fields=[];for(var e=0,t=this.adaptedFields;e<t.length;e++){var r=t[e];r.postInitialization(this,this._parent),this.fields.push(r.field)}},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._extraFilter?t._getFilteredSet("",null,null,null,e):t._parent._getSet(e)})).then((function(r){return t._checkCancelled(e),t._wset=new s(r._candidates.slice(0),r._known.slice(0),r._ordered,t._clonePageDefinition(r.pagesDefinition)),t._wset})):u.resolve(this._wset)},t.prototype._isInFeatureSet=function(e){return this._parent._isInFeatureSet(e)},t.prototype._getFeatures=function(e,t,r,i){var o=this,l=[];-1!==t&&void 0===this._featureCache[t]&&l.push(t);var c=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,c))return this._expandPagedSet(e,c,0,0,i).then((function(){return o._getFeatures(e,t,r,i)}));for(var d=0,f=e._lastFetchedIndex;f<e._known.length&&(++d<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[f]]&&(e._known[f]!==t&&l.push(e._known[f]),l.length>=c-1)));f++);if(0===l.length)return u.resolve("success");e=new s([],l,e._ordered,null);var p=Math.min(l.length,r);return this._parent._getFeatures(e,-1,p,i).then((function(){o._checkCancelled(i);for(var e=[],t=0;t<p;t++){var r=o._parent._featureFromCache(l[t]);void 0!==r&&e.push({geometry:r.geometry,attributes:r.attributes,id:l[t]})}for(var s=0,u=e;s<u.length;s++){for(var c=u[s],d=[],f=0,h=o.adaptedFields;f<h.length;f++){var _=h[f];d[_.field.name]=_.extractValue(c)}o._featureCache[c.id]=new n({attributes:d,geometry:a.cloneGeometry(c.geometry)})}return"success"}))},t.prototype._fetchAndRefineFeatures=function(){return u.reject(new Error("Fetch and Refine should not be called in this featureset"))},t.prototype._getFilteredSet=function(e,t,r,n,a){var i,o=this,u=this.reformulateWithoutAdaptions(r);i=u.cannot,r=u.where;var c=!1;if(null!==n){c=!0;for(var d=[],f=0,_=this.adaptedFields;f<_.length;f++){var y=_[f];if(!(y instanceof p)&&!0===n.scanForField(y.field.name)){if(!(y instanceof h)){n=null,c=!1;break}d.push({field:y.field.name,newfield:y.originalField.name})}}n&&d.length>0&&(n=n.replaceFields(d))}return null!==r?null!==this._extraFilter&&(r=l.combine(this._extraFilter,r)):r=this._extraFilter,this._ensureLoaded().then((function(){return o._parent._getFilteredSet(e,t,r,n,a)})).then((function(e){return o._checkCancelled(a),!0===i?new s(e._candidates.slice(0).concat(e._known.slice(0)),[],!0===c&&e._ordered,o._clonePageDefinition(e.pagesDefinition)):new s(e._candidates.slice(0),e._known.slice(0),!0===c&&e._ordered,o._clonePageDefinition(e.pagesDefinition))}))},t.prototype.reformulateWithoutAdaptions=function(e){var t={cannot:!1,where:e};if(null!==e)for(var r=0,n=this.adaptedFields;r<n.length;r++){var a=n[r];if(!0===l.scanForField(e,a.field.name)){var i=a.rewriteSql(e,this);if(!0!==i.rewritten){t.cannot=!0,t.where=null;break}t.where=i.where}}return t},t.prototype._stat=function(e,t,r,n,a,i,s){var o=this,c=!1,d=this.reformulateWithoutAdaptions(t);return c=d.cannot,t=d.where,d=this.reformulateWithoutAdaptions(a),c=c||d.cannot,null!==(a=d.where)?null!==this._extraFilter&&(a=l.combine(this._extraFilter,a)):a=this._extraFilter,!0===c?null===a&&""===r&&null===n?this._manualStat(e,t,i,s):u.resolve({calculated:!1}):this._parent._stat(e,t,r,n,a,i,s).then((function(l){return!1===l.calculated?null===a&&""===r&&null===n?o._manualStat(e,t,i,s):{calculated:!1}:l}))},t.prototype._canDoAggregates=function(e,t,r,n,a){if(null===this._parent)return u.resolve(!1);for(var i=0;i<e.length;i++)for(var s=0,o=this.adaptedFields;s<o.length;s++){var c=o[s];if(e[i].toLowerCase()===c.field.name.toLowerCase()&&!(c instanceof p))return u.resolve(!1)}var d=[];for(i=0;i<t.length;i++){var f=t[i];if(null!==f.workingexpr){var h=this.reformulateWithoutAdaptions(f.workingexpr);if(h.cannot)return u.resolve(!1);var _=f.clone();_.workingexpr=h.where,d.push(_)}else d.push(f)}var y=this.reformulateWithoutAdaptions(a);return y.cannot?u.resolve(!1):(null!==(a=y.where)?null!==this._extraFilter&&(a=l.combine(this._extraFilter,a)):a=this._extraFilter,this._parent._canDoAggregates(e,d,r,n,a))},t.prototype._getAggregatePagesDataSourceDefinition=function(e,t,r,n,a,i,s){if(null===this._parent)return u.reject(new Error("Should never be called"));for(var o=[],c=0;c<t.length;c++){var d=t[c];if(null!==d.workingexpr){var f=this.reformulateWithoutAdaptions(d.workingexpr);if(f.cannot)return u.reject(new Error("Should never be called"));var p=d.clone();p.workingexpr=f.where,o.push(p)}else o.push(d)}var h=this.reformulateWithoutAdaptions(a);return h.cannot?u.reject(new Error("Should never be called")):(null!==(a=h.where)?null!==this._extraFilter&&(a=l.combine(this._extraFilter,a)):a=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,r,n,a,i,s))},t}(i);t.AdaptedFeatureSet=g}).apply(null,n))||(e.exports=a)},ijuC:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("88sq"),r("Q4uJ"),r("tq6K"),r("qMld")],void 0===(a=(function(e,t,r,n,a,i,s){var o=function(e){function t(t){var r=e.call(this,t)||this;return r._topnum=0,r.declaredClass="esri.arcade.featureset.actions.Top",r._countedin=0,r._maxProcessing=100,r._topnum=t.topnum,r._parent=t.parentfeatureset,r}return r.__extends(t,e),t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._parent._getSet(e)})).then((function(e){return t._wset=new a(e._candidates.slice(0),e._known.slice(0),!1,t._clonePageDefinition(e.pagesDefinition)),t._setKnownLength(t._wset)>t._topnum&&(t._wset._known=t._wset._known.slice(0,t._topnum)),t._setKnownLength(t._wset)>=t._topnum&&(t._wset._candidates=[]),t._wset})):s.resolve(this._wset)},t.prototype._setKnownLength=function(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length},t.prototype._isInFeatureSet=function(e){var t=this._parent._isInFeatureSet(e);if(t===i.IdState.NotInFeatureSet)return t;var r=this._idstates[e];return r===i.IdState.InFeatureSet||r===i.IdState.NotInFeatureSet?r:t===i.IdState.InFeatureSet&&void 0===r?this._countedin<this._topnum?(this._idstates[e]=i.IdState.InFeatureSet,this._countedin++,i.IdState.InFeatureSet):(this._idstates[e]=i.IdState.NotInFeatureSet,i.IdState.NotInFeatureSet):i.IdState.Unknown},t.prototype._expandPagedSet=function(e,t,r,n,a){var i=this;if(null===this._parent)return s.reject(new Error("Parent Paging not implemented"));if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){var o=e._known.length;return o>0&&"GETPAGES"===e._known[o-1]&&(e._known.length=o-1),(o=e._candidates.length)>0&&"GETPAGES"===e._candidates[o-1]&&(e._candidates.length=o-1),s.resolve("success")}return this._parent._expandPagedSet(e,t,r,n,a).then((function(t){return i._setKnownLength(e)>i._topnum&&(e._known.length=i._topnum),i._setKnownLength(e)>=i._topnum&&(e._candidates.length=0),t}))},t.prototype._getFeatures=function(e,t,r,n){var i=this,o=[],l=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,l))return this._expandPagedSet(e,l,0,0,n).then((function(){return i._getFeatures(e,t,r,n)}));-1!==t&&void 0===this._featureCache[t]&&o.push(t);for(var u=0,c=e._lastFetchedIndex;c<e._known.length&&(++u<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[c]]&&(e._known[c]!==t&&o.push(e._known[c]),o.length>l-1)));c++);if(0===o.length)return s.resolve("success");var d=new a([],o,!1,null),f=Math.min(o.length,r);return this._parent._getFeatures(d,-1,f,n).then((function(){for(var e=0;e<f;e++){var t=i._parent._featureFromCache(o[e]);void 0!==t&&(i._featureCache[o[e]]=t)}return"success"}))},t.prototype._getFilteredSet=function(e,t,r,n,i){var s=this;return this._ensureLoaded().then((function(){return s._getSet(i)})).then((function(e){return new a(e._candidates.slice(0).concat(e._known.slice(0)),[],!1,s._clonePageDefinition(e.pagesDefinition))}))},t.prototype._refineKnowns=function(e,t){for(var r=0,n=null,a=[],s=0;s<e._candidates.length;s++){var o=this._isInFeatureSet(e._candidates[s]);if(o===i.IdState.InFeatureSet){if(e._known.push(e._candidates[s]),r+=1,null===n?n={start:s,end:s}:n.end===s-1?n.end=s:(a.push(n),n={start:s,end:s}),e._known.length>=this._topnum)break}else if(o===i.IdState.NotInFeatureSet)null===n?n={start:s,end:s}:n.end===s-1?n.end=s:(a.push(n),n={start:s,end:s}),r+=1;else if(o===i.IdState.Unknown)break;if(r>=t)break}null!==n&&a.push(n);for(var l=a.length-1;l>=0;l--)e._candidates.splice(a[l].start,a[l].end-a[l].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])},t.prototype._stat=function(){return s.resolve({calculated:!1})},t.prototype._canDoAggregates=function(){return s.resolve(!1)},t}(n);return n._featuresetFunctions.top=function(e){return new o({parentfeatureset:this,topnum:e})},o}).apply(null,n))||(e.exports=a)},mHvT:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("gfOZ"),r("lT9l"),r("qMld"),r("1eyA")],void 0===(a=(function(e,t,r,n,a,i){function s(e,t,s,l,u,c){if(1===l.length){if(r.isArray(l[0]))return a.resolve(n.calculateStat(e,l[0],r.defaultUndefined(l[1],-1)));if(r.isImmutableArray(l[0]))return a.resolve(n.calculateStat(e,l[0].toArray(),r.defaultUndefined(l[1],-1)))}else if(2===l.length){if(r.isArray(l[0]))return a.resolve(n.calculateStat(e,l[0],r.defaultUndefined(l[1],-1)));if(r.isImmutableArray(l[0]))return a.resolve(n.calculateStat(e,l[0].toArray(),r.defaultUndefined(l[1],-1)));if(r.isFeatureSet(l[0]))return l[0].load().then((function(n){return o(i.WhereClause.create(l[1],n.getFieldsIndex()),c,u).then((function(n){return l[0].calculateStatistic(e,n,r.defaultUndefined(l[2],1e3),t.abortSignal)}))}))}else if(3===l.length&&r.isFeatureSet(l[0]))return l[0].load().then((function(n){return o(i.WhereClause.create(l[1],n.getFieldsIndex()),c,u).then((function(n){return l[0].calculateStatistic(e,n,r.defaultUndefined(l[2],1e3),t.abortSignal)}))}));return a.resolve(n.calculateStat(e,l,-1))}function o(e,t,r){try{var n=e.getVariables();if(n.length>0){for(var i=[],s=0;s<n.length;s++)i.push(t.evaluateIdentifier(r,{name:n[s]}));return a.all(i).then((function(t){for(var r={},a=0;a<n.length;a++)r[n[a]]=t[a];return e.parameters=r,e}))}return a.resolve(e)}catch(e){return a.reject(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.registerFunctions=function(e){"async"===e.mode&&(e.functions.stdev=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("stdev",r,0,a,t,e)}))},e.functions.variance=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("variance",r,0,a,t,e)}))},e.functions.average=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("mean",r,0,a,t,e)}))},e.functions.mean=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("mean",r,0,a,t,e)}))},e.functions.sum=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("sum",r,0,a,t,e)}))},e.functions.min=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("min",r,0,a,t,e)}))},e.functions.max=function(t,r){return e.standardFunctionAsync(t,r,(function(r,n,a){return s("max",r,0,a,t,e)}))},e.functions.count=function(t,n){return e.standardFunctionAsync(t,n,(function(e,t,n){if(r.pcCheck(n,1,1),r.isFeatureSet(n[0]))return n[0].count(e.abortSignal);if(r.isArray(n[0])||r.isString(n[0]))return n[0].length;if(r.isImmutableArray(n[0]))return n[0].length();throw new Error("Invalid Parameters for Count")}))})}}).apply(null,n))||(e.exports=a)},ufnL:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("88sq"),r("Q4uJ"),r("tq6K"),r("SqzB"),r("qMld"),r("1eyA"),r("Z4y+")],void 0===(a=(function(e,t,r,n,a,i,s,o,l,u){var c=function(e){function t(t){var r=e.call(this,t)||this;return r.declaredClass="esri.arcade.featureset.actions.AttributeFilter",r._maxProcessing=1e3,r._parent=t.parentfeatureset,t.whereclause instanceof l.WhereClause?(r._whereclause=t.whereclause,r._whereClauseFunction=null):(r._whereClauseFunction=t.whereclause,r._whereclause=null),r}return r.__extends(t,e),t.prototype._initialiseFeatureSet=function(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.spatialReference=new u({wkid:4326}),this.geometryType=i.layerGeometryEsriConstants.point)},t.prototype._getSet=function(e){var t=this;return null===this._wset?this._ensureLoaded().then((function(){return t._parent._getFilteredSet("",null,t._whereclause,null,e)})).then((function(r){return t._checkCancelled(e),t._wset=null!==t._whereClauseFunction?new a(r._candidates.slice(0).concat(r._known.slice(0)),[],r._ordered,t._clonePageDefinition(r.pagesDefinition)):new a(r._candidates.slice(0),r._known.slice(0),r._ordered,t._clonePageDefinition(r.pagesDefinition)),t._wset})):o.resolve(this._wset)},t.prototype._isInFeatureSet=function(e){var t=this._parent._isInFeatureSet(e);return t===i.IdState.NotInFeatureSet?t:void 0===(t=this._idstates[e])?i.IdState.Unknown:t},t.prototype._getFeature=function(e,t,r){return this._parent._getFeature(e,t,r)},t.prototype._getFeatures=function(e,t,r,n){return this._parent._getFeatures(e,t,r,n)},t.prototype._featureFromCache=function(e){return this._parent._featureFromCache(e)},t.prototype.executeWhereClause=function(e){return this._whereclause.testFeature(e)},t.prototype.executeWhereClauseDeferred=function(e){if(null!==this._whereClauseFunction)try{var t=this._whereClauseFunction(e);return o.isPromiseLike(t)?t:o.resolve(t)}catch(e){return o.reject(e)}return o.resolve(this.executeWhereClause(e))},t.prototype._fetchAndRefineFeatures=function(e,t,r){var n=this,s=new a([],e,!1,null),l=Math.min(t,e.length);return this._parent._getFeatures(s,-1,l,r).then((function(){if(n._checkCancelled(r),null==n._whereClauseFunction){for(var a=0;a<l;a++){var s=n._parent._featureFromCache(e[a]);n._idstates[e[a]]=!0===n.executeWhereClause(s)?i.IdState.InFeatureSet:i.IdState.NotInFeatureSet}return"success"}var u=[];for(a=0;a<l;a++)s=n._parent._featureFromCache(e[a]),u.push(n.executeWhereClauseDeferred(s));return o.all(u).then((function(r){for(var a=0;a<t;a++)n._idstates[e[a]]=!0===r[a]?i.IdState.InFeatureSet:i.IdState.NotInFeatureSet;return"success"}))}))},t.prototype._getFilteredSet=function(e,t,r,n,i){var o=this;return null!==this._whereClauseFunction||(null!==r?null!==this._whereclause&&(r=s.combine(this._whereclause,r)):r=this._whereclause),this._ensureLoaded().then((function(){return o._parent._getFilteredSet(e,t,r,n,i)})).then((function(e){return o._checkCancelled(i),null!==o._whereClauseFunction?new a(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,o._clonePageDefinition(e.pagesDefinition)):new a(e._candidates.slice(0),e._known.slice(0),e._ordered,o._clonePageDefinition(e.pagesDefinition))}))},t.prototype._stat=function(e,t,r,n,a,i,l){var u=this;if(null!==this._whereClauseFunction)return null===a&&""===r&&null===n?this._manualStat(e,t,i,l):o.resolve({calculated:!1});var c=this._whereclause;return null!==a&&null!==this._whereclause&&(c=s.combine(this._whereclause,a)),this._parent._stat(e,t,r,n,c,i,l).then((function(s){return!1===s.calculated?null===a&&""===r&&null===n?u._manualStat(e,t,i,l):{calculated:!1}:s}))},t.prototype._canDoAggregates=function(e,t,r,n,a){return null!==this._whereClauseFunction?o.resolve(!1):(null!==a?null!==this._whereclause&&(a=s.combine(this._whereclause,a)):a=this._whereclause,null===this._parent?o.resolve(!1):this._parent._canDoAggregates(e,t,r,n,a))},t.prototype._getAggregatePagesDataSourceDefinition=function(e,t,r,n,a,i,l){return null===this._parent?o.reject(new Error("Should never be called")):(null!==a?null!==this._whereclause&&(a=s.combine(this._whereclause,a)):a=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,r,n,a,i,l))},t}(n);return n._featuresetFunctions.filter=function(e){if("function"==typeof e)return new c({parentfeatureset:this,whereclause:e});var t=null;return e instanceof l.WhereClause&&(t=e),new c({parentfeatureset:this,whereclause:t})},c}).apply(null,n))||(e.exports=a)},wfTL:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("zOht"),r("TMur"),r("8V7H")],void 0===(a=(function(e,t,r,n,a){function i(e){var t;return Array.isArray(e)?null===(t=e[0])||void 0===t?void 0:t.spatialReference:null==e?void 0:e.spatialReference}function s(e){return e?Array.isArray(e)?e.map(s):e.toJSON?e.toJSON():e:e}function o(e){return Array.isArray(e)?e.map((function(e){return n.fromJSON(e)})):n.fromJSON(e)}var l;function u(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return l||(l=a.open("geometryEngineWorker",{strategy:"distributed"})),[2,l]}))}))}function c(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,u()];case 1:return[2,r.sent().invoke("executeGEOperation",{operation:e,parameters:s(t)})]}}))}))}function d(e){return"xmin"in e?e.center:"x"in e?e:e.extent.center}Object.defineProperty(t,"__esModule",{value:!0}),t.extendedSpatialReferenceInfo=function(e){return c("extendedSpatialReferenceInfo",[e])},t.clip=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("clip",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.cut=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("cut",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.contains=function(e,t){return c("contains",[i(e),e,t])},t.crosses=function(e,t){return c("crosses",[i(e),e,t])},t.distance=function(e,t,r){return c("distance",[i(e),e,t,r])},t.equals=function(e,t){return c("equals",[i(e),e,t])},t.intersects=function(e,t){return c("intersects",[i(e),e,t])},t.touches=function(e,t){return c("touches",[i(e),e,t])},t.within=function(e,t){return c("within",[i(e),e,t])},t.disjoint=function(e,t){return c("disjoint",[i(e),e,t])},t.overlaps=function(e,t){return c("overlaps",[i(e),e,t])},t.relate=function(e,t,r){return c("relate",[i(e),e,t,r])},t.isSimple=function(e){return c("isSimple",[i(e),e])},t.simplify=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){switch(t.label){case 0:return[4,c("simplify",[i(e),e])];case 1:return[2,o(t.sent())]}}))}))},t.convexHull=function(e,t){return void 0===t&&(t=!1),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("convexHull",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.difference=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("difference",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.symmetricDifference=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("symmetricDifference",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.intersect=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("intersect",[i(e),e,t])];case 1:return[2,o(r.sent())]}}))}))},t.union=function(e,t){return void 0===t&&(t=null),r.__awaiter(this,void 0,void 0,(function(){var n;return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("union",[i(n=function(e,t){var r;return Array.isArray(e)?r=e:((r=[]).push(e),null!=t&&r.push(t)),r}(e,t)),n])];case 1:return[2,o(r.sent())]}}))}))},t.offset=function(e,t,n,a,s,l){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("offset",[i(e),e,t,n,a,s,l])];case 1:return[2,o(r.sent())]}}))}))},t.buffer=function(e,t,n,a){return void 0===a&&(a=!1),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("buffer",[i(e),e,t,n,a])];case 1:return[2,o(r.sent())]}}))}))},t.geodesicBuffer=function(e,t,n,a,s,l){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("geodesicBuffer",[i(e),e,t,n,a,s,l])];case 1:return[2,o(r.sent())]}}))}))},t.nearestCoordinate=function(e,t,a){return void 0===a&&(a=!0),r.__awaiter(this,void 0,void 0,(function(){var s;return r.__generator(this,(function(o){switch(o.label){case 0:return[4,c("nearestCoordinate",[i(e),e,t,a])];case 1:return s=o.sent(),[2,r.__assign(r.__assign({},s),{coordinate:n.Point.fromJSON(s.coordinate)})]}}))}))},t.nearestVertex=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){var a;return r.__generator(this,(function(s){switch(s.label){case 0:return[4,c("nearestVertex",[i(e),e,t])];case 1:return a=s.sent(),[2,r.__assign(r.__assign({},a),{coordinate:n.Point.fromJSON(a.coordinate)})]}}))}))},t.nearestVertices=function(e,t,a,s){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(o){switch(o.label){case 0:return[4,c("nearestVertices",[i(e),e,t,a,s])];case 1:return[2,o.sent().map((function(e){return r.__assign(r.__assign({},e),{coordinate:n.Point.fromJSON(e.coordinate)})}))]}}))}))},t.rotate=function(e,t,n){return r.__awaiter(this,void 0,void 0,(function(){var a,i,s,o;return r.__generator(this,(function(r){switch(r.label){case 0:if(null==e)throw new Error("Illegal Argument Exception");return a=e.spatialReference,n=null!=n?n:d(e),o=(s=e.constructor).fromJSON,[4,c("rotate",[a,e,t,n])];case 1:return(i=o.apply(s,[r.sent()])).spatialReference=a,[2,i]}}))}))},t.flipHorizontal=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){var n,a,i,s;return r.__generator(this,(function(r){switch(r.label){case 0:if(null==e)throw new Error("Illegal Argument Exception");return n=e.spatialReference,t=null!=t?t:d(e),s=(i=e.constructor).fromJSON,[4,c("flipHorizontal",[n,e,t])];case 1:return(a=s.apply(i,[r.sent()])).spatialReference=n,[2,a]}}))}))},t.flipVertical=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){var n,a,i,s;return r.__generator(this,(function(r){switch(r.label){case 0:if(null==e)throw new Error("Illegal Argument Exception");return n=e.spatialReference,t=null!=t?t:d(e),s=(i=e.constructor).fromJSON,[4,c("flipVertical",[n,e,t])];case 1:return(a=s.apply(i,[r.sent()])).spatialReference=n,[2,a]}}))}))},t.generalize=function(e,t,n,a){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("generalize",[i(e),e,t,n,a])];case 1:return[2,o(r.sent())]}}))}))},t.densify=function(e,t,n){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("densify",[i(e),e,t,n])];case 1:return[2,o(r.sent())]}}))}))},t.geodesicDensify=function(e,t,n,a){return void 0===a&&(a=0),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){switch(r.label){case 0:return[4,c("geodesicDensify",[i(e),e,t,n,a])];case 1:return[2,o(r.sent())]}}))}))},t.planarArea=function(e,t){return c("planarArea",[i(e),e,t])},t.planarLength=function(e,t){return c("planarLength",[i(e),e,t])},t.geodesicArea=function(e,t,r){return c("geodesicArea",[i(e),e,t,r])},t.geodesicLength=function(e,t,r){return c("geodesicLength",[i(e),e,t,r])}}).apply(null,n))||(e.exports=a)},"x/o6":function(e,t,r){var n,a;n=[r.dj.c(e.i),t],void 0===(a=(function(e,t){return function(){function e(){this._databaseTypeMetaData={},this._layerInfo={}}return e.prototype.clearDatabaseType=function(e){void 0===this._databaseTypeMetaData[e]&&delete this._databaseTypeMetaData[e]},e.prototype.getDatabaseType=function(e){return"MUSTBESET"===e||void 0===this._databaseTypeMetaData[e]?null:this._databaseTypeMetaData[e]},e.prototype.setDatabaseType=function(e,t){this._databaseTypeMetaData[e]=t},e.prototype.getLayerInfo=function(e){return void 0===this._layerInfo[e]?null:this._layerInfo[e]},e.prototype.setLayerInfo=function(e,t){this._layerInfo[e]=t},e.prototype.clearLayerInfo=function(e){void 0!==this._layerInfo[e]&&delete this._layerInfo[e]},e.applicationCache=null,e}()}).apply(null,n))||(e.exports=a)},ydXo:function(e,t,r){var n,a;n=[r.dj.c(e.i),t,r("qMld")],void 0===(a=(function(e,t,r){return function(){function e(e,t){this._lastId=-1,this._progress=t,this._parent=e}return e.prototype.reset=function(){this._lastId=-1},e.prototype.nextBatch=function(e){var t=this;if(null!==this._parent._mainSetInUse)return this._parent._mainSetInUse.then((function(r){return t.nextBatch(e)}),(function(r){return t.nextBatch(e)}));var n={returnpromise:null,hasset:!1},a=[];return n.returnpromise=r.create((function(r,i){t._parent._getSet(t._progress).then((function(s){var o=s._known.length-1;if("GETPAGES"===s._known[s._known.length-1]&&(o-=1),t._lastId+e<o&&s._known.length>0&&"GETPAGES"===s._known[s._known.length-1])t._parent._expandPagedSet(s,t._parent._maxQueryRate(),0,0,t._progress).then((function(r){return n.hasset=!0,t._parent._mainSetInUse=null,t.nextBatch(e)}),(function(e){n.hasset=!0,t._parent._mainSetInUse=null,i(e)}));else{if(o>=t._lastId+e||0===s._candidates.length){for(var l=0;l<e;l++){var u=l+t._lastId+1;if(u>=s._known.length)break;a[l]=s._known[u]}return t._lastId+=a.length,0===a.length&&(n.hasset=!0,t._parent._mainSetInUse=null,r([])),void t._parent._getFeatureBatch(a,t._progress).then((function(e){n.hasset=!0,t._parent._mainSetInUse=null,r(e)}),(function(e){n.hasset=!0,t._parent._mainSetInUse=null,i(e)}))}t._parent._refineSetBlock(s,t._parent._maxProcessingRate(),t._progress).then((function(){n.hasset=!0,t._parent._mainSetInUse=null,t.nextBatch(e).then(r,i)}),(function(e){n.hasset=!0,t._parent._mainSetInUse=null,i(e)}))}}),(function(e){n.hasset=!0,t._parent._mainSetInUse=null,i(e)}))})),!1===n.hasset&&(this._parent._mainSetInUse=n.returnpromise,n.hasset=!0),n.returnpromise},e.prototype.next=function(){var e=this;if(null!==this._parent._mainSetInUse)return this._parent._mainSetInUse.then((function(t){return e.next()}),(function(t){return e.next()}));var t={returnpromise:null,hasset:!1};return t.returnpromise=r.create((function(r,n){e._parent._getSet(e._progress).then((function(a){e._lastId<a._known.length-1?"GETPAGES"===a._known[e._lastId+1]?e._parent._expandPagedSet(a,e._parent._maxQueryRate(),0,0,e._progress).then((function(r){return t.hasset=!0,e._parent._mainSetInUse=null,e.next()})).then(r,n):(e._lastId+=1,e._parent._getFeature(a,a._known[e._lastId],e._progress).then((function(n){t.hasset=!0,e._parent._mainSetInUse=null,r(n)}),(function(r){t.hasset=!0,e._parent._mainSetInUse=null,n(r)}))):a._candidates.length>0?e._parent._refineSetBlock(a,e._parent._maxProcessingRate(),e._progress).then((function(){t.hasset=!0,e._parent._mainSetInUse=null,e.next().then(r,n)}),(function(r){t.hasset=!0,e._parent._mainSetInUse=null,n(r)})):(t.hasset=!0,e._parent._mainSetInUse=null,r(null))}),(function(r){t.hasset=!0,e._parent._mainSetInUse=null,n(r)}))})),!1===t.hasset&&(this._parent._mainSetInUse=t.returnpromise,t.hasset=!0),t.returnpromise},e.prototype.count=function(){var e=this;return-1!==this._parent._totalCount?r.resolve(this._parent._totalCount):this._parent._getSet(this._progress).then((function(t){return e._refineAllSets(t)})).then((function(t){return e._parent._totalCount=t._known.length,r.resolve(e._parent._totalCount)}))},e.prototype._refineAllSets=function(e){var t=this;return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,1,this._progress).then((function(r){return t._refineAllSets(e)})).then((function(e){return r.resolve(e)})):e._candidates.length>0?"GETPAGES"===e._known[e._candidates.length-1]?this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,2,this._progress).then((function(r){return t._refineAllSets(e)})).then((function(e){return r.resolve(e)})):this._parent._refineSetBlock(e,this._parent._maxProcessingRate(),this._progress).then((function(e){return e._candidates.length>0?t._refineAllSets(e):r.resolve(e)})):r.resolve(e)},e}()}).apply(null,n))||(e.exports=a)}}]);