PageSourceSearch

https://www.north-ayrshire.gov.uk/_1aq29Q_29eeb5b2-83c8-44ab-8d13-…/modern/js/2240.c885d270ed8f009f62f4.mjs

js north-ayrshire.gov.uk collected 2026-10-02 05:48:53 UTC 101,546 bytes, 1 lines download raw bytes

1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2240],{43320:(re,$,c)=>{c.d($,{A:()=>Q});class Q{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(N,E,x){this._layerById[E]=x,this._layerByName[N]=x}async featureSetByName(N,E=!0,x=["*"]){return this._layerByName[N]===void 0?null:this._layerByName[N]}async featureSetById(N,E=!0,x=["*"]){return this._layerById[N]===void 0?null:this._layerById[N]}castToText(N=!1){return"object, FeatureSetCollection"}}},66233:(re,$,c)=>{c.r($),c.d($,{constructAssociationMetaDataFeatureSetFromUrl:()=>Re,constructFeatureSet:()=>se,constructFeatureSetFromPortalItem:()=>Me,constructFeatureSetFromRelationship:()=>Oe,constructFeatureSetFromUrl:()=>_e,convertToFeatureSet:()=>Ne,createFeatureSetCollectionFromMap:()=>Pe,createFeatureSetCollectionFromService:()=>xe,initialiseMetaDataCache:()=>Ae});var Q=c(78634),Y=c(43320),N=c(1253),E=c(46565),x=c(69563),K=c(41826),w=c(12758),_=c(87610),O=c(28543),R=c(5444),S=c(78763),F=c(33074),v=c(51078),L=c(99388),f=c(46847);function C(b){if(b.parseTree.type==="function"){if(b.parseTree.args.value.length===0)return{name:b.parseTree.name,expr:null};if(b.parseTree.args.value.length>1)throw new _.L8(_.Z7.MissingStatisticParameters);const e=f.WhereClause.create((0,v.Mi)(b.parseTree.args.value[0],F.zl.Standardised,b.parameters),b.fieldsIndex,b.timeZone);return{name:b.parseTree.name,expr:e}}return null}class T{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new T;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,s,i){const u=new T;u.field=e;const r=f.WhereClause.create(t,s,i),a=C(r);if(a===null)throw new _.L8(_.Z7.UnsupportedSqlFunction,{function:""});const d=a.name.toUpperCase().trim();if(d==="MIN"){if(u.typeofstat="MIN",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"min"})}else if(d==="MAX"){if(u.typeofstat="MAX",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"max"})}else if(d==="COUNT")u.typeofstat="COUNT",u.workingexpr=a.expr;else if(d==="STDEV"){if(u.typeofstat="STDDEV",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"stdev"})}else if(d==="SUM"){if(u.typeofstat="SUM",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"sum"})}else if(d==="MEAN"){if(u.typeofstat="AVG",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:d})}else if(d==="AVG"){if(u.typeofstat="AVG",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"avg"})}else{if(d!=="VAR")throw new _.L8(_.Z7.UnsupportedSqlFunction,{function:d});if(u.typeofstat="VAR",u.workingexpr=a.expr,r===null)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"var"})}return u}toStatisticsName(){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"}}}var o=c(24003),h=c(88988),y=c(52457),D=c(94813),g=c(11863),U=c(44914),B=c(20461);function W(b){if(!b)return"COUNT";switch(b.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"}class M extends O.A{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(this._wset===null){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return F.J6.InFeatureSet}_nextUniqueName(e){for(;e["T"+this._uniqueIds.toString()]===1;)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,s=1;const i=this._parent?this._parent.getFieldsIndex():new B.A([]);for(this.objectIdField="ROW__ID",this.globalIdField="";t===!1;){let r=!1;for(let a=0;a<this._config.groupbyfields.length;a++)if(this._config.groupbyfields[a].name.toLowerCase()===this.objectIdField.toLowerCase()){r=!0;break}if(r===!1){for(let a=0;a<this._config.statsfields.length;a++)if(this._config.statsfields[a].name.toLowerCase()===this.objectIdField.toLowerCase()){r=!0;break}}r===!1?t=!0:(this.objectIdField="ROW__ID"+s.toString(),s++)}for(const r of this._config.statsfields){const a=new T;a.field=r.name,a.tofieldname=r.name,a.workingexpr=r.expression instanceof f.WhereClause?r.expression:f.WhereClause.create(r.expression,i,this.dateFieldsTimeZoneDefaultUTC),a.typeofstat=W(r.statistic),this._decodedStatsfield.push(a)}this._decodedGroupbyfield=[];for(const r of this._config.groupbyfields){const a={name:r.name,singlefield:null,tofieldname:r.name,expression:r.expression instanceof f.WhereClause?r.expression:f.WhereClause.create(r.expression,i,this.dateFieldsTimeZoneDefaultUTC),sqlType:null};this._decodedGroupbyfield.push(a)}if(this._parent!==null){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const r of this._parent.fields)e[r.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=F.ik.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new g.A({wkid:4326});this.fields=[];const u=new T;u.field=this._nextUniqueName(e),u.tofieldname=this.objectIdField,u.workingexpr=f.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC),u.typeofstat="MIN",this._decodedStatsfield.push(u);for(const r of this._decodedGroupbyfield){const a=new U.default;if(r.name=this._nextUniqueName(e),a.name=r.tofieldname,a.alias=a.name,(0,v.DA)(r.expression)){const d=this._parent.getField((0,v.YY)(r.expression,F.zl.Standardised));if(!d)throw new _.dr(_.D_.AggregationFieldNotFound);r.name=d.name,r.singlefield=d.name,this.phsyicalgroupbyfields.push(d.name),a.type=d.type,r.sqlType=d.type}else{a.type=this._convertToEsriFieldType((0,v.IY)(r.expression,this._parent.fields));const d=new U.default;d.name=r.name,d.alias=d.name,this.phsyicalgroupbyfields.push(r.name),this._adaptedFields.push(new K.Gr(d,r.expression)),this._candosimplegroupby=!1,r.sqlType=a.type}this.fields.push(a)}if(this._adaptedFields.length>0)for(const r of this._parent.fields)this._adaptedFields.push(new K.IO(r));for(let r=0;r<this._decodedStatsfield.length;r++){const a=new U.default;let d=null;const m=this._decodedStatsfield[r];m.field=this._nextUniqueName(e),m.tofieldname===this.objectIdField&&(this._internalObjectIdField=m.f
1ield),a.name=m.tofieldname,a.alias=a.name;const I=m.workingexpr!==null&&(0,v.DA)(m.workingexpr)?(0,v.YY)(m.workingexpr,F.zl.Standardised):"";switch(this._decodedStatsfield[r].typeofstat){case"SUM":if(I!==""){if(d=this._parent.getField(I),!d)throw new _.dr(_.D_.AggregationFieldNotFound);a.type=d.type}else a.type="double";break;case"MIN":case"MAX":if(I!==""){if(d=this._parent.getField(I),!d)throw new _.dr(_.D_.AggregationFieldNotFound);a.type=d.type}else a.type="double";break;case"COUNT":a.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(I!==""&&(d=this._parent.getField(I),!d))throw new _.dr(_.D_.AggregationFieldNotFound);a.type="double"}this.fields.push(a)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,s,i){t!==-1&&this._featureCache[t];const u=this._maxQuery;return this._checkIfNeedToExpandKnownPage(e,u)===!0?(await this._expandPagedSet(e,u,0,0,i),this._getFeatures(e,t,s,i)):"success"}async _getFilteredSet(e,t,s,i,u){if(e!=="")return new R.A([],[],!0,null);let r=null;const a={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),s!==null){for(let m=0;m<this._decodedStatsfield.length;m++)if((0,v.Ju)(s,this._decodedStatsfield[m].tofieldname)===!0){a.nowhereclause=!0,s=null;break}}if(i!==null){a.ordered=!0;for(let m=0;m<this._decodedStatsfield.length;m++)if(i.scanForField(this._decodedStatsfield[m].tofieldname)===!0){i=null,a.ordered=!1;break}if(i!==null){for(const m of this._decodedGroupbyfield)if(m.singlefield===null&&i.scanForField(m.tofieldname)===!0){i=null,a.ordered=!1;break}}}if(this._candosimplegroupby!==!1&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let m=null;s&&(m=this._reformulateWhereClauseWithoutGroupByFields(s));let I=null;i&&(I=this._reformulateOrderClauseWithoutGroupByFields(i));const j=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,m,I,this._internalObjectIdField);return this._checkCancelled(u),r=a.nowhereclause===!0?new R.A(j._candidates.slice(0).concat(j._known.slice(0)),[],a.ordered===!0&&j._ordered,this._clonePageDefinition(j.pagesDefinition)):new R.A(j._candidates.slice(0),j._known.slice(0),a.ordered===!0&&j._ordered,this._clonePageDefinition(j.pagesDefinition)),r}let d=this._parent;if(this._adaptedFields.length>0&&(d=new K.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),a.nowhereclause===!0)r=new R.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new w.A({parentfeatureset:d,orderbyclause:new S.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let m=d;if(s!==null){let I=null;s&&(I=this._reformulateWhereClauseWithoutGroupByFields(s)),m=new E.A({parentfeatureset:m,whereclause:I})}r=new R.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new w.A({parentfeatureset:m,orderbyclause:new S.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return r}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,v.bD)(e,t.tofieldname,(0,v.YY)(t.workingexpr,F.zl.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,v.bD)(e,t.tofieldname,(0,v.YY)(t.expression,F.zl.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const s of this._decodedGroupbyfield)s.tofieldname!==s.name&&t.push({field:s.tofieldname,newfield:s.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return e===null?null:e.aggregatefeaturesetpagedefinition===!0?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,s){if(this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)===!0)return await this._expandPagedSet(e,this._maxQuery,0,0,s),this._refineSetBlock(e,t,s);this._checkCancelled(s);const i=e._candidates.length;return this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e}_expandPagedSet(e,t,s,i,u){return this._expandPagedSetFeatureSet(e,t,s,i,u)}
1async _getPhysicalPage(e,t,s){if(e.pagesDefinition.aggregatefeaturesetpagedefinition===!0)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,s,[]);const i=await this._getAgregagtePhysicalPage(e,t,s);for(const u of i){const r={geometry:u.geometry,attributes:{}},a={};for(const d in u.attributes)a[d.toLowerCase()]=u.attributes[d];for(const d of this._decodedGroupbyfield)r.attributes[d.tofieldname]=a[d.name.toLowerCase()];for(const d of this._decodedStatsfield)r.attributes[d.tofieldname]=a[d.field.toLowerCase()];this._featureCache[r.attributes[this.objectIdField]]=new x.default(r)}return i.length}_sequentialGetPhysicalItem(e,t,s,i){return new Promise((u,r)=>{e.pagesDefinition.internal.iterator===null&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(s)),e.pagesDefinition.internal.fullyResolved===!0||t===0?u(i.length):this._nextAggregateItem(e,t,s,i,a=>{a===null?u(i.length):(t-=1,u(this._sequentialGetPhysicalItem(e,t,s,i)))},r)})}_nextAggregateItem(e,t,s,i,u,r){try{(0,N.a2)(e.pagesDefinition.internal.iterator.next()).then(a=>{if(a===null)if(e.pagesDefinition.internal.workingItem!==null){const d=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);i.push(d),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(d.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,u(null)}else e.pagesDefinition.internal.fullyResolved=!0,u(null);else{const d=this._generateAggregateHash(a);if(e.pagesDefinition.internal.workingItem===null)e.pagesDefinition.internal.workingItem={features:[a],id:d};else{if(d!==e.pagesDefinition.internal.workingItem.id){const m=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return i.push(m),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(m.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[a],id:d},void u(m)}e.pagesDefinition.internal.workingItem.features.push(a)}this._nextAggregateItem(e,t,s,i,u,r)}},r)}catch(a){r(a)}}
1_calculateFieldStat(e,t,s){const i=[];for(let u=0;u<e.features.length;u++)if(t.workingexpr!==null){const r=t.workingexpr.calculateValue(e.features[u]);r!==null&&(r instanceof h.n||r instanceof D.k?i.push(r.toNumber()):r instanceof y.g?i.push(r.toMilliseconds()):i.push(r))}else i.push(null);switch(t.typeofstat){case"MIN":s.attributes[t.tofieldname]=(0,L.tQ)("min",i,-1);break;case"MAX":s.attributes[t.tofieldname]=(0,L.tQ)("max",i,-1);break;case"SUM":s.attributes[t.tofieldname]=(0,L.tQ)("sum",i,-1);break;case"COUNT":s.attributes[t.tofieldname]=i.length;break;case"VAR":s.attributes[t.tofieldname]=(0,L.tQ)("var",i,-1);break;case"STDDEV":s.attributes[t.tofieldname]=(0,L.tQ)("stddev",i,-1);break;case"AVG":s.attributes[t.tofieldname]=(0,L.tQ)("avg",i,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const u=i.singlefield?e.features[0].attributes[i.singlefield]:f.WhereClause.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=u}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const s=[];for(let i=0;i<this._decodedStatsfield.length;i++)s.push(this._calculateFieldStat(e,this._decodedStatsfield[i],t));return this._featureCache[t.attributes[this.objectIdField]]=new x.default({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const s of this._decodedGroupbyfield){const i=s.singlefield?e.attributes[s.singlefield]:s.expression.calculateValue(e);t+=i==null?":":":"+i.toString()}return(0,o.d)(t,o.T.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){O.A._featuresetFunctions.groupby=function(e,t){return new M({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var A=c(72253),P=c(66360),k=c(42286),ue=c(33415),fe=c(51782),ce=c(51267),ee=c(38118),p=c(8405),Z=c(84807),te=c(29092),ae=c(68977),ne=c(55624),ie=c(1319),de=c(83549),je=c(71789),Ue=c(1525),Ie=c(94472),ke=c(12759),Be=c(40945),We=c(59051),Ge=c(34530),Ke=c(93294),Qe=c(58775),Ze=c(69209),Ve=c(43479),Je=c(18144),ze=c(21040),le=c(12107),De=c(57193),me=c(91414),Ye=c(58515),qe=c(19848),Xe=c(86186),$e=c(60622),Fe=c(42060),He=c(37772),we=c(83969);class pe extends O.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return F.gO}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,F.JB)(e.toJSON());return(0,o.d)(t,o.T.String)}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=this._layer?.capabilities?.data?.supportsZ===!0,this.hasM=this._layer?.capabilities?.data?.supportsM===!0,this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const e=[],t=[];for(const s of this.fields)if(s.type==="oid")e.push(s),t.push(s.name);else for(const i of this._overrideFields)if(i.toLowerCase()===s.name.toLowerCase()){e.push(s),t.push(s.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;this._layer.source.sourceJSON.useStandardizedQueries===!0?(this._databaseType=F.zl.StandardisedNoInterval,e!=null&&e>=10.61&&(this._databaseType=F.zl.Standardised)):e!=null&&(e>=10.5&&(this._databaseType=F.zl.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=F.zl.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)e.type==="global-id"&&(this.globalIdField=e.name);this._layer instanceof Z.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}_isInFeatureSet(){return F.J6.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new le.default;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch{return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||this._layer.capabilities.query.supportsPagination!==!0)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){const t=this._layer?.capabilities?.query;
1return!e.outStatistics&&t?.supportsFormatPBF===!0&&t?.supportsQuantizationEditMode===!0}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await(0,te.eW)(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const s=t==="execute"?me.s:t==="executeForCount"?Ie.I:De.V,i=t==="execute"&&this.pbfSupportedForQuery(e);let u=null;if(this.recentlyUsedQueries){const r=this.convertQueryToLruCacheKey(e);u=this.recentlyUsedQueries.getFromCache(r),u===null&&(u=i!==!0?s(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(r,u),u=u.catch(a=>{throw this.recentlyUsedQueries?.removeFromCache(r),a}))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),u===null&&(u=i!==!0?s(this._layer.parsedUrl.path,e):this.queryPBF(e)),u}async _getFilteredSet(e,t,s,i,u){const r=await this.databaseType();if(this.isTable()&&t&&e!==null&&e!=="")return new R.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,s,i,u);let a="",d=!1;i!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(a=i.constructClause(),d=!0);const m=new le.default;this.datesInUnknownTimezone&&(m.timeReferenceUnknownClient=!0),m.where=s===null?t===null?"1=1":"":(0,v.YY)(s,r),this._requestStandardised&&(m.sqlFormat="standard"),m.spatialRelationship=this._makeRelationshipEnum(e),m.outSpatialReference=this.spatialReference,m.orderByFields=a!==""?a.split(","):null,m.geometry=t===null?null:t,m.relationParameter=this._makeRelationshipParam(e);let I=await this.executeQuery(m,"executeForIds");return I===null&&(I=[]),this._checkCancelled(u),new R.A([],I,d,null)}_expandPagedSet(e,t,s,i,u){return this._expandPagedSetFeatureSet(e,t,s,i,u)}async _getFilteredSetUsingPaging(e,t,s,i,u){let r="",a=!1;i!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(r=i.constructClause(),a=!0);const d=await this.databaseType();let m=s===null?t===null?"1=1":"":(0,v.YY)(s,d);this._layer.definitionExpression&&this._useDefinitionExpression&&(m=m!==""?"(("+this._layer.definitionExpression+") AND ("+m+"))":this._layer.definitionExpression);let I=this._maxQueryRate();const j=this._layer.capabilities?.query.maxRecordCount;j!=null&&j<I&&(I=j);let G=null;if(this._pageJustIds===!0)G=new R.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:I,resultOffset:0,geometry:t===null?null:t,where:m,orderByFields:r,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let V=!0;this._removeGeometry===!0&&(V=!1);const q=this._overrideFields??this._fieldsIncludingObjectId(["*"]);G=new R.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:q.join(","),resultRecordCount:I,resultOffset:0,geometry:t===null?null:t,where:m,orderByFields:r,returnGeometry:V,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(G,I,0,1,u),G}_clonePageDefinition(e){return e===null?null:e.groupbypage!==!0?{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,groupBy
1FieldsForStatistics: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}}async _getPhysicalPage(e,t,s){const i=e.pagesDefinition.internal.lastRetrieved,u=i,r=e.pagesDefinition.internal.lastPage,a=new le.default;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const d=await this.executeQuery(a,"execute");if(this._checkCancelled(s),e.pagesDefinition.internal.lastPage!==r)return"done";const m=this._layer.objectIdField;for(let I=0;I<d.features.length;I++)e.pagesDefinition.internal.set[u+I]=d.features[I].attributes[m];if(this._pageJustIds===!1)for(let I=0;I<d.features.length;I++)this._featureCache[d.features[I].attributes[m]]=d.features[I];return(d.exceededTransferLimit===void 0&&d.features.length!==e.pagesDefinition.resultRecordCount||d.exceededTransferLimit===!1)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+d.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(e===null)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let s=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){s=!0;break}return s===!1&&t.push(this.objectIdField),t}async _getFeatures(e,t,s,i){const u=[];if(t!==-1&&this._featureCache[t]===void 0&&u.push(t),this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate())===!0)return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,s,i);let r=0;for(let I=e._lastFetchedIndex;I<e._known.length;I++){if(e._lastFetchedIndex+=1,r++,this._featureCache[e._known[I]]===void 0){let j=!1;if(this._layer._mode!==null&&this._layer._mode!==void 0){const G=this._layer._mode;if(G._featureMap[e._known[I]]!==void 0){const V=G._featureMap[e._known[I]];V!==null&&(j=!0,this._featureCache[e._known[I]]=V)}}if(j===!1&&(e._known[I]!==t&&u.push(e._known[I]),u.length>=this._maxProcessingRate()-1))break}if(r>=s&&u.length===0)break}if(u.length===0)return"success";const a=new le.default;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.objectIds=u,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,this._removeGeometry===!0&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const d=await this.executeQuery(a,"execute");if(this._checkCancelled(i),d.error!==void 0)throw new _.dr(_.D_.RequestFailed,{reason:d.error});const m=this._layer.objectIdField;for(let I=0;I<d.features.length;I++)this._featureCache[d.features[I].attributes[m]]=d.features[I];return"success"}async _getDistinctPages(e,t,s,i,u,r,a,d,m){await this._ensureLoaded();const I=await this.databaseType();let j=s.parseTree.column;const G=this._layer.fields??[];for(let J=0;J<G.length;J++)if(G[J].name.toLowerCase()===j.toLowerCase()){j=G[J].name;break}const V=new le.default;this._requestStandardised&&(V.sqlFormat="standard"),this.datesInUnknownTimezone&&(V.timeReferenceUnknownClient=!0);let q=r===null?u===null?"1=1":"":(0,v.YY)(r,I);this._layer.definitionExpression&&this._useDefinitionExpression&&(q=q!==""?"(("+this._layer.definitionExpression+") AND ("+q+"))":this._layer.definitionExpression),V.where=q,V.spatialRelationship=this._makeRelationshipEnum(i),V.relationParameter=this._makeRelationshipParam(i),V.geometry=u===null?null:u,V.returnDistinctValues=!0,V.returnGeometry=!1,V.outFields=[j];const X=await this.executeQuery(V,"execute");
1if(this._checkCancelled(m),!X.hasOwnProperty("features"))throw new _.dr(_.D_.InvalidStatResponse);let H=!1;for(let J=0;J<G.length;J++)if(G[J].name===j){G[J].type==="date"&&(H=!0);break}for(let J=0;J<X.features.length;J++){if(H){const he=X.features[J].attributes[j];he!==null?d.push(new Date(he)):d.push(he)}else d.push(X.features[J].attributes[j]);if(d.length>=a)break}return X.features.length===0?d:X.features.length===this._layer.capabilities?.query.maxRecordCount&&d.length<a?{calculated:!0,result:await this._getDistinctPages(e+X.features.length,t,s,i,u,r,a,d,m)}:d}async _distinctStat(e,t,s,i,u,r,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,s,i,u,r,[],a)}}isTable(){return this._layer.isTable||this._layer.geometryType===null||this._layer.type==="table"||this._layer.geometryType===""||this._layer.geometryType==="esriGeometryNull"}async _countstat(e,t,s,i){const u=await this.databaseType(),r=new le.default;if(this._requestStandardised&&(r.sqlFormat="standard"),this.isTable()&&s&&t!==null&&t!=="")return{calculated:!0,result:0};let a=i===null?s===null?"1=1":"":(0,v.YY)(i,u);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=a!==""?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),r.where=a,this.datesInUnknownTimezone&&(r.timeReferenceUnknownClient=!0),r.where=a,r.spatialRelationship=this._makeRelationshipEnum(t),r.relationParameter=this._makeRelationshipParam(t),r.geometry=s===null?null:s,r.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(r,"executeForCount")}}async _stats(e,t,s,i,u,r,a){await this._ensureLoaded();const d=this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsSqlExpression===!0,m=this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsStatistics===!0,I=this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsDistinct===!0;if(e==="count")return I?this._countstat(e,s,i,u):{calculated:!1};if(m===!1||(0,v.DA)(t)===!1&&d===!1||t.isStandardized===!1)return s!==""||u!==null?{calculated:!1}:this._manualStat(e,t,r,a);if(e==="distinct")return I===!1?s!==""||u!==null?{calculated:!1}:this._manualStat(e,t,r,a):this._distinctStat(e,t,s,i,u,r,a);const j=await this.databaseType();if(this.isTable()&&i&&s!==null&&s!=="")return{calculated:!0,result:null};const G=new le.default;this._requestStandardised&&(G.sqlFormat="standard");let V=u===null?i===null?"1=1":"":(0,v.YY)(u,j);this._layer.definitionExpression&&this._useDefinitionExpression&&(V=V!==""?"(("+this._layer.definitionExpression+") AND ("+V+"))":this._layer.definitionExpression),G.where=V,G.spatialRelationship=this._makeRelationshipEnum(s),G.relationParameter=this._makeRelationshipParam(s),G.geometry=i===null?null:i,this.datesInUnknownTimezone&&(G.timeReferenceUnknownClient=!0);const q=new we.A;q.statisticType=(0,L.Dp)(e),q.onStatisticField=(0,v.YY)(t,j),q.outStatisticFieldName="ARCADE_STAT_RESULT",G.returnGeometry=!1;let X="ARCADE_STAT_RESULT";G.outStatistics=[q];const H=await this.executeQuery(G,"execute");if(!H.hasOwnProperty("features")||H.features.length===0)throw new _.dr(_.D_.InvalidStatResponse);let J=!1;const he=H.fields??[];for(let oe=0;oe<he.length;oe++)if(he[oe].name.toUpperCase()==="ARCADE_STAT_RESULT"){X=he[oe].name,he[oe].type==="date"&&(J=!0);break}if(J){let oe=H.features[0].attributes[X];return oe!==null&&(oe=new Date(H.features[0].attributes[X])),{calculated:!0,result:oe}}return{calculated:!0,result:H.features[0].attributes[X]}}_stat(e,t,s,i,u,r,a){return this._stats(e,t,s,i,u,r,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let s=!1;const i=this._layer.capabilities?.query,u=i?.supportsSqlExpression===!0;if(i!=null&&i.supportsStatistics===!0&&i.supportsOrderBy===!0&&(s=!0),s)for(let r=0;r<t.length-1;r++)(t[r].workingexpr?.isStandardized===!1||(0,v.DA)(t[r].workingexpr)===!1&&u===!1)&&(s=!1);return s!==!1}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))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}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,s,i,u,r,a){await this._ensureLoaded();const d=await this.databaseType();let m="",I=!1,j=!1;r!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(m=r.constructClause(),j=!0),this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsPagination===!1&&(j=!1,I=!0,m=this._layer.objectIdField);const G=[];for(let H=0;H<t.length;H++){const J=new we.A;J.onStatisticField=t[H].workingexpr!==null?(0,v.YY)(t[H].workingexpr,d):"",J.outStatisticFieldName=t[H].field,J.statisticType=t[H].toStatisticsName(),G.push(J)}m===""&&(m=e.join(","));let V=this._maxQueryRate();const q=this._layer.capabilities?.query.maxRecordCount;q!=null&&q<V&&(V=q);let X=u===null?i===null?"1=1":"":(0,v.YY)(u,d);return this._layer.definitionExpression&&this._useDefinitionExpression&&(X=X!==""?"(("+this._layer.definitionExpression+") AND ("+X+"))":this._layer.definitionExpression),new R.A([],["GETPAGES"],j,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(s),relationParam:this._makeRelationshipParam(s),outFields:["*"],useOIDpagination:I,generatedOid:a,resultRecordCount:V,resultOffset:0,groupBy
1FieldsForStatistics:e,outStatistics:G,geometry:i===null?null:i,where:X,orderByFields:m,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,s){let i=e.pagesDefinition.where;e.pagesDefinition.useOIDpagination===!0&&(i=i!==""?"("+i+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const u=e.pagesDefinition.internal.lastRetrieved,r=u,a=e.pagesDefinition.internal.lastPage,d=new le.default;if(this._requestStandardised&&(d.sqlFormat="standard"),d.where=i,d.spatialRelationship=e.pagesDefinition.spatialRel,d.relationParameter=e.pagesDefinition.relationParam,d.outFields=e.pagesDefinition.outFields,d.outStatistics=e.pagesDefinition.outStatistics,d.geometry=e.pagesDefinition.geometry,d.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,d.num=e.pagesDefinition.resultRecordCount,d.start=e.pagesDefinition.internal.lastPage,d.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(d.timeReferenceUnknownClient=!0),d.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&d.geometry&&d.spatialRelationship)return[];const m=await this.executeQuery(d,"execute");if(this._checkCancelled(s),!m.hasOwnProperty("features"))throw new _.dr(_.D_.InvalidStatResponse);const I=[];if(e.pagesDefinition.internal.lastPage!==a)return[];m.features.length>0&&m.features[0].attributes[e.pagesDefinition.generatedOid]===void 0&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let j=0;j<m.features.length;j++)e.pagesDefinition.internal.set[r+j]=m.features[j].attributes[e.pagesDefinition.generatedOid];for(let j=0;j<m.features.length;j++)I.push(new x.default({attributes:m.features[j].attributes,geometry:null}));return e.pagesDefinition.useOIDpagination===!0?m.features.length===0?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=m.features[m.features.length-1].attributes[e.pagesDefinition.generatedOid]:(m.exceededTransferLimit===void 0&&m.features.length!==e.pagesDefinition.resultRecordCount||m.exceededTransferLimit===!1)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=u+m.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,I}static create(e,t,s,i,u){const r=new p.default({url:e,outFields:t===null?["*"]:t});return new pe({layer:r,spatialReference:s,lrucache:i,interceptor:u})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,F.Qi)(this._layer.parsedUrl.path)}async queryAttachments(e,t,s,i,u){const r=this._layer.capabilities;if(r?.data.supportsAttachment&&r?.operations.supportsQueryAttachments){const a={objectIds:[e],returnMetadata:u};(t&&t>0||s&&s>0)&&(a.size=[t&&t>0?t:0,s&&s>0?s:t+1]),i&&i.length>0&&(a.attachmentTypes=i),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:a,method:"attachments"});const d=await this._layer.queryAttachments(a),m=[];return d&&d[e]&&d[e].forEach(I=>{const j=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+I.id.toString();let G=null;u&&I.exifInfo&&(G=fe.A.convertJsonToArcade(I.exifInfo,"system",!0)),m.push(new ue.A(I.id,I.name,I.contentType,I.size,j,G,I.keywords??null))}),m}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};e.resultOffset!==void 0&&e.resultOffset!==null&&(t.resultOffset=e.resultOffset.toString()),e.resultRecordCount!==void 0&&e.resultRecordCount!==null&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,ee.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const s=await(0,Q.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(s.data){const i={},u=s.data;if(u?.relatedRecordGroups){const r=u.spatialReference;for(const a of u.relatedRecordGroups){const d=a.objectId,m=[];for(const I of a.relatedRecords){I.geometry&&(I.geometry.spatialReference=r);const j=new x.default({geometry:I.geometry?(0,ce.rS)(I.geometry):null,attributes:I.attributes});m.push(j)}i[d]={features:m,exceededTransferLimit:u.exceededTransferLimit===!0}}}return i}throw new _.dr(_.D_.InvalidRequest)}async getFeatureByObjectId(e,t){const s=new le.default;s.outFields=t,s.returnGeometry=!1,s.outSpatialReference=this.spatialReference,s.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(s.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:s,method:"execute"});const i=await(0,me.s)(this._layer.parsedUrl.path,s);return i.features.length===1?i.features[0]:null}async getIdentityUser(){await this.load();const e=k.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=k.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const s=t.toLowerCase().indexOf("/rest/services");if(t=s>-1?t.substring(0,s):t,t){t+="/rest/info";try{const i=await(0,Q.A)(t,{query:{f:"json"}});let u="";return i.data?.owningSystemUrl&&(u=i.data.owningSystemUrl),u}catch{return""}}return""}getDataSourceFeatureSet(){const e=new pe({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,{parsedUrl:{path:t},serviceItemId:s=null}=this._layer;if(t){const u=await(0,Q.A)(t,{responseType:"json",query:{f:"json"}});e=u?.data?.name??null,s=u?.data?.serviceItemId??null}const i=this._layer.title&&(this._layer.parent??null)!==null;return this.featureSetInfo={layerId:this._layer.layerId,layerName:e===""?null:e,itemId:s===""?null:s,serviceLayer
1Url:t===""?null:t,webMapLayerId:i?this._layer.id??null:null,webMapLayerTitle:i?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var ve=c(8112);class Ce extends O.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return F.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(0),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const t=[],s=[];for(const i of this.fields)if(i.type==="oid")t.push(i),s.push(i.name);else for(const u of this._overrideFields)if(u.toLowerCase()===i.name.toLowerCase()){t.push(i),s.push(i.name);break}this.fields=t,this._overrideFields=s}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return F.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const s of this.fields)t[s.name]=e.attributes[s.name];return new x.default({geometry:this._removeGeometry===!0?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,s,i,u){if(await this.databaseType(),this.isTable()&&t&&e!==null&&e!=="")return new R.A([],[],!0,null);const r=this._layer.nativeCapabilities();if(r.canQueryRelated===!1)return new R.A([],[],!0,null);if(r.capabilities?.queryRelated&&r.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,s,i,u);let a="",d=!1;i!==null&&r.capabilities?.queryRelated&&r.capabilities.queryRelated.supportsOrderBy===!0&&(a=i.constructClause(),d=!0);const m=new Fe.default;m.objectIds=[this._findObjectId];const I=this._overrideFields!==null?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(J=>J.name):["*"]);m.outFields=I,m.relationshipId=this.relationship.id,m.where="1=1";let j=!0;this._removeGeometry===!0&&(j=!1),m.returnGeometry=j,this._requestStandardised&&(m.sqlFormat="standard"),m.outSpatialReference=this.spatialReference,m.orderByFields=a!==""?a.split(","):null;const G=await r.source.queryRelatedFeatures(m);this._checkCancelled(u);const V=G[this._findObjectId]?G[this._findObjectId].features:[],q=[];for(let J=0;J<V.length;J++)this._featureCache[V[J].attributes[this._relatedLayer.objectIdField]]=V[J],q.push(V[J].attributes[this._relatedLayer.objectIdField]);const X=t&&e!==null&&e!=="",H=s!=null;return new R.A(X||H?q:[],X||H?[]:q,d,null)}_fieldsIncludingObjectId(e){if(e===null)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let s=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){s=!0;break}return s===!1&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,s,i,u){let r="",a=!1;const d=this._layer.nativeCapabilities();i!==null&&d?.capabilities?.queryRelated&&d.capabilities.queryRelated.supportsOrderBy===!0&&(r=i.constructClause(),a=!0),await this.databaseType();const m="1=1";let I=this._maxQueryRate();const j=d.capabilities?.query.maxRecordCount;j!=null&&j<I&&(I=j);const G=t&&e!==null&&e!=="",V=s!=null;let q=null,X=!0;this._removeGeometry===!0&&(X=!1);const H=this._overrideFields!==null?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(J=>J.name):["*"]);
1return q=new R.A(G||V?["GETPAGES"]:[],G||V?[]:["GETPAGES"],a,{outFields:H.join(","),resultRecordCount:I,resultOffset:0,objectIds:[this._findObjectId],where:m,orderByFields:r,returnGeometry:X,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(q,I,0,0,u),q}_expandPagedSet(e,t,s,i,u){return this._expandPagedSetFeatureSet(e,t,s,i,u)}_clonePageDefinition(e){return e===null?null:e.groupbypage!==!0?{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}}async _getPhysicalPage(e,t,s){const i=e.pagesDefinition.internal.lastRetrieved,u=i,r=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),d=new Fe.default;this._requestStandardised===!0&&(d.sqlFormat="standard"),d.relationshipId=this.relationship.id,d.objectIds=e.pagesDefinition.objectIds,d.resultOffset=e.pagesDefinition.internal.lastPage,d.resultRecordCount=e.pagesDefinition.resultRecordCount,d.outFields=e.pagesDefinition.outFields.split(","),d.where=e.pagesDefinition.where,d.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,d.returnGeometry=e.pagesDefinition.returnGeometry,d.outSpatialReference=this.spatialReference;const m=await a.source.queryRelatedFeatures(d);if(this._checkCancelled(s),e.pagesDefinition.internal.lastPage!==r)return 0;const I=m[this._findObjectId]?m[this._findObjectId].features:[];for(let G=0;G<I.length;G++)e.pagesDefinition.internal.set[u+G]=I[G].attributes[this._relatedLayer.objectIdField];for(let G=0;G<I.length;G++)this._featureCache[I[G].attributes[this._relatedLayer.objectIdField]]=I[G];const j=!m[this._findObjectId]||m[this._findObjectId].exceededTransferLimit===!1;return I.length!==e.pagesDefinition.resultRecordCount&&j&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+I.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,I.length}async _getFeatures(e,t,s,i){const u=[];t!==-1&&this._featureCache[t]===void 0&&u.push(t);const r=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(e,r)===!0)return await this._expandPagedSet(e,r,0,0,i),this._getFeatures(e,t,s,i);let a=0;for(let d=e._lastFetchedIndex;d<e._known.length&&(a++,a<=s&&(e._lastFetchedIndex+=1),!(e._known[d]!=="GETPAGES"&&this._featureCache[e._known[d]]===void 0&&(e._known[d]!==t&&u.push(e._known[d]),u.length>s)))&&!(a>=s&&u.length===0);d++);if(u.length===0)return"success";throw new _.dr(_.D_.MissingFeatures)}async _refineSetBlock(e,t,s){return e}async _stat(e,t,s,i,u,r,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,s,i,u){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,s,i,u){return this._relatedLayer.queryAttachments(e,t,s,i,u)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var z=c(66593),be=c(23990);function Ae(){z.A.applicationCache===null&&(z.A.applicationCache=new z.A)}async function ye(b,e){if(z.A.applicationCache){const t=z.A.applicationCache.getLayerInfo(b);if(t){const u=await t;return new p.default({url:b,outFields:e,sourceJSON:u})}const s=new p.default({url:b,outFields:e}),i=(async()=>(await s.load(),s.sourceJSON))();if(z.A.applicationCache){z.A.applicationCache.setLayerInfo(b,i);try{return await i,s}catch(u){throw z.A.applicationCache.clearLayerInfo(b),u}}return await i,s}return new p.default({url:b,outFields:e})}async function _e(b,e,t,s,i,u=null){return se(await ye(b,["*"]),e,t,s,i,u)}function se(b,e=null,t=null,s=!0,i=null,u=null){if(b instanceof p.default||(0,N.a0)(b)){const a={layer:b,spatialReference:e,outFields:t,includeGeometry:s,lrucache:i,interceptor:u};return b.url||!b.source?new pe(a):new ve.A(a)}const r=se(b.parent,e,t,s,i,u);return r.filter(f.WhereClause.create(b.parent.subtypeField+"="+b.subtypeCode.toString(),b.parent.fieldsIndex,r.dateFieldsTimeZoneDefaultUTC))}async function Te(b){if(z.A.applicationCache!==null){const t=z.A.applicationCache.getLayerInfo(b);if(t!==null)return t}const e=(async()=>{const t=await(0,Q.A)(b,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(z.A.applicationCache!==null){z.A.applicationCache.setLayerInfo(b,e);try{return await e}catch(t){throw z.A.applicationCache.clearLayerInfo(b),t}}return e}async function Ee(b,e){const t="QUERYDATAELEMTS:"+e.toString()+":"+b;if(z.A.applicationCache!==null){const i=z.A.applicationCache.getLayerInfo(t);if(i!==null)return i}const s=(async()=>{const i=await(0,Q.A)(b+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([e.toString()]),f:"json"}});if(i.data){const u=i.data;if(u.layerDataElements?.[0])return u.layerDataElements[0]}throw new _.dr(_.D_.DataElementsNotFound)})();if(z.A.applicationCache!==null){z.A.applicationCache.setLayerInfo(t,s);try{return await s}catch(i){throw z.A.applicationCache.clearLayerInfo(t),i}}return s}async function Se(b){if(z.A.applicationCache!==null){const t=z.A.applicationCache.getLayerInfo(b);if(t!==null)return t}const e=(async()=>{const t=await(0,Q.A)(b,{responseType:"json",query:{f:"json"}});if(t.data){const s=t.data;return s.layers||(s.layers=[]),s.tables||(s.tables=[]),s}return{layers:[],tables:[]}})();if(z.A.applicationCache!==null){z.A.applicationCache.setLayerInfo(b,e);try{return await e}catch(t){throw z.A.applicationCache.clearLayerInfo(b),t}}return e}async function Re(b,e){const t={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},s=await Se(b);if(t.metadata=s,s.controllerDatasetLayers?.utilityNetworkLayerId!==void 0&&s.controllerDatasetLayers.utilityNetworkLayerId!==null){if(s.layers)for(const r of s.layers)t.layerNameLkp[r.id]=r.name;if(s.tables)for(const r of s.tables)t.layerNameLkp[r.id]=r.name;const i=s.controllerDatasetLayers.utilityNetworkLayerId;t.networkId=i;const u=await Ee(b,i);if(u){t.queryelem=u,t.queryelem?.dataElement&&t.queryelem.dataElement.schemaGeneration!==void 0&&(t.unVersion=t.queryelem.dataElement.schemaGeneration),t.lkp={},t.queryelem.dataElement.domainNetworks||(t.queryelem.dataElement.domainNetworks=[]);for(const a of t.queryelem.dataElement.domainNetworks){for(const d of a.edgeSources??[]){const m={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};m.className&&(t.lkp[m.className]=m)}for(const d of a.junctionSources??[]){const m={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};m.className&&(t.lkp[m.className]=m)}}if(t.queryelem.dataElement.terminalConfigurations)for(const a of t.queryelem.dataElement.terminalConfigurations)for(const d of a.terminals)t.terminals.push({terminalId:d.terminalId,terminalName:d.terminalName});const r=await Te(b+"/"+i);if(r.systemLayers?.associationsTableId!==void 0&&r.systemLayers.associationsTableId!==null){const a=[];t.unVersion>=4&&(a.push("STATUS"),a.push("PERCENTALONG"));let d=await _e(b+"/"+r.systemLayers.associationsTableId.toString(),e,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...a
1],!1,null,null);return await d.load(),t.unVersion>=4&&(d=d.filter(f.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)",d.getFieldsIndex(),d.dateFieldsTimeZoneDefaultUTC)),await d.load()),{lkp:t.lkp,associations:d,unVersion:t.unVersion,terminals:t.terminals}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}async function Oe(b,e,t,s=null,i=null,u=!0,r=null,a=null){let d=b.serviceUrl();if(!d)return null;d=d.charAt(d.length-1)==="/"?d+e.relatedTableId.toString():d+"/"+e.relatedTableId.toString();const m=await _e(d,s,i,u,r,a);return new Ce({layer:b,relatedLayer:m,relationship:e,objectId:t,spatialReference:s,outFields:i,includeGeometry:u,lrucache:r,interceptor:a})}E.A.registerAction(),M.registerAction(),w.A.registerAction(),A.A.registerAction(),P.A.registerAction();class Le extends Y.A{constructor(e,t=null,s=null,i=null){super(),this._map=e,this._overridespref=t,this._lrucache=s,this._interceptor=i,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,s=null){const i=se(e,this._overridespref,s===null?["*"]:s,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(s)}),i}async featureSetByName(e,t=!0,s=null){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetByName(e,t,s);s===null&&(s=["*"]),s=(s=s.slice(0)).sort();const i=JSON.stringify(s);for(let r=0;r<this._instantLayers.length;r++){const a=this._instantLayers[r];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===i)return this._instantLayers[r].featureset}const u=this._map.allLayers.find(r=>{if(r instanceof p.default){if(r.title===e)return!0}else if((0,N.a0)(r)&&r.title===e)return!0;return!1});if(u)return this._makeAndAddFeatureSet(u,t,s);if(this._map.tables){const r=this._map.tables.find(a=>!!(a.title&&a.title===e||a.title&&a.title===e));if(r){if(r instanceof p.default)return this._makeAndAddFeatureSet(r,t,s);if(!r._materializedTable){const a=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new p.default(a)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,s)}}return null}async featureSetById(e,t=!0,s=["*"]){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetById(e,t,s);s===null&&(s=["*"]),s=(s=s.slice(0)).sort();const i=JSON.stringify(s);for(let r=0;r<this._instantLayers.length;r++){const a=this._instantLayers[r];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===i)return this._instantLayers[r].featureset}const u=this._map.allLayers.find(r=>{if(r instanceof p.default){if(r.id===e)return!0}else if((0,N.a0)(r)&&r.id===e)return!0;return!1});if(u)return this._makeAndAddFeatureSet(u,t,s);if(this._map.tables){const r=this._map.tables.find(a=>a.id===e);if(r){if(r instanceof p.default)return this._makeAndAddFeatureSet(r,t,s);if(!r._materializedTable){const a={...r,outFields:["*"]};r._materializedTable=new p.default(a)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,s)}}return null}}class ge extends Y.A{constructor(e,t=null,s=null,i=null){super(),this._url=e,this._overridespref=t,this._lrucache=s,this._interceptor=i,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,s=null){const i=se(e,this._overridespref,s===null?["*"]:s,t,this._lrucache);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(s)}),i}async _loadMetaData(){const e=await Se(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ge(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,s=null){s===null&&(s=["*"]),s=(s=s.slice(0)).sort();const i=JSON.stringify(s);for(let a=0;a<this._instantLayers.length;a++){const d=this._instantLayers[a];if(d.opitem.title===e&&d.includeGeometry===t&&d.outFields===i)return this._instantLayers[a].featureset}const u=await this._loadMetaData();let r=null;for(const a of u.layers??[])a.name===e&&(r=a);if(!r)for(const a of u.tables??[])a.name===e&&(r=a);if(r){const a=await ye(this._url+"/"+r.id,["*"]);return this._makeAndAddFeatureSet(a,t,s)}return null}async featureSetById(e,t=!0,s=["*"]){s===null&&(s=["*"]),s=(s=s.slice(0)).sort();const i=JSON.stringify(s);e=e!=null?e.toString():"";for(let a=0;a<this._instantLayers.length;a++){const d=this._instantLayers[a];if(d.opitem.id===e&&d.includeGeometry===t&&d.outFields===i)return this._instantLayers[a].featureset}const u=await this._loadMetaData();let r=null;for(const a of u.layers??[])a.id!==null&&a.id!==void 0&&a.id.toString()===e&&(r=a);if(!r)for(const a of u.tables??[])a.id!==null&&a.id!==void 0&&a.id.toString()===e&&(r=a);if(r){const a=await ye(this._url+"/"+r.id,["*"]);return this._makeAndAddFeatureSet(a,t,s)}return null}}function Pe(b,e,t=null,s=null){return new Le(b,e,t,s)}function xe(b,e,t=null,s=null){return new ge(b,e,t,s)}function Ne(b,e,t,s,i){if(b===null)return null;if(b instanceof p.default){switch(e){case"datasource":return se(b,i,b.outFields,!0,t,s).getDataSourceFeatureSet();case"parent":case"root":return se(b,i,b.outFields,!0,t,s)}return null}if((0,N.a0)(b)){switch(e){case"datasource":return se(b,i,b.outFields,!0,t,s).getDataSourceFeatureSet();case"parent":case"root":return se(b,i,b.outFields,!0,t,s)}return null}if((0,N.a1)(b)){switch(e){case"datasource":return se(b.parent,i,b.parent.outFields,!0,t,s).getDataSourceFeatureSet();case"parent":case"root":return se(b,i,b.parent.outFields,!0,t,s)}return null}if(b instanceof O.A)switch(e){case"datasource":return b.getDataSourceFeatureSet();case"parent":return b;case"root":return b.getRootFeatureSet()}return null}async function Me(b,e,t,s,i,u,r,a=null){if(z.A.applicationCache){const m=z.A.applicationCache.getLayerInfo(b+":"+u.url);if(m){const I=await m;return se(new p.default({url:(0,F.Qi)(I.url)+"/"+e,outFields:["*"]}),t,s,i,r,a)}}const d=new be.default({id:b,portal:u}).load();z.A.applicationCache&&z.A.applicationCache.setLayerInfo(b+":"+u.url,d);try{const m=await d;return se(new p.default({url:(0,F.Qi)(m.url??"")+"/"+e,outFields:["*"]}),t,s,i,r,a)}catch(m){throw z.A.applicationCache&&z.A.applicationCache.clearLayerInfo(b+":"+u.url),m}}},41826:(re,$,c)=>{c.d($,{Gr:()=>f,IO:()=>F,a:()=>C,bV:()=>L,p8:()=>v});var Q=c(69563),Y=c(23),N=c(87610),E=c(28543),x=c(5444),K=c(33074),w=c(51078),_=c(26859),O=c(46847),R=c(11863);class S{constructor(o){this.field=o,this.sqlRewritable=!1}postInitialization(o,h){}}class F extends S{constructor(o){super(o),this.sqlRewritable=!0}extractValue(o){return o.attributes[this.field.name]}rewriteSql(o){return{rewritten:this.sqlRewritable,where:o}}}class v extends S{constructor(o,h,y){super((0,K.ke)(o)),this.originalField=o,this.sqlRewritable=!0,this.field.name=h,this.field.alias=y}rewriteSql(o,h){return{rewritten:this.sqlRewritable,where:(0,w.bD)(o,this.field.name,this.originalField.name,h.getFieldsIndex())}}extractValue(o){return o.attributes[this.originalField.name]}}class L extends S{constructor(o,h,y){super(o),this.codefield=h,this.lkp=y,this.reverseLkp={};for(const D in y)this.reverseLkp[y[D]]=D;this.sqlRewritable=!0}rewriteSql(o,h){const y=this.evaluateNodeToWhereClause(o.parseTree,K.zl.Standardised,this.field.name,this.co
1defield instanceof O.WhereClause?(0,w.YY)(this.codefield,K.zl.Standardised):this.codefield,o.parameters);return y.includes(L.BADNESS)?{rewritten:!1,where:o}:{rewritten:this.sqlRewritable,where:O.WhereClause.create(y,h._parent.getFieldsIndex(),h.dateFieldsTimeZoneDefaultUTC)}}evaluateNodeToWhereClause(o,h,y=null,D=null,g){let U,B,W,M;switch(o.type){case"interval":return(0,w.oj)(this.evaluateNodeToWhereClause(o.value,h,y,D,g),o.qualifier,o.op);case"case-expression":{let A=" CASE ";o.format==="simple"&&(A+=this.evaluateNodeToWhereClause(o.operand,h,y,L.BADNESS,g));for(let P=0;P<o.clauses.length;P++)A+=" WHEN "+this.evaluateNodeToWhereClause(o.clauses[P].operand,h,y,L.BADNESS,g)+" THEN "+this.evaluateNodeToWhereClause(o.clauses[P].value,h,y,L.BADNESS,g);return o.else!==null&&(A+=" ELSE "+this.evaluateNodeToWhereClause(o.else,h,y,L.BADNESS,g)),A+=" END ",A}case"parameter":{const A=g[o.value.toLowerCase()];if(typeof A=="string")return"'"+A.toString().replaceAll("'","''")+"'";if((0,K.$P)(A)||(0,K.Lk)(A))return(0,w.bm)(A,h);if((0,K.eg)(A))return(0,w.F1)(A,h);if((0,K.rX)(A))return(0,w.R8)(A,h);if((0,K.f0)(A))return(0,w.Nf)(A,h);if(A instanceof Array){const P=[];for(let k=0;k<A.length;k++)typeof A[k]=="string"?P.push("'"+A[k].toString().replaceAll("'","''")+"'"):(0,K.$P)(A[k])||(0,K.Lk)(A[k])?P.push((0,w.bm)(A[k],h)):(0,K.eg)(A[k])?P.push((0,w.F1)(A[k],h)):(0,K.rX)(A[k])?P.push((0,w.R8)(A[k],h)):(0,K.f0)(A[k])?P.push((0,w.Nf)(A[k],h)):P.push(A[k].toString());return P}return A.toString()}case"expression-list":B=[];for(const A of o.value)B.push(this.evaluateNodeToWhereClause(A,h,y,D,g));return B;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(o.expr,h,y,L.BADNESS,g)+" ) ";case"binary-expression":switch(o.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" AND "+this.evaluateNodeToWhereClause(o.right,h,y,D,g)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" OR "+this.evaluateNodeToWhereClause(o.right,h,y,D,g)+") ";case"IS":if(o.right.type!=="null")throw new N.L8(N.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IS NULL )";case"ISNOT":if(o.right.type!=="null")throw new N.L8(N.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IS NOT NULL )";case"IN":if(U=[],o.right.type==="expression-list"){if(o.left.type==="column-reference"&&o.left.column.toUpperCase()===this.field.name.toUpperCase()){const A=[];let P=!0;for(const k of o.right.value){if(k.type!=="string"){P=!1;break}if(this.lkp[k.value]===void 0){P=!1;break}A.push(this.lkp[k.value].toString())}if(P)return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IN ("+A.join(",")+")) "}return U=this.evaluateNodeToWhereClause(o.right,h,y,D,g)," ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IN ("+U.join(",")+")) "}return M=this.evaluateNodeToWhereClause(o.right,h,y,D,g),M instanceof Array?" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IN ("+M.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" IN ("+M+")) ";case"NOT IN":if(U=[],o.right.type==="expression-list"){if(o.left.type==="column-reference"&&o.left.column.toUpperCase()===this.field.name.toUpperCase()){const A=[];let P=!0;for(const k of o.right.value){if(k.type!=="string"){P=!1;break}if(this.lkp[k.value]===void 0){P=!1;break}A.push(this.lkp[k.value].toString())}if(P)return" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" NOT IN ("+A.join(",")+")) "}return U=this.evaluateNodeToWhereClause(o.right,h,y,D,g)," ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" NOT IN ("+U.join(",")+")) "}return M=this.evaluateNodeToWhereClause(o.right,h,y,D,g),M instanceof Array?" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" NOT IN ("+M.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(o.left,h,y,D,g)+" NOT IN ("+M+")) ";case"BETWEEN":return W=this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)," ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" BETWEEN "+W[0]+" AND "+W[1]+" ) ";case"NOTBETWEEN":return W=this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)," ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" NOT BETWEEN "+W[0]+" AND "+W[1]+" ) ";case"LIKE":return o.escape!==""?" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" LIKE "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+" ESCAPE '"+o.escape+"') ":" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" LIKE "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+") ";case"NOT LIKE":return o.escape!==""?" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" NOT LIKE "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+" ESCAPE '"+o.escape+"') ":" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" NOT LIKE "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+") ";case"<>":case"=":if(o.left.type==="column-reference"&&o.right.type==="string"){if(o.left.column.toUpperCase()===this.field.name.toUpperCase()&&this.lkp[o.right.value.toString()]!==void 0)return" ("+D+" "+o.operator+" "+this.lkp[o.right.value.toString()].toString()+") "}else if(o.right.type==="column-reference"&&o.left.type==="string"&&o.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[o.right.value.toString()].toString()+" "+o.operator+" "+D+") ";return" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" "+o.operator+" "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(o.left,h,y,L.BADNESS,g)+" "+o.operator+" "+this.evaluateNodeToWhereClause(o.right,h,y,L.BADNESS,g)+") "}case"null":return"null";case"boolean":return o.value===!0?"1":"0";case"string":return"'"+o.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${o.value}'`;case"date":return`date '${o.value}'`;case"time":return`time '${o.value}'`;case"number":return o.value.toString();case"current-time":return(0,w.C6)(o.mode==="date",h);case"column-reference":return y&&y.toLowerCase()===o.column.toLowerCase()?"("+D+")":o.column;case"data-type":return o.value;case"function":{const A=this.evaluateNodeToWhereClause(o.args,h,y,L.BADNESS,g);return(0,w.F6)(o.name,A,h)}}throw new N.L8(N.Z7.UnsupportedSyntax,{node:o.type})}
1extractValue(o){return this.codefield instanceof O.WhereClause?this.reverseLkp[O.WhereClause.convertValueToStorageFormat(this.codefield.calculateValueCompiled(o))]:this.reverseLkp[o.attributes[this.codefield]]}}L.BADNESS="_!!!_BAD_LKP_!!!!";class f extends S{constructor(o,h){super(o),this._sql=h}rewriteSql(o,h){return{rewritten:!0,where:(0,w.bD)(o,this.field.name,(0,w.YY)(this._sql,K.zl.Standardised),h.getFieldsIndex())}}extractValue(o){return O.WhereClause.convertValueToStorageFormat(this._sql.calculateValueCompiled(o),this.field.type)}}class C extends E.A{static findField(o,h){for(const y of o)if(y.name.toLowerCase()===h.toString().toLowerCase())return y;return null}constructor(o){super(o),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=o.extraFilter,this._parent=o.parentfeatureset,this._maxProcessing=30,this.adaptedFields=o.adaptedFields}_initialiseFeatureSet(){this._parent!==null?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,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 R.A({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=K.ik.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const o of this.adaptedFields)o.postInitialization(this,this._parent),this.fields.push(o.field)}async _getSet(o){if(this._wset===null){await this._ensureLoaded();let h=null;return h=this._extraFilter?await this._getFilteredSet("",null,null,null,o):await this._parent?._getSet(o),this._checkCancelled(o),(0,_.Lw)(h),this._wset=new x.A(h._candidates.slice(0),h._known.slice(0),h._ordered,this._clonePageDefinition(h.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(o){return this._parent._isInFeatureSet(o)}async _getFeatures(o,h,y,D){const g=[];h!==-1&&this._featureCache[h]===void 0&&g.push(h);const U=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(o,U)===!0)return await this._expandPagedSet(o,U,0,0,D),this._getFeatures(o,h,y,D);let B=0;for(let A=o._lastFetchedIndex;A<o._known.length&&(B++,B<=y&&(o._lastFetchedIndex+=1),!(this._featureCache[o._known[A]]===void 0&&(o._known[A]!==h&&g.push(o._known[A]),g.length>=U)));A++);if(g.length===0)return"success";o=new x.A([],g,o._ordered,null);const W=Math.min(g.length,y);await this._parent?._getFeatures(o,-1,W,D),this._checkCancelled(D);const M=[];for(let A=0;A<W;A++){const P=this._parent?._featureFromCache(g[A]);P!==void 0&&M.push({geometry:P.geometry,attributes:P.attributes,id:g[A]})}for(const A of M){const P=[];for(const k of this.adaptedFields)P[k.field.name]=k.extractValue(A);this._featureCache[A.id]=new Q.default({attributes:P,geometry:(0,Y.Yq)(A.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new N.dr(N.D_.NeverReach)}async _getFilteredSet(o,h,y,D,g){let U=!1;const B=this._reformulateWithoutAdaptions(y);U=B.cannot,y=B.where;let W=!1;if(D!==null){W=!0;const P=[];for(const k of this.adaptedFields)if(!(k instanceof F)&&D.scanForField(k.field.name)===!0){if(!(k instanceof v)){D=null,W=!1;break}P.push({field:k.field.name,newfield:k.originalField.name})}D&&P.length>0&&(D=D.replaceFields(P))}y!==null?this._extraFilter!==null&&(y=(0,w.kg)(this._extraFilter,y)):y=this._extraFilter,await this._ensureLoaded();const M=await this._parent._getFilteredSet(o,h,y,D,g);let A;return this._checkCancelled(g),A=U===!0?new x.A(M._candidates.slice(0).concat(M._known.slice(0)),[],W===!0&&M._ordered,this._clonePageDefinition(M.pagesDefinition)):new x.A(M._candidates.slice(0),M._known.slice(0),W===!0&&M._ordered,this._clonePageDefinition(M.pagesDefinition)),A}_reformulateWithoutAdaptions(o){const h={cannot:!1,where:o};if(o!==null){for(const y of this.adaptedFields)if((0,w.Ju)(o,y.field.name)===!0){const D=y.rewriteSql(o,this);if(D.rewritten!==!0){h.cannot=!0,h.where=null;break}h.where=D.where}}return h}async _stat(o,h,y,D,g,U,B){let W=!1,M=this._reformulateWithoutAdaptions(h);if(W=M.cannot,h=M.where,M=this._reformulateWithoutAdaptions(g),W=W||M.cannot,(g=M.where)!==null?this._extraFilter!==null&&(g=(0,w.kg)(this._extraFilter,g)):g=this._extraFilter,W===!0)return g===null&&y===""&&D===null?this._manualStat(o,h,U,B):{calculated:!1};const A=await this._parent._stat(o,h,y,D,g,U,B);return A.calculated===!1?g===null&&y===""&&D===null?this._manualStat(o,h,U,B):{calculated:!1}:A}async _canDoAggregates(o,h,y,D,g){if(this._parent===null)return!1;for(let W=0;W<o.length;W++)for(const M of this.adaptedFields)if(o[W].toLowerCase()===M.field.name.toLowerCase()&&!(M instanceof F))return!1;const U=[];for(let W=0;W<h.length;W++){const M=h[W];if(M.workingexpr!==null){const A=this._reformulateWithoutAdaptions(M.workingexpr);if(A.cannot)return!1;const P=M.clone();P.workingexpr=A.where,U.push(P)}else U.push(M)}const B=this._reformulateWithoutAdaptions(g);return!B.cannot&&((g=B.where)!==null?this._extraFilter!==null&&(g=(0,w.kg)(this._extraFilter,g)):g=this._extraFilter,this._parent._canDoAggregates(o,U,y,D,g))}async _getAggregatePagesDataSourceDefinition(o,h,y,D,g,U,B){if(this._parent===null)throw new N.dr(N.D_.NeverReach);const W=[];for(let A=0;A<h.length;A++){const P=h[A];if(P.workingexpr!==null){const k=this._reformulateWithoutAdaptions(P.workingexpr);if(k.cannot)throw new N.dr(N.D_.NeverReach);const ue=P.clone();ue.workingexpr=k.where,W.push(ue)}else W.push(P)}const M=this._reformulateWithoutAdaptions(g);if(M.cannot)throw new N.dr(N.D_.NeverReach);return(g=M.where)!==null?this._extraFilter!==null&&(g=(0,w.kg)(this._extraFilter,g)):g=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(o,W,y,D,g,U,B)}}},46565:(re,$,c)=>{c.d($,{A:()=>O});var Q=c(87610),Y=c(28543),N=c(5444),E=c(33074),x=c(51078),K=c(18573),w=c(46847),_=c(11863);class O extends Y.A{constructor(S){super(S),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=S.parentfeatureset,S.whereclause instanceof w.WhereClause?(this._whereclause=S.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=S.whereclause,this._whereclause=null)}_initialiseFeatureSet(){this._parent!==null?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,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.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new _.A({wkid:4326}),this.geometryType=E.ik.point)}async _getSet(S){if(this._wset===null){await this._ensureLoaded();const F=await this._parent._getFilteredSet("",null,this._whereclause,null,S);return this._checkCancelled(S),this._whereClauseFunction!==null?this._wset=new N.A(F._candidates.slice(0).concat(F._known.slice(0)),[],F._ordered,this._clonePageDefinition(F.pagesDefinition)):this._wset=new N.A(F._candidates.slice(0),F._known.slice(0),F._ordered,this._clonePageDefinition(F.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(S){let F=this._parent?._isInFeatureSet(S);return F===E.J6.NotInFeatureSet?F:(F=this._idstates[S],F===void 0?E.J6.Unknown:F)}_getFeature(S,F,v){return this._parent._getFeature(S,F,v)}
1_getFeatures(S,F,v,L){return this._parent._getFeatures(S,F,v,L)}_featureFromCache(S){return this._parent._featureFromCache(S)}executeWhereClause(S){return this._whereclause?.testFeature(S)??!1}async executeWhereClauseDeferred(S){if(this._whereClauseFunction!==null){const F=this._whereClauseFunction(S);return(0,K.$X)(F),F}return this.executeWhereClause(S)}async _fetchAndRefineFeatures(S,F,v){const L=new N.A([],S,!1,null),f=Math.min(F,S.length);if(await this._parent?._getFeatures(L,-1,f,v),this._checkCancelled(v),this._whereClauseFunction==null){for(let T=0;T<f;T++){const o=this._parent?._featureFromCache(S[T]);this.executeWhereClause(o)===!0?this._idstates[S[T]]=E.J6.InFeatureSet:this._idstates[S[T]]=E.J6.NotInFeatureSet}return"success"}const C=[];for(let T=0;T<f;T++){const o=this._parent?._featureFromCache(S[T]);C.push(await this.executeWhereClauseDeferred(o))}for(let T=0;T<F;T++)C[T]===!0?this._idstates[S[T]]=E.J6.InFeatureSet:this._idstates[S[T]]=E.J6.NotInFeatureSet;return"success"}async _getFilteredSet(S,F,v,L,f){this._whereClauseFunction!==null||(v!==null?this._whereclause!==null&&(v=(0,x.kg)(this._whereclause,v)):v=this._whereclause),await this._ensureLoaded();const C=await this._parent._getFilteredSet(S,F,v,L,f);let T;return this._checkCancelled(f),T=this._whereClauseFunction!==null?new N.A(C._candidates.slice(0).concat(C._known.slice(0)),[],C._ordered,this._clonePageDefinition(C.pagesDefinition)):new N.A(C._candidates.slice(0),C._known.slice(0),C._ordered,this._clonePageDefinition(C.pagesDefinition)),T}async _stat(S,F,v,L,f,C,T){if(this._whereClauseFunction!==null)return f===null&&v===""&&L===null?this._manualStat(S,F,C,T):{calculated:!1};let o=this._whereclause;f!==null&&this._whereclause!==null&&(o=(0,x.kg)(this._whereclause,f));const h=await this._parent._stat(S,F,v,L,o,C,T);return h.calculated===!1?f===null&&v===""&&L===null?this._manualStat(S,F,C,T):{calculated:!1}:h}async _canDoAggregates(S,F,v,L,f){return this._whereClauseFunction===null&&(f!==null?this._whereclause!==null&&(f=(0,x.kg)(this._whereclause,f)):f=this._whereclause,this._parent!==null&&this._parent._canDoAggregates(S,F,v,L,f))}async _getAggregatePagesDataSourceDefinition(S,F,v,L,f,C,T){if(this._parent===null)throw new Q.dr(Q.D_.NeverReach);return f!==null?this._whereclause!==null&&(f=(0,x.kg)(this._whereclause,f)):f=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(S,F,v,L,f,C,T)}static registerAction(){Y.A._featuresetFunctions.filter=function(S){if(typeof S=="function")return new O({parentfeatureset:this,whereclause:S});let F=null;return S instanceof w.WhereClause&&(F=S),new O({parentfeatureset:this,whereclause:F})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},12758:(re,$,c)=>{c.d($,{A:()=>K});var Q=c(1253),Y=c(87610),N=c(28543),E=c(5444),x=c(78763);class K extends N.A{constructor(_){super(_),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=_.orderbyclause,this._parent=_.parentfeatureset}async _getSet(_){if(this._wset===null){await this._ensureLoaded();const O=await this._getFilteredSet("",null,null,this._orderbyclause,_);return this._checkCancelled(_),this._wset=O,this._wset}return this._wset}async manualOrderSet(_,O){const R=await this.getIdColumnDictionary(_,[],-1,O);this._orderbyclause?.order(R);const S=new E.A([],[],!0,null);for(let F=0;F<R.length;F++)S._known.push(R[F].id);return S}async getIdColumnDictionary(_,O,R,S){if(R<_._known.length-1){const F=this._maxQueryRate();if(_._known[R+1]==="GETPAGES")return await(0,Q.a2)(this._parent._expandPagedSet(_,F,0,0,S)),this.getIdColumnDictionary(_,O,R,S);let v=R+1;const L=[];for(;v<_._known.length&&_._known[v]!=="GETPAGES";)L.push(_._known[v]),v++;R+=L.length;const f=await(0,Q.a2)(this._parent._getFeatureBatch(L,S));this._checkCancelled(S);for(const C of f)O.push({id:C.attributes[this.objectIdField],feature:C});return this.getIdColumnDictionary(_,O,R,S)}return _._candidates.length>0?(await(0,Q.a2)(this._refineSetBlock(_,this._maxProcessingRate(),S)),this._checkCancelled(S),this.getIdColumnDictionary(_,O,R,S)):O}_isInFeatureSet(_){return this._parent._isInFeatureSet(_)}_getFeatures(_,O,R,S){return this._parent._getFeatures(_,O,R,S)}_featureFromCache(_){if(this._featureCache[_]===void 0){const O=this._parent._featureFromCache(_);return O===void 0?void 0:O===null?null:(this._featureCache[_]=O,O)}return this._featureCache[_]}async _fetchAndRefineFeatures(){throw new Y.dr(Y.D_.NeverReach)}async _getFilteredSet(_,O,R,S,F){await this._ensureLoaded();const v=await this._parent._getFilteredSet(_,O,R,S===null?this._orderbyclause:S,F);this._checkCancelled(F);const L=new E.A(v._candidates.slice(0),v._known.slice(0),v._ordered,this._clonePageDefinition(v.pagesDefinition));let f=!0;if(v._candidates.length>0&&(f=!1),L._ordered===!1){let C=await this.manualOrderSet(L,F);return f===!1&&(O===null&&R===null||(C=new E.A(C._candidates.slice(0).concat(C._known.slice(0)),[],C._ordered,this._clonePageDefinition(C.pagesDefinition)))),C}return L}static registerAction(){N.A._featuresetFunctions.orderBy=function(_){return _===""?this:new K({parentfeatureset:this,orderbyclause:new x.A(_)}
1)}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},66360:(re,$,c)=>{c.d($,{A:()=>x});var Q=c(87610),Y=c(28543),N=c(5444),E=c(33074);class x extends Y.A{constructor(w){super(w),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=w.topnum,this._parent=w.parentfeatureset}async _getSet(w){if(this._wset===null){await this._ensureLoaded();const _=await this._parent._getSet(w);return this._wset=new N.A(_._candidates.slice(0),_._known.slice(0),!1,this._clonePageDefinition(_.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(w){return w._known.length>0&&w._known[w._known.length-1]==="GETPAGES"?w._known.length-1:w._known.length}_isInFeatureSet(w){const _=this._parent._isInFeatureSet(w);if(_===E.J6.NotInFeatureSet)return _;const O=this._idstates[w];return O===E.J6.InFeatureSet||O===E.J6.NotInFeatureSet?O:_===E.J6.InFeatureSet&&O===void 0?this._countedin<this._topnum?(this._idstates[w]=E.J6.InFeatureSet,this._countedin++,E.J6.InFeatureSet):(this._idstates[w]=E.J6.NotInFeatureSet,E.J6.NotInFeatureSet):E.J6.Unknown}async _expandPagedSet(w,_,O,R,S){if(this._parent===null)throw new Q.dr(Q.D_.NotImplemented);if(_>this._topnum&&(_=this._topnum),this._countedin>=this._topnum&&w.pagesDefinition.internal.set.length<=w.pagesDefinition.resultOffset){let v=w._known.length;return v>0&&w._known[v-1]==="GETPAGES"&&(w._known.length=v-1),v=w._candidates.length,v>0&&w._candidates[v-1]==="GETPAGES"&&(w._candidates.length=v-1),"success"}const F=await this._parent._expandPagedSet(w,_,O,R,S);return this._setKnownLength(w)>this._topnum&&(w._known.length=this._topnum),this._setKnownLength(w)>=this._topnum&&(w._candidates.length=0),F}async _getFeatures(w,_,O,R){const S=[],F=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(w,F)===!0)return await this._expandPagedSet(w,F,0,0,R),this._getFeatures(w,_,O,R);_!==-1&&this._featureCache[_]===void 0&&S.push(_);let v=0;for(let C=w._lastFetchedIndex;C<w._known.length&&(v++,v<=O&&(w._lastFetchedIndex+=1),!(this._featureCache[w._known[C]]===void 0&&(w._known[C]!==_&&S.push(w._known[C]),S.length>F)));C++);if(S.length===0)return"success";const L=new N.A([],S,!1,null),f=Math.min(S.length,O);await this._parent._getFeatures(L,-1,f,R);for(let C=0;C<f;C++){const T=this._parent._featureFromCache(S[C]);T!==void 0&&(this._featureCache[S[C]]=T)}return"success"}async _getFilteredSet(w,_,O,R,S){await this._ensureLoaded();const F=await this._getSet(S);return new N.A(F._candidates.slice(0).concat(F._known.slice(0)),[],!1,this._clonePageDefinition(F.pagesDefinition))}_refineKnowns(w,_){let O=0,R=null;const S=[];for(let F=0;F<w._candidates.length;F++){const v=this._isInFeatureSet(w._candidates[F]);if(v===E.J6.InFeatureSet){if(w._known.push(w._candidates[F]),O+=1,R===null?R={start:F,end:F}:R.end===F-1?R.end=F:(S.push(R),R={start:F,end:F}),w._known.length>=this._topnum)break}else if(v===E.J6.NotInFeatureSet)R===null?R={start:F,end:F}:R.end===F-1?R.end=F:(S.push(R),R={start:F,end:F}),O+=1;else if(v===E.J6.Unknown)break;if(O>=_)break}R!==null&&S.push(R);for(let F=S.length-1;F>=0;F--)w._candidates.splice(S[F].start,S[F].end-S[F].start+1);this._setKnownLength(w)>this._topnum&&(w._known=w._known.slice(0,this._topnum)),this._setKnownLength(w)>=this._topnum&&(w._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){Y.A._featuresetFunctions.top=function(w){return new x({parentfeatureset:this,topnum:w})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},8112:(re,$,c)=>{c.d($,{A:()=>v});var Q=c(69563),Y=c(87610),N=c(28543),E=c(5444),x=c(33074),K=c(51078),w=c(90778),_=c(8405),O=c(84807),R=c(32320),S=c(44914),F=c(12107);class v extends N.A{constructor(f){super(f),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,f.spatialReference&&(this.spatialReference=f.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=f.layer,this._wset=null,f.isTable===!0&&(this._forceIsTable=!0),f.outFields!==void 0&&(this._overrideFields=f.outFields),f.includeGeometry!==void 0&&(this._removeGeometry=f.includeGeometry===!1)}_maxQueryRate(){return x.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const f=[],C=[];for(const T of this.fields)if(T.type==="oid")f.push(T),C.push(T.name);else for(const o of this._overrideFields)if(o.toLowerCase()===T.name.toLowerCase()){f.push(T),C.push(T.name);break}this.fields=f,this._overrideFields=C}this.objectIdField=this._layer.objectIdField;for(const f of this.fields)f.type==="global-id"&&(this.globalIdField=f.name);this._databaseType=x.zl.Standardised,this.hasZ=this._layer?.capabilities?.data?.supportsZ===!0,this.hasM=this._layer?.capabilities?.data?.supportsM===!0,this._layer instanceof O.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}isTable(){return this._forceIsTable||this._layer.isTable||this._layer.type==="table"||!this._layer.geometryType}_isInFeatureSet(){return x.J6.InFeatureSet}_candidateIdTransform(f){return f}async _getSet(f){if(this._wset===null){await this._ensureLoaded();const C=await this._getFilteredSet("",null,null,null,f);return this._wset=C,C}return this._wset}
1_changeFeature(f){const C={};for(const T of this.fields)C[T.name]=f.attributes[T.name];return new Q.default({geometry:this._removeGeometry===!0?null:f.geometry,attributes:C})}async _getFilteredSet(f,C,T,o,h){let y="",D=!1;if(o!==null&&(y=o.constructClause(),D=!0),this.isTable()&&C&&f!==null&&f!=="")return new E.A([],[],!0,null);const g=new F.default;g.returnZ=this.hasZ,g.returnM=this.hasM,g.where=T===null?C===null?"1=1":"":(0,K.YY)(T,x.zl.Standardised),g.spatialRelationship=this._makeRelationshipEnum(f),g.outSpatialReference=this.spatialReference,g.orderByFields=y!==""?y.split(","):null,g.geometry=C===null?null:C,g.returnGeometry=!0,g.relationParameter=this._makeRelationshipParam(f);const U=await this._layer.queryFeatures(g);if(U===null)return new E.A([],[],D,null);this._checkCancelled(h);const B=[];return U.features.forEach(W=>{const M=W.attributes[this._layer.objectIdField];B.push(M),this._featureCache[M]=this._changeFeature(W)}),new E.A([],B,D,null)}_makeRelationshipEnum(f){if(f.includes("esriSpatialRelRelation"))return"relation";switch(f){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 f}_makeRelationshipParam(f){return f.includes("esriSpatialRelRelation")?f.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const f=new F.default;if(f.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const o=[];return this._layer.source.items.forEach(h=>{const y=h.attributes[this._layer.objectIdField];o.push(y),this._featureCache[y]=this._changeFeature(h)}),this._wset=new E.A([],o,!1,null),this._wset}f.returnZ=this.hasZ,f.returnM=this.hasM;const C=await this._layer.queryFeatures(f),T=[];return C.features.forEach(o=>{const h=o.attributes[this._layer.objectIdField];T.push(h),this._featureCache[h]=this._changeFeature(o)}),this._wset=new E.A([],T,!1,null),this._wset}async _getFeatures(f,C,T){const o=[];C!==-1&&this._featureCache[C]===void 0&&o.push(C);for(let h=f._lastFetchedIndex;h<f._known.length&&(f._lastFetchedIndex+=1,!(this._featureCache[f._known[h]]===void 0&&(f._known[h]!==C&&o.push(f._known[h]),o.length>T)));h++);if(o.length===0)return"success";throw new Y.dr(Y.D_.MissingFeatures)}async _refineSetBlock(f){return f}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(f){const C={};for(const T in f)C[T]=f[T];return C}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(f,C){let T=f.layerDefinition.objectIdField;const o=f.layerDefinition.typeIdField??"",h=[];if(f.layerDefinition.types)for(const P of f.layerDefinition.types)h.push(R.A.fromJSON(P));let y=f.layerDefinition.geometryType;y===void 0&&(y=f.featureSet.geometryType||"");let D=f.featureSet.features;const g=C.toJSON();if(!T){let P=!1;for(const k of f.layerDefinition.fields)if(k.type==="oid"||k.type==="esriFieldTypeOID"){T=k.name,P=!0;break}if(P===!1){let k="FID",ue=!0,fe=0;for(;ue;){let ee=!0;for(const p of f.layerDefinition.fields)if(p.name===k){ee=!1;break}ee===!0?ue=!1:(fe++,k="FID"+fe.toString())}f.layerDefinition.fields.push({type:"esriFieldTypeOID",name:k,alias:k});const ce=[];for(let ee=0;ee<D.length;ee++)ce.push({geometry:f.featureSet.features[ee].geometry,attributes:f.featureSet.features[ee].attributes?this._cloneAttr(f.featureSet.features[ee].attributes):{}}),ce[ee].attributes[k]=ee;D=ce,T=k}}const U=[];for(const P of f.layerDefinition.fields)P instanceof S.default?U.push(P):U.push(S.default.fromJSON(P));let B=y;switch(B||(B=""),B){case"esriGeometryPoint":B="point";break;case"esriGeometryPolyline":B="polyline";break;case"esriGeometryPolygon":B="polygon";break;case"esriGeometryEnvelope":B="extent";break;case"esriGeometryMultipoint":B="multipoint";break;case"":case"esriGeometryNull":B="esriGeometryNull"}if(B!=="esriGeometryNull")for(const P of D)P.geometry&&!(P.geometry instanceof w.A)&&(P.geometry.type=B,P.geometry.spatialReference===void 0&&(P.geometry.spatialReference=g));else for(const P of D)P.geometry&&(P.geometry=null);const W={outFields:["*"],source:D,fields:U,hasZ:f?.layerDefinition?.hasZ===!0||f?.featureSet?.hasZ===!0,hasM:f?.layerDefinition?.hasM===!0||f?.featureSet?.hasM===!0,types:h,typeIdField:o,objectIdField:T,spatialReference:C},M=B==="esriGeometryNull"||B===null;M||(W.geometryType=B);const A=new _.default(W);return f?.layerDefinition?.subtypeField&&f?.layerDefinition?.subtypes&&A.read({subtypes:f.layerDefinition.subtypes,subtypeField:f.layerDefinition.subtypeField}),new v({layer:A,spatialReference:C,isTable:M})}async queryAttachments(){return[]}async getFeatureByObjectId(f){const C=new F.default;C.where=this.objectIdField+"="+f.toString(),C.returnZ=this.hasZ,C.returnM=this.hasM;const T=await this._layer.queryFeatures(C);return T.features.length===1?T.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer?.datesInUnknownTimezone}get editFieldsInfo(){return this._layer?.editFieldsInfo}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const f=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayer
1Url:null,webMapLayerId:f?this._layer.id??null:null,webMapLayerTitle:f?this._layer.title??null:null,className:null,objectClassId:null}}}},78763:(re,$,c)=>{c.d($,{A:()=>Y});function Q(N,E){return N===E?0:N===null?-1:E===null?1:N<E?-1:1}class Y{constructor(E){const x=E.split(",");this._fields=[],this._directions=[];for(let K=0;K<x.length;K++){const w=x[K].match(/\S+/g);this._fields.push(w[0]),w.length===2?w[1].toLowerCase()==="asc"?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let E="";for(let x=0;x<this._fields.length;x++)x!==0&&(E+=","),E+=this._fields[x],this._directions[x]===1?E+=" ASC":E+=" DESC";return E}order(E){E.sort((x,K)=>{for(let w=0;w<this._fields.length;w++){const _=this.featureValue(x.feature,this._fields[w],w),O=this.featureValue(K.feature,this._fields[w],w);let R=0;if(R=this._directions[w]===1?Q(_,O):-1*Q(_,O),R!==0)return R}return 0})}scanForField(E){for(let x=0;x<this._fields.length;x++)if(this._fields[x].toLowerCase().trim()===E.toLowerCase().trim())return!0;return!1}replaceFields(E){let x="";for(let K=0;K<this._fields.length;K++){K!==0&&(x+=",");let w=this._fields[K];for(const _ of E)if(w.toLowerCase()===_.field.toLowerCase()){w=_.newfield;break}x+=w,this._directions[K]===1?x+=" ASC":x+=" DESC"}return new Y(x)}featureValue(E,x,K){const w=E.attributes[x];if(w!==void 0)return w;for(const _ in E.attributes)if(x.toLowerCase()===_.toLowerCase())return this._fields[K]=_,E.attributes[_];return null}}},32320:(re,$,c)=>{c.d($,{A:()=>L});var Q=c(27394),Y=c(79049),N=c(63171),E=c(53580),x=c(1319),K=c(59051),w=c(55624),_=c(80646),O=c(91591),R=c(9430),S=c(97806),F=c(99578);let v=class extends(0,Y.O)(N.oY){constructor(f){super(f),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(f){const C={};for(const T of Object.keys(f))C[T]=(0,S.rS)(f[T]);return C}writeDomains(f,C){const T={};for(const o of Object.keys(f))f[o]&&(T[o]=f[o]?.toJSON());C.domains=T}};(0,Q._)([(0,E.MZ)({json:{write:!0}})],v.prototype,"id",void 0),(0,Q._)([(0,E.MZ)({json:{write:!0}})],v.prototype,"name",void 0),(0,Q._)([(0,E.MZ)({json:{write:!0}})],v.prototype,"domains",void 0),(0,Q._)([(0,_.w)("domains")],v.prototype,"readDomains",null),(0,Q._)([(0,R.K)("domains")],v.prototype,"writeDomains",null),(0,Q._)([(0,E.MZ)({type:[F.A],json:{write:!0}})],v.prototype,"templates",void 0),v=(0,Q._)([(0,O.$)("esri.layers.support.FeatureType")],v);const L=v},49611:(re,$,c)=>{c.d($,{Fi:()=>_,HZ:()=>f,Jf:()=>L,LS:()=>C,Wo:()=>v,bd:()=>T,cr:()=>S,iz:()=>R,qg:()=>O,yG:()=>F});var Q=c(83549),Y=c(29936);const N={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer"},E=Object.values(N),x=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${E.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),K=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${E.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),w=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function _(h){return!!x.test(h)}function O(h){if(h==null)return null;const y=(0,Q.An)(h),D=y?.path.match(x)||y?.path.match(K);if(!D)return null;const[,g,U,B,W]=D,M=U.indexOf("/");return{title:S(M!==-1?U.slice(M+1):U),serverType:N[B.toLowerCase()],sublayer:W!=null&&W!==""?parseInt(W,10):null,url:{path:g}}}function R(h){const y=(0,Q.An)(h).path.match(w);return y?{serviceUrl:y[1],sublayerId:Number(y[2])}:null}function S(h){return(h=h.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+h.slice(1)}function F(h,y){const D=[];if(h){const g=O(h);g!=null&&g.title&&D.push(g.title)}if(y){const g=S(y);D.push(g)}if(D.length===2){if(D[0].toLowerCase().includes(D[1].toLowerCase()))return D[0];if(D[1].toLowerCase().includes(D[0].toLowerCase()))return D[1]}return D.join(" - ")}function v(h){if(!h)return!1;const y=".arcgis.com/",D="//services",g="//tiles",U="//features",B=(h=h.toLowerCase()).includes(y),W=h.includes(D)||h.includes(g)||h.includes(U);return B&&W}function L(h,y){return h&&(0,Q.UC)((0,Q.zi)(h,y))}function f(h){let{url:y}=h;if(!y)return{url:y};y=(0,Q.zi)(y,h.logger);const D=(0,Q.An)(y),g=O(D.path);let U;if(g!=null)g.sublayer!=null&&h.layer.layerId==null&&(U=g.sublayer),y=g.url.path;else if(h.nonStandardUrlAllowed){const B=R(D.path);B!=null&&(y=B.serviceUrl,U=B.sublayerId)}return{url:(0,Q.UC)(y),layerId:U}}function C(h,y,D,g,U){(0,Y.w)(y,g,"url",U),g.url&&h.layerId!=null&&(g.url=(0,Q.fj
1)(g.url,D,h.layerId.toString()))}function T(h){if(!h)return!1;const y=h.toLowerCase(),D=y.includes("/services/"),g=y.includes("/mapserver/wmsserver"),U=y.includes("/imageserver/wmsserver"),B=y.includes("/wmsserver");return D&&(g||U||B)}function o(h){if(!h)return!1;const y=new n(l(h)),D=y.authority?.toLowerCase();return D==="server.arcgisonline.com"||D==="services.arcgisonline.com"}},22262:(re,$,c)=>{c.d($,{BR:()=>fe,F2:()=>R,Ov:()=>g,Sv:()=>S,TU:()=>C,W_:()=>U,XX:()=>f,tk:()=>ee,wI:()=>P,yZ:()=>E});var Q=c(42286),Y=c(78634);function N(p){return F(p)||O(p)}function E(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="feature"}function x(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="graphics"}function K(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="map-notes"&&"sublayers"in p}function w(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="knowledge-graph"&&"layers"in p}function _(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="link-chart"&&"layers"in p}function O(p){return p?.type==="scene"}function R(p){return p!=null&&typeof p=="object"&&"type"in p&&p.type==="subtype-group"&&"sublayers"in p}function S(p){return p?.type==="subtype-sublayer"}function F(p){const Z=p?.type;return Z==="imagery-tile"||Z==="tile"||Z==="open-street-map"||Z==="vector-tile"||Z==="web-tile"||Z==="wmts"}function v(p){const Z=p?.type;return Z==="base-tile"||Z==="tile"||Z==="elevation"||Z==="imagery-tile"||Z==="base-elevation"||Z==="open-street-map"||Z==="wcs"||Z==="web-tile"||Z==="wmts"||Z==="vector-tile"}function L(p){return p!=null&&"type"in p&&p.type==="group"}const f={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function C(p){const Z=p?.type;return Z==="building-scene"||Z==="integrated-mesh"||Z==="point-cloud"||Z==="scene"}function T(p){return p==="IntegratedMeshLayer"||p==="IntegratedMesh3DTilesLayer"}function o(p){return p==="integrated-mesh"||p==="integrated-mesh-3dtiles"}function h(p){return p?.type==="voxel"}function y(p){return p?.type==="imagery-tile"}function D(p){return p?.parent!=null&&"declaredClass"in p.parent&&p.parent.declaredClass==="esri.Basemap"&&p.parent.baseLayers.includes(p)}function g(p){return p?.type==="feature"&&!p.url&&p.source?.type==="memory"}function U(p){return(p?.type==="feature"||p?.type==="subtype-group")&&p.source?.type==="feature-layer"}function B(p){return p?.type==="feature"&&p.source?.type==="feature-layer"}function W(p){const Z=/[:;]/,te=[];let ae=!1;if(p&&(p.forEach((ne,ie)=>{te.push([ie,ne]),!ae&&Z.test(ne)&&(ae=!0)}),te.length>0)){let ne;if(ae){const ie={};te.forEach(de=>{ie[de[0]]=de[1]}),ne=JSON.stringify(ie)}else{const ie=[];te.forEach(de=>{ie.push(de[0]+":"+de[1])}),ne=ie.join(";")}return ne}return null}function M(p){if(!p)return;const Z=[];return p.forEach((te,ae)=>{Z.push('"'+ae+'":'+JSON.stringify(te))}),Z.length?"{"+Z.join(",")+"}":void 0}function A(p){if(p.activeLayer){const Z=p.activeLayer.tileMatrixSet;if(Z)return Z;const te=p.activeLayer.tileMatrixSets;if(te)return te}return null}async function P(p,Z){const te=Q.id?.findServerInfo(p);if(te?.currentVersion!=null)return te.owningSystemUrl||null;const ae=p.toLowerCase().indexOf("/rest/services");if(ae===-1)return null;const ne=`${p.substring(0,ae)}/rest/info`,ie=Z!=null?Z.signal:null,{data:de}=await(0,Y.A)(ne,{query:{f:"json"},responseType:"json",signal:ie});return de?.owningSystemUrl||null}function k(p){if(!("capabilities"in p))return!1;switch(p.type){case"catalog":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function ue(p){return p!=null&&typeof p=="object"&&"isTable"in p&&!!p.isTable}function fe(p){return k(p)?"effectiveCapabilities"in p?p.effectiveCapabilities:p.capabilities:null}function ce(p){if(!("editingEnabled"in p))return!1;switch(p.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function ee(p){return!!ce(p)&&("effectiveEditingEnabled"in p?p.effectiveEditingEnabled:p.editingEnabled)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.