@arcgis/core 5.2.0-next.138 → 5.2.0-next.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/arcade/featureset/actions/GroupBy.js +1 -1
  2. package/arcade/featureset/support/FeatureSet.js +1 -1
  3. package/arcade/featureset/support/shared.js +1 -1
  4. package/arcade/featureset/support/sqlUtils.js +1 -1
  5. package/arcade/featureset/support/stats.js +1 -1
  6. package/arcade/functions/featuresetstats.js +1 -1
  7. package/arcade/functions/fieldStats.js +1 -1
  8. package/arcgisGlobal.d.ts +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/1380cec385426673f294.js +1 -0
  11. package/assets/esri/core/workers/chunks/2671035cc08027185737.js +1 -0
  12. package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +1 -0
  13. package/assets/esri/core/workers/chunks/8b1c17cc52d989924313.js +1 -0
  14. package/assets/esri/core/workers/chunks/acfa03c65ba3ca6c5685.js +1 -0
  15. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  16. package/core/sql/AggregateFunctions.js +1 -1
  17. package/legend/ActiveLayerInfo.d.ts +2 -2
  18. package/legend/{LegendContent.d.ts → LegendModel.d.ts} +10 -10
  19. package/legend/{LegendContent.js → LegendModel.js} +1 -1
  20. package/legend/types.d.ts +4 -4
  21. package/package.json +2 -2
  22. package/popup/FeatureContent.d.ts +17 -8
  23. package/popup/FeatureContent.js +1 -1
  24. package/popup/FeatureContentCollection.d.ts +0 -1
  25. package/popup/FeatureContentCollection.js +1 -1
  26. package/symbols/cim/cimAnalyzer.js +1 -1
  27. package/symbols/cim/types.d.ts +493 -8
  28. package/widgets/Legend/LegendViewModel.d.ts +3 -3
  29. package/widgets/Legend/LegendViewModel.js +1 -1
  30. package/assets/esri/core/workers/chunks/37fc47373c1c8fcdfd1a.js +0 -1
  31. package/assets/esri/core/workers/chunks/537dbd3b870bbef7433e.js +0 -1
  32. package/assets/esri/core/workers/chunks/703411e4a18a6a36048a.js +0 -1
  33. package/assets/esri/core/workers/chunks/879b2f0ff1977bca9376.js +0 -1
  34. package/assets/esri/core/workers/chunks/b748faaa5ebdeba73103.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[152],{52106(e,t,r){r.d(t,{A:()=>S});var s,i,a=r(32198),n=r(37838),l=r(69540),o=r(51447),h=r(25482),u=r(53966),c=r(36708),d=r(24326),g=r(91429),m=r(12195),f=r(65864),p=r(50498),y=r(55156),_=r(60950),b=r(54339),v=r(94128),T=r(33910);const w=Symbol("meshGeometryHandles");function A(e){if(null==e)return null;let t={};for(let r in e){let s=e[r];s&&(t[r]=s.toJSON())}return 0===Object.keys(t).length?null:t}let S=class extends((0,l.OU)(h.o)){static{s=v.Z}static{i=this}constructor(e){super(e),this[s]=!0,this.distance=null,this.isAggregate=!1,this.layer=null,this.origin=null,this.sourceLayer=null,this.statisticsAggregatedIds=void 0,this._version=0,Object.defineProperty(this,"uid",{value:(0,d.c)(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&(0,o.eF)(u.A.getLogger(this),"Graphic",{version:"4.30"})}set aggregateGeometries(e){let t=this._get("aggregateGeometries");JSON.stringify(t)!==JSON.stringify(e)&&this._set("aggregateGeometries",e)}set attributes(e){let t=this._get("attributes");t!==e&&(this._set("attributes",e),this._notifyLayer("attributes",t,e))}set geometry(e){let t=this._get("geometry");t!==e&&(this._set("geometry",e),this._watchMeshGeometryChanges(),this._notifyLayer("geometry",t,e))}set popupTemplate(e){let t=this._get("popupTemplate");t!==e&&(this._set("popupTemplate",e),this._notifyLayer("popupTemplate",t,e))}set symbol(e){let t=this._get("symbol");t!==e&&(this._set("symbol",e),this._notifyLayer("symbol",t,e))}get version(){return this._version}set visible(e){let t=this._get("visible");t!==e&&(this._set("visible",e),this._notifyLayer("visible",t,e))}cloneShallow(){return new i({aggregateGeometries:this.aggregateGeometries,statisticsAggregatedIds:this.statisticsAggregatedIds,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(e=!1){if(this.popupTemplate)return this.popupTemplate;let t=(0,_.E_)(this.origin);if(t)return t.popupTemplate??(e?t.defaultPopupTemplate:null)??null;let r=this.origin&&"layer"in this.origin?this.origin.layer:null;for(let t of[r,this.sourceLayer,this.layer])if(t&&"object"==typeof t){if("popupTemplate"in t&&t.popupTemplate)return t.popupTemplate;if(e&&"defaultPopupTemplate"in t&&null!=t.defaultPopupTemplate)return t.defaultPopupTemplate}return null}getAttribute(e){return this.attributes?.[e]}setAttribute(e,t){if(this.attributes){let r=this.getAttribute(e);this.attributes[e]=t,this._notifyLayer("attributes",r,t,e)}else this.attributes={[e]:t}}getObjectId(){let e=(0,y.I)(this.origin);if(e)return(0,b.r)(this,e);let t=this.sourceLayer??this.layer;return t?(0,b.r)(this,t):null}getGlobalId(){let e=(0,y.I)(this.origin);if(e?.globalIdField)return this.getAttribute(e.globalIdField);let t=this.sourceLayer??this.layer;return t&&"globalIdField"in t&&t.globalIdField?this.getAttribute(t.globalIdField):null}toJSON(){let e={aggregateGeometries:A(this.aggregateGeometries),geometry:this.geometry?.toJSON()??null,symbol:this.symbol?.toJSON()??null,attributes:(0,m.W)(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null};return this.statisticsAggregatedIds?.length&&(e.aggregateIds=[...this.statisticsAggregatedIds]),null!=this.distance&&(e.distance=this.distance),e}notifyMeshTransformChanged(e={}){let{geometry:t}=this;if("mesh"===t?.type){let r={origin:t.origin,transform:t.transform};this._notifyLayer("origin-transform",r,r,e.action)}}_notifyLayer(e,t,r,s){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;let i={graphic:this,property:e,oldValue:t,newValue:r};"origin-transform"===e&&(i.action=s),"attributes"===e&&(i.attributeName=s),this.layer.graphicChanged(i)}_watchMeshGeometryChanges(){this.removeHandles(w);let e=this.geometry;"mesh"===e?.type&&this.addHandles([(0,c.z7)(()=>e.vertexSpace.origin?{localMatrix:e.transform?.localMatrix,origin:e.vertexSpace.origin}:void 0,({localMatrix:e,origin:t})=>{(this._lastMeshTransform.localMatrix!==e||this._lastMeshTransform.origin!==t)&&(this._lastMeshTransform.localMatrix=e,this._lastMeshTransform.origin=t,this.notifyMeshTransformChanged())}),(0,c.z7)(()=>({vertexAttributes:e.vertexAttributes}),()=>{e.vertexSpace.origin?(this._lastMeshTransform.localMatrix=e.transform?.localMatrix,this._lastMeshTransform.origin=e.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",e,e)},{equals:(e,t)=>e===t,sync:!0})],w)}};(0,a.Cg)([(0,g.MZ)({value:null,json:{read:function(e){if(!e)return null;let t={};for(let r in e){let s=(0,f.rS)(e[r]);s&&(t[r]=s)}return 0===Object.keys(t).length?null:t}}})],S.prototype,"aggregateGeometries",null),(0,a.Cg)([(0,g.MZ)({value:null})],S.prototype,"attributes",null),(0,a.Cg)([(0,g.MZ)({value:null,types:p.yR,json:{read:f.rS}})],S.prototype,"geometry",null),(0,a.Cg)([(0,g.MZ)()],S.prototype,"distance",void 0),(0,a.Cg)([(0,g.MZ)({type:Boolean})],S.prototype,"isAggregate",void 0),(0,a.Cg)([(0,g.MZ)({clonable:!1})],S.prototype,"layer",void 0),(0,a.Cg)([(0,g.MZ)({clonable:"reference"})],S.prototype,"origin",void 0),(0,a.Cg)([(0,g.MZ)({type:n.A,value:null})],S.prototype,"popupTemplate",null),(0,a.Cg)([(0,g.MZ)({clonable:"reference"})],S.prototype,"sourceLayer",void 0),(0,a.Cg)([(0,g.MZ)({json:{name:"aggregateIds",read:e=>e?.map(e=>Array.isArray(e)?JSON.stringify(e):e)}})],S.prototype,"statisticsAggregatedIds",void 0),(0,a.Cg)([(0,g.MZ)({value:null,types:T.Es})],S.prototype,"symbol",null),(0,a.Cg)([(0,g.MZ)({clonable:!1,json:{read:!1,write:!1}})],S.prototype,"_version",void 0),(0,a.Cg)([(0,g.MZ)({type:Boolean,value:!0})],S.prototype,"visible",null),S=i=(0,a.Cg)([(0,g.$K)("esri.Graphic")],S)},11221(e,t,r){r.d(t,{t1:()=>A,Jn:()=>S,Rn:()=>T,An:()=>w,rj:()=>v});var s=r(52106),i=r(48938),a=r(54639),n=r(23732),l=r(87449),o=r(32198),h=r(93833),u=r(60999);class c{constructor(e,t){this._parent=e,this._abortSignal=t,this._done=!1,this._features=null,this._batchMutex=new u.aD,this._currentPage=null,this._pageCursor=-1}get _numAvailable(){return null==this._currentPage||this._pageCursor<0?0:Math.max(this._currentPage.length-this._pageCursor,0)}_takeNFeatures(e){if(null==this._currentPage)return[];let t=this._currentPage.slice(this._pageCursor,this._pageCursor+e);return this._pageCursor+=t.length,t.map(e=>s.A.fromJSON(e))}_takeOneFeature(){let e=this._currentPage[this._pageCursor];return this._pageCursor+=1,s.A.fromJSON(e)}async _nextBatch(){if(this._done)return!1;let e,t=await(this._features??=this._parent.queryAll(this._abortSignal));do{if(e=await t.next(),e.done)return this._done=!0,this._currentPage=null,this._pageCursor=-1,!1}while(e.value.length<=0);return this._currentPage=e.value,this._pageCursor=0,!0}async nextBatchAsArcadeFeatures(e,t){let r=await this.nextBatch(e);return null==r?r:r.map(e=>h.Xj.createFromGraphicLikeObject(e.geometry,e.attributes,this._parent,t))}async nextBatch(e){let t={stack:[],error:void 0,hasError:!1};try{if(this._done)return null;if(e<=0)return[];if((0,o.mS)(t,await this._batchMutex.acquire(),!1),this._numAvailable>=e)return this._takeNFeatures(e);let r=[],s=e;do{let e=this._takeNFeatures(s);s-=e.length,r.push(e)}while(s>0&&await this._nextBatch());let i=r.flat();return i.length>0?i:null}catch(e){t.error=e,t.hasError=!0}finally{(0,o.hk)(t)}}async next(){let e={stack:[],error:void 0,hasError:!1};try{return this._done?null:((0,o.mS)(e,await this._batchMutex.acquire(),!1),this._numAvailable>=1||await this._nextBatch()?this._takeOneFeature():null)}catch(t){e.error=t,e.hasError=!0}finally{(0,o.hk)(e)}}}var d=r(33325),g=r(80609),m=r(50145),f=r(71163),p=r(5479),y=r(89696),_=r(16930),b=r(95466);function v(e){switch(e){case"esriSpatialRelIntersects":return{spatialRelationship:"intersects",relationParameter:null};case"esriSpatialRelContains":return{spatialRelationship:"contains",relationParameter:null};case"esriSpatialRelOverlaps":return{spatialRelationship:"overlaps",relationParameter:null};case"esriSpatialRelWithin":return{spatialRelationship:"within",relationParameter:null};case"esriSpatialRelTouches":return{spatialRelationship:"touches",relationParameter:null};case"esriSpatialRelCrosses":return{spatialRelationship:"crosses",relationParameter:null};case"esriSpatialRelEnvelopeIntersects":return{spatialRelationship:"envelope-intersects",relationParameter:null};default:if(e.includes("esriSpatialRelRelation"))return{spatialRelationship:"relation",relationParameter:e.split(":")[1]};throw new l.dr("NeverReach")}}function T(e,t){for(let r of e)null!=r.geometry&&(r.geometry.spatialReference??=t)}const w=Object.freeze({ordered:!0,filterApplied:!0,spatialFilterApplied:!0,features:Object.freeze({next:()=>Promise.resolve({done:!0,value:void 0}),[Symbol.asyncIterator](){return this}})});class A{constructor(){this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._parent=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=7,this._databaseTypeProbed=null,this._loadPromise=null,this._allFeatures=null,this._fieldsIndex=null,this.typeIdField=null,this.types=null,this.subtypeField=null,this.subtypes=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1}_ensureLoaded(){return this.load()}load(){return null===this._loadPromise&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){return await(this._parent?.load()),this._initialiseFeatureSet(),this}_initialiseFeatureSet(){null===this._parent?(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new _.A({wkid:4326}),this.geometryType=d.ik.point):(this.fields=this._parent.fields.slice(),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)}getField(e,t){return e=e.toLowerCase(),(t||this.fields).find(t=>t.name.toLowerCase()===e)}getFieldsIndex(){return null===this._fieldsIndex&&(this._fieldsIndex=b.A.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return null===this._parent?Math.min(this._maxProcessing,this._maxQueryRate()):Math.min(this._maxProcessing,this._parent._maxProcessingRate())}_maxQueryRate(){return null===this._parent?this._maxQuery:Math.max(this._maxQuery,this._parent._maxQueryRate())}nativeCapabilities(){return this._parent.nativeCapabilities()}get _hasCachedFeatures(){return null!=this._allFeatures}async queryAll(e){this._allFeatures??=this._queryAll().then(e=>(0,p.N5)(e));let t=(await this._allFeatures)();return null==e||e===i._?t:async function*(){for await(let r of t)(0,l.dZ)(e),yield r}()}async databaseType(){if(7===this._databaseType){if(null!==n.A.applicationCache){let e=n.A.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==e)return e}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),null!==n.A.applicationCache&&n.A.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(e){throw null!==n.A.applicationCache&&n.A.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),e}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){for(let e of[{dbType:2,probeSql:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{dbType:3,probeSql:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{dbType:1,probeSql:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}])if(!0===await this._runDatabaseProbe(e.probeSql))return e.dbType;return 1}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(null!==this._parent)return this._parent._runDatabaseProbe(e);throw new l.dr("NotImplemented")}isTable(){return this._parent?.isTable()??!1}async first(e){if(this._hasCachedFeatures)return this.iterator(e).next();let t=await this.query({limit:1,abortSignal:e});for await(let e of t.features)if(e.length>0)return s.A.fromJSON(e[0]);return null}async isEmpty(e){return this._totalCount>=0?0===this._totalCount:null==await this.first(e)}async calculateStatistic(e,t,r,s){await this._ensureLoaded();let i=await this.queryStat({stat:e,field:t,limit:r,abortSignal:s});return!1===i.calculated&&(i=await this._manualStat(e,t,r,s)),i.result}async _manualStat(e,t,r,s){let i=null;switch(e.toLowerCase()){case"count":{if(this._totalCount>=0)return{calculated:!0,result:this._totalCount};let e=await this.queryAll(s),t=0;for await(let r of e)t+=r.length;return this._totalCount=t,{calculated:!0,result:t}}case"distinct":return i=await(0,m.dM)(this,t,r,s),{calculated:!0,result:i};case"avg":case"mean":return i=await(0,m._X)(this,t,"avg",s),t&&!(0,g.DA)(t)&&"integer"===(0,g.IY)(t,this.fields)?{calculated:!0,result:null==i?null:Math.trunc(i)}:{calculated:!0,result:i};case"stdev":return i=await(0,m._X)(this,t,"stddev",s),{calculated:!0,result:i};case"variance":return i=await(0,m._X)(this,t,"var",s),{calculated:!0,result:i};case"sum":return i=await(0,m._X)(this,t,"sum",s),{calculated:!0,result:i};case"min":return i=await(0,m._X)(this,t,"min",s),{calculated:!0,result:i};case"max":return i=await(0,m._X)(this,t,"max",s),{calculated:!0,result:i};default:return{calculated:!0,result:0}}}iterator(e){return new c(this,e)}async sumArea(e,t,r){let s=0;for await(let i of await this.queryAll(r))for(let r of i)null!=r.geometry&&(s+=null==t?await(0,f.C)("area",[r.geometry,(0,a.b)(this.spatialReference),e]):await(0,f.C)("geodeticArea",[r.geometry,(0,a.b)(this.spatialReference),e,t]));return s}async sumLength(e,t,r){let s=0;for await(let i of await this.queryAll(r))for(let r of i)null!=r.geometry&&(s+=null==t?await(0,f.C)("length",[r.geometry,(0,a.b)(this.spatialReference),e]):await(0,f.C)("geodeticLength",[r.geometry,(0,a.b)(this.spatialReference),e,t]));return s}async count(e){return await this.load(),this.calculateStatistic("count",y.A.create("1",{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),-1,e??i._)}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,r,s,i){return this._parent.queryAttachments(e,t,r,s,i)}serviceUrl(){return this._parent.serviceUrl()}subtypeMetadata(){return this.subtypeField&&this.subtypes?{subtypeField:this.subtypeField,subtypes:this.subtypes?this.subtypes.map(e=>({name:e.name,code:e.code})):[]}:this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map(e=>({name:e.name,code:e.id})):[]}:null}relationshipMetadata(){return this._parent.relationshipMetadata()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){let e=[];for(let t of this.fields)e.push((0,d.nE)(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:void 0===d.yT[this.geometryType]?"esriGeometryNull":d.yT[this.geometryType],fields:e}}async convertToText(e,t){return"schema"===e?(await this._ensureLoaded(),JSON.stringify(this.schema())):"featureset"===e?JSON.stringify(await this.castAsJsonAsync(t)):this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return this._parent.getRootFeatureSet()}getDataSourceFeatureSet(){return null===this._parent?this:this._parent.getDataSourceFeatureSet()}castAsJson(){return{type:"FeatureSet"}}async castAsJsonAsync(e=null){await this._ensureLoaded();let t=[];for await(let r of await this.queryAll(e))for(let e of r){let r=e.attributes,s=null;if(null!=e.geometry)if(e.geometry.spatialReference){let{spatialReference:t,...r}=e.geometry;s=r}else s=e.geometry;t.push({geometry:s,attributes:r})}return{...this.schema(),features:t,spatialReference:this.spatialReference?.toJSON()??null}}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){return this._parent?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._parent?.dateFieldsTimeZone??null}get dateFieldsTimeZoneDefaultUTC(){return this.datesInUnknownTimezone?"unknown":this.dateFieldsTimeZone||"UTC"}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){return this._parent?.editFieldsInfo??null}get timeInfo(){return this._parent?.timeInfo??null}getFeatureSetInfo(){return this._parent?this._parent.getFeatureSetInfo():Promise.resolve(null)}}class S extends A{constructor(){super(...arguments),this._parent=null}getRootFeatureSet(){return this}}},23732(e,t,r){r.d(t,{A:()=>s});class s{static{this.applicationCache=null}constructor(){this._databaseTypeMetaData={},this._layerInfo={}}clearDatabaseType(e){void 0===this._databaseTypeMetaData[e]&&delete this._databaseTypeMetaData[e]}getDatabaseType(e){return"MUSTBESET"===e||void 0===this._databaseTypeMetaData[e]?null:this._databaseTypeMetaData[e]}setDatabaseType(e,t){this._databaseTypeMetaData[e]=t}getLayerInfo(e){return void 0===this._layerInfo[e]?null:this._layerInfo[e]}setLayerInfo(e,t){this._layerInfo[e]=t}clearLayerInfo(e){void 0!==this._layerInfo[e]&&delete this._layerInfo[e]}}},87449(e,t,r){r.d(t,{dZ:()=>n,dr:()=>a});var s=r(799);const i={Cancelled:"Cancelled",InvalidStatResponse:"Invalid statistics response from service",InvalidRequest:"Invalid request",RequestFailed:"Request failed - {reason}",MissingFeatures:"Missing features",AggregationFieldNotFound:"Aggregation field not found",DataElementsNotFound:"Data elements not found on service",NeverReach:"Encountered unreachable logic",NotImplemented:"Not implemented"};class a extends Error{constructor(e,t){super((0,s.HC)(i[e],t)),this.declaredRootClass="esri.arcade.featureset.support.featureseterror",Error.captureStackTrace&&Error.captureStackTrace(this,a)}}function n(e){if(null!=e&&e?.aborted)throw new a("Cancelled")}},80609(e,t,r){r.d(t,{C6:()=>v,DA:()=>C,F1:()=>_,F6:()=>f,IY:()=>T,Ju:()=>I,Kb:()=>g,Mi:()=>u,Nf:()=>y,R8:()=>p,YY:()=>h,bD:()=>c,bm:()=>b,kg:()=>d,oj:()=>F});var s=r(66131),i=r(33325),a=r(1262),n=r(15032),l=r(89696),o=r(34747);function h(e,t){return m(e?.parseTree,t,e?.parameters)}function u(e,t,r){return m(e,t,r)}function c(e,t,r,s){let i=m(e.parseTree,0,e.parameters,t,r);return l.A.create(i,{fieldsIndex:s,timeZone:e.timeZone,currentUser:e.currentUser})}function d(e,t,r="AND"){return l.A.create("(("+h(e,0)+")"+r+"("+h(t,0)+"))",{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser})}function g(e){return!0===e.delimited?`"${e.column.split('"').join('""')}"`:e.column}function m(e,t,r,s=null,n=null){let l,o,h,u;switch(e.type){case"interval":return F(m(e.value,t,r,s,n),e.qualifier,e.op);case"case-expression":{let i=" CASE ";"simple"===e.format&&(i+=m(e.operand,t,r,s,n));for(let a=0;a<e.clauses.length;a++)i+=" WHEN "+m(e.clauses[a].operand,t,r,s,n)+" THEN "+m(e.clauses[a].value,t,r,s,n);return null!==e.else&&(i+=" ELSE "+m(e.else,t,r,s,n)),i+=" END ",i}case"parameter":{let s=r[e.value.toLowerCase()];if("string"==typeof s)return"'"+r[e.value.toLowerCase()].toString().replaceAll("'","''")+"'";if((0,i.$P)(s)||(0,i.Lk)(s))return b(s,t);if((0,i.eg)(s))return _(s,t);if((0,i.rX)(s))return p(s,t);if((0,i.f0)(s))return y(s,t);if(Array.isArray(s)){let e=[];for(let r=0;r<s.length;r++)"string"==typeof s[r]?e.push("'"+s[r].toString().replaceAll("'","''")+"'"):(0,i.$P)(s[r])||(0,i.Lk)(s[r])?e.push(b(s[r],t)):(0,i.eg)(s[r])?e.push(_(s[r],t)):(0,i.rX)(s[r])?e.push(p(s[r],t)):(0,i.f0)(s[r])?e.push(y(s[r],t)):e.push(s[r].toString());return e}return s.toString()}case"expression-list":o=[];for(let i of e.value)o.push(m(i,t,r,s,n));return o;case"unary-expression":return" ( NOT "+m(e.expr,t,r,s,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+m(e.left,t,r,s,n)+" AND "+m(e.right,t,r,s,n)+") ";case"OR":return" ("+m(e.left,t,r,s,n)+" OR "+m(e.right,t,r,s,n)+") ";case"IS":if("null"!==e.right.type)throw new a.L("UnsupportedIsRhs");return" ("+m(e.left,t,r,s,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new a.L("UnsupportedIsRhs");return" ("+m(e.left,t,r,s,n)+" IS NOT NULL )";case"IN":return l=[],"expression-list"===e.right.type?(l=m(e.right,t,r,s,n)," ("+m(e.left,t,r,s,n)+" IN ("+l.join(",")+")) "):(u=m(e.right,t,r,s,n),Array.isArray(u)?" ("+m(e.left,t,r,s,n)+" IN ("+u.join(",")+")) ":" ("+m(e.left,t,r,s,n)+" IN ("+u+")) ");case"NOT IN":return l=[],"expression-list"===e.right.type?(l=m(e.right,t,r,s,n)," ("+m(e.left,t,r,s,n)+" NOT IN ("+l.join(",")+")) "):(u=m(e.right,t,r,s,n),Array.isArray(u)?" ("+m(e.left,t,r,s,n)+" NOT IN ("+u.join(",")+")) ":" ("+m(e.left,t,r,s,n)+" NOT IN ("+u+")) ");case"BETWEEN":return h=m(e.right,t,r,s,n)," ("+m(e.left,t,r,s,n)+" BETWEEN "+h[0]+" AND "+h[1]+" ) ";case"NOTBETWEEN":return h=m(e.right,t,r,s,n)," ("+m(e.left,t,r,s,n)+" NOT BETWEEN "+h[0]+" AND "+h[1]+" ) ";case"LIKE":return""===e.escape?" ("+m(e.left,t,r,s,n)+" LIKE "+m(e.right,t,r,s,n)+") ":" ("+m(e.left,t,r,s,n)+" LIKE "+m(e.right,t,r,s,n)+" ESCAPE '"+e.escape+"') ";case"NOT LIKE":return""===e.escape?" ("+m(e.left,t,r,s,n)+" NOT LIKE "+m(e.right,t,r,s,n)+") ":" ("+m(e.left,t,r,s,n)+" NOT LIKE "+m(e.right,t,r,s,n)+" ESCAPE '"+e.escape+"') ";case"<>":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+m(e.left,t,r,s,n)+" "+e.operator+" "+m(e.right,t,r,s,n)+") ";case"||":return" ("+m(e.left,t,r,s,n)+" "+(2===t?"+":e.operator)+" "+m(e.right,t,r,s,n)+") "}throw new a.L("UnsupportedOperator",{operator:e.operator});case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return v(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return s&&s.toLowerCase()===e.column.toLowerCase()?"("+n+")":g(e);case"data-type":return e.value;case"function":{let i=m(e.args,t,r,s,n);return f(e.name,i,t)}}throw new a.L("UnsupportedSyntax",{node:e.type})}function f(e,t,r){switch(e.toLowerCase().trim()){case"cos":case"sin":case"tan":case"cosh":case"tanh":case"sinh":case"acos":case"asin":case"atan":case"floor":case"log10":case"log":case"abs":if(1!==t.length)throw new a.L("InvalidFunctionParameters",{function:e.toLowerCase().trim()});return`${e.toUpperCase().trim()}(${t[0]})`;case"ceiling":case"ceil":if(1!==t.length)throw new a.L("InvalidFunctionParameters",{function:"ceiling"});return"CEILING("+t[0]+")";case"mod":case"power":case"nullif":if(2!==t.length)throw new a.L("InvalidFunctionParameters",{function:e.toLowerCase().trim()});return`${e.toUpperCase().trim()}(${t[0]},${t[1]})`;case"round":if(2===t.length)return"ROUND("+t[0]+","+t[1]+")";if(1===t.length)return"ROUND("+t[0]+")";throw new a.L("InvalidFunctionParameters",{function:"round"});case"truncate":if(t.length<1||t.length>2)throw new a.L("InvalidFunctionParameters",{function:"truncate"});return 2===r?"ROUND("+t[0]+(1===t.length?"0":","+t[1])+",1)":"TRUNCATE("+t[0]+(1===t.length?")":","+t[1]+")");case"char_length":case"len":if(1!==t.length)throw new a.L("InvalidFunctionParameters",{function:"char_length"});switch(r){case 2:return"LEN("+t[0]+")";case 3:return"LENGTH("+t[0]+")";default:return"CHAR_LENGTH("+t[0]+")"}case"coalesce":case"concat":{if(t.length<1)throw new a.L("InvalidFunctionParameters",{function:e.toLowerCase()});let r=e.toUpperCase().trim()+"(";for(let e=0;e<t.length;e++)0!==e&&(r+=","),r+=t[e];return r+=")",r}case"lower":case"lcase":if(1!==t.length)throw new a.L("InvalidFunctionParameters",{function:"lower"});return"LOWER("+t[0]+")";case"upper":case"ucase":if(1!==t.length)throw new a.L("InvalidFunctionParameters",{function:"upper"});return"UPPER("+t[0]+")";case"substring":{let e="";switch(r){case 3:return e="SUBSTR("+t[0]+","+t[1],3===t.length&&(e+=","+t[2]),e+=")",e;case 2:return e=3===t.length?"SUBSTRING("+t[0]+","+t[1]+","+t[2]+")":"SUBSTRING("+t[0]+", "+t[1]+", LEN("+t[0]+") - "+t[1]+")",e;default:return e="SUBSTRING("+t[0]+" FROM "+t[1],3===t.length&&(e+=" FOR "+t[2]),e+=")",e}}case"extract":return"EXTRACT("+t[0].replaceAll("'","")+" FROM "+t[1]+")";case"cast":{let e="";switch(r){case 3:switch(t[1].type){case"date":e="DATE";break;case"float":e="DOUBLE";break;case"integer":e="INTEGER";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;case 4:switch(t[1].type){case"date":e="DATE";break;case"float":e="DOUBLE PRECISION";break;case"integer":e="INT";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;case 2:switch(t[1].type){case"date":e="DATE";break;case"float":e="FLOAT";break;case"integer":e="INT";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="DATETIME";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;default:switch(t[1].type){case"date":e="DATE";break;case"float":e="FLOAT";break;case"integer":e="INTEGER";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`}}}throw new a.L("InvalidFunctionParameters",{function:e})}function p(e,t){let r=e.toDateTime(),s=0===r.hour&&0===r.minute&&0===r.second&&0===r.millisecond;switch(t){case 6:case 0:case 1:return s?`date '${r.toFormat("yyyy-LL-dd")}'`:`timestamp '${r.toFormat("yyyy-LL-dd HH:mm:ss")}'`;case 3:return s?`TO_DATE('${r.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')`:`TO_DATE('${r.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;case 2:return`'${r.toFormat(s?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;case 5:return`#${r.toFormat(s?"LL-dd-yyyy":"LL-dd-yyyy HH:mm:ss")}#`;case 4:return`TIMESTAMP '${r.toFormat(s?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;default:return`timestamp '${r.toFormat("yyyy-LL-dd HH:mm:ss")}'`}}function y(e,t){switch(t){case 6:case 0:case 1:default:return e.toSQLWithKeyword();case 3:return`TO_DATE('${e.toFormat("Y-MM-DD")}'`;case 2:return`'${e.toFormat("Y-MM-DD")}'`;case 5:return`#${e.toFormat("Y-MM-DD")}#`;case 4:return`TIMESTAMP '${e.toFormat("Y-MM-DD")}'`}}function _(e,t){switch(e instanceof n.k&&(e=e.toStorageString()),t){case 3:return`TO_DATE('${e}', 'HH24:MI:SS')`;case 2:return`'${e}'`;default:return`time '${e}'`}}function b(e,t){return p(s.lY.dateTimeToArcadeDate((0,i.Lk)(e)?e:o.c9.fromJSDate(e)),t)}function v(e,t){switch(t){case 6:case 0:case 1:case 3:case 5:default:return"date"===e?"CURRENT_DATE":"time"===e?"CURRENT_TIME":"CURRENT_TIMESTAMP";case 2:return"date"===e?"CAST(GETDATE() AS DATE)":"time"===e?"CAST(GETDATE() AS TIME)":"GETDATE()";case 4:return"date"===e?"CURRENT_DATE":"time"===e?"LOCALTIME":"CURRENT_TIMESTAMP"}}function T(e,t,r={}){let s={},i={},a={esriFieldTypeSmallInteger:"integer",esriFieldTypeInteger:"integer",esriFieldTypeBigInteger:"integer",esriFieldTypeSingle:"double",esriFieldTypeDouble:"double",esriFieldTypeString:"string",esriFieldTypeTimeOnly:"time-only",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimestampOffset:"timestamp-offset",esriFieldTypeDate:"date",esriFieldTypeOID:"integer",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"guid",oid:"integer",long:"integer","small-integer":"integer",integer:"integer","big-integer":"integer",single:"double","time-only":"time-only","date-only":"date-only","timestamp-offset":"timestamp-offset",double:"double",date:"date",guid:"guid","global-id":"guid",string:"string"};for(let e of t){let t=e.type?a[e.type]:void 0;s[e.name.toLowerCase()]=void 0===t?"":t}for(let e in r){let t=a[r[e]];i[e.toLowerCase()]=void 0===t?"":t}switch(w(s,e.parseTree,e.parameters,i)){case"double":return"double";case"integer":return"integer";case"date":return"date";case"date-only":return"date-only";case"time-only":return"time-only";case"timestamp-offset":return"timestamp-offset";case"string":return"string";case"global-id":case"guid":return"guid"}return""}function w(e,t,r,s){let n;switch(t.type){case"interval":return"integer";case"case-expression":{let i=[];if("simple"===t.format){for(let a=0;a<t.clauses.length;a++)i.push(w(e,t.clauses[a].value,r,s));null!==t.else&&i.push(w(e,t.else,r,s))}else{for(let a=0;a<t.clauses.length;a++)i.push(w(e,t.clauses[a].value,r,s));null!==t.else&&i.push(w(e,t.else,r,s))}return S(i)}case"parameter":{let e=s[t.value.toLowerCase()];if(void 0===e&&r){let e=r[t.value.toLowerCase()];if(null==e)return"";if("string"==typeof e||e instanceof String)return"string";if("boolean"==typeof e)return"boolean";if((0,i.$P)(e)||(0,i.rX)(e))return"date";if((0,i.f0)(e))return"date-only";if((0,i.eg)(e))return"time-only";if("number"==typeof e)return e%1==0?"integer":"double"}return void 0===e?"":e}case"expression-list":{let i=[];for(let a of t.value)i.push(w(e,a,r,s));return i}case"unary-expression":return"boolean";case"binary-expression":switch(t.operator){case"AND":case"OR":case"IN":case"NOT IN":case"BETWEEN":case"NOTBETWEEN":case"LIKE":case"NOT LIKE":case"<>":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if("null"!==t.right.type)throw new a.L("UnsupportedIsRhs");return"boolean";case"*":case"-":case"+":case"/":return S([w(e,t.left,r,s),w(e,t.right,r,s)]);case"||":return"string";default:throw new a.L("UnsupportedOperator",{operator:t.operator})}case"null":return"";case"boolean":return"boolean";case"string":return"string";case"number":return null===t.value?"":t.value%1==0?"integer":"double";case"date":return"date";case"timestamp":return t.withtimezone?"timestamp-offset":"date";case"time":return"time-only";case"current-time":return"time"===t.mode?"time-only":"date";case"current-user":return"string";case"column-reference":{let r=e[t.column.toLowerCase()];return void 0===r?"":r}case"function":switch(t.name.toLowerCase()){case"cast":switch(t.args?.value[1]?.value.type??""){case"integer":case"smallint":return"integer";case"real":case"float":return"double";case"date":case"timestamp":return!0===t.args?.value[1]?.value?.withtimezone?"timestamp-offset":"date";case"time":return"time-only";case"varchar":return"string";default:return""}case"position":case"extract":case"char_length":case"mod":return"integer";case"round":if(n=w(e,t.args,r,s),Array.isArray(n)){if(n.length<=0)return"double";n=n[0]}return n;case"sign":return"integer";case"ceiling":case"floor":case"abs":return n=w(e,t.args,r,s),Array.isArray(n)&&(n=S(n)),"integer"===n||"double"===n?n:"double";case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"cosh":case"sinh":case"tanh":case"power":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string";case"truncate":return"double";case"nullif":case"coalesce":return n=w(e,t.args,r,s),Array.isArray(n)?n.length>0?n[0]:"":n}return""}throw new a.L("UnsupportedSyntax",{node:t.type})}const A={boolean:1,string:2,integer:3,double:4,date:5};function S(e){if(e){let t="";for(let r of e)""!==r&&(t=""===t||A[t]<A[r]?r:t);return t}return""}function I(e,t){return L(e.parseTree,t)}function C(e){return"column-reference"===e?.parseTree.type}function L(e,t){if(null==e)return!1;switch(e.type){case"when-clause":return L(e.operand,t)||L(e.value,t);case"case-expression":for(let r of e.clauses)if(L(r,t))return!0;return!!("simple"===e.format&&L(e.operand,t)||null!==e.else&&L(e.else,t));case"parameter":case"null":case"boolean":case"date":case"timestamp":case"time":case"string":case"number":return!1;case"expression-list":for(let r of e.value)if(L(r,t))return!0;return!1;case"unary-expression":return L(e.expr,t);case"binary-expression":return L(e.left,t)||L(e.right,t);case"column-reference":return t.toLowerCase()===e.column.toLowerCase();case"function":return L(e.args,t)}return!1}function E(e){let t="";return t+=e.period.toUpperCase(),t}function F(e,t,r){let s="";return s="interval-period"===t.type?E(t):E(t.start)+" TO "+E(t.end),"INTERVAL "+r+" "+e+" "+s}},50145(e,t,r){r.d(t,{Dp:()=>o,_X:()=>h,dM:()=>u});var s=r(87449),i=r(74639),a=r(44729),n=r(55612),l=r(15032);function o(e){switch(e.toLowerCase()){case"distinct":return"distinct";case"avg":case"mean":return"avg";case"min":return"min";case"sum":return"sum";case"max":return"max";case"stdev":case"stddev":return"stddev";case"var":case"variance":return"var";case"count":return"count"}return null}async function h(e,t,r,a){let n=await e.queryAll(a),l=[];if(null!=t){let e={ticker:0};for await(let r of n){if(e.ticker+=r.length,e.ticker>=100&&(e.ticker=0,await new Promise(e=>{setTimeout(e,0)})),a?.aborted)throw new s.dr("Cancelled");for(let e of r)l.push(t.calculateValue(e))}}return(0,i.s)(r,[l])}async function u(e,t,r=1e3,i=null){if(null==t)return[];let o=await e.queryAll(i),h=[],u=new Set,c={ticker:0};for await(let e of o){if(c.ticker+=e.length,c.ticker>=100&&(c.ticker=0,await new Promise(e=>{setTimeout(e,0)})),i?.aborted)throw new s.dr("Cancelled");for(let s of e){let e=t.calculateValue(s),i=e;if(e instanceof a.n?i="!!DATEONLY!!-"+e.toString():e instanceof n.g?i="!!TSOFFSETONLY!!-"+e.toString():e instanceof l.k?i="!!TIMEONLY!!-"+e.toString():e instanceof Date&&(i="!!DATE!!-"+e.toString()),null!=e&&(u.has(i)||(h.push(e),u.add(i))),h.length>=r&&-1!==r)return h}}return h}},71163(e,t,r){r.d(t,{C:()=>o});var s=r(29953);let i,a,n=!1;function l(){return i??=(0,s.ho)("arcadeGeometryOperatorsWorker").then(e=>{a=e,n=!0,i=void 0})}async function o(e,t){return n?a.apply("invokeGeometryOp",[e,t]):(await l(),o(e,t))}},69540(e,t,r){var s=r(32198),i=r(69622),a=(r(44208),r(4718)),n=(r(53966),r(97768)),l=r(88620),o=r(64108);const h=Symbol("ClonableMixin"),u=e=>{var t;let r=e,i=class extends r{constructor(){super(...arguments),this[t]=!0}static{t=h}clone(e){let t=(0,l.oY)(this);(0,n.Lw)(t,"unable to clone instance of non-accessor class");let r=t.metadata,s=t.store,i={},o=new Map;for(let t in r){let n=r[t],l=s?.originOf(t),h=n.clonable;if(n.readOnly||!1===h||7!==l&&0!==l&&5!==l&&4!==l)continue;let u=this[t],c=null;if("function"==typeof h)c=h(u,e);else if("reference"===h)c=u;else if(c=(0,a.TU)(u,e),null!=u&&null==c)continue;0===l?o.set(t,c):i[t]=c}let h=new(0,Object.getPrototypeOf(this).constructor)(i);if(o.size){let e=(0,l.oY)(h)?.store;if(e)for(let[t,r]of o)e.set(t,r,0)}return h}};return i=(0,s.Cg)([(0,o.$)("esri.core.Clonable")],i),i},c=u(i.A);r.d(t,["OU",0,u,"Pw",0,c])},7762(e,t,r){var s,i=r(32198),a=r(98291),n=r(4576),l=r(65529),o=r(36563),h=r(4718),u=r(53966),c=r(93687),d=r(76030),g=r(78888),m=r(62788),f=r(10107),p=r(7695),y=r(64108),_=r(95488),b=r(12195);class v{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class T{constructor(e,t,r,s,i){this.target=e,this.added=t,this.removed=r,this.start=s,this.deleteCount=i}}const w=new c.A(()=>new v,void 0,e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1});function A(e){e&&"object"==typeof e&&"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}function S(e){return e?e instanceof x?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function I(e){if(e?.length)return e[0]}function C(e,t,r,s){let i=Math.min(e.length-r,t.length-s),a=0;for(;a<i&&e[r+a]===t[s+a];)a++;return a}function L(e,t,r,s){t&&t.forEach((t,i,a)=>{e.push(t),L(e,r.call(s,t,i,a),r,s)})}const E=new Set,F=new Set,M=new Set,N=new Map;let D=0,x=s=class extends l.nJ{static ofType(e){if(!e)return s;if(N.has(e))return N.get(e);let t=null;if("function"==typeof e)t=e.prototype.declaredClass;else if(e.base)t=e.base.prototype.declaredClass;else for(let r in e.typeMap){let s=e.typeMap[r].prototype.declaredClass;t?t+=` | ${s}`:t=s}let r=class extends s{};return(0,i.Cg)([(0,p.u)({Type:e,ensureType:"function"==typeof e?(0,g.dp)(e):(0,g.aq)(e)})],r.prototype,"itemType",void 0),r=(0,i.Cg)([(0,y.$)(`esri.core.Collection<${t}>`)],r),N.set(e,r),r}static isCollection(e){return null!=e&&e instanceof s}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._updating=!1,this._timer=null,this._observable=new _.I,this._length=0,this._items=[],Object.defineProperty(this,"uid",{value:D++})}normalizeCtorArgs(e){return e?(0,n.yc)(e)||e instanceof s?{items:e}:e:{}}destroy(){this._removeAllRaw(),this._timer&&this._timer.remove(),super.destroy(),this._notifications=null}*[Symbol.iterator](){yield*this.items}get length(){return this._length}set length(e){e>this._length?u.A.getLogger(this).error("#length=","Cannot increase the length of the collection by assigning to the length property."):this.splice(e,Math.max(0,this._length-e))}get items(){return(0,m.gc)(this._observable),this._items}set items(e){this._emitBeforeChanges(1)||(this._splice(0,this.length,S(e)),this._emitAfterChanges(1))}hasEventListener(e){return!this.destroyed&&("change"===e?this._chgListeners.length>0:super.hasEventListener(e))}on(e,t){if(this.destroyed)return(0,o.hA)();if("change"===e){let e=this._chgListeners,r={removed:!1,callback:t};return e.push(r),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),(0,o.hA)(()=>{r.removed=!0,e.splice(e.indexOf(r),1)})}return super.on(e,t)}once(e,t){let r="deref"in t?()=>t.deref():()=>t,s=this.on(e,e=>{r()?.call(null,e),s.remove()});return s}add(e,t){if((0,m.gc)(this._observable),this._emitBeforeChanges(1))return this;let r=this.getNextIndex(t??null);return this._splice(r,0,[e]),this._emitAfterChanges(1),this}addMany(e,t=this._items.length){if((0,m.gc)(this._observable),!e?.length||this._emitBeforeChanges(1))return this;let r=this.getNextIndex(t);return this._splice(r,0,S(e)),this._emitAfterChanges(1),this}at(e){if((0,m.gc)(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if((0,m.gc)(this._observable),!this.length||this._emitBeforeChanges(2))return[];let e=this._removeAllRaw();return this._emitAfterChanges(2),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return(0,m.gc)(this._observable),this._createNewInstance({items:this._items.map(h.o8)})}concat(...e){(0,m.gc)(this._observable);let t=e.map(S);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if((0,m.gc)(this._observable),!this.length||this._emitBeforeChanges(2))return;let r=this._splice(0,this.length),s=r.length;for(let i=0;i<s;i++)e.call(t,r[i],i,r);this._emitAfterChanges(2)}destroyAll(){this.drain(A)}destroyMany(e){let t=this.removeMany(e);return t.forEach(A),t}every(e,t){return(0,m.gc)(this._observable),this._items.every(e,t)}filter(e,t){(0,m.gc)(this._observable);let r=2===arguments.length?this._items.filter(e,t):this._items.filter(e);return this._createNewInstance({items:r})}find(e,t){return(0,m.gc)(this._observable),this._items.find(e,t)}findIndex(e,t){return(0,m.gc)(this._observable),this._items.findIndex(e,t)}findLast(e,t){return(0,m.gc)(this._observable),this._items.findLast(e,t)}findLastIndex(e,t){return(0,m.gc)(this._observable),this._items.findLastIndex(e,t)}flatten(e,t){(0,m.gc)(this._observable);let r=[];return L(r,this,e,t),new s(r)}forEach(e,t){return(0,m.gc)(this._observable),this._items.forEach(e,t)}getItemAt(e){return(0,m.gc)(this._observable),this._items[e]}getNextIndex(e){(0,m.gc)(this._observable);let t=this.length;return e??=t,e<0?e=0:e>t&&(e=t),e}includes(e,t=0){return(0,m.gc)(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return(0,m.gc)(this._observable),this._items.indexOf(e,t)}join(e=","){return(0,m.gc)(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return(0,m.gc)(this._observable),this._items.lastIndexOf(e,t)}map(e,t){(0,m.gc)(this._observable);let r=this._items.map(e,t);return new s({items:r})}reorder(e,t=this.length-1){(0,m.gc)(this._observable);let r=this.indexOf(e);if(-1!==r){if(t<0?t=0:t>=this.length&&(t=this.length-1),r!==t){if(this._emitBeforeChanges(4))return e;this._splice(r,1),this._splice(t,0,[e]),this._emitAfterChanges(4)}return e}}pop(){if((0,m.gc)(this._observable),!this.length||this._emitBeforeChanges(2))return;let e=I(this._splice(this.length-1,1));return this._emitAfterChanges(2),e}push(...e){return(0,m.gc)(this._observable),this._emitBeforeChanges(1)||(this._splice(this.length,0,e),this._emitAfterChanges(1)),this.length}reduce(e,t){(0,m.gc)(this._observable);let r=this._items;return 2===arguments.length?r.reduce(e,t):r.reduce(e)}reduceRight(e,t){(0,m.gc)(this._observable);let r=this._items;return 2===arguments.length?r.reduceRight(e,t):r.reduceRight(e)}remove(e){return(0,m.gc)(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if((0,m.gc)(this._observable),e<0||e>=this.length||this._emitBeforeChanges(2))return;let t=I(this._splice(e,1));return this._emitAfterChanges(2),t}removeMany(e){if((0,m.gc)(this._observable),!e?.length||this._emitBeforeChanges(2))return[];let t=e instanceof s?e.toArray():e,r=this._items,i=[],a=t.length;for(let e=0;e<a;e++){let s=t[e],a=r.indexOf(s);if(a>-1){let s=1+C(t,r,e+1,a+1),n=this._splice(a,s);n&&n.length>0&&i.push.apply(i,n),e+=s-1}}return this._emitAfterChanges(2),i}reverse(){if((0,m.gc)(this._observable),this._emitBeforeChanges(4))return this;let e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(4),this}shift(){if((0,m.gc)(this._observable),!this.length||this._emitBeforeChanges(2))return;let e=I(this._splice(0,1));return this._emitAfterChanges(2),e}slice(e=0,t=this.length){return(0,m.gc)(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return(0,m.gc)(this._observable),this._items.some(e,t)}sort(e){if((0,m.gc)(this._observable),!this.length||this._emitBeforeChanges(4)||!this._requiresSort(e))return this;let t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(4),this}_requiresSort(e=(e,t)=>e===t?0:e<t?-1:1){let t=this.length-1;for(let r=0;r<t;r++)if(e(this.items[r],this.items[r+1])>0)return!0;return!1}splice(e,t,...r){(0,m.gc)(this._observable),1===arguments.length&&(t=this.length),t??=0;let s=(t?2:0)|!!r.length;if(this._emitBeforeChanges(s))return[];let i=this._splice(e,t,r)||[];return this._emitAfterChanges(s),i}toArray(){return(0,m.gc)(this._observable),this._items.slice()}toJSON(e){return(0,m.gc)(this._observable),this.toArray().map(t=>(0,b.W)(t)?t.toJSON(e):t)}toLocaleString(){return(0,m.gc)(this._observable),this._items.toLocaleString()}toString(){return(0,m.gc)(this._observable),this._items.toString()}unshift(...e){return(0,m.gc)(this._observable),!e.length||this._emitBeforeChanges(1)||(this._splice(0,0,e),this._emitAfterChanges(1)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,r){let s,i,a=this._items,n=this.itemType;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._updating=!0,this._timer=(0,d._)(()=>this._dispatchChange())),e<0&&(e+=this.length),t){if(i=a.splice(e,t),this.hasEventListener("before-remove")){let t=w.acquire();t.target=this,t.cancellable=!0;for(let r=0,n=i.length;r<n;r++)s=i[r],t.reset(s),this.emit("before-remove",t),t.defaultPrevented&&(i.splice(r,1),a.splice(e,0,s),e+=1,--r,--n);w.release(t)}if(this._length=this._items.length,this.hasEventListener("after-remove")){let e=w.acquire();e.target=this,e.cancellable=!1;let t=i.length;for(let r=0;r<t;r++)e.reset(i[r]),this.emit("after-remove",e);w.release(e)}}if(r?.length){if(n){let e=[];for(let t of r){let r=n.ensureType(t);(null!=r||null==t)&&e.push(r)}r=e}let t=this.hasEventListener("before-add"),s=this.hasEventListener("after-add"),i=e===this.length;if(t||s){let n=w.acquire();n.target=this,n.cancellable=!0;let l=w.acquire();l.target=this,l.cancellable=!1;for(let o of r)t?(n.reset(o),this.emit("before-add",n),n.defaultPrevented||(i?a.push(o):a.splice(e++,0,o),this._length=a.length,s&&(l.reset(o),this.emit("after-add",l)))):(i?a.push(o):a.splice(e++,0,o),this._length=a.length,l.reset(o),this.emit("after-add",l));w.release(l),w.release(n)}else{if(i)for(let e of r)a.push(e);else a.splice(e,0,...r);this._length=a.length}}if((r?.length||i?.length)&&this._notifyChangeEvent(r,i),this.hasEventListener("after-splice")){let s=new T(this,r,i,e,t);this.emit("after-splice",s)}return i}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){let r=w.acquire();r.target=this,r.cancellable=!0,r.type=e,this.emit("before-changes",r),t=r.defaultPrevented,w.release(r)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){let t=w.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),w.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}get updating(){return this._updating}_dispatchChange(){if(this._timer&&=(this._timer.remove(),null),this._updating=!1,!this._notifications)return;let e=this._notifications;this._notifications=null;for(let t of e){let e=t.changes;E.clear(),F.clear(),M.clear();for(let{added:t,removed:r}of e){if(t)if(0===M.size&&0===F.size)for(let e of t)E.add(e);else for(let e of t)F.has(e)?(M.add(e),F.delete(e)):M.has(e)||E.add(e);if(r)if(0===M.size&&0===E.size)for(let e of r)F.add(e);else for(let e of r)E.has(e)?E.delete(e):(M.delete(e),F.add(e))}let r=a.A.acquire();E.forEach(e=>{r.push(e)});let s=a.A.acquire();F.forEach(e=>{s.push(e)});let i=this._items,n=t.items,l=a.A.acquire();if(M.forEach(e=>{n.indexOf(e)!==i.indexOf(e)&&l.push(e)}),t.listeners&&(r.length||s.length||l.length)){let e={target:this,added:r,removed:s,moved:l},i=t.listeners.length;for(let r=0;r<i;r++){let s=t.listeners[r];s.removed||s.callback.call(this,e)}}a.A.release(r),a.A.release(s),a.A.release(l)}E.clear(),F.clear(),M.clear()}};(0,i.Cg)([(0,f.MZ)()],x.prototype,"_updating",void 0),(0,i.Cg)([(0,f.MZ)()],x.prototype,"_length",void 0),(0,i.Cg)([(0,f.MZ)()],x.prototype,"length",null),(0,i.Cg)([(0,f.MZ)()],x.prototype,"items",null),(0,i.Cg)([(0,f.MZ)({readOnly:!0})],x.prototype,"updating",null),x=s=(0,i.Cg)([(0,y.$)("esri.core.Collection")],x);const O=x;r.d(t,["A",0,O])},4902(e,t,r){var s=r(32198),i=r(64108);let a=0;const n=e=>{let t=e,r=class extends t{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+a++})}};return r=(0,s.Cg)([(0,i.$)("esri.core.Identifiable")],r),r};n(class{}),r.d(t,["s",0,n])},7695(e,t,r){function s(e){return(t,r)=>{t[r]=e}}r.d(t,{u:()=>s})},36708(e,t,r){r.d(t,{C_:()=>d,on:()=>c,wB:()=>o,z7:()=>h});var s=r(37955),i=r(36563),a=r(97768),n=r(17676),l=r(14012);function o(e,t,r={}){return u(e,t,r,g)}function h(e,t,r={}){return u(e,t,r,m)}function u(e,t,r={},s){let i=null,n=r.once?(e,r)=>{s(e)&&((0,a.xt)(i),t(e,r))}:(e,r)=>{s(e)&&t(e,r)};if(i=(0,l.Cn)(e,n,r.sync,r.equals),r.initial){let t=e();n(t,t)}return i}function c(e,t,r,n={}){let l=null,h=null,u=null;function c(){l&&h&&(h.remove(),n.onListenerRemove?.(l),l=null,h=null)}function d(e){n.once&&n.once&&(0,a.xt)(u),r(e)}let g=o(e,(e,r)=>{c(),(0,s.wb)(e)&&(l=e,h=(0,s.on)(e,t,d),n.onListenerAdd?.(e))},{sync:n.sync,initial:!0});return u=(0,i.hA)(()=>{g.remove(),c()}),u}function d(e,t){return function(e,t,r){if((0,n.G4)(r))return Promise.reject((0,n.NK)());let s=e();if(t?.(s))return Promise.resolve(s);let l=null;function o(){l=(0,a.xt)(l)}return new Promise((s,a)=>{l=(0,i.vE)([(0,n.u7)(r,()=>{o(),a((0,n.NK)())}),u(e,e=>{o(),s(e)},{sync:!1,once:!0},t??g)])})}(e,m,t)}function g(e){return!0}function m(e){return!!e}r(80559),r.d(t,["OH",0,{sync:!0},"Vh",0,{initial:!0},"pc",0,{sync:!0,initial:!0}])},55156(e,t,r){r.d(t,{I:()=>i});const s=Symbol("idFieldsProviderSymbol");function i(e){return(t=e)&&s in t?e[s]:void 0;var t}r.d(t,["e",0,s])},97770(e,t,r){r.d(t,{Ey:()=>M,F8:()=>F,J2:()=>I,Yq:()=>L,_m:()=>C,iS:()=>E,wj:()=>N});var s=r(66552),i=r(73444),a=r(98623),n=r(34747);const l={dateStyle:void 0,year:void 0,month:void 0,day:void 0,weekday:void 0},o={timeStyle:void 0,hour12:void 0,hourCycle:void 0,hour:void 0,minute:void 0,second:void 0},h={timeZone:"UTC"},u={year:"numeric",month:"numeric",day:"numeric"},c={year:"numeric",month:"long",day:"numeric"},d={year:"numeric",month:"short",day:"numeric"},g={year:"numeric",month:"long",weekday:"long",day:"numeric"},m={hour:"numeric",minute:"numeric"},f={...m,second:"numeric"},p={hourCycle:"h23"},y={...m,...p},_={...f,...p},b={"short-date":u,"short-date-short-time":{...u,...m},"short-date-short-time-24":{...u,...y},"short-date-long-time":{...u,...f},"short-date-long-time-24":{...u,..._},"short-date-le":u,"short-date-le-short-time":{...u,...m},"short-date-le-short-time-24":{...u,...y},"short-date-le-long-time":{...u,...f},"short-date-le-long-time-24":{...u,..._},"long-month-day-year":c,"long-month-day-year-short-time":{...c,...m},"long-month-day-year-short-time-24":{...c,...y},"long-month-day-year-long-time":{...c,...f},"long-month-day-year-long-time-24":{...c,..._},"day-short-month-year":d,"day-short-month-year-short-time":{...d,...m},"day-short-month-year-short-time-24":{...d,...y},"day-short-month-year-long-time":{...d,...f},"day-short-month-year-long-time-24":{...d,..._},"long-date":g,"long-date-short-time":{...g,...m},"long-date-short-time-24":{...g,...y},"long-date-long-time":{...g,...f},"long-date-long-time-24":{...g,..._},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":m,"long-time":f},v=(0,s.O)()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),T={ar:"ar-u-nu-latn-ca-gregory",nn:"no-NN"};function w(){let e=(0,i.lR)();return(e&&T[e])??(0,i.QC)()}"mart"!==new Intl.DateTimeFormat("bs",{month:"long"}).formatToParts(new Date(2025,2)).find(({type:e})=>"month"===e)?.value.toLowerCase()&&(T.bs="sr-Latn-CS");let A=new WeakMap;const S=b["short-date-short-time"];function I(e){return b[e]}function C(e){let{dateStyle:t,timeStyle:r,hour12:s,year:i,month:a}=e,n={};return t?n.dateStyle=t:i&&(n.year=i,n.month=a||void 0),r&&!n.year&&(n.timeStyle=r,n.hour12="auto"===s?void 0:"always"===s),n}function L(e,t=S){return function(e){let t=A.get(e);if(!t){let r=w(),s=N(e.timeZone??"system"),i={...e,timeZone:s};t=new Intl.DateTimeFormat(r,i),A.set(e,t)}return t}(t).format(e)}function E(e,t=S){return L(new Date(e),{...t,...h,...o})}function F(e,t=S){return L(new Date(`1970-01-01T${e}Z`),{...t,...h,...l})}function M(e,t=S){let r=n.c9.fromISO(e,{setZone:!0});if(!r.isValid)return e;if(t.timeZone)return L(r.toJSDate(),t);let s=0===r.offset?"UTC":t.timeZone,i={...t,timeZone:s};return r.toLocaleString(i,{locale:w()})}function N(e){switch(e){case"system":return a.N;case a.L:return"UTC";default:return e}}(0,i.Ml)(()=>{A=new WeakMap}),r.d(t,["_v",0,v])},54339(e,t,r){function s(e,t){switch(t.type){case"object-id":case"unique-id-simple":return e.attributes[t.fieldName];case"unique-id-composite":{let r=[];for(let s of t.fieldNames)r.push(e.attributes[s]??null);return JSON.stringify(r)}}}function i(e,t){if("uniqueIdFields"in t&&t.uniqueIdFields?.length){if(1===t.uniqueIdFields.length)return e.attributes?.[t.uniqueIdFields[0]];let r=t.uniqueIdFields.map(t=>e.attributes?.[t]);return JSON.stringify(r)}return"objectIdField"in t&&t.objectIdField?e.attributes?.[t.objectIdField]:null}r.d(t,{W:()=>s,r:()=>i})}}]);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{DateOnly as e}from"./DateOnly.js";import{SqlError as t}from"./errorSupport.js";import{SqlTimeStampOffset as n}from"./SqlTimestampOffset.js";import{TimeOnly as r}from"./TimeOnly.js";import{DateTime as i}from"luxon";function a(e,n){let r=s[e.toLowerCase()];if(r==null)throw new t(`FunctionNotRecognized`);if(n.length<r.minParams||n.length>r.maxParams)throw new t(`InvalidParameterCount`,{name:e.toUpperCase()});return r.evaluate(n)}function o(e,t){let n=s[e.toLowerCase()];return n!=null&&t>=n.minParams&&t<=n.maxParams}const s={min:{minParams:1,maxParams:1,evaluate:e=>u(e[0],`min`)},max:{minParams:1,maxParams:1,evaluate:e=>u(e[0],`max`)},avg:{minParams:1,maxParams:1,evaluate:e=>c(e[0])},sum:{minParams:1,maxParams:1,evaluate:e=>d(e[0])},stddev:{minParams:1,maxParams:1,evaluate:e=>f(e[0])},count:{minParams:1,maxParams:1,evaluate:e=>e[0]==null?null:e[0].length},var:{minParams:1,maxParams:1,evaluate:e=>p(e[0])}};function c(e){if(e===null)return null;let n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a!==null){if(!l(a))throw new t(`InvalidValueForAggregateFunction`);r++,n+=a}}return r===0?null:n/e.length}function l(e){return typeof e==`number`}function u(t,a){if(t===null)return null;let o=null,s=null;for(let c of t){let t=c;t=e.isDateOnly(c)||r.isTimeOnly(c)?c.toNumber():i.isDateTime(c)?c.toMillis():n.isTimestampOffset(c)?c.toMilliseconds():c,(o===null||a===`max`&&s!==null&&t!==null&&s<=t||a===`min`&&s!==null&&t!==null&&s>=t)&&(o=c,s=t)}return o}function d(e){if(e===null)return null;let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i!==null){if(!l(i))throw new t(`InvalidValueForAggregateFunction`);n+=i}}return n}function f(e){if(e===null)return null;let t=p(e);return t===null?null:Math.sqrt(t)}function p(e){if(e===null||(e=e.filter(e=>e!==null),e.length===0))return null;let n=c(e);if(n===null)return null;let r=0;for(let i of e){if(!l(i))throw new t(`InvalidValueForAggregateFunction`);r+=(n-i)**2}return r/(e.length-1)}export{a as aggregateFunction,o as isAggregate};
2
+ import{DateOnly as e}from"./DateOnly.js";import{SqlError as t}from"./errorSupport.js";import{SqlTimeStampOffset as n}from"./SqlTimestampOffset.js";import{TimeOnly as r}from"./TimeOnly.js";import{DateTime as i}from"luxon";function a(e,n){let r=s[e.toLowerCase()];if(r==null)throw new t(`FunctionNotRecognized`);if(n.length<r.minParams||n.length>r.maxParams)throw new t(`InvalidParameterCount`,{name:e.toUpperCase()});return r.evaluate(n)}function o(e,t){let n=s[e.toLowerCase()];return n!=null&&t>=n.minParams&&t<=n.maxParams}const s={min:{minParams:1,maxParams:1,evaluate:e=>u(e[0],`min`)},max:{minParams:1,maxParams:1,evaluate:e=>u(e[0],`max`)},avg:{minParams:1,maxParams:1,evaluate:e=>c(e[0])},sum:{minParams:1,maxParams:1,evaluate:e=>d(e[0])},stddev:{minParams:1,maxParams:1,evaluate:e=>f(e[0])},count:{minParams:1,maxParams:1,evaluate:e=>e[0]==null?null:e[0].filter(e=>e!==null).length},var:{minParams:1,maxParams:1,evaluate:e=>p(e[0])}};function c(e){if(e===null)return null;let n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a!==null){if(!l(a))throw new t(`InvalidValueForAggregateFunction`);r++,n+=a}}return r===0?null:n/r}function l(e){return typeof e==`number`}function u(t,a){if(t===null)return null;let o=null,s=null;for(let c of t){let t=c;t=e.isDateOnly(c)||r.isTimeOnly(c)?c.toNumber():i.isDateTime(c)?c.toMillis():n.isTimestampOffset(c)?c.toMilliseconds():c,(o===null||a===`max`&&s!==null&&t!==null&&s<=t||a===`min`&&s!==null&&t!==null&&s>=t)&&(o=c,s=t)}return o}function d(e){if(e===null||e.length===0)return null;let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i!==null){if(!l(i))throw new t(`InvalidValueForAggregateFunction`);n+=i}}return n}function f(e){if(e===null)return null;let t=p(e);return t===null?null:Math.sqrt(t)}function p(e){if(e===null||(e=e.filter(e=>e!==null),e.length===0))return null;let n=c(e);if(n===null)return null;let r=0;for(let i of e){if(!l(i))throw new t(`InvalidValueForAggregateFunction`);r+=(n-i)**2}return r/(e.length-1)}export{a as aggregateFunction,o as isAggregate};
@@ -9,10 +9,10 @@ export interface ActiveLayerInfoProperties extends Partial<Pick<ActiveLayerInfo,
9
9
 
10
10
  /**
11
11
  * Represents the legend content for a layer or sublayer in a
12
- * [LegendContent](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/) instance.
12
+ * [LegendModel](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/) instance.
13
13
  *
14
14
  * An `ActiveLayerInfo` is added to or removed from
15
- * [LegendContent.activeLayerInfos](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#activeLayerInfos) as layers become visible or invisible in the view. It maintains
15
+ * [LegendModel.activeLayerInfos](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#activeLayerInfos) as layers become visible or invisible in the view. It maintains
16
16
  * parent and child relationships and generates the [legend elements](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/#legendElements)
17
17
  * required to render the layer's symbology.
18
18
  *
@@ -2,12 +2,12 @@ import type Accessor from "../core/Accessor.js";
2
2
  import type Collection from "../core/Collection.js";
3
3
  import type ActiveLayerInfo from "./ActiveLayerInfo.js";
4
4
  import type LinkChartView from "../views/LinkChartView.js";
5
- import type { LayerInfo, LegendContentState } from "./types.js";
5
+ import type { LayerInfo, LegendModelState } from "./types.js";
6
6
  import type { MapViewOrSceneView } from "../views/MapViewOrSceneView.js";
7
7
  import type { ActiveLayerInfoProperties } from "./ActiveLayerInfo.js";
8
8
  import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
9
9
 
10
- export interface LegendContentProperties extends Partial<Pick<LegendContent, "basemapLegendVisible" | "groundLegendVisible" | "hideLayersNotInCurrentView" | "keepCacheOnDestroy" | "layerInfos" | "respectLayerDefinitionExpression" | "respectLayerVisibility" | "view">> {
10
+ export interface LegendModelProperties extends Partial<Pick<LegendModel, "basemapLegendVisible" | "groundLegendVisible" | "hideLayersNotInCurrentView" | "keepCacheOnDestroy" | "layerInfos" | "respectLayerDefinitionExpression" | "respectLayerVisibility" | "view">> {
11
11
  /**
12
12
  * Collection of [ActiveLayerInfo](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/) objects used by the legend view to
13
13
  * display data in the legend. Use this property to hide or display the layer's symbols in the legend when
@@ -23,13 +23,13 @@ export interface LegendContentProperties extends Partial<Pick<LegendContent, "ba
23
23
  *
24
24
  * @since 5.2
25
25
  * @example
26
- * const legendContent = new LegendContent({
26
+ * const legendModel = new LegendModel({
27
27
  * view,
28
28
  * layerInfos: [{ layer: map.allLayers.getItemAt(0) }],
29
29
  * });
30
30
  */
31
- export default class LegendContent extends Accessor {
32
- constructor(properties?: LegendContentProperties);
31
+ export default class LegendModel extends Accessor {
32
+ constructor(properties?: LegendModelProperties);
33
33
  /**
34
34
  * Collection of [ActiveLayerInfo](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/) objects used by the legend view to
35
35
  * display data in the legend. Use this property to hide or display the layer's symbols in the legend when
@@ -60,7 +60,7 @@ export default class LegendContent extends Accessor {
60
60
  * the layer to `false`.
61
61
  *
62
62
  * @default false
63
- * @see [respectLayerVisibility](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#respectLayerVisibility)
63
+ * @see [respectLayerVisibility](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#respectLayerVisibility)
64
64
  */
65
65
  accessor hideLayersNotInCurrentView: boolean;
66
66
  /**
@@ -71,9 +71,9 @@ export default class LegendContent extends Accessor {
71
71
  */
72
72
  accessor keepCacheOnDestroy: boolean;
73
73
  /**
74
- * Defines which layers and sublayers are shown in the legend, including any [basemap layers](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#basemapLegendVisible) you want visible.
74
+ * Defines which layers and sublayers are shown in the legend, including any [basemap layers](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#basemapLegendVisible) you want visible.
75
75
  * If not set, all layers in the map are displayed in the legend by default, including basemap layers when
76
- * [basemapLegendVisible](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#basemapLegendVisible) is `true`.
76
+ * [basemapLegendVisible](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#basemapLegendVisible) is `true`.
77
77
  */
78
78
  accessor layerInfos: LayerInfo[];
79
79
  /** Indicates whether one or more active layer info objects are currently generating legend elements. */
@@ -104,7 +104,7 @@ export default class LegendContent extends Accessor {
104
104
  * and `legendEnabled` properties for each layer in the map.
105
105
  *
106
106
  * @default true
107
- * @see [hideLayersNotInCurrentView](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#hideLayersNotInCurrentView)
107
+ * @see [hideLayersNotInCurrentView](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#hideLayersNotInCurrentView)
108
108
  */
109
109
  accessor respectLayerVisibility: boolean;
110
110
  /**
@@ -112,7 +112,7 @@ export default class LegendContent extends Accessor {
112
112
  *
113
113
  * @default "disabled"
114
114
  */
115
- get state(): LegendContentState;
115
+ get state(): LegendModelState;
116
116
  /** The map, scene, or link chart view whose layer views supply the legend content. */
117
117
  accessor view: MapViewOrSceneView | LinkChartView | null | undefined;
118
118
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t}from"../intl.js";import n from"../core/Accessor.js";import r from"../core/Collection.js";import{watch as i,initial as a,when as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{get as l}from"../core/accessorSupport/get.js";import u from"./ActiveLayerInfo.js";import{getEffectiveFeatureReduction as d}from"../views/2d/layers/features/layerAdapters/featureReductionUtils.js";const f={state:`state`,view:`view`,allLayerViews:`all-layer-views`,legendProperties:`legend-properties`},p=r.ofType(u),m=new Set(`esri.layers.BuildingSceneLayer,esri.layers.CatalogLayer,esri.layers.CSVLayer,esri.layers.FeatureLayer,esri.layers.GeoJSONLayer,esri.layers.GeoRSSLayer,esri.layers.GroupLayer,esri.layers.HeatmapLayer,esri.layers.ImageryLayer,esri.layers.ImageryTileLayer,esri.layers.MapImageLayer,esri.layers.OGCFeatureLayer,esri.layers.OrientedImageryLayer,esri.layers.ParquetLayer,esri.layers.PointCloudLayer,esri.layers.StreamLayer,esri.layers.SceneLayer,esri.layers.SubtypeGroupLayer,esri.layers.TileLayer,esri.layers.VoxelLayer,esri.layers.WFSLayer,esri.layers.WMSLayer,esri.layers.WMTSLayer,esri.layers.WCSLayer,esri.layers.LinkChartLayer,esri.layers.catalog.CatalogFootprintLayer,esri.layers.catalog.CatalogDynamicGroupLayer,esri.layers.knowledgeGraph.KnowledgeGraphSublayer,esri.layers.KnowledgeGraphLayer`.split(`,`)),h=`view.basemapView.baseLayerViews`,g=`view.groundView.layerViews`,_=`view.basemapView.referenceLayerViews`,v=[h,g,`view.layerViews`,_];let y=class extends n{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new p,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.layerInfos=[],this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.view=null}initialize(){this.addHandles(i(()=>this.view,()=>this._viewHandles(),a),f.view),this.addHandles(t(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?`ready`:`disabled`}_viewHandles(){this.removeHandles(f.state),this.view&&this.addHandles(i(()=>this.state,()=>this._stateHandles(),a),f.state)}_stateHandles(){this._resetAll(),this.state===`ready`&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([f.allLayerViews,f.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);let t=this._activeLayerInfosByLayerViewId[e];t&&this._activeLayerInfosPromises.delete(t),delete this._activeLayerInfosByLayerViewId[e],t?.parent?.children.remove(t)}_watchPropertiesAndAllLayerViews(){let{view:e}=this;if(!e)return;let{allLayerViews:t}=e;t.length&&this._refresh(),this.addHandles(t.on(`change`,e=>this._allLayerViewsChangeHandle(e)),f.allLayerViews),this.addHandles(i(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh()),f.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length){this._destroyViewActiveLayerInfos(),this._refresh();return}if(e.removed.length){for(let{uid:t}of e.removed)this._destroyViewActiveLayerInfo(t);this._refresh()}}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;let{baseLayerViews:t,groundLayerViews:n,referenceLayerViews:r}=this.view.basemapView,i=t.some(t=>{let n=`layerViews`in t?t.layerViews:null;return n?n.includes(e):t===e}),a=!this.basemapLegendVisible&&(i||r?.includes(e)),o=!this.groundLegendVisible&&n?.includes(e);return!a&&!o}_sortActiveLayerInfos(e){let t=this.view;if(e.length<2||!t)return;let n=[];e.forEach(t=>{if(!t.parent){let r=t.layer.parent,i=r&&`uid`in r&&this._layerViewByLayerId[r.uid],a=i&&this._activeLayerInfosByLayerViewId[i.uid];a&&e.includes(a)&&(n.push(t),t.parent=a,a.children.add(t),this._sortActiveLayerInfos(a.children))}}),e.removeMany(n);let r={};t.allLayerViews.forEach((e,t)=>r[e.layer.uid]=t),e.sort((e,t)=>{let n=r[e.layer.uid]||0;return(r[t.layer.uid]||0)-n})}_generateLayerViews(){let e=[];return v.filter(this._filterLayerViews,this).map(e=>l(this,e)).filter(e=>e!=null).forEach(this._collectLayerViews(`layerViews`,e)),e}_filterLayerViews(e){let t=!this.basemapLegendVisible&&(e===h||e===_),n=!this.groundLegendVisible&&e===g;return!t&&!n}_collectLayerViews(e,t){let n=r=>(r&&r.forEach(r=>{t.push(r),n(r[e])}),t);return n}_filterLayerViewsByLayerInfos(e){let t=this.layerInfos;return t&&t.length?t.some(t=>this._hasLayerInfo(t,e)):!0}_hasLayerInfo(e,t){let n=this._isLayerUIDMatching(e.layer,t.layer.uid);return n&&(this._layerInfosByLayerViewId[t.uid]=e),n}_isLayerUIDMatching(e,t){return e&&(e.uid===t||this._hasLayerUID(e.layers,t))}_hasLayerUID(e,t){return e&&e.some(e=>this._isLayerUIDMatching(e,t))}_isLayerViewSupported(e){return m.has(e.layer.declaredClass)?(this._layerViewByLayerId[e.layer.uid]=e,!0):!1}_generateActiveLayerInfo(e){if(this._isLayerActive(e)){this._buildActiveLayerInfo(e);return}this.removeHandles(e.uid),this.addHandles(i(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid)}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}async _buildActiveLayerInfo(e){let t=e.layer,n=e.uid,r=this._layerInfosByLayerViewId[n],i=this._activeLayerInfosByLayerViewId[n];i||(i=new u({keepCacheOnDestroy:this.keepCacheOnDestroy,layer:t,layerView:e,view:this.view??void 0}),this._activeLayerInfosByLayerViewId[n]=i);let a=r?.title!==void 0&&r.layer.uid===t.uid;i.title=a?r.title:t.title,i.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,i.respectLayerVisibility=this.respectLayerVisibility,i.hideLayersNotInCurrentView=this.hideLayersNotInCurrentView,i.sublayerIds=r?.sublayerIds||[];let o=t.parent&&`uid`in t.parent?this._layerViewByLayerId[t.parent?.uid]:null;i.parent=this._activeLayerInfosByLayerViewId[o?.uid],this._addActiveLayerInfo(i),this._constructLegendElements(i),this._attachHandlesToActiveLayerInfo(i)}_attachHandlesToActiveLayerInfo(e){let{layer:t,layerView:n}=e,r=n.uid;this.removeHandles(r),this.addHandles([i(()=>t.title,t=>this._titleHandle(t,e)),i(()=>[t.opacity,`renderer`in t&&t.renderer,`pointSymbol`in t&&t.pointSymbol,`lineSymbol`in t&&t.lineSymbol,`polygonSymbol`in t&&t.polygonSymbol,`effect`in t&&t.effect,`featureReduction`in t&&d(t,n.view),this.view?.timeZone],()=>this._constructLegendElements(e)),i(()=>`filter`in n&&n.filter,()=>{d(n.layer,n.view)!=null&&this._constructLegendElements(e)}),o(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),i(()=>e.loading,()=>this.notifyChange(`loading`),a)],r),this.respectLayerVisibility&&this.addHandles([i(()=>t.legendEnabled,t=>this._legendEnabledHandle(t,e)),i(()=>n.legendEnabled,t=>{this.view?.suspended||this._legendEnabledHandle(t,e)})],r),this.respectLayerDefinitionExpression&&`definitionExpression`in t&&this.addHandles(i(()=>t.definitionExpression,()=>this._constructLegendElements(e)),r)}_titleHandle(e,t){t.title=e,this._constructLegendElements(t)}_legendEnabledHandle(e,t){e?this._addActiveLayerInfo(t):this._removeActiveLayerInfo(t)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){let{layerView:t,layer:n}=e;if(this._isLayerActive(t)&&!this.activeLayerInfos.includes(e)){let t=e.parent;if(t)t.children.includes(e)||t.children.push(e),this._sortActiveLayerInfos(t.children);else{let t=this.layerInfos?.some(e=>e.layer.uid===n.uid),r=n.parent;r&&`uid`in r&&this._layerViewByLayerId[r.uid]&&!t?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){let e=[];this._activeLayerInfosWithNoParent.forEach(t=>{let n=t.layer.parent,r=n&&`uid`in n?this._layerViewByLayerId[n?.uid]:null,i=this._activeLayerInfosByLayerViewId[r?.uid];i&&(e.push(t),t.parent=i)}),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach(e=>this._addActiveLayerInfo(e)))}}}_removeActiveLayerInfo(e){let t=e.parent;t?t.children.remove(e):this.activeLayerInfos.remove(e)}async _getBuildLegendPromise(e){let{layer:t}=e;if(`featureCollections`in t&&t.featureCollections)return e.buildLegendElementsForFeatureCollections(t.featureCollections);if(`featureReduction`in t&&t.featureReduction&&`renderer`in t.featureReduction&&(t.featureReduction.type===`binning`||t.featureReduction.type===`cluster`)&&(!this.view||t.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(t.featureReduction);if(`renderer`in t&&t.renderer&&!(`sublayers`in t))return e.buildLegendElementsForRenderer(t.renderer);if(`url`in t&&t.url&&t.type!==`catalog`&&t.type!==`knowledge-graph`)return e.buildLegendElementsForTools();let n=e.children.map(e=>this._constructLegendElements(e));return Promise.all(n).then(()=>{})}async _constructLegendElements(e){let t=this._activeLayerInfosPromises.get(e);t&&await t.catch(()=>{});let n=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,n),n.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([s({type:p})],y.prototype,`activeLayerInfos`,void 0),e([s()],y.prototype,`basemapLegendVisible`,void 0),e([s()],y.prototype,`groundLegendVisible`,void 0),e([s()],y.prototype,`hideLayersNotInCurrentView`,void 0),e([s()],y.prototype,`keepCacheOnDestroy`,void 0),e([s()],y.prototype,`layerInfos`,void 0),e([s({readOnly:!0})],y.prototype,`loading`,null),e([s()],y.prototype,`respectLayerDefinitionExpression`,void 0),e([s()],y.prototype,`respectLayerVisibility`,void 0),e([s({readOnly:!0})],y.prototype,`state`,null),e([s()],y.prototype,`view`,void 0),y=e([c(`esri.legend.LegendContent`)],y);const b=y;export{b as default};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t}from"../intl.js";import n from"../core/Accessor.js";import r from"../core/Collection.js";import{watch as i,initial as a,when as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{get as l}from"../core/accessorSupport/get.js";import u from"./ActiveLayerInfo.js";import{getEffectiveFeatureReduction as d}from"../views/2d/layers/features/layerAdapters/featureReductionUtils.js";const f={state:`state`,view:`view`,allLayerViews:`all-layer-views`,legendProperties:`legend-properties`},p=r.ofType(u),m=new Set(`esri.layers.BuildingSceneLayer,esri.layers.CatalogLayer,esri.layers.CSVLayer,esri.layers.FeatureLayer,esri.layers.GeoJSONLayer,esri.layers.GeoRSSLayer,esri.layers.GroupLayer,esri.layers.HeatmapLayer,esri.layers.ImageryLayer,esri.layers.ImageryTileLayer,esri.layers.MapImageLayer,esri.layers.OGCFeatureLayer,esri.layers.OrientedImageryLayer,esri.layers.ParquetLayer,esri.layers.PointCloudLayer,esri.layers.StreamLayer,esri.layers.SceneLayer,esri.layers.SubtypeGroupLayer,esri.layers.TileLayer,esri.layers.VoxelLayer,esri.layers.WFSLayer,esri.layers.WMSLayer,esri.layers.WMTSLayer,esri.layers.WCSLayer,esri.layers.LinkChartLayer,esri.layers.catalog.CatalogFootprintLayer,esri.layers.catalog.CatalogDynamicGroupLayer,esri.layers.knowledgeGraph.KnowledgeGraphSublayer,esri.layers.KnowledgeGraphLayer`.split(`,`)),h=`view.basemapView.baseLayerViews`,g=`view.groundView.layerViews`,_=`view.basemapView.referenceLayerViews`,v=[h,g,`view.layerViews`,_];let y=class extends n{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new p,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.layerInfos=[],this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.view=null}initialize(){this.addHandles(i(()=>this.view,()=>this._viewHandles(),a),f.view),this.addHandles(t(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?`ready`:`disabled`}_viewHandles(){this.removeHandles(f.state),this.view&&this.addHandles(i(()=>this.state,()=>this._stateHandles(),a),f.state)}_stateHandles(){this._resetAll(),this.state===`ready`&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([f.allLayerViews,f.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);let t=this._activeLayerInfosByLayerViewId[e];t&&this._activeLayerInfosPromises.delete(t),delete this._activeLayerInfosByLayerViewId[e],t?.parent?.children.remove(t)}_watchPropertiesAndAllLayerViews(){let{view:e}=this;if(!e)return;let{allLayerViews:t}=e;t.length&&this._refresh(),this.addHandles(t.on(`change`,e=>this._allLayerViewsChangeHandle(e)),f.allLayerViews),this.addHandles(i(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh()),f.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length){this._destroyViewActiveLayerInfos(),this._refresh();return}if(e.removed.length){for(let{uid:t}of e.removed)this._destroyViewActiveLayerInfo(t);this._refresh()}}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;let{baseLayerViews:t,groundLayerViews:n,referenceLayerViews:r}=this.view.basemapView,i=t.some(t=>{let n=`layerViews`in t?t.layerViews:null;return n?n.includes(e):t===e}),a=!this.basemapLegendVisible&&(i||r?.includes(e)),o=!this.groundLegendVisible&&n?.includes(e);return!a&&!o}_sortActiveLayerInfos(e){let t=this.view;if(e.length<2||!t)return;let n=[];e.forEach(t=>{if(!t.parent){let r=t.layer.parent,i=r&&`uid`in r&&this._layerViewByLayerId[r.uid],a=i&&this._activeLayerInfosByLayerViewId[i.uid];a&&e.includes(a)&&(n.push(t),t.parent=a,a.children.add(t),this._sortActiveLayerInfos(a.children))}}),e.removeMany(n);let r={};t.allLayerViews.forEach((e,t)=>r[e.layer.uid]=t),e.sort((e,t)=>{let n=r[e.layer.uid]||0;return(r[t.layer.uid]||0)-n})}_generateLayerViews(){let e=[];return v.filter(this._filterLayerViews,this).map(e=>l(this,e)).filter(e=>e!=null).forEach(this._collectLayerViews(`layerViews`,e)),e}_filterLayerViews(e){let t=!this.basemapLegendVisible&&(e===h||e===_),n=!this.groundLegendVisible&&e===g;return!t&&!n}_collectLayerViews(e,t){let n=r=>(r&&r.forEach(r=>{t.push(r),n(r[e])}),t);return n}_filterLayerViewsByLayerInfos(e){let t=this.layerInfos;return t&&t.length?t.some(t=>this._hasLayerInfo(t,e)):!0}_hasLayerInfo(e,t){let n=this._isLayerUIDMatching(e.layer,t.layer.uid);return n&&(this._layerInfosByLayerViewId[t.uid]=e),n}_isLayerUIDMatching(e,t){return e&&(e.uid===t||this._hasLayerUID(e.layers,t))}_hasLayerUID(e,t){return e&&e.some(e=>this._isLayerUIDMatching(e,t))}_isLayerViewSupported(e){return m.has(e.layer.declaredClass)?(this._layerViewByLayerId[e.layer.uid]=e,!0):!1}_generateActiveLayerInfo(e){if(this._isLayerActive(e)){this._buildActiveLayerInfo(e);return}this.removeHandles(e.uid),this.addHandles(i(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid)}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}async _buildActiveLayerInfo(e){let t=e.layer,n=e.uid,r=this._layerInfosByLayerViewId[n],i=this._activeLayerInfosByLayerViewId[n];i||(i=new u({keepCacheOnDestroy:this.keepCacheOnDestroy,layer:t,layerView:e,view:this.view??void 0}),this._activeLayerInfosByLayerViewId[n]=i);let a=r?.title!==void 0&&r.layer.uid===t.uid;i.title=a?r.title:t.title,i.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,i.respectLayerVisibility=this.respectLayerVisibility,i.hideLayersNotInCurrentView=this.hideLayersNotInCurrentView,i.sublayerIds=r?.sublayerIds||[];let o=t.parent&&`uid`in t.parent?this._layerViewByLayerId[t.parent?.uid]:null;i.parent=this._activeLayerInfosByLayerViewId[o?.uid],this._addActiveLayerInfo(i),this._constructLegendElements(i),this._attachHandlesToActiveLayerInfo(i)}_attachHandlesToActiveLayerInfo(e){let{layer:t,layerView:n}=e,r=n.uid;this.removeHandles(r),this.addHandles([i(()=>t.title,t=>this._titleHandle(t,e)),i(()=>[t.opacity,`renderer`in t&&t.renderer,`pointSymbol`in t&&t.pointSymbol,`lineSymbol`in t&&t.lineSymbol,`polygonSymbol`in t&&t.polygonSymbol,`effect`in t&&t.effect,`featureReduction`in t&&d(t,n.view),this.view?.timeZone],()=>this._constructLegendElements(e)),i(()=>`filter`in n&&n.filter,()=>{d(n.layer,n.view)!=null&&this._constructLegendElements(e)}),o(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),i(()=>e.loading,()=>this.notifyChange(`loading`),a)],r),this.respectLayerVisibility&&this.addHandles([i(()=>t.legendEnabled,t=>this._legendEnabledHandle(t,e)),i(()=>n.legendEnabled,t=>{this.view?.suspended||this._legendEnabledHandle(t,e)})],r),this.respectLayerDefinitionExpression&&`definitionExpression`in t&&this.addHandles(i(()=>t.definitionExpression,()=>this._constructLegendElements(e)),r)}_titleHandle(e,t){t.title=e,this._constructLegendElements(t)}_legendEnabledHandle(e,t){e?this._addActiveLayerInfo(t):this._removeActiveLayerInfo(t)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){let{layerView:t,layer:n}=e;if(this._isLayerActive(t)&&!this.activeLayerInfos.includes(e)){let t=e.parent;if(t)t.children.includes(e)||t.children.push(e),this._sortActiveLayerInfos(t.children);else{let t=this.layerInfos?.some(e=>e.layer.uid===n.uid),r=n.parent;r&&`uid`in r&&this._layerViewByLayerId[r.uid]&&!t?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){let e=[];this._activeLayerInfosWithNoParent.forEach(t=>{let n=t.layer.parent,r=n&&`uid`in n?this._layerViewByLayerId[n?.uid]:null,i=this._activeLayerInfosByLayerViewId[r?.uid];i&&(e.push(t),t.parent=i)}),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach(e=>this._addActiveLayerInfo(e)))}}}_removeActiveLayerInfo(e){let t=e.parent;t?t.children.remove(e):this.activeLayerInfos.remove(e)}async _getBuildLegendPromise(e){let{layer:t}=e;if(`featureCollections`in t&&t.featureCollections)return e.buildLegendElementsForFeatureCollections(t.featureCollections);if(`featureReduction`in t&&t.featureReduction&&`renderer`in t.featureReduction&&(t.featureReduction.type===`binning`||t.featureReduction.type===`cluster`)&&(!this.view||t.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(t.featureReduction);if(`renderer`in t&&t.renderer&&!(`sublayers`in t))return e.buildLegendElementsForRenderer(t.renderer);if(`url`in t&&t.url&&t.type!==`catalog`&&t.type!==`knowledge-graph`)return e.buildLegendElementsForTools();let n=e.children.map(e=>this._constructLegendElements(e));return Promise.all(n).then(()=>{})}async _constructLegendElements(e){let t=this._activeLayerInfosPromises.get(e);t&&await t.catch(()=>{});let n=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,n),n.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([s({type:p})],y.prototype,`activeLayerInfos`,void 0),e([s()],y.prototype,`basemapLegendVisible`,void 0),e([s()],y.prototype,`groundLegendVisible`,void 0),e([s()],y.prototype,`hideLayersNotInCurrentView`,void 0),e([s()],y.prototype,`keepCacheOnDestroy`,void 0),e([s()],y.prototype,`layerInfos`,void 0),e([s({readOnly:!0})],y.prototype,`loading`,null),e([s()],y.prototype,`respectLayerDefinitionExpression`,void 0),e([s()],y.prototype,`respectLayerVisibility`,void 0),e([s({readOnly:!0})],y.prototype,`state`,null),e([s()],y.prototype,`view`,void 0),y=e([c(`esri.legend.LegendModel`)],y);const b=y;export{b as default};
package/legend/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Public types used to configure [LegendContent](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/) and describe the legend elements generated by
2
+ * Public types used to configure [LegendModel](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/) and describe the legend elements generated by
3
3
  * [ActiveLayerInfo](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/).
4
4
  *
5
5
  * These types can be used when rendering a custom legend independently of the Legend component.
@@ -115,7 +115,7 @@ export interface ImageSymbolTableElementInfo {
115
115
  /**
116
116
  * An object that defines a layer, optional sublayer IDs, and a custom title for legend display.
117
117
  * Use this to specify which layers and sublayers appear in the legend and how they are labeled with
118
- * [layerInfos](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#layerInfos).
118
+ * [layerInfos](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#layerInfos).
119
119
  */
120
120
  export interface LayerInfo {
121
121
  /** A layer to display in the legend. */
@@ -136,8 +136,8 @@ export interface LayerInfo {
136
136
  /** The allowed color names used in multilayer stretch legends. */
137
137
  export type LegendColorName = "red" | "green" | "blue";
138
138
 
139
- /** Represents the allowed values for the [LegendContent.state](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#state) property. */
140
- export type LegendContentState = "ready" | "disabled";
139
+ /** Represents the allowed values for the [LegendModel.state](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#state) property. */
140
+ export type LegendModelState = "ready" | "disabled";
141
141
 
142
142
  /** Properties defining the scheme of each supported [legend element](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/#legendElements). */
143
143
  export type LegendElement = SymbolTableElement | ColorRampElement | StretchRampElement | OpacityRampElement | SizeRampElement | HeatmapRampElement | RelationshipRampElement | UnivariateColorSizeRampElement | PieChartRampElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.138",
3
+ "version": "5.2.0-next.139",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.20.8",
23
- "@arcgis/toolkit": "5.2.0-next.138",
23
+ "@arcgis/toolkit": "5.2.0-next.139",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0-next.89",
26
26
  "@vaadin/grid": "~25.3.2",
@@ -11,12 +11,17 @@ import type { FeatureFormattedAttributes, LastEditInfo, PopupAction, PopupTempla
11
11
  import type { TimeZone } from "../time/types.js";
12
12
  import type { MapViewOrSceneView } from "../views/MapViewOrSceneView.js";
13
13
  import type { FeatureAbilitiesProperties } from "./support/FeatureAbilities.js";
14
+ import type { ActionToggleProperties } from "../support/actions/ActionToggle.js";
15
+ import type { ActionButtonProperties } from "../support/actions/ActionButton.js";
16
+ import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
14
17
  import type { GraphicProperties } from "../Graphic.js";
15
18
  import type { PointProperties } from "../geometry/Point.js";
16
19
 
17
- export interface FeatureContentProperties extends IdentifiableMixinProperties, Partial<Pick<FeatureContent, "defaultPopupTemplateEnabled" | "map" | "view">> {
20
+ export interface FeatureContentProperties extends IdentifiableMixinProperties, Partial<Pick<FeatureContent, "defaultPopupTemplateEnabled" | "includeDefaultActions" | "map" | "view">> {
18
21
  /** Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that should be used when querying and displaying content. */
19
22
  abilities?: FeatureAbilitiesProperties;
23
+ /** A collection of custom actions to include with the feature's popup actions. */
24
+ actions?: ReadonlyArrayOrCollection<((ActionButtonProperties & { type: "button" }) | (ActionToggleProperties & { type: "toggle" }))>;
20
25
  /**
21
26
  * The [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) used to represent the feature.
22
27
  *
@@ -95,6 +100,11 @@ export default class FeatureContent extends FeatureContentSuperclass {
95
100
  /** Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that should be used when querying and displaying content. */
96
101
  get abilities(): FeatureAbilities;
97
102
  set abilities(value: FeatureAbilitiesProperties);
103
+ /** A collection of custom actions to include with the feature's popup actions. */
104
+ get actions(): Collection<PopupAction>;
105
+ set actions(value: ReadonlyArrayOrCollection<((ActionButtonProperties & { type: "button" }) | (ActionToggleProperties & { type: "toggle" }))>);
106
+ /** A collection of the actions available for the feature. */
107
+ get allActions(): Collection<PopupAction>;
98
108
  /** The [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content) of the feature. */
99
109
  get content(): PopupContent | null | undefined;
100
110
  /**
@@ -150,6 +160,12 @@ export default class FeatureContent extends FeatureContentSuperclass {
150
160
  * @default ""
151
161
  */
152
162
  get heading(): string;
163
+ /**
164
+ * Indicates whether to include the default actions.
165
+ *
166
+ * @default false
167
+ */
168
+ accessor includeDefaultActions: boolean;
153
169
  /** Indicates whether the current [graphic](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureContent/#graphic) resides in a non-spatial table. */
154
170
  get isFeatureFromTable(): boolean;
155
171
  /** A read-only property containing metadata regarding the last edit performed on a feature. */
@@ -226,13 +242,6 @@ export default class FeatureContent extends FeatureContentSuperclass {
226
242
  accessor view: MapViewOrSceneView | null | undefined;
227
243
  /** Indicates whether the feature is currently waiting for all of its content to finish loading. */
228
244
  get waitingForContent(): boolean;
229
- /**
230
- * @param actions - The custom actions to include with the feature's actions.
231
- * @param includeDefaultActions - Indicates whether to include the default actions.
232
- * @returns The actions available for the feature.
233
- * @internal
234
- */
235
- getAllActions(actions: Collection<PopupAction>, includeDefaultActions?: boolean): Collection<PopupAction>;
236
245
  /**
237
246
  * Fetches and updates the geometry of the [graphic](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureContent/#graphic).
238
247
  * This method can be called to refresh the [graphic](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureContent/#graphic)'s geometry before taking actions such as calling
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import{FeatureSetQueryInterceptor as n}from"../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../core/Accessor.js";import{isSome as i}from"../core/arrayUtils.js";import{createTask as a}from"../core/asyncUtils.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(this._graphicChanged,()=>this.notifyChange(`waitingForContent`),1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get isFeatureFromTable(){return k(this.graphic)?.isTable??!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??q}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}getAllActions(e,t=!1){let n=new b,{defaultActions:r,defaultPopupTemplateEnabled:a,graphic:o}=this,s=t?r.concat(e):e,c=o&&(typeof o.getEffectivePopupTemplate==`function`&&o.getEffectivePopupTemplate(a)||o.popupTemplate),l=c?.actions;return(c?.overwriteActions?l:l?.concat(s)??s)?.filter(i).forEach(e=>n.add(e)),n}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(e){throw u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureContent`)],Y);const X=Y;export{X as default};
2
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import{FeatureSetQueryInterceptor as n}from"../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../core/Accessor.js";import{isSome as i}from"../core/arrayUtils.js";import{createTask as a}from"../core/asyncUtils.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.actions=new b,this.includeDefaultActions=!1,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(this._graphicChanged,()=>this.notifyChange(`waitingForContent`),1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get allActions(){let e=this._get(`allActions`)||new b,{actions:t,defaultPopupTemplateEnabled:n,includeDefaultActions:r,graphic:a}=this,o=[];if(a){let e=r?this.defaultActions.concat(t):t,s=typeof a.getEffectivePopupTemplate==`function`&&a.getEffectivePopupTemplate(n)||a.popupTemplate,c=s?.actions;o=(s?.overwriteActions?c:c?.concat(e)??e)?.filter(i).toArray()??[]}let s=e.toArray();return(s.length!==o.length||s.some((e,t)=>e!==o[t]))&&(e.removeAll(),e.addMany(o)),e}get isFeatureFromTable(){return k(this.graphic)?.isTable??!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??q}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(e){throw u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:b})],Y.prototype,`actions`,void 0),e([g()],Y.prototype,`includeDefaultActions`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`allActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureContent`)],Y);const X=Y;export{X as default};
@@ -274,7 +274,6 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
274
274
  * > In order to disable any [default actions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureContentCollection/#defaultActions), it is necessary to set [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureContentCollection/#includeDefaultActions) to `false`.
275
275
  *
276
276
  * @default true
277
- * @internal
278
277
  * @example
279
278
  * // Removes the default actions
280
279
  * featureContentCollection.includeDefaultActions = false;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"../geometry/Point.js";import{project as p}from"../geometry/projectionUtils.js";import m from"../geometry/SpatialReference.js";import{geographicToWebMercator as h}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as g}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as _}from"../layers/LayerConstants.js";import{ActionsCollection as v,createDefaultActions as y}from"./actions.js";import{getSelectedTarget as b}from"./actionUtils.js";import x from"./FeatureContent.js";import S from"./support/FeatureAbilities.js";import{getDisplayedSymbol as C}from"../symbols/support/symbolUtils.js";import{system as w}from"../time/constants.js";import{highlightsSupported as T}from"../views/support/layerViewUtils.js";import{GoTo as E}from"../widgets/support/GoTo.js";let D=null;function O(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let k=class extends E(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new S,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new v,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),c(()=>this.featureItems,()=>this._featureItemsChange()),c(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new v;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??y()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionEnabled?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?h(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??w}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=b(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){this.selectedFeatureIndex!==-1&&(this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null)}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){let{features:e,featureCount:t,featurePage:n,featuresPerPage:r,featureItems:i}=this;if(n==null)return;let a=((n-1)*r+t)%t,o=Math.min(a+r,i.length);for(let t=a;t<o;t++){let n=i[t];n&&(n.graphic??=e[t])}}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=g(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await C(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureItems`,[])}_updateFeatureItems(){let e=this.selectedFeature,t=this.features,n=this.featureItems,r=this.view,i=this.spatialReference,a=this.map,o=this.timeZone,s=this.location,c=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length){this._destroyFeatureItems();return}let l=[],u=new Map,d=new Set;n.forEach(e=>{let t=e?.graphic;e&&t&&u.set(t,e)}),t.forEach((t,f)=>{if(!t)return;let p=n[f];if(p&&!d.has(p)&&(p.graphic==null||p.graphic===t)){p.abilities=c,l[f]=p,d.add(p);return}let m=u.get(t);if(m&&!d.has(m)){m.abilities=c,l[f]=m,d.add(m);return}let h=new x({abilities:c,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:i,graphic:t===e?t:null,location:s,map:a,view:r,timeZone:o});l[f]=h,d.add(h)}),n.forEach(e=>{e&&!d.has(e)&&!e.destroyed&&e.destroy()}),this._set(`featureItems`,l)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=p(r,t),D??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=D;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=g(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(O(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||_:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!T(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){try{for await(let n of e){if(e!==this._activeFeatureStream)return;let r=!this._featureStreamHasYielded;r&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),this._addFeature(n),r&&(this._featureStreamHasYielded=!0)}}finally{this._activeFeatureStream===e&&(this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeature(e){let{features:t}=this;t.includes(e)||(this.features=t.concat(e))}};e([u()],k.prototype,`_initialDisplayMode`,void 0),e([u()],k.prototype,`_activeFeatureStream`,void 0),e([u()],k.prototype,`_featureStreamHasYielded`,void 0),e([u({type:v})],k.prototype,`actions`,void 0),e([u({type:v,readOnly:!0})],k.prototype,`defaultActions`,null),e([u({readOnly:!0})],k.prototype,`active`,null),e([u()],k.prototype,`activeFeature`,void 0),e([u()],k.prototype,`aggregatedFeaturesEnabled`,void 0),e([u({value:null})],k.prototype,`content`,null),e([u({type:Boolean})],k.prototype,`defaultPopupTemplateEnabled`,void 0),e([u({readOnly:!0})],k.prototype,`diagnostics`,void 0),e([u({readOnly:!0})],k.prototype,`effectiveHeading`,null),e([u({readOnly:!0})],k.prototype,`featureCount`,null),e([u()],k.prototype,`featurePage`,void 0),e([u({value:[]})],k.prototype,`features`,null),e([u()],k.prototype,`featureStream`,null),e([u()],k.prototype,`featuresPerPage`,void 0),e([u()],k.prototype,`featureMenuOpen`,void 0),e([u({type:S})],k.prototype,`featureItemAbilities`,void 0),e([u({readOnly:!0})],k.prototype,`featureItems`,void 0),e([u()],k.prototype,`heading`,void 0),e([u()],k.prototype,`highlightEnabled`,void 0),e([u()],k.prototype,`includeDefaultActions`,void 0),e([u()],k.prototype,`initialDisplayMode`,null),e([u({type:f})],k.prototype,`location`,null),e([u()],k.prototype,`map`,null),e([u()],k.prototype,`open`,void 0),e([u({readOnly:!0})],k.prototype,`pendingLocation`,null),e([u({readOnly:!0})],k.prototype,`streamingFeatures`,null),e([u({value:null,readOnly:!0})],k.prototype,`selectedFeature`,null),e([u({value:-1})],k.prototype,`selectedFeatureIndex`,null),e([u({readOnly:!0})],k.prototype,`selectedFeatureItem`,null),e([u({type:m})],k.prototype,`spatialReference`,null),e([u({readOnly:!0})],k.prototype,`state`,null),e([u()],k.prototype,`timeZone`,null),e([u()],k.prototype,`updateLocationEnabled`,void 0),e([u()],k.prototype,`view`,void 0),e([u({readOnly:!0})],k.prototype,`waitingForContents`,null),e([u({readOnly:!0})],k.prototype,`waitingForResult`,null),e([u()],k.prototype,`zoomFactor`,void 0),k=e([d(`esri.popup.FeatureContentCollection`)],k);const A=k;export{A as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"../geometry/Point.js";import{project as p}from"../geometry/projectionUtils.js";import m from"../geometry/SpatialReference.js";import{geographicToWebMercator as h}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as g}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as _}from"../layers/LayerConstants.js";import{ActionsCollection as v,createDefaultActions as y}from"./actions.js";import{getSelectedTarget as b}from"./actionUtils.js";import x from"./FeatureContent.js";import S from"./support/FeatureAbilities.js";import{getDisplayedSymbol as C}from"../symbols/support/symbolUtils.js";import{system as w}from"../time/constants.js";import{highlightsSupported as T}from"../views/support/layerViewUtils.js";import{GoTo as E}from"../widgets/support/GoTo.js";let D=null;function O(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let k=class extends E(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new S,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new v,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),c(()=>this.featureItems,()=>this._featureItemsChange()),c(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new v;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??y()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionEnabled?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?h(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??w}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=b(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){this.selectedFeatureIndex!==-1&&(this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null)}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){let{features:e,featureCount:t,featurePage:n,featuresPerPage:r,featureItems:i}=this;if(n==null)return;let a=((n-1)*r+t)%t,o=Math.min(a+r,i.length);for(let t=a;t<o;t++){let n=i[t];n&&(n.graphic??=e[t])}}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=g(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await C(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureItems`,[])}_updateFeatureItems(){let e=this.selectedFeature,t=this.features,n=this.featureItems,r=this.view,i=this.spatialReference,a=this.map,o=this.timeZone,s=this.location,c=this.actions,l=this.includeDefaultActions,u=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length){this._destroyFeatureItems();return}let d=[],f=new Map,p=new Set;n.forEach(e=>{let t=e?.graphic;e&&t&&f.set(t,e)}),t.forEach((t,m)=>{if(!t)return;let h=n[m];if(h&&!p.has(h)&&(h.graphic==null||h.graphic===t)){h.abilities=u,h.actions=c,h.includeDefaultActions=l,d[m]=h,p.add(h);return}let g=f.get(t);if(g&&!p.has(g)){g.abilities=u,g.actions=c,g.includeDefaultActions=l,d[m]=g,p.add(g);return}let _=new x({actions:c,abilities:u,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:l,spatialReference:i,graphic:t===e?t:null,location:s,map:a,view:r,timeZone:o});d[m]=_,p.add(_)}),n.forEach(e=>{e&&!p.has(e)&&!e.destroyed&&e.destroy()}),this._set(`featureItems`,d)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=p(r,t),D??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=D;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=g(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(O(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||_:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!T(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){try{for await(let n of e){if(e!==this._activeFeatureStream)return;let r=!this._featureStreamHasYielded;r&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),this._addFeature(n),r&&(this._featureStreamHasYielded=!0)}}finally{this._activeFeatureStream===e&&(this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeature(e){let{features:t}=this;t.includes(e)||(this.features=t.concat(e))}};e([u()],k.prototype,`_initialDisplayMode`,void 0),e([u()],k.prototype,`_activeFeatureStream`,void 0),e([u()],k.prototype,`_featureStreamHasYielded`,void 0),e([u({type:v})],k.prototype,`actions`,void 0),e([u({type:v,readOnly:!0})],k.prototype,`defaultActions`,null),e([u({readOnly:!0})],k.prototype,`active`,null),e([u()],k.prototype,`activeFeature`,void 0),e([u()],k.prototype,`aggregatedFeaturesEnabled`,void 0),e([u({value:null})],k.prototype,`content`,null),e([u({type:Boolean})],k.prototype,`defaultPopupTemplateEnabled`,void 0),e([u({readOnly:!0})],k.prototype,`diagnostics`,void 0),e([u({readOnly:!0})],k.prototype,`effectiveHeading`,null),e([u({readOnly:!0})],k.prototype,`featureCount`,null),e([u()],k.prototype,`featurePage`,void 0),e([u({value:[]})],k.prototype,`features`,null),e([u()],k.prototype,`featureStream`,null),e([u()],k.prototype,`featuresPerPage`,void 0),e([u()],k.prototype,`featureMenuOpen`,void 0),e([u({type:S})],k.prototype,`featureItemAbilities`,void 0),e([u({readOnly:!0})],k.prototype,`featureItems`,void 0),e([u()],k.prototype,`heading`,void 0),e([u()],k.prototype,`highlightEnabled`,void 0),e([u()],k.prototype,`includeDefaultActions`,void 0),e([u()],k.prototype,`initialDisplayMode`,null),e([u({type:f})],k.prototype,`location`,null),e([u()],k.prototype,`map`,null),e([u()],k.prototype,`open`,void 0),e([u({readOnly:!0})],k.prototype,`pendingLocation`,null),e([u({readOnly:!0})],k.prototype,`streamingFeatures`,null),e([u({value:null,readOnly:!0})],k.prototype,`selectedFeature`,null),e([u({value:-1})],k.prototype,`selectedFeatureIndex`,null),e([u({readOnly:!0})],k.prototype,`selectedFeatureItem`,null),e([u({type:m})],k.prototype,`spatialReference`,null),e([u({readOnly:!0})],k.prototype,`state`,null),e([u()],k.prototype,`timeZone`,null),e([u()],k.prototype,`updateLocationEnabled`,void 0),e([u()],k.prototype,`view`,void 0),e([u({readOnly:!0})],k.prototype,`waitingForContents`,null),e([u({readOnly:!0})],k.prototype,`waitingForResult`,null),e([u()],k.prototype,`zoomFactor`,void 0),k=e([d(`esri.popup.FeatureContentCollection`)],k);const A=k;export{A as default};