@arcgis/core 4.26.0-next.20230120 → 4.26.0-next.20230121

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 (52) hide show
  1. package/arcade/ArcadeDate.js +1 -1
  2. package/arcade/Feature.js +1 -1
  3. package/arcade/featureset/support/shared.js +1 -1
  4. package/arcade/featureset/support/sqlUtils.js +1 -1
  5. package/arcade/languageUtils.js +1 -1
  6. package/arcade/lib/arcade-parser.js +1 -1
  7. package/arcade/lib/parser.js +1 -1
  8. package/arcade/lib/scanner.js +1 -1
  9. package/arcade/lib/types.js +1 -1
  10. package/arcade/validation/arcadeValidator.js +1 -1
  11. package/arcade/validation/diagnosticMessages.js +1 -1
  12. package/arcade/validation/languageKeywords.js +5 -0
  13. package/assets/esri/core/workers/RemoteClient.js +1 -1
  14. package/assets/esri/core/workers/chunks/293594192932f0e00ecf.js +1 -0
  15. package/assets/esri/core/workers/chunks/4f4064eabbbc4a66f95a.js +1 -0
  16. package/assets/esri/core/workers/chunks/6a90b1d73d5941ebb112.js +1 -0
  17. package/assets/esri/core/workers/chunks/96d4c50f74a9c0dcdb66.js +1 -0
  18. package/assets/esri/core/workers/chunks/b26a671d3523b8a48404.js +1 -0
  19. package/assets/esri/core/workers/chunks/{5dfed65b615b33588488.js → db96a2dc1879b4944cb8.js} +1 -1
  20. package/assets/esri/core/workers/chunks/fcf033c581f58d006cf6.js +1 -0
  21. package/assets/esri/core/workers/chunks/{5e872adb3a5e84c49865.js → fde8827bd7f1a97a6db3.js} +1 -1
  22. package/chunks/languageUtils.js +1 -1
  23. package/layers/StreamLayer.js +1 -1
  24. package/layers/graphics/controllers/StreamController.js +1 -1
  25. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  26. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  27. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  28. package/layers/support/FeatureReductionBinning.js +1 -1
  29. package/layers/support/FeatureReductionCluster.js +1 -1
  30. package/layers/support/StreamConnection.js +1 -1
  31. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  32. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  33. package/package.json +1 -1
  34. package/support/revision.js +1 -1
  35. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  36. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +1 -1
  37. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  38. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  39. package/views/2d/layers/StreamLayerView2D.js +1 -1
  40. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  41. package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
  42. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  43. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  44. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  45. package/views/3d/layers/StreamLayerView3D.js +1 -1
  46. package/views/layers/StreamLayerView.js +1 -1
  47. package/assets/esri/core/workers/chunks/0efee8d9fc5632346cb4.js +0 -1
  48. package/assets/esri/core/workers/chunks/10e715aa4ac96d7dd1b4.js +0 -1
  49. package/assets/esri/core/workers/chunks/2dfb17fa5b6a5d239942.js +0 -1
  50. package/assets/esri/core/workers/chunks/2e3962506c353b562a88.js +0 -1
  51. package/assets/esri/core/workers/chunks/7320e6d8f207399bc8f1.js +0 -1
  52. package/assets/esri/core/workers/chunks/a194f90ffe13b3d448b0.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{applySome as o,isSome as l,destroyMaybe as u,unwrap as h,removeMaybe as d,isNone as c}from"../../../core/maybe.js";import{debounce as p,isAbortError as y}from"../../../core/promiseUtils.js";import{watch as g,whenOnce as f,syncAndInitial as m,initial as _}from"../../../core/reactiveUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import R from"../../../layers/effects/FeatureEffectView.js";import S from"../../../layers/support/FeatureFilter.js";import w from"../../../rest/support/AggregateFeatureSet.js";import x from"../../../rest/support/FeatureSet.js";import U from"../../../rest/support/Query.js";import{MAX_FILTERS as C}from"../engine/webgl/definitions.js";import{LayerView2DMixin as F}from"./LayerView2D.js";import{createSchema as q}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{isRendererSupported as O}from"./features/support/rendererUtils.js";import{findSizeVV as E,createClusterCountSizeVariable as T,injectDynamicLevelDependentSizeVisualVariable as V,isClusterCompatibleRenderer as j,createClusterRenderer as A}from"./support/clusterUtils.js";import N from"./support/FeatureCommandQueue.js";import Q from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as L}from"./support/util.js";import{TileManager as k}from"../tiling/TileManager.js";import P from"../../layers/FeatureLayerView.js";import H from"../../layers/LayerView.js";import J from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as z}from"../../webgl/capabilities.js";import M from"../../../geometry/Extent.js";function B(e){return e&&"openPorts"in e}let $=class extends(P(J(F(H)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new N({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new R,this._lastDefinitionExpression=null}destroy(){o(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),g((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),m)]),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});const t="feature"===e.type||"subtype-group"===e.type,i="capabilities"in e&&e.capabilities.operations.supportsQuery;if(t&&!i)throw new s("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const r=this._createClientOptions();return this._set("_proxy",new Q({client:r})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:u}=this,h="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,c="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),y="featureReduction"in t?t.featureReduction?.toJSON():null,g="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),f="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),m="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:g,sublayerHash:f,subtypeCode:m,filterHash:l(this.filter)&&this.filter.toJSON(),effectHash:l(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:c,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:u,floors:i,clipsHash:p,featureReduction:y,customParameters:h,apiKey:d})}highlight(e){let t;e instanceof i?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:r.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const s=t?.filter(l);return s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((i=>this._createGraphicHit(e,t.fromJSON(i)))),...a.map((t=>this._createGraphicHit(e,i.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryAggregateSummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryAggregateUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryAggregateClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}async queryAggregateHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const i=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),r=w.fromJSON(i);return r.features.forEach((e=>this._setLayersForFeature(e))),r}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:M.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new k({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(g((()=>this.renderingConfigHash),(()=>this._update()),_),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=u(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,i=null!=this._updatingRequiredFieldsPromise,r=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||i||r||s||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${i}\n -> updatingProxy ${r}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,i="editingInfo"in this.layer&&this.layer.editingInfo?.lastEditDate,r="refreshInterval"in this.layer&&!!this.layer.refreshInterval,s=!i&&r;if(t&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!s&&has("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),i=has("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=h(this.layer.fullExtent),a=s?.clone().intersection(r),n=l(a)?a.width*a.height:0,o=s?.width*s?.height;if(e<=t&&(0===o?0:n/o)>=i)return{mode:"snapshot",featureCount:e}}catch(a){n.getLogger(this.declaredClass).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:a})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const{capabilities:t,objectIdField:i}=e,r=e.fields.map((e=>e.toJSON())),s=l(e.fullExtent)?e.fullExtent.toJSON():null,n=L(e.geometryType),o="timeInfo"in e&&e.timeInfo&&e.timeInfo.toJSON()||null,u=e.spatialReference?e.spatialReference.toJSON():null,h="feature"===e.type?e.globalIdField:null;let d;"ogc-feature"===e.type?d=e.source.getSource():B(e.source)?d=await e.source.openPorts():e.parsedUrl&&(d=a(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(d.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,p=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:y,featureCount:g}=await this._detectQueryMode(d);let f=this.layer.objectIdField;if("feature"===this.layer.type&&l(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(f=e)}return{type:y,timeReferenceUnknownClient:c,subtypeField:p,featureCount:g,globalIdField:h,maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,capabilities:t,fields:r,fullExtent:s,geometryType:n,objectIdField:i,source:d,timeInfo:o,spatialReference:u,orderByFields:f,datesInUnknownTimezone:c,dateFieldsTimeReference:("dateFieldsTimeReference"in this.layer?this.layer.dateFieldsTimeReference?.toJSON():null)||null,preferredTimeReference:("preferredTimeReference"in this.layer?this.layer.preferredTimeReference?.toJSON():null)||null,editFieldsInfo:"editFieldsInfo"in this.layer?this.layer.editFieldsInfo?.toJSON():null}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=U.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=U.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(n.getLogger(this.declaredClass).error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),o=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const l=a.schema.tileRenderer,u=this._createTileRendererHash(l);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),u!==this._tileRendererHash){await this._initTileRenderer(l,r);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(r),"stream"!==e.type&&B(e.source)&&(t.source=await e.source.openPorts());const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,t,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&o&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets?.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){y(e)||n.getLogger(this.declaredClass).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=u,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){y(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(i){y(i),0}this._unlockGPUUploads();const t=this.layer;t&&"featureReduction"in t&&t.featureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return g((()=>this._aggregateValueRanges),(i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=E(e.visualVariables);if(l(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=T(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,i="featureReduction"in e?e.featureReduction:null;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),i&&"renderer"in i&&i.renderer&&!i.renderer.authoringInfo?.isAutoGenerated){const e=i.fields;if("cluster"===i.type){const{renderer:t,didInject:r}=V(i.renderer,i,this._aggregateValueRanges);return r&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,i)),{renderer:t,aggregateFields:e,featureReduction:i}}return{renderer:i.renderer,aggregateFields:e,featureReduction:i}}if(i&&"cluster"===i.type&&t&&j(t)){const e=i,r=[],s=A(r,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:r,featureReduction:i}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e,t){const i=await I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=u(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=i,this._set("tileRenderer",i),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=l(e)?e.timeExtent:null,i=l(this.timeExtent)&&l(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=l(e)?e.where:null;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return l(e)?e.toJSON():null;(e=l(e)&&e.clone()||new S).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return i;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const r=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));r.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",r.join(", ")),l(i)&&i.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+a:a}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(C),n=this._injectOverrides(t);a[0]=n,a[1]=l(i)?i.toJSON():null;const o=q(e);if(c(o))return null;const u=z("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:u.supportsTextureFloat,maxTextureSize:u.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||O(e.renderer)}_onceTilesUpdated(){return this.requestUpdate(),f((()=>!this._pipelineIsUpdating))}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:"featureReduction"in e?e.featureReduction:null,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{y(e)||n.getLogger(this.declaredClass).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{y(e)||n.getLogger(this.declaredClass).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),l(t.geometry)&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([v()],$.prototype,"_serviceOptions",void 0),e([v()],$.prototype,"_proxy",void 0),e([v()],$.prototype,"_pipelineIsUpdating",void 0),e([v()],$.prototype,"_effectiveRenderer",void 0),e([v()],$.prototype,"_aggregateValueRanges",void 0),e([v()],$.prototype,"_commandsQueue",void 0),e([v()],$.prototype,"featureEffectView",void 0),e([v()],$.prototype,"labelsVisible",null),e([v({readOnly:!0})],$.prototype,"queryMode",null),e([v()],$.prototype,"renderingConfigHash",null),e([v()],$.prototype,"tileRenderer",void 0),e([v()],$.prototype,"updating",void 0),$=e([b("esri.views.2d.layers.FeatureLayerView2D")],$);const G=$;export{G as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{applySome as o,isSome as l,destroyMaybe as h,unwrap as u,removeMaybe as d,isNone as c}from"../../../core/maybe.js";import{debounce as p,isAbortError as y}from"../../../core/promiseUtils.js";import{watch as g,whenOnce as f,syncAndInitial as m,initial as _}from"../../../core/reactiveUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import R from"../../../layers/effects/FeatureEffectView.js";import S from"../../../layers/support/FeatureFilter.js";import x from"../../../rest/support/AggregateFeatureSet.js";import w from"../../../rest/support/FeatureSet.js";import F from"../../../rest/support/Query.js";import{MAX_FILTERS as U}from"../engine/webgl/definitions.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import{createSchema as q}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{isRendererSupported as O}from"./features/support/rendererUtils.js";import{findSizeVV as E,createClusterCountSizeVariable as T,injectDynamicLevelDependentSizeVisualVariable as V,isClusterCompatibleRenderer as j,createClusterRenderer as A}from"./support/clusterUtils.js";import N from"./support/FeatureCommandQueue.js";import Q from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as L}from"./support/util.js";import{TileManager as k}from"../tiling/TileManager.js";import P from"../../layers/FeatureLayerView.js";import H from"../../layers/LayerView.js";import J from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as z}from"../../webgl/capabilities.js";import M from"../../../geometry/Extent.js";function B(e){return e&&"openPorts"in e}let $=class extends(P(J(C(H)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new N({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new R,this._lastDefinitionExpression=null}destroy(){o(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),g((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),m)]),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});const t="feature"===e.type||"subtype-group"===e.type,i="capabilities"in e&&e.capabilities.operations.supportsQuery;if(t&&!i)throw new s("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const r=this._createClientOptions();return this._set("_proxy",new Q({client:r})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get _effectiveFeatureReduction(){if(!("featureReduction"in this.layer))return null;const e=this.layer.featureReduction;return e&&(!("maxScale"in e)||!e.maxScale||e.maxScale<this.view.scale)?e:null}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:h}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,c="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),y=this._effectiveFeatureReduction?.toJSON(),g="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),f="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),m="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:g,sublayerHash:f,subtypeCode:m,filterHash:l(this.filter)&&this.filter.toJSON(),effectHash:l(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:c,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:h,floors:i,clipsHash:p,featureReduction:y,customParameters:u,apiKey:d})}highlight(e){let t;e instanceof i?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:r.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const s=t?.filter(l);return s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((i=>this._createGraphicHit(e,t.fromJSON(i)))),...a.map((t=>this._createGraphicHit(e,i.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryAggregateSummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryAggregateUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryAggregateClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}async queryAggregateHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const i=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),r=x.fromJSON(i);return r.features.forEach((e=>this._setLayersForFeature(e))),r}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:M.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new k({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(g((()=>this.renderingConfigHash),(()=>this._update()),_),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=h(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,i=null!=this._updatingRequiredFieldsPromise,r=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||i||r||s||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${i}\n -> updatingProxy ${r}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,i="editingInfo"in this.layer&&this.layer.editingInfo?.lastEditDate,r="refreshInterval"in this.layer&&!!this.layer.refreshInterval,s=!i&&r;if(t&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!s&&has("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),i=has("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),a=s?.clone().intersection(r),n=l(a)?a.width*a.height:0,o=s?.width*s?.height;if(e<=t&&(0===o?0:n/o)>=i)return{mode:"snapshot",featureCount:e}}catch(a){n.getLogger(this.declaredClass).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:a})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const{capabilities:t,objectIdField:i}=e,r=e.fields.map((e=>e.toJSON())),s=l(e.fullExtent)?e.fullExtent.toJSON():null,n=L(e.geometryType),o="timeInfo"in e&&e.timeInfo&&e.timeInfo.toJSON()||null,h=e.spatialReference?e.spatialReference.toJSON():null,u="feature"===e.type?e.globalIdField:null;let d;"ogc-feature"===e.type?d=e.source.getSource():B(e.source)?d=await e.source.openPorts():e.parsedUrl&&(d=a(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(d.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,p=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:y,featureCount:g}=await this._detectQueryMode(d);let f=this.layer.objectIdField;if("feature"===this.layer.type&&l(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(f=e)}return{type:y,timeReferenceUnknownClient:c,subtypeField:p,featureCount:g,globalIdField:u,maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,capabilities:t,fields:r,fullExtent:s,geometryType:n,objectIdField:i,source:d,timeInfo:o,spatialReference:h,orderByFields:f,datesInUnknownTimezone:c,dateFieldsTimeReference:("dateFieldsTimeReference"in this.layer?this.layer.dateFieldsTimeReference?.toJSON():null)||null,preferredTimeReference:("preferredTimeReference"in this.layer?this.layer.preferredTimeReference?.toJSON():null)||null,editFieldsInfo:"editFieldsInfo"in this.layer?this.layer.editFieldsInfo?.toJSON():null}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=F.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=F.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(n.getLogger(this.declaredClass).error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=this._createConfiguration(s,i,t.filter),o=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const l=a.schema.tileRenderer,h=this._createTileRendererHash(l);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),h!==this._tileRendererHash){await this._initTileRenderer(l,r);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(r),"stream"!==e.type&&B(e.source)&&(t.source=await e.source.openPorts());const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,a,t,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&o&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(a);(t.mesh||t.targets?.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){y(e)||n.getLogger(this.declaredClass).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=h,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){y(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(t){y(t),0}this._unlockGPUUploads(),this._effectiveFeatureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return g((()=>this._aggregateValueRanges),(i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=E(e.visualVariables);if(l(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=T(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,i=this._effectiveFeatureReduction;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),i&&"renderer"in i&&i.renderer&&!i.renderer.authoringInfo?.isAutoGenerated){const e=i.fields;if("cluster"===i.type){const{renderer:t,didInject:r}=V(i.renderer,i,this._aggregateValueRanges);return r&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,i)),{renderer:t,aggregateFields:e,featureReduction:i}}return{renderer:i.renderer,aggregateFields:e,featureReduction:i}}if(i&&"cluster"===i.type&&t&&j(t)){const e=i,r=[],s=A(r,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:r,featureReduction:i}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e,t){const i=await I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=h(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=i,this._set("tileRenderer",i),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=l(e)?e.timeExtent:null,i=l(this.timeExtent)&&l(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=l(e)?e.where:null;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return l(e)?e.toJSON():null;(e=l(e)&&e.clone()||new S).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return i;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const r=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));r.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",r.join(", ")),l(i)&&i.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+a:a}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(U),n=this._injectOverrides(t);a[0]=n,a[1]=l(i)?i.toJSON():null;const o=q(e);if(c(o))return null;const h=z("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:h.supportsTextureFloat,maxTextureSize:h.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||O(e.renderer)}_onceTilesUpdated(){return this.requestUpdate(),f((()=>!this._pipelineIsUpdating))}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:this._effectiveFeatureReduction,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{y(e)||n.getLogger(this.declaredClass).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{y(e)||n.getLogger(this.declaredClass).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),l(t.geometry)&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([v()],$.prototype,"_serviceOptions",void 0),e([v()],$.prototype,"_proxy",void 0),e([v()],$.prototype,"_pipelineIsUpdating",void 0),e([v()],$.prototype,"_effectiveRenderer",void 0),e([v()],$.prototype,"_effectiveFeatureReduction",null),e([v()],$.prototype,"_aggregateValueRanges",void 0),e([v()],$.prototype,"_commandsQueue",void 0),e([v()],$.prototype,"featureEffectView",void 0),e([v()],$.prototype,"labelsVisible",null),e([v({readOnly:!0})],$.prototype,"queryMode",null),e([v()],$.prototype,"renderingConfigHash",null),e([v()],$.prototype,"tileRenderer",void 0),e([v()],$.prototype,"updating",void 0),$=e([b("esri.views.2d.layers.FeatureLayerView2D")],$);const G=$;export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,isSome as s}from"../../../core/maybe.js";import{watch as i}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import{toJSONGeometryType as p}from"./support/util.js";function l(e,t){if(r(e)&&r(t))return null;const i={};return s(t)&&(i.geometry=t.toJSON()),s(e)&&(i.where=e),i}let d=class extends c{constructor(){super(...arguments),this._enabledDataReceived=!1,this.errorString=null,this.connectionStatus="disconnected"}initialize(){this.handles.add([i((()=>this.layer?.purgeOptions),(()=>this._update())),i((()=>this.suspended),(e=>{e?this._proxy.pauseStream():this._proxy.resumeStream()}))])}get connectionError(){if(this.errorString)return new t("stream-controller",this.errorString)}on(e,t){"data-received"===e&&(this._enabledDataReceived=!0,this._proxy.enableEvent("data-received",!0));const r=super.on(e,t),s=this;return{remove(){r.remove(),"data-received"===e&&(s._proxy.closed||s.hasEventListener("data-received")||s._proxy.enableEvent("data-received",!1))}}}queryLatestObservations(e,r){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField))throw new t("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._proxy.queryLatestObservations(this._cleanUpQuery(e),r).then((e=>{const t=n.fromJSON(e);return t.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),t}))}detach(){super.detach(),this.connectionStatus="disconnected"}_createClientOptions(){return{...super._createClientOptions(),setProperty:e=>{this.set(e.propertyName,e.value)}}}_createTileRendererHash(e){const t=`${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(l(this.layer.definitionExpression,this.layer.geometryDefinition))})`;return super._createTileRendererHash(e)+t}async _createServiceOptions(){const e=this.layer,{objectIdField:t}=e,r=e.fields.map((e=>e.toJSON())),s=p(e.geometryType),i=e.timeInfo&&e.timeInfo.toJSON()||null,o=e.spatialReference?e.spatialReference.toJSON():null;return{type:"stream",fields:r,geometryType:s,objectIdField:t,timeInfo:i,source:this.layer.parsedUrl,serviceFilter:l(this.layer.definitionExpression,this.layer.geometryDefinition),purgeOptions:this.layer.purgeOptions.toJSON(),enableDataReceived:this._enabledDataReceived,spatialReference:o,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,updateInterval:this.layer.updateInterval,customParameters:e.customParameters}}};e([o()],d.prototype,"errorString",void 0),e([o({readOnly:!0})],d.prototype,"connectionError",null),e([o()],d.prototype,"connectionStatus",void 0),d=e([a("esri.views.2d.layers.StreamLayerView2D")],d);const u=d;export{u as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,isSome as s}from"../../../core/maybe.js";import{watch as i}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import{toJSONGeometryType as p}from"./support/util.js";function l(e,t){if(r(e)&&r(t))return null;const i={};return s(t)&&(i.geometry=t.toJSON()),s(e)&&(i.where=e),i}let d=class extends c{constructor(){super(...arguments),this._enabledDataReceived=!1,this._isUserPaused=!1,this.errorString=null,this.connectionStatus="disconnected"}initialize(){this.handles.add([this.layer?.on("send-message",(e=>this._proxy.sendMessage(e))),this.layer?.on("receive-message",(e=>this._proxy.receiveMessage(e))),i((()=>this.layer?.purgeOptions),(()=>this._update())),i((()=>this.suspended),(e=>{e?this._proxy.pauseStream():this._isUserPaused||this._proxy.resumeStream()}))])}get connectionError(){if(this.errorString)return new t("stream-controller",this.errorString)}pause(){this._isUserPaused=!0,this._proxy.pauseStream()}resume(){this._isUserPaused=!1,this._proxy.resumeStream()}on(e,t){"data-received"===e&&(this._enabledDataReceived=!0,this._proxy.enableEvent("data-received",!0));const r=super.on(e,t),s=this;return{remove(){r.remove(),"data-received"===e&&(s._proxy.closed||s.hasEventListener("data-received")||s._proxy.enableEvent("data-received",!1))}}}queryLatestObservations(e,r){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new t("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._proxy.queryLatestObservations(this._cleanUpQuery(e),r).then((e=>{const t=n.fromJSON(e);return t.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),t}))}detach(){super.detach(),this.connectionStatus="disconnected"}_createClientOptions(){return{...super._createClientOptions(),setProperty:e=>{this.set(e.propertyName,e.value)}}}_createTileRendererHash(e){const t=`${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(l(this.layer.definitionExpression,this.layer.geometryDefinition))})`;return super._createTileRendererHash(e)+t}async _createServiceOptions(){const e=this.layer,{objectIdField:t}=e,r=e.fields.map((e=>e.toJSON())),s=p(e.geometryType),i=e.timeInfo&&e.timeInfo.toJSON()||null,o=e.spatialReference?e.spatialReference.toJSON():null;return{type:"stream",fields:r,geometryType:s,objectIdField:t,timeInfo:i,source:this.layer.parsedUrl,serviceFilter:l(this.layer.definitionExpression,this.layer.geometryDefinition),purgeOptions:this.layer.purgeOptions.toJSON(),enableDataReceived:this._enabledDataReceived,spatialReference:o,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,updateInterval:this.layer.updateInterval,customParameters:e.customParameters}}};e([o()],d.prototype,"errorString",void 0),e([o({readOnly:!0})],d.prototype,"connectionError",null),e([o()],d.prototype,"connectionStatus",void 0),d=e([a("esri.views.2d.layers.StreamLayerView2D")],d);const u=d;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{isNone as r,applySome as s,isSome as i,filterNones as a}from"../../../../../core/maybe.js";import{ignoreAbortErrors as o,after as n,throwIfAborted as u,throwIfNotAbortError as g,isAbortError as h}from"../../../../../core/promiseUtils.js";import{when as d,whenOnce as c}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as y}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as f}from"../../../../../layers/graphics/data/QueryEngine.js";import m from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as S}from"../FeatureStore2D.js";import{createSource as _}from"../sources/createSource.js";import v from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as I}from"../support/ClusterStore.js";import{ComputedAttributeStorage as Q}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as w}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as E}from"../support/UpdateToken.js";import{QueueProcessor as C}from"../../../../support/QueueProcessor.js";const F=5e3,j="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function x(e){return"worker:port-closed"===e.name}function R(e){if(!h(e)&&!x(e))throw e}function A(e){return"feature"===e.type&&"snapshot"===e.mode}let U=class extends t{constructor(){super(...arguments),this._storage=new Q,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new C({concurrency:"geoevent"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),d((()=>!this.updating),(()=>this.onIdle()))]),this._checkUpdating=setInterval((()=>this.notifyChange("updating")),300)}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=_(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(R))),e.on("errorString",(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(R))),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(R))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(R)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new v({type:"remote",initialize:(e,t)=>o(this.remoteClient.invoke(j,e,{signal:t}).catch(R)),update:(e,t)=>o(this.remoteClient.invoke(T,e,{signal:t}).catch(R)),render:e=>o(this.remoteClient.invoke(k,void 0,{signal:e}).catch(R))},e,(()=>this.notifyChange("updating"))))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new S(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new f({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(r(t.aggregateStore))return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),r(e))return;const s=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new f({definitionExpression:void 0,fields:s,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new m(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updating,t=!!this._updateQueue.length,r=!this.attributeStore||this.attributeStore.isUpdating(),s=e||t||r;return has("esri-2d-log-updating")&&console.log(`Updating FeatureController2D: ${s}\n -> updatingSource ${e}\n -> updateQueue ${t}\n -> updatingAttributeStore ${r}\n`),s}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"geoevent"===this._source.type&&this._source.pauseStream()}resumeStream(){"geoevent"===this._source.type&&this._source.resumeStream()}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(i(this.aggregateStore)&&(this.handles.remove("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new I(e,this.spatialReference,this._storage,this.service),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(R)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),i(this.aggregateStore)&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`Applying update ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await c((()=>!this.updating)),i(this.aggregateStore)&&(await n(10),await c((()=>!this.updating)))}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),i(this.aggregateStore)&&this.aggregateStore.clear(),await this._source.resend(),await c((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=E.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await c((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){i(this.aggregateStore)&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,(i(this.aggregateStore)||"heatmap"===this.processor.type)&&await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(i(this.aggregateStore)){const t=this.aggregateStore.getDisplayId(e);if(r(t)){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=i(this.aggregateStore)?this.getAggregate(s):null;if(i(e))if(i(e.attributes.referenceId)){const r=this.getFeature(e.attributes.referenceId);i(r)&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);i(e)&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(r(t))return null;const s=t.readHydratedGeometry(),i=y(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:i}}getAggregate(e){return r(this.aggregateStore)?null:this.aggregateStore.getAggregate(e)}getAggregates(){return r(this.aggregateStore)?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=a(e.map((e=>this.getDisplayId(e))));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(r(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),r(s))throw new Error(`Expected to find a feature with globalId ${e}`);return s}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:w.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:E.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>F&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).then((()=>{this.notifyChange("updating")})).catch((e=>{this.notifyChange("updating")}));return this.notifyChange("updating"),r}async _onTileMessage(e,t){if(u(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const a=this.tileStore.get(e.id);if(!a)return;if(e.clear)return this.processor.onTileClear(a);const o=e.status;this._cleanupNeeded=!0;const n=[];for(const r of e.remove??[]){const e=this.featureStore.lookupDisplayId(r);e&&n.push(e)}e.remove=n;try{if(r(e.addOrUpdate))return void this.processor.onTileMessage(a,{...e,addOrUpdate:null},i(this.aggregateStore),t).catch(g);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&o.targets.feature||(o.targets.feature=!0,this.featureStore.onTileData(a,e)),!o.storage.data||!o.storage.filters){o.storage.data=!0,o.storage.filters=!0,this.attributeStore.onTileData(a,e);"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),u(t)):this.attributeStore.sendUpdates()}if(i(this.aggregateStore)&&!o.targets.aggregate){o.targets.aggregate=!0;const t=A(this._source)&&this._source.loading,r=!A(this._source)||t||e.end;if(this.aggregateStore.onTileData(a,e,this._storage,this.attributeStore,r),!r)return;o.mesh||(this.attributeStore.onTileData(a,e),await this.attributeStore.sendUpdates())}if(!o.mesh){o.mesh=!0;const r=i(this.aggregateStore)&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(a,e,r,t),u(t)}this._maybeForceCleanup()}catch(h){g(h)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("geoevent"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),i(this.aggregateStore)&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([l({constructOnly:!0})],U.prototype,"tileStore",void 0),e([l()],U.prototype,"config",void 0),e([l({readOnly:!0})],U.prototype,"fieldsIndex",null),e([l()],U.prototype,"processor",void 0),e([l({constructOnly:!0})],U.prototype,"remoteClient",void 0),e([l({constructOnly:!0})],U.prototype,"service",void 0),e([l()],U.prototype,"spatialReference",null),e([l()],U.prototype,"updating",null),U=e([p("esri.views.2d.layers.features.controllers.FeatureController2D")],U);const q=U;export{q as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{isNone as r,applySome as s,isSome as i,filterNones as a}from"../../../../../core/maybe.js";import{ignoreAbortErrors as o,after as n,throwIfAborted as u,throwIfNotAbortError as g,isAbortError as h}from"../../../../../core/promiseUtils.js";import{when as d,whenOnce as c}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as y}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as f}from"../../../../../layers/graphics/data/QueryEngine.js";import m from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as S}from"../FeatureStore2D.js";import{createSource as _}from"../sources/createSource.js";import v from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as I}from"../support/ClusterStore.js";import{ComputedAttributeStorage as Q}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as w}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as E}from"../support/UpdateToken.js";import{QueueProcessor as C}from"../../../../support/QueueProcessor.js";const F=5e3,j="tileRenderer.featuresView.attributeView.initialize",k="tileRenderer.featuresView.attributeView.requestUpdate",T="tileRenderer.featuresView.requestRender";function x(e){return"worker:port-closed"===e.name}function R(e){if(!h(e)&&!x(e))throw e}function A(e){return"feature"===e.type&&"snapshot"===e.mode}let U=class extends t{constructor(){super(...arguments),this._storage=new Q,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new C({concurrency:"geoevent"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),d((()=>!this.updating),(()=>this.onIdle()))]),this._checkUpdating=setInterval((()=>this.notifyChange("updating")),300)}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=_(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(R))),e.on("errorString",(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(R))),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(R))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(R))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(R)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new v({type:"remote",initialize:(e,t)=>o(this.remoteClient.invoke(j,e,{signal:t}).catch(R)),update:(e,t)=>o(this.remoteClient.invoke(k,e,{signal:t}).catch(R)),render:e=>o(this.remoteClient.invoke(T,void 0,{signal:e}).catch(R))},e,(()=>this.notifyChange("updating"))))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new S(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new f({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(r(t.aggregateStore))return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),r(e))return;const s=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new f({definitionExpression:void 0,fields:s,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new m(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updating,t=!!this._updateQueue.length,r=!this.attributeStore||this.attributeStore.isUpdating(),s=e||t||r;return has("esri-2d-log-updating")&&console.log(`Updating FeatureController2D: ${s}\n -> updatingSource ${e}\n -> updateQueue ${t}\n -> updatingAttributeStore ${r}\n`),s}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"geoevent"===this._source.type&&this._source.pauseStream()}resumeStream(){"geoevent"===this._source.type&&this._source.resumeStream()}sendMessage(e){"geoevent"===this._source.type&&this._source.sendMessage(e)}receiveMessage(e){"geoevent"===this._source.type&&this._source.receiveMessage(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(i(this.aggregateStore)&&(this.handles.remove("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new I(e,this.spatialReference,this._storage,this.service),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(R)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),i(this.aggregateStore)&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`Applying update ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await c((()=>!this.updating)),i(this.aggregateStore)&&(await n(10),await c((()=>!this.updating)))}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),i(this.aggregateStore)&&this.aggregateStore.clear(),await this._source.resend(),await c((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=E.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await c((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){i(this.aggregateStore)&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,(i(this.aggregateStore)||"heatmap"===this.processor.type)&&await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(i(this.aggregateStore)){const t=this.aggregateStore.getDisplayId(e);if(r(t)){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=i(this.aggregateStore)?this.getAggregate(s):null;if(i(e))if(i(e.attributes.referenceId)){const r=this.getFeature(e.attributes.referenceId);i(r)&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);i(e)&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(r(t))return null;const s=t.readHydratedGeometry(),i=y(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:i}}getAggregate(e){return r(this.aggregateStore)?null:this.aggregateStore.getAggregate(e)}getAggregates(){return r(this.aggregateStore)?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=a(e.map((e=>this.getDisplayId(e))));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(r(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),r(s))throw new Error(`Expected to find a feature with globalId ${e}`);return s}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:w.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:E.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>F&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).then((()=>{this.notifyChange("updating")})).catch((e=>{this.notifyChange("updating")}));return this.notifyChange("updating"),r}async _onTileMessage(e,t){if(u(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const a=this.tileStore.get(e.id);if(!a)return;if(e.clear)return this.processor.onTileClear(a);const o=e.status;this._cleanupNeeded=!0;const n=[];for(const r of e.remove??[]){const e=this.featureStore.lookupDisplayId(r);e&&n.push(e)}e.remove=n;try{if(r(e.addOrUpdate))return void this.processor.onTileMessage(a,{...e,addOrUpdate:null},i(this.aggregateStore),t).catch(g);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&o.targets.feature||(o.targets.feature=!0,this.featureStore.onTileData(a,e)),!o.storage.data||!o.storage.filters){o.storage.data=!0,o.storage.filters=!0,this.attributeStore.onTileData(a,e);"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),u(t)):this.attributeStore.sendUpdates()}if(i(this.aggregateStore)&&!o.targets.aggregate){o.targets.aggregate=!0;const t=A(this._source)&&this._source.loading,r=!A(this._source)||t||e.end;if(this.aggregateStore.onTileData(a,e,this._storage,this.attributeStore,r),!r)return;o.mesh||(this.attributeStore.onTileData(a,e),await this.attributeStore.sendUpdates())}if(!o.mesh){o.mesh=!0;const r=i(this.aggregateStore)&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(a,e,r,t),u(t)}this._maybeForceCleanup()}catch(h){g(h)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("geoevent"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),i(this.aggregateStore)&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([l({constructOnly:!0})],U.prototype,"tileStore",void 0),e([l()],U.prototype,"config",void 0),e([l({readOnly:!0})],U.prototype,"fieldsIndex",null),e([l()],U.prototype,"processor",void 0),e([l({constructOnly:!0})],U.prototype,"remoteClient",void 0),e([l({constructOnly:!0})],U.prototype,"service",void 0),e([l()],U.prototype,"spatialReference",null),e([l()],U.prototype,"updating",null),U=e([p("esri.views.2d.layers.features.controllers.FeatureController2D")],U);const q=U;export{q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../core/has.js";import{isSome as e}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{r as s}from"../../../../../chunks/rbush.js";import{convertFromFeature as r,quantizeOptimizedGeometry as i,quantizeX as n,quantizeY as a}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as d}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as c}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as h}from"./DataTileSource.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as p}from"../support/UpdateToken.js";const l=2500;function m(t,s){const r=t.weakClone();if(e(t.geometry)){const e=n(s,t.geometry.coords[0]),i=a(s,t.geometry.coords[1]);r.geometry=new o([],[e,i])}return r}function _(e){return"esriGeometryPoint"===e?m:(t,s)=>{const r=t.weakClone(),n=new o,a=!1,d=!1,c=i(n,t.geometry,a,d,e,s,!1,!1);return r.geometry=c,r}}function v(t){return"esriGeometryPoint"===t?t=>e(t.geometry)?{minX:t.geometry.coords[0],minY:t.geometry.coords[1],maxX:t.geometry.coords[0],maxY:t.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:t=>{let s=1/0,r=1/0,i=-1/0,n=-1/0;return e(t.geometry)&&t.geometry.forEachVertex(((e,t)=>{s=Math.min(s,e),r=Math.min(r,t),i=Math.max(i,e),n=Math.max(n,t)})),{minX:s,minY:r,maxX:i,maxY:n}}}function f(e,t){const r=s(9,v(t));return r.load(e),r}function g(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class y{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=f(this._features,this._geometryType)),g(this._index,e)}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class b extends h{constructor(e){super(e),this.type="geoevent",this._updateIntervalId=0,this._dataReceiveEventEnabled=!1,this._level=0,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=e,{geometryType:r,objectIdField:i,timeInfo:n,purgeOptions:a,source:o,spatialReference:h,serviceFilter:u,maxReconnectionAttempts:p,maxReconnectionInterval:m,updateInterval:v,enableDataReceived:f,customParameters:g}=e.serviceInfo,b=new y(this._onUpdate.bind(this),r),I=new d(b,i,n,a),U=c(o,h,s,r,u,p,m,g??{});this._store=b,this._manager=I,this._connection=U,this._quantize=_(r),this._dataReceiveEventEnabled=f,this._handles=[this._connection.on("data-received",(e=>this._onFeature(e))),t((()=>U.connectionStatus),(e=>this.events.emit("connectionStatus",e))),t((()=>U.errorString),(e=>this.events.emit("errorString",e)))],this._initUpdateInterval=()=>{let t=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),r=s-t;if(r>l){t=s;const e=Math.round(this._updateInfo.client/(r/1e3)),i=Math.round(this._updateInfo.websocket/(r/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:e,websocket:i})}e.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),v)},this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._handles.forEach((e=>e.remove())),this._connection.destroy()}_fetchDataTile(){}pauseStream(){this._clearUpdateInterval()}resumeStream(){this._initUpdateInterval()}enableEvent(e,t){"data-received"===e&&(this._dataReceiveEventEnabled=t)}get updating(){return!1}subscribe(e,t){super.subscribe(e,t);const s=this._subscriptions.get(e.id);this._level=e.level;const r=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:r,end:!0}),s.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(t){const s=this._subscriptions.get(t),{tile:r}=s;yield this._getTileFeatures(r);for(const i of s.requests.stream.entries)e(i)&&e(i.addOrUpdate)&&(yield i.addOrUpdate)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onFeature(e){this._updateInfo.websocket++;try{this._dataReceiveEventEnabled&&this.events.emit("data-received",e);const t=r(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(t,s){this._inUpdate=!0;try{e(t)&&(this._updateInfo.client+=t.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const s=[];this._subscriptions.forEach(((e,t)=>{if(!e.didSend||e.tile.level!==this._level)return;const r=e.tile,i={type:"append",id:t,addOrUpdate:this._getTileFeatures(r),remove:[],end:!1,status:p.empty()};e.requests.stream.enqueue(i),s.push(this._onMessage(i))})),await Promise.all(s),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{b as GeoEventSource};
5
+ import"../../../../../core/has.js";import{isSome as e}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{r as s}from"../../../../../chunks/rbush.js";import{convertFromFeature as i,quantizeOptimizedGeometry as n,quantizeX as r,quantizeY as o}from"../../../../../layers/graphics/featureConversionUtils.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as c}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as d}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as h}from"./DataTileSource.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as l}from"../support/UpdateToken.js";const p=2500;function m(t,s){const i=t.weakClone();if(e(t.geometry)){const e=r(s,t.geometry.coords[0]),n=o(s,t.geometry.coords[1]);i.geometry=new a([],[e,n])}return i}function _(e){return"esriGeometryPoint"===e?m:(t,s)=>{const i=t.weakClone(),r=new a,o=!1,c=!1,d=n(r,t.geometry,o,c,e,s,!1,!1);return i.geometry=d,i}}function v(t){return"esriGeometryPoint"===t?t=>e(t.geometry)?{minX:t.geometry.coords[0],minY:t.geometry.coords[1],maxX:t.geometry.coords[0],maxY:t.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:t=>{let s=1/0,i=1/0,n=-1/0,r=-1/0;return e(t.geometry)&&t.geometry.forEachVertex(((e,t)=>{s=Math.min(s,e),i=Math.min(i,t),n=Math.max(n,e),r=Math.max(r,t)})),{minX:s,minY:i,maxX:n,maxY:r}}}function g(e,t){const i=s(9,v(t));return i.load(e),i}function f(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class y{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=g(this._features,this._geometryType)),f(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class I extends h{constructor(e){super(e),this.type="geoevent",this._updateIntervalId=0,this._dataReceiveEventEnabled=!1,this._level=0,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=e,{geometryType:i,objectIdField:n,timeInfo:r,purgeOptions:o,source:a,spatialReference:h,serviceFilter:u,maxReconnectionAttempts:l,maxReconnectionInterval:m,updateInterval:v,enableDataReceived:g,customParameters:f}=e.serviceInfo,I=new y(this._onUpdate.bind(this),i),b=new c(I,n,r,o),j=d(a,h,s,i,u,l,m,f??{});this._store=I,this._manager=b,this._connection=j,this._quantize=_(i),this._dataReceiveEventEnabled=g,this._handles=[this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e))),t((()=>j.connectionStatus),(e=>this.events.emit("connectionStatus",e))),t((()=>j.errorString),(e=>this.events.emit("errorString",e)))],this._initUpdateInterval=()=>{let t=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),i=s-t;if(i>p){t=s;const e=Math.round(this._updateInfo.client/(i/1e3)),n=Math.round(this._updateInfo.websocket/(i/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:e,websocket:n})}e.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),v)},this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._handles.forEach((e=>e.remove())),this._connection.destroy()}_fetchDataTile(){}pauseStream(){this._clearUpdateInterval(),this.events.emit("connectionStatus","paused")}resumeStream(){this._initUpdateInterval(),this.events.emit("connectionStatus",this._connection.connectionStatus)}sendMessage(e){this._connection.sendMessage(e)}receiveMessage(e){this._connection.receiveMessage(e)}enableEvent(e,t){"data-received"===e&&(this._dataReceiveEventEnabled=t)}get updating(){return!1}subscribe(e,t){super.subscribe(e,t);const s=this._subscriptions.get(e.id);this._level=e.level;const i=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:i,end:!0}),s.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onWebSocketMessage(e){if(this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._dataReceiveEventEnabled&&this.events.emit("data-received",e);const t=i(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(t,s){this._inUpdate=!0;try{e(t)&&(this._updateInfo.client+=t.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const s=[];this._subscriptions.forEach(((e,t)=>{if(!e.didSend||e.tile.level!==this._level)return;const i=e.tile,n={type:"append",id:t,addOrUpdate:this._getTileFeatures(i),remove:[],end:!1,status:l.empty()};e.requests.stream.enqueue(n),s.push(this._onMessage(n))})),await Promise.all(s),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{I as GeoEventSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{DateTimeReferenceFieldIndex as t}from"../../../../../arcade/arcadeTimeUtils.js";import has from"../../../../../core/has.js";import{isSome as r,isNone as s,unwrapOrThrow as i,unwrapOr as a}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as n}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import d from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as h}from"./StaticBitSet.js";import{fromJSON as u}from"../../../../../geometry/support/jsonUtils.js";let c=0;const l=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],m=l[0],f=l[1],g=l[2],_=l[3],y=has("featurelayer-simplify-payload-size-factors")??[1,2,4],p=y[0],x=y[1],I=y[2],A=has("featurelayer-simplify-mobile-factor")??2,S=has("esri-mobile");class b{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this._datetimeMetadata=null,this.instance=e,this._layerSchema=t}static createInstance(){return c++,c=c>65535?0:c,c}get isEmpty(){return r(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let r=1;const s=S?A:1;t>4e6?r=I*s:t>1e6?r=x*s:t>5e5?r=p*s:t>1e5&&(r=s);let i=0;e>4e3?i=_*r:e>2e3?i=g*r:e>100?i=f:e>15&&(i=m);let a=8;return this._level<4?a=1:this._level<5?a=2:this._level<6&&(a=4),i*a}createQuantizedExtrudedQuad(e,t){return new d([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,r,s){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=r,i._sy*=s,i}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=o(e,this.geometryType,this.hasZ,this.hasM),r=u(t);return r&&(r.spatialReference=this._arcadeSpatialReference),r}get dateTimeReferenceFieldIndex(){return this._datetimeMetadata||(this._datetimeMetadata=t.create(this._layerSchema.fields,this._layerSchema)),this._datetimeMetadata}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSToArcadeDate(r):r}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}field(e){if(this.hasField(e))return this.autocastArcadeDate(e,this.readAttribute(e,!0));for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e)){const r=t._readAttribute(e,!0);return this.autocastArcadeDate(e,r)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.getFieldNames()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes?t.attributes:{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry().toJSON()}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(s(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();){const r=i(t.getObjectId());e.set(r,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const r of e)t.has(r)&&this.removeAtIndex(t.get(r))}removeAtIndex(e){s(this._deleted)&&(this._deleted=h.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return s(this._deleted)||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=a(this.getQuantizationTransform(),null);return n(new d,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}export{b as FeatureSetReader};
5
+ import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{DateTimeReferenceFieldIndex as t}from"../../../../../arcade/arcadeTimeUtils.js";import has from"../../../../../core/has.js";import{isSome as r,isNone as s,unwrapOrThrow as i,unwrapOr as a}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as n}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import d from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as h}from"./StaticBitSet.js";import{fromJSON as u}from"../../../../../geometry/support/jsonUtils.js";let c=0;const l=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],m=l[0],f=l[1],g=l[2],_=l[3],y=has("featurelayer-simplify-payload-size-factors")??[1,2,4],p=y[0],x=y[1],I=y[2],A=has("featurelayer-simplify-mobile-factor")??2,S=has("esri-mobile");class b{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this._datetimeMetadata=null,this.instance=e,this._layerSchema=t}static createInstance(){return c++,c=c>65535?0:c,c}get isEmpty(){return r(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let r=1;const s=S?A:1;t>4e6?r=I*s:t>1e6?r=x*s:t>5e5?r=p*s:t>1e5&&(r=s);let i=0;e>4e3?i=_*r:e>2e3?i=g*r:e>100?i=f:e>15&&(i=m);let a=8;return this._level<4?a=1:this._level<5?a=2:this._level<6&&(a=4),i*a}createQuantizedExtrudedQuad(e,t){return new d([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,r,s){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=r,i._sy*=s,i}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=o(e,this.geometryType,this.hasZ,this.hasM),r=u(t);return r&&(r.spatialReference=this._arcadeSpatialReference),r}get dateTimeReferenceFieldIndex(){return this._datetimeMetadata||(this._datetimeMetadata=t.create(this._layerSchema.fields,this._layerSchema)),this._datetimeMetadata}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSToArcadeDate(r):r}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}field(e){if(this.hasField(e))return this.autocastArcadeDate(e,this.readAttribute(e,!0));for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e)){const r=t._readAttribute(e,!0);return this.autocastArcadeDate(e,r)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.getFieldNames()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes?t.attributes:{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(s(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();){const r=i(t.getObjectId());e.set(r,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const r of e)t.has(r)&&this.removeAtIndex(t.get(r))}removeAtIndex(e){s(this._deleted)&&(this._deleted=h.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return s(this._deleted)||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=a(this.getQuantizationTransform(),null);return n(new d,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}export{b as FeatureSetReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{isSome as s,unwrap as r}from"../../../../core/maybe.js";import{debounce as a,isAbortError as l,eachAlways as o}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import p from"../../../../layers/support/TileInfo.js";import{update as d,unregister as y,register as g,getRasterId as m}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{extractBands as _}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{getWorldWidth as f,computeProjectedScales as b}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import"../../tiling/PagedTileQueue.js";import w from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import P from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{TILE_SIZE as C}from"../../engine/webgl/definitions.js";import{getWebGLCapabilities as R}from"../../../webgl/capabilities.js";import T from"../../../../geometry/Extent.js";const S=[0,0];let U=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=a((async(e={})=>{if(!this.previousLOD||this.layerView.suspended)return;e.reprocess&&(await this.updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters());return e.refetch||"raster"!==this.type&&!!e.reprocess?this.updatingHandles.addPromise(this.doRefresh()):this.updatingHandles.addPromise(this._redrawImage(e.signal))}))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return null==this._get("useProgressiveUpdate")||this._get("useProgressiveUpdate")}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:T.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then((()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()})));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._fetchQueue?.updating||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){R("2d").supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new w(this.layerView.tileInfo,this.layerView.fullExtent);const e=this._computeFetchConcurrency();this._fetchQueue=new P({tileInfoView:this._tileInfoView,concurrency:e,process:(e,t)=>this._fetchTile1(e,t)});const t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._enqueueTileFetch(t),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",(()=>{e.destroy(),this.layerView.requestUpdate()})),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&s(this._emptyTilePixelBlock))return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,r]=e,a=new u({width:i,height:r,pixels:[new Uint8Array(i*r)],mask:new Uint8Array(i*r),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=a),a}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map((e=>i[Math.min(e,i.length-1)])):e||i}updateRasterFunctionParameters(){}_fetchTile1(e,t){const i=s(t)?t.signal:null,a=this.canUseWebGLForProcessing(),{layerView:l}=this,{tileInfo:o}=l,n=!o.isWrappable&&s(f(l.view.spatialReference)),h=a&&this.layer.raster.hasUniqueSourceStorageInfo,c={allowPartialFill:!0,datumTransformation:l.datumTransformation,interpolation:a?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:h,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:r(i),srcResolution:this._srcResolutions[e.level],timeExtent:l.timeExtent,tileInfo:o,disableWrapAround:n};return this.fetchTile(e,c)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const e=this.layerView.view.spatialReference,t=new c({x:this.layerView.fullExtent.xmin,y:this.layerView.fullExtent.ymax,spatialReference:e}),{scales:i,srcResolutions:s,isCustomTilingScheme:r}=b(this.layer.rasterInfo,e,C),a=p.create({spatialReference:e,size:C,scales:i});(0===a.origin.x||a.origin.x>t.x)&&(a.origin=t),this._isCustomTilingScheme=r,this.layerView.set("tileInfo",a),this._srcResolutions=s??[]}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){this.updatingHandles.addPromise(this._enqueueTileFetch1(e,t))}async _enqueueTileFetch1(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let a=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){a=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){l(s)&&i.getLogger(this.declaredClass).error(s)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const o=this._tileInfoView.getTileCoords(S,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:a,bandIds:r,coords:o,resolution:n}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(s){l(s)||i.getLogger(this.declaredClass).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await o(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const{resolution:s}=this.previousLOD,r=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:_(i.pixelBlock,r),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:r});!this.canUseWebGLForProcessing()&&a&&"stretch"===a.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(a.factor=a.factor.map((e=>255*e)),a.outMin=Math.round(255*a.outMin),a.outMax=Math.round(255*a.outMax)),this._globalSymbolizerParams=a}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{url:s,raster:r}=t,{multidimensionalDefinition:a}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),l=r.rasterInfo.multidimensionalInfo?r.getSliceIndex(a):null,o=m(s,l);if(o!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&y(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=g(o,r.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),s=this._srcResolutions[t.level];d(o,this._blockCacheRegistryId,e.extent,e.resolution,s,r.ioConfig.sampling)}this._blockCacheRegistryUrl=o}}async doRefresh(){if(!this.attached)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.tiles.forEach((t=>e.push(this._enqueueTileFetch(t)))),await o(e)}};e([n()],U.prototype,"_fetchQueue",void 0),e([n()],U.prototype,"_globalUpdateRequested",void 0),e([n()],U.prototype,"attached",void 0),e([n()],U.prototype,"container",void 0),e([n()],U.prototype,"layer",void 0),e([n()],U.prototype,"layerView",void 0),e([n()],U.prototype,"type",void 0),e([n()],U.prototype,"useWebGLForProcessing",null),e([n()],U.prototype,"useProgressiveUpdate",null),e([n()],U.prototype,"timeExtent",void 0),e([n()],U.prototype,"updating",null),U=e([h("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],U);export{U as BaseImageryTileSubView2D};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{HandleOwner as t}from"../../../../core/HandleOwner.js";import i from"../../../../core/Logger.js";import{isSome as s,unwrap as r}from"../../../../core/maybe.js";import{debounce as a,isAbortError as o,eachAlways as l}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/Point.js";import u from"../../../../layers/support/PixelBlock.js";import p from"../../../../layers/support/TileInfo.js";import{update as d,unregister as g,register as y,getRasterId as m}from"../../../../layers/support/rasterDatasets/RawBlockCache.js";import{extractBands as _}from"../../../../layers/support/rasterFunctions/pixelUtils.js";import{getWorldWidth as f,computeProjectedScales as b}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import"../../tiling/PagedTileQueue.js";import w from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import I from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{TILE_SIZE as C}from"../../engine/webgl/definitions.js";import{getWebGLCapabilities as R}from"../../../webgl/capabilities.js";import T from"../../../../geometry/Extent.js";const S=[0,0];let v=class extends t{constructor(){super(...arguments),this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=a((async(e={})=>{if(!this.previousLOD||this.layerView.suspended)return;e.reprocess&&(await this.updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters());return e.refetch||"raster"!==this.type&&!!e.reprocess?this.updatingHandles.addPromise(this.doRefresh()):this.updatingHandles.addPromise(this._redrawImage(e.signal))}))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return null==this._get("useProgressiveUpdate")||this._get("useProgressiveUpdate")}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s=t.toJSON?t:T.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null==this._symbolizerParams||this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.layerView.hasTilingEffects&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then((()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()})));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._fetchQueue?.updating||this._globalUpdateRequested||!(!this.updatingHandles||!this.updatingHandles.updating)}attach(){R("2d").supportsTextureFloat||(this.useWebGLForProcessing=!1),this._initializeTileInfo(),this._tileInfoView=new w(this.layerView.tileInfo,this.layerView.fullExtent);const e=this._computeFetchConcurrency();this._fetchQueue=new I({tileInfoView:this._tileInfoView,concurrency:e,process:(e,t)=>this._fetchTile1(e,t)});const t=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,g(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._enqueueTileFetch(t),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",(()=>{e.destroy(),this.layerView.requestUpdate()})),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.tileInfo.size.join(",");if(t&&s(this._emptyTilePixelBlock))return this._emptyTilePixelBlock;e=e||this._tileInfoView.tileInfo.size;const[i,r]=e,a=new u({width:i,height:r,pixels:[new Uint8Array(i*r)],mask:new Uint8Array(i*r),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=a),a}_getBandIds(){if(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain)return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map((e=>i[Math.min(e,i.length-1)])):e||i}updateRasterFunctionParameters(){}_fetchTile1(e,t){const i=s(t)?t.signal:null,a=this.canUseWebGLForProcessing(),{layerView:o}=this,{tileInfo:l}=o,n=!l.isWrappable&&s(f(o.view.spatialReference)),h=a&&this.layer.raster.hasUniqueSourceStorageInfo,c={allowPartialFill:!0,datumTransformation:o.datumTransformation,interpolation:a?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:h,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:r(i),srcResolution:this._srcResolutions[e.level],timeExtent:o.timeExtent,tileInfo:l,disableWrapAround:n};return this.fetchTile(e,c)}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference,i=new c({x:e.fullExtent.xmin,y:e.fullExtent.ymax,spatialReference:t});if(this._canUseLayerLODs()){const{lods:s}=this.layer.tileInfo,r=s.map((({scale:e})=>e)),a=p.create({spatialReference:t,size:C,scales:r}),o=t.isGeographic?.01*1e-5:.01;if(this._isCustomTilingScheme=Math.abs(a.origin.x-i.x)>o,(0===a.origin.x||a.origin.x>i.x)&&(a.origin=i),!this._isCustomTilingScheme){const e=p.create({spatialReference:t,size:C}).lods.map((({scale:e})=>e));this._isCustomTilingScheme=r.some((t=>!e.some((e=>Math.abs(e-t)<.001))))}return e.set("tileInfo",a),void(this._srcResolutions=s.map((({resolution:e})=>({x:e,y:e}))))}const{scales:s,srcResolutions:r,isCustomTilingScheme:a}=b(this.layer.rasterInfo,t,C),o=p.create({spatialReference:t,size:C,scales:s});(0===o.origin.x||o.origin.x>i.x)&&(o.origin=i),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;if(!(s?.length===i.length&&s.every((({scale:e},t)=>Math.abs(e-i[t].scale)<.001))))return!1;const r=[];for(let a=0;a<i.length-1;a++)r.push(Math.round(10*i[a].resolution/i[a+1].resolution)/10);return r.some((e=>e!==e[0]))}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.rasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){this.updatingHandles.addPromise(this._enqueueTileFetch1(e,t))}async _enqueueTileFetch1(e,t){if(!this._fetchQueue.has(e.key.id)){try{const t=await this._fetchQueue.push(e.key),r=this._getBandIds();let a=!this.useProgressiveUpdate||this.layerView.hasTilingEffects&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){a=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){o(s)&&i.getLogger(this.declaredClass).error(s)}this._globalUpdateRequested=!1}!this.canUseWebGLForProcessing()&&"rasterVF"!==this.type||this.layerView.hasTilingEffects||null!=this._symbolizerParams||this._updateSymbolizerParams();const l=this._tileInfoView.getTileCoords(S,e.key),n=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:t,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:a,bandIds:r,coords:l,resolution:n}),e.once("attach",(()=>this.layerView.requestUpdate())),this.container.addChild(e)}catch(s){o(s)||i.getLogger(this.declaredClass).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(0===this.container.children.length)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects?await this._updateGlobalSymbolizerParams(e):(this._updateSymbolizerParams(),this._globalSymbolizerParams=null);const t=this.container.children.map((async e=>this.updateTileSymbolizerParameters(e,{local:this._symbolizerParams,global:this._globalSymbolizerParams})));await l(t),this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t={srcResolution:this._srcResolutions[this.previousLOD.level],registryId:this._blockCacheRegistryId,signal:e},i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,t);if(!i||!i.pixelBlock)return;const{resolution:s}=this.previousLOD,r=this._getBandIds(),a=this.layer.symbolizer.generateWebGLParameters({pixelBlock:_(i.pixelBlock,r),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:r});!this.canUseWebGLForProcessing()&&a&&"stretch"===a.type&&this.layer.renderer&&"raster-stretch"===this.layer.renderer.type&&(a.factor=a.factor.map((e=>255*e)),a.outMin=Math.round(255*a.outMin),a.outMax=Math.round(255*a.outMax)),this._globalSymbolizerParams=a}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{url:s,raster:r}=t,{multidimensionalDefinition:a}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),o=r.rasterInfo.multidimensionalInfo?r.getSliceIndex(a):null,l=m(s,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&g(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=y(l,r.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),s=this._srcResolutions[t.level];d(l,this._blockCacheRegistryId,e.extent,e.resolution,s,r.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached)return;await this.layer.updateRenderer(),this.layerView.hasTilingEffects||this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.layerView.hasTilingEffects||!this.useProgressiveUpdate,this._tileStrategy.tiles.forEach((t=>e.push(this._enqueueTileFetch(t)))),await l(e)}};e([n()],v.prototype,"_fetchQueue",void 0),e([n()],v.prototype,"_globalUpdateRequested",void 0),e([n()],v.prototype,"attached",void 0),e([n()],v.prototype,"container",void 0),e([n()],v.prototype,"layer",void 0),e([n()],v.prototype,"layerView",void 0),e([n()],v.prototype,"type",void 0),e([n()],v.prototype,"useWebGLForProcessing",null),e([n()],v.prototype,"useProgressiveUpdate",null),e([n()],v.prototype,"timeExtent",void 0),e([n()],v.prototype,"updating",null),v=e([h("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],v);export{v as BaseImageryTileSubView2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{EsriPromise as t}from"../../../../core/Promise.js";import{createResolver as r,ignoreAbortErrors as s,throwIfNotAbortError as o}from"../../../../core/promiseUtils.js";import{open as i}from"../../../../core/workers/workers.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";function c(e){return Array.isArray(e)}let u=class extends t{constructor(e){super(e),this._startupResolver=r(),this.isReady=!1}initialize(){this._controller=new AbortController,this.addResolvingPromise(this._startWorker(this._controller.signal))}destroy(){this._controller.abort(),this._connection&&this._connection.close()}set tileRenderer(e){this.client.tileRenderer=e}get closed(){return this._connection.closed}async startup(e,t,r,s){await this.when();const o=this._controller.signal,i=c(r.source)?{transferList:r.source,signal:o}:void 0,n={service:r,config:t,tileInfo:e.tileInfo.toJSON(),tiles:s};await this._connection.invoke("startup",n,i),this._startupResolver.resolve(),this._set("isReady",!0)}async updateTiles(e){return await this._startupResolver.promise,s(this._connection.invoke("updateTiles",e))}async update(e){const t={config:e};return await this._startupResolver.promise,this._connection.invoke("update",t)}async applyUpdate(e){return await this._startupResolver.promise,this._connection.invoke("applyUpdate",e)}async setHighlight(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.setHighlight",e))}async stop(){if(await this._startupResolver.promise,!this.closed)return s(this._connection.invoke("stop"))}async refresh(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.refresh",e))}async querySummaryStatistics(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.querySummaryStatistics",{query:e.toJSON(),params:t},r)}async queryAggregateSummaryStatistics(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateSummaryStatistics",{query:e.toJSON(),params:t},r)}async queryUniqueValues(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryUniqueValues",{query:e.toJSON(),params:t},r)}async queryAggregateUniqueValues(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateUniqueValues",{query:e.toJSON(),params:t},r)}async queryClassBreaks(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryClassBreaks",{query:e.toJSON(),params:t},r)}async queryAggregateClassBreaks(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateClassBreaks",{query:e.toJSON(),params:t},r)}async queryHistogram(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryHistogram",{query:e.toJSON(),params:t},r)}async queryAggregateHistogram(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateHistogram",{query:e.toJSON(),params:t},r)}async queryFeatures(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatures",e?.toJSON(),t)}async queryVisibleFeatures(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryVisibleFeatures",e?.toJSON(),t)}async queryObjectIds(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryObjectIds",e?.toJSON(),t)}async queryFeatureCount(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatureCount",e?.toJSON(),t)}async queryExtent(e,t){return this._connection.invoke("controller.queryExtent",e.toJSON(),t)}async queryLatestObservations(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryLatestObservations",e.toJSON(),t)}async queryStatistics(e){return await this._startupResolver.promise,this._connection.invoke("controller.queryStatistics",e)}async queryAggregates(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregates",e?.toJSON(),t)}async queryAggregateCount(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateCount",e?.toJSON(),t)}async queryAggregateIds(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateIds",e?.toJSON(),t)}async getObjectId(e){return await this._startupResolver.promise,this._connection.invoke("controller.getObjectId",e)}async getDisplayId(e){return await this._startupResolver.promise,this._connection.invoke("controller.getDisplayId",e)}async getFeatures(e){return await this._startupResolver.promise,this._connection.invoke("controller.getFeatures",e)}async getAggregates(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregates")}async getAggregateValueRanges(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregateValueRanges")}async mapValidDisplayIds(e){return await this._startupResolver.promise,this._connection.invoke("controller.mapValidDisplayIds",e)}async onEdits(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.onEdits",e))}async enableEvent(e,t){return await this._startupResolver.promise,s(this._connection.invoke("controller.enableEvent",{name:e,value:t}))}pauseStream(){return s(this._connection.invoke("controller.pauseStream"))}resumeStream(){return s(this._connection.invoke("controller.resumeStream"))}async _startWorker(e){try{this._connection=await i("Pipeline",{client:this.client,strategy:"dedicated",signal:e})}catch(t){o(t)}}};e([n()],u.prototype,"isReady",void 0),e([n({constructOnly:!0})],u.prototype,"client",void 0),e([n()],u.prototype,"tileRenderer",null),u=e([a("esri.views.2d.layers.support.FeatureLayerProxy")],u);const l=u;export{l as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{EsriPromise as t}from"../../../../core/Promise.js";import{createResolver as r,ignoreAbortErrors as s,throwIfNotAbortError as o}from"../../../../core/promiseUtils.js";import{open as i}from"../../../../core/workers/workers.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";function c(e){return Array.isArray(e)}let u=class extends t{constructor(e){super(e),this._startupResolver=r(),this.isReady=!1}initialize(){this._controller=new AbortController,this.addResolvingPromise(this._startWorker(this._controller.signal))}destroy(){this._controller.abort(),this._connection&&this._connection.close()}set tileRenderer(e){this.client.tileRenderer=e}get closed(){return this._connection.closed}async startup(e,t,r,s){await this.when();const o=this._controller.signal,i=c(r.source)?{transferList:r.source,signal:o}:void 0,n={service:r,config:t,tileInfo:e.tileInfo.toJSON(),tiles:s};await this._connection.invoke("startup",n,i),this._startupResolver.resolve(),this._set("isReady",!0)}async updateTiles(e){return await this._startupResolver.promise,s(this._connection.invoke("updateTiles",e))}async update(e){const t={config:e};return await this._startupResolver.promise,this._connection.invoke("update",t)}async applyUpdate(e){return await this._startupResolver.promise,this._connection.invoke("applyUpdate",e)}async setHighlight(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.setHighlight",e))}async stop(){if(await this._startupResolver.promise,!this.closed)return s(this._connection.invoke("stop"))}async refresh(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.refresh",e))}async querySummaryStatistics(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.querySummaryStatistics",{query:e.toJSON(),params:t},r)}async queryAggregateSummaryStatistics(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateSummaryStatistics",{query:e.toJSON(),params:t},r)}async queryUniqueValues(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryUniqueValues",{query:e.toJSON(),params:t},r)}async queryAggregateUniqueValues(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateUniqueValues",{query:e.toJSON(),params:t},r)}async queryClassBreaks(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryClassBreaks",{query:e.toJSON(),params:t},r)}async queryAggregateClassBreaks(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateClassBreaks",{query:e.toJSON(),params:t},r)}async queryHistogram(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryHistogram",{query:e.toJSON(),params:t},r)}async queryAggregateHistogram(e,t,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateHistogram",{query:e.toJSON(),params:t},r)}async queryFeatures(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatures",e?.toJSON(),t)}async queryVisibleFeatures(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryVisibleFeatures",e?.toJSON(),t)}async queryObjectIds(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryObjectIds",e?.toJSON(),t)}async queryFeatureCount(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatureCount",e?.toJSON(),t)}async queryExtent(e,t){return this._connection.invoke("controller.queryExtent",e.toJSON(),t)}async queryLatestObservations(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryLatestObservations",e.toJSON(),t)}async queryStatistics(e){return await this._startupResolver.promise,this._connection.invoke("controller.queryStatistics",e)}async queryAggregates(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregates",e?.toJSON(),t)}async queryAggregateCount(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateCount",e?.toJSON(),t)}async queryAggregateIds(e,t){return await this._startupResolver.promise,this._connection.invoke("controller.queryAggregateIds",e?.toJSON(),t)}async getObjectId(e){return await this._startupResolver.promise,this._connection.invoke("controller.getObjectId",e)}async getDisplayId(e){return await this._startupResolver.promise,this._connection.invoke("controller.getDisplayId",e)}async getFeatures(e){return await this._startupResolver.promise,this._connection.invoke("controller.getFeatures",e)}async getAggregates(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregates")}async getAggregateValueRanges(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregateValueRanges")}async mapValidDisplayIds(e){return await this._startupResolver.promise,this._connection.invoke("controller.mapValidDisplayIds",e)}async onEdits(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.onEdits",e))}async enableEvent(e,t){return await this._startupResolver.promise,s(this._connection.invoke("controller.enableEvent",{name:e,value:t}))}async pauseStream(){return await this._startupResolver.promise,s(this._connection.invoke("controller.pauseStream"))}async resumeStream(){return await this._startupResolver.promise,s(this._connection.invoke("controller.resumeStream"))}async sendMessage(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.sendMessage",e))}async receiveMessage(e){return await this._startupResolver.promise,s(this._connection.invoke("controller.receiveMessage",e))}async _startWorker(e){try{this._connection=await i("Pipeline",{client:this.client,strategy:"dedicated",signal:e})}catch(t){o(t)}}};e([n()],u.prototype,"isReady",void 0),e([n({constructOnly:!0})],u.prototype,"client",void 0),e([n()],u.prototype,"tileRenderer",null),u=e([a("esri.views.2d.layers.support.FeatureLayerProxy")],u);const l=u;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{StreamController as i}from"../../../layers/graphics/controllers/StreamController.js";import a from"../../../rest/support/Query.js";import{FeatureLikeLayerView3D as n}from"./FeatureLikeLayerView3D.js";import{LayerView3D as l}from"./LayerView3D.js";import{UpdatePolicy as p}from"../webgl-engine/lib/UpdatePolicy.js";import c from"../../layers/LayerView.js";import m from"../../layers/StreamLayerView.js";let y=class extends(m(n(l(c)))){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=p.ASYNC,this.hasZ=!0,this.hasM=!1}initialize(){this.handles.add(t((()=>this.suspended),(r=>{this.controller&&(r?this.controller.pauseStream():this.controller.resumeStream())})))}get connectionError(){const r=this.get("controller.connection.errorString");if(r)return new e("stream-controller",r)}createQuery(){return new a({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(r,e){return this.queryEngine.executeQueryForLatestObservations(this._ensureQuery(r),e?.signal)}createController(){return new i({layer:this.layer,layerView:this})}beforeSetController(){}};r([o({readOnly:!0})],y.prototype,"updatePolicy",void 0),r([o({readOnly:!0})],y.prototype,"connectionError",null),r([o()],y.prototype,"controller",void 0),r([o({readOnly:!0})],y.prototype,"hasZ",void 0),r([o({readOnly:!0})],y.prototype,"hasM",void 0),y=r([s("esri.views.3d.layers.StreamLayerView3D")],y);const u=y;export{u as default};
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{StreamController as i}from"../../../layers/graphics/controllers/StreamController.js";import a from"../../../rest/support/Query.js";import{FeatureLikeLayerView3D as l}from"./FeatureLikeLayerView3D.js";import{LayerView3D as n}from"./LayerView3D.js";import{UpdatePolicy as p}from"../webgl-engine/lib/UpdatePolicy.js";import c from"../../layers/LayerView.js";import u from"../../layers/StreamLayerView.js";let m=class extends(u(l(n(c)))){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=p.ASYNC,this.hasZ=!0,this.hasM=!1,this._isUserPaused=!1}initialize(){this.handles.add(t((()=>this.suspended),(r=>{this.controller&&(r?this.controller.pauseStream():this._isUserPaused||this.controller.resumeStream())})))}get connectionError(){const r=this.get("controller.connection.errorString");if(r)return new e("stream-controller",r)}pause(){this._isUserPaused=!0,this.controller.pauseStream()}resume(){this._isUserPaused=!1,this.controller.resumeStream()}createQuery(){return new a({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(r,e){return this.queryEngine.executeQueryForLatestObservations(this._ensureQuery(r),e?.signal)}createController(){return new i({layer:this.layer,layerView:this})}beforeSetController(){}};r([s({readOnly:!0})],m.prototype,"updatePolicy",void 0),r([s({readOnly:!0})],m.prototype,"connectionError",null),r([s()],m.prototype,"controller",void 0),r([s({readOnly:!0})],m.prototype,"hasZ",void 0),r([s({readOnly:!0})],m.prototype,"hasM",void 0),m=r([o("esri.views.3d.layers.StreamLayerView3D")],m);const y=m;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/FeatureFilter.js";const s=s=>{let n=class extends s{constructor(...r){super(...r),this.connectionError=null,this.filter=null}get connectionStatus(){return this.controller?.connection?.connectionStatus??"disconnected"}};return r([o({readOnly:!0})],n.prototype,"connectionError",void 0),r([o({readOnly:!0})],n.prototype,"connectionStatus",null),r([o({type:e})],n.prototype,"filter",void 0),n=r([t("esri.layers.mixins.StreamLayerView")],n),n};export{s as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/support/FeatureFilter.js";const s=s=>{let n=class extends s{constructor(...r){super(...r),this.connectionError=null,this.filter=null}get connectionStatus(){return this.controller?.isPaused?"paused":this.controller?.connection?.connectionStatus??"disconnected"}};return r([o({readOnly:!0})],n.prototype,"connectionError",void 0),r([o({readOnly:!0})],n.prototype,"connectionStatus",null),r([o({type:e})],n.prototype,"filter",void 0),n=r([t("esri.layers.mixins.StreamLayerView")],n),n};export{s as default};