@arcgis/core 4.33.9 → 4.33.11

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 (38) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/11587332ed09d46fa368.js +1 -0
  3. package/assets/esri/core/workers/chunks/5f42b7315d8330401410.js +1 -0
  4. package/assets/esri/core/workers/chunks/822e554d7c985c0181b9.js +1 -0
  5. package/assets/esri/core/workers/chunks/c3dfa739d109aa9c99a5.js +1 -0
  6. package/kernel.js +1 -1
  7. package/layers/mixins/ArcGISImageService.js +1 -1
  8. package/layers/save/featureLayerUtils.js +1 -1
  9. package/package.json +1 -1
  10. package/support/revision.js +1 -1
  11. package/views/2d/LabelManager.js +1 -1
  12. package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +1 -1
  13. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  14. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  15. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  16. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
  17. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  18. package/views/2d/layers/features/FeatureContainer.js +1 -1
  19. package/views/2d/layers/features/RenderState.js +1 -1
  20. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  21. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  22. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  23. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  24. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  25. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  26. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  27. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  28. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  29. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  30. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  31. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  32. package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
  33. package/views/SelectionManager.js +1 -1
  34. package/views/support/LayerLayerViewInfo.js +1 -1
  35. package/assets/esri/core/workers/chunks/606782a94adcce6975af.js +0 -1
  36. package/assets/esri/core/workers/chunks/68e432a80bf6fa7b17fb.js +0 -1
  37. package/assets/esri/core/workers/chunks/d45a4e5806a80b69ceec.js +0 -1
  38. package/assets/esri/core/workers/chunks/fd520abd351571226ae3.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlOr as v,sqlIn as _,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import O from"../../../rest/support/AttributeBinsQuery.js";import Q from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as T}from"./LayerView2D.js";import{FeatureContainer as D}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as P}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as M}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as H}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as N}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as J}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as G}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as $}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as B}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as z}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as Z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as K}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as X}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as Y}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as ee}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as te}from"./support/handleNoEngineError.js";import{toJSONGeometryType as re}from"./support/util.js";import{FeatureTileSubscriptionManager as se}from"../tiling/FeatureTileSubscriptionManager.js";import ie from"../../layers/FeatureLayerView.js";import ae from"../../layers/LayerView.js";import oe from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as ne}from"../../support/HighlightDefaults.js";function ue(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const le=4294967294;function he(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let ce=class extends(ie(oe(T(ae)))){constructor(){super(...arguments),this._commandsQueue=new ee({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await P(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?v(e,_(this.layer.objectIdField,this.highlightIds)):e}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new J(this.layer):new H(this.layer);case"geojson":case"csv":case"wfs":return new J(this.layer);case"parquet":return new z(this.layer);case"subtype-group":return new K(this.layer);case"ogc-feature":return new $(this.layer);case"stream":return new Z(this.layer);case"oriented-imagery":return new B(this.layer);case"knowledge-graph-sublayer":return new G(this.layer);case"catalog-footprint":return new M(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=s?.filter(i);if(!o?.length)return u();const n=t?.name??ne;return this._addHighlights(o,n),u((()=>!this.destroyed&&this._removeHighlights(o,n)))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,s.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return te(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return te(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return te(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return te(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return te(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return te(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return te(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return te(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return te(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=Q.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await te(r,{features:[]}),i=Q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await te(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return te(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return te(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return te(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return te(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return te(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return te(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await te(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await te(r,{features:[]});return R.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.subscriptionManager.update(e.targetState,this._lastTargetState),r=this.subscriptionManager.coverageSet;for(const s of this.featureContainer.tiles||[])s.isCoverage=r.has(s.id),s.neededForCoverage=t.has(s.id)||s.isCoverage;this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new D(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new se({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([he([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=re(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await X({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=O.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this.updateSuspended?(this.subscriptionManager.suspend(),Promise.resolve()):this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%le+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%le+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=re(this.layer.geometryType),i=N(this.layer),a=[];for(const o of e.added){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),E(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new Y;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new Y;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ue(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[pe(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{m(e)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function pe(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new x,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new x,i.where=b(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(s)),u}e([F()],ce.prototype,"_commandsQueue",void 0),e([F()],ce.prototype,"_sourceRefreshVersion",void 0),e([F()],ce.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],ce.prototype,"_pipelineUpdating",void 0),e([F()],ce.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],ce.prototype,"dataUpdating",null),e([F({readOnly:!0})],ce.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],ce.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],ce.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],ce.prototype,"hasFullGeometries",null),e([F()],ce.prototype,"featureEffectView",void 0),e([F()],ce.prototype,"labelingCollisionInfos",null),e([F()],ce.prototype,"layerAdapter",null),e([F({readOnly:!0})],ce.prototype,"timeExtent",null),e([F()],ce.prototype,"updating",void 0),ce=e([S("esri.views.2d.layers.FeatureLayerView2D")],ce);export{ce as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlOr as v,sqlIn as _,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import O from"../../../rest/support/AttributeBinsQuery.js";import Q from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as T}from"./LayerView2D.js";import{FeatureContainer as D}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as P}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as M}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as H}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as N}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as J}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as G}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as $}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as B}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as z}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as Z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as K}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as X}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as Y}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as ee}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as te}from"./support/handleNoEngineError.js";import{toJSONGeometryType as re}from"./support/util.js";import{FeatureTileSubscriptionManager as se}from"../tiling/FeatureTileSubscriptionManager.js";import ie from"../../layers/FeatureLayerView.js";import ae from"../../layers/LayerView.js";import oe from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as ne}from"../../support/HighlightDefaults.js";function ue(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const le=4294967294;function he(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let ce=class extends(ie(oe(T(ae)))){constructor(){super(...arguments),this._commandsQueue=new ee({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await P(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?v(e,_(this.layer.objectIdField,this.highlightIds)):e}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new J(this.layer):new H(this.layer);case"geojson":case"csv":case"wfs":return new J(this.layer);case"parquet":return new z(this.layer);case"subtype-group":return new K(this.layer);case"ogc-feature":return new $(this.layer);case"stream":return new Z(this.layer);case"oriented-imagery":return new B(this.layer);case"knowledge-graph-sublayer":return new G(this.layer);case"catalog-footprint":return new M(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=s?.filter(i);if(!o?.length)return u();const n=t?.name??ne;return this._addHighlights(o,n),u((()=>!this.destroyed&&this._removeHighlights(o,n)))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,s.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return te(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return te(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return te(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return te(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return te(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return te(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return te(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return te(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return te(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=Q.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await te(r,{features:[]}),i=Q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await te(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return te(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return te(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return te(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return te(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return te(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return te(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await te(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await te(r,{features:[]});return R.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.subscriptionManager.update(e.targetState,this._lastTargetState),r=this.subscriptionManager.coverageSet;for(const s of this.featureContainer.tiles||[])s.isCoverage=r.has(s.id),s.neededForCoverage=t.has(s.id)||s.isCoverage;this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new D(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new se({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([he([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.view.labelManager.removeContainer(this.featureContainer),this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=re(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await X({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=O.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this.updateSuspended?(this.subscriptionManager.suspend(),Promise.resolve()):this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%le+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%le+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=re(this.layer.geometryType),i=N(this.layer),a=[];for(const o of e.added){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),E(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new Y;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new Y;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ue(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[pe(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{m(e)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function pe(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new x,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new x,i.where=b(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(s)),u}e([F()],ce.prototype,"_commandsQueue",void 0),e([F()],ce.prototype,"_sourceRefreshVersion",void 0),e([F()],ce.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],ce.prototype,"_pipelineUpdating",void 0),e([F()],ce.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],ce.prototype,"dataUpdating",null),e([F({readOnly:!0})],ce.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],ce.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],ce.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],ce.prototype,"hasFullGeometries",null),e([F()],ce.prototype,"featureEffectView",void 0),e([F()],ce.prototype,"labelingCollisionInfos",null),e([F()],ce.prototype,"layerAdapter",null),e([F({readOnly:!0})],ce.prototype,"timeExtent",null),e([F()],ce.prototype,"updating",void 0),ce=e([S("esri.views.2d.layers.FeatureLayerView2D")],ce);export{ce 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.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as r,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as h}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{TechniqueType as d}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{RenderState as l}from"./RenderState.js";import{renderHighlight as u}from"../support/util.js";class c{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class _ extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}renderChildren(e){if(this._updateAttributeView(),this._renderState?.update(this.attributeView.currentEpoch),this._layerView.requestUpdate(),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._subscriptions.get(t.key.id)?.end(),this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._layerView.view.labelManager.symbolFader.restartDeclutter(),this.requestRender())}const t=this._layerView.subscriptionManager.updateVisibility();this.setVisibleTiles(t);for(const s of this.children)s.setTransform(e.state);switch(super.renderChildren(e),e.drawPhase){case r.MAP:return this._renderMapPhase(e);case r.HIGHLIGHT:return this._renderHighlightPhase(e);case r.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight}get _layer(){return this._layerView.layer}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&h.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(p(t))return t;return null}get tiles(){return this._renderState?.tiles()}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&(this._layerView.view.labelManager.requestUpdate(),this._layerView.view.labelManager.symbolFader.restartDeclutter())}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new c(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new l((()=>this._stage),(e=>this._subscriptions.get(e)?.version),e,this.layerView.view.labelManager.symbolFader,this,this.tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const i of t)s.set(i.fieldName,{minValue:i.minValue,maxValue:i.maxValue})}lockForOverrides(){this._renderState?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState?.flush(),this.requestRender()}trySwapRenderState(){if(this._renderStateNext){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`);const e=new Map;for(const t of this._renderState?.tiles()||[])e.set(t.id,t.metricsVisibility);this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderState.flush();for(const t of this._renderState.tiles())t.copyMetricsVisibility(e.get(t.id)||new Set);this._renderStateNext=null}this.requestRender()}setVisibleTiles(e){this._visibleTiles=e;for(const t of this.tiles??[])t.rendering=e.has(t.key.id)}async onMessage(t,s){e(s);const i=t.inner;if(!this._subscriptions.has(i.id))return;const r=this._subscriptions.get(i.id);if(r.version!==i.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${i.subscriptionVesrion} != ${r.version}`;console.debug(`Version[${e}] Tile[${i.id}] FeatureContainer - Dropping message, outdated version]`,i)}return}const n=this._renderStateNext??this._renderState;if(!n)throw new Error("InternalError: No renderState defined");n.version!==i.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${i.version}]`),n.enqueueUpdate(t),this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const i=t();return s?s.resolvers.push(i):(s={x:e.x,y:e.y,resolvers:[i]},this._hitTestsRequests.push(s)),this.requestRender(),i.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const i of this.children)if(i.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=h.heatmap.getStencilReference(t)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&u(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,i=t.getBoundFramebufferObject(),a=t.getViewport(),o=e.passOptions,h=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=r.HITTEST;const{distance:d,smallSymbolDistance:l}=e.passOptions,u=Math.max(d,l);for(const r of this.children)r.visible&&r.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(r,e,n.All);s.draw(e),s.unbind(),t.bindFramebuffer(i),t.restoreViewport(a),e.passOptions=o,e.drawPhase=h}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const i of this.children)i.visible&&this._renderTile(i,e,t,d.Heatmap);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,i){const r=has("featurelayer-strict-draw-order")?a.STRICT_ORDER:has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,n=e.getDisplayList(this._instanceStore,r);t.selection=s,n?.render(t,i)}}function p(e){return e.techniqueRef.type===d.Heatmap}export{_ as FeatureContainer};
5
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t,createResolver as s}from"../../../../core/promiseUtils.js";import{UpdatingHandles as r}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as n,FeatureSelection as a,FeatureBatchingStrategy as o}from"../../engine/webgl/enums.js";import h from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as d}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{TechniqueType as l}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as c}from"../support/util.js";class _{constructor(e,t){this.id=e,this.version=t,this._resolver=s(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class p extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new r,this._hitTestsRequests=[],this._store=new h,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState=e(this._renderState),this._renderStateNext=e(this._renderStateNext)}renderChildren(e){if(this._updateAttributeView(),this._renderState?.update(this.attributeView.currentEpoch),this._layerView.requestUpdate(),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._subscriptions.get(t.key.id)?.end(),this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._layerView.view.labelManager.symbolFader.restartDeclutter(),this.requestRender())}const t=this._layerView.subscriptionManager.updateVisibility();this.setVisibleTiles(t);for(const s of this.children)s.setTransform(e.state);switch(super.renderChildren(e),e.drawPhase){case n.MAP:return this._renderMapPhase(e);case n.HIGHLIGHT:return this._renderHighlightPhase(e);case n.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight}get _layer(){return this._layerView.layer}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&d.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(f(t))return t;return null}get tiles(){return this._renderState?.tiles()}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&(this._layerView.view.labelManager.requestUpdate(),this._layerView.view.labelManager.symbolFader.restartDeclutter())}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new _(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new u((()=>this._stage),(e=>this._subscriptions.get(e)?.version),e,this.layerView.view.labelManager.symbolFader,this,this.tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState?.flush(),this.requestRender()}trySwapRenderState(){if(this._renderStateNext){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`);const e=new Map;for(const t of this._renderState?.tiles()||[])e.set(t.id,t.metricsVisibility);this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderState.flush();for(const t of this._renderState.tiles())t.copyMetricsVisibility(e.get(t.id)||new Set);this._renderStateNext=null}this.requestRender()}setVisibleTiles(e){this._visibleTiles=e;for(const t of this.tiles??[])t.rendering=e.has(t.key.id)}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext??this._renderState;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let t=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const r=s();return t?t.resolvers.push(r):(t={x:e.x,y:e.y,resolvers:[r]},this._hitTestsRequests.push(t)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=d.heatmap.getStencilReference(t)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,a.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&c(e,!1,(e=>{this._renderFeatures(e,a.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,a.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,a.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,a.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.getBoundFramebufferObject(),i=t.getViewport(),o=e.passOptions,h=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=n.HITTEST;const{distance:d,smallSymbolDistance:l}=e.passOptions,u=Math.max(d,l);for(const n of this.children)n.visible&&n.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(n,e,a.All);s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=o,e.drawPhase=h}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,l.Heatmap);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){const i=has("featurelayer-strict-draw-order")?o.STRICT_ORDER:has("featurelayer-force-marker-text-draw-order")?o.STRICT_MARKERS_AND_TEXT:o.BATCHING,n=e.getDisplayList(this._instanceStore,i);t.selection=s,n?.render(t,r)}}function f(e){return e.techniqueRef.type===l.Heatmap}export{p as FeatureContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{create as s}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import o from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as n}from"../../engine/webgl/FeatureTile.js";import{TechniqueType as r}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";const d=1e3;class l{constructor(t,i,s,o,n,r){this.getStage=t,this.getSubscriptionVersion=i,this.version=s,this._fader=o,this._container=n,this._tileInfoView=r,this._pendingUpdates=new e(d),this._locked=!1,this._tiles=new Map}destroy(){for(const e of this.tiles())e.destroy();this._pendingUpdates.clear(),this._tiles.clear()}tiles(){return this._tiles.values()}size(){return this._tiles.size}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1,this.flush()}enqueueUpdate(e){this._pendingUpdates.enqueue(e)}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||t.inner.attributeEpoch>e)break;this._updateTile(t),this._pendingUpdates.dequeue()}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&(t.isReady&&t.decluttered)}flush(){for(;this._pendingUpdates.size;){const e=this._pendingUpdates.dequeue();null!=e&&this._updateTile(e)}for(const e of this._tiles.values())e.upload()}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const o=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;o.onMessage({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void o.onMessage({type:"append",clear:t.clear,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...r]=t.append;o.onMessage({type:"append",clear:t.clear,append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const d of r){const e=this._tiles.get(d.tileId);e&&e.onMessage({type:"update",modify:d,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const d=new o(e),l=this._tileInfoView.getTileBounds(s(),d),a=l[0],u=l[3],p=this._tileInfoView.getTileResolution(d.level),c=this._container.instanceStore.find(r.Label)?.instanceId,h=new n(d,p,a,u,this._fader,c,!0);if(this._fader.registerFeatureTile(h),h.stage=this.getStage(),!h.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return h}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let o=-1;o<=1;o++){if(0===s&&0===o)continue;const n=e.key.getNormalizedNeighbor(o,s,i).id,r=this._tiles.get(n);if(null!=r){const i=1<<t;e.copyPixelBufferedEntitesFrom(r,i,o,s)}t--}}}export{l as RenderState};
5
+ import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{create as s}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import o from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as n}from"../../engine/webgl/FeatureTile.js";import{TechniqueType as r}from"../../engine/webgl/shaderGraph/techniques/TechniqueType.js";const d=1e3;class l{constructor(t,i,s,o,n,r){this.getStage=t,this.getSubscriptionVersion=i,this.version=s,this._fader=o,this._container=n,this._tileInfoView=r,this._pendingUpdates=new e(d),this._locked=!1,this._tiles=new Map}destroy(){for(const e of this.tiles())this._fader.unregisterFeatureTile(e),e.destroy();this._pendingUpdates.clear(),this._tiles.clear(),this._container=null,this._fader=null}tiles(){return this._tiles.values()}size(){return this._tiles.size}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1,this.flush()}enqueueUpdate(e){this._pendingUpdates.enqueue(e)}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||t.inner.attributeEpoch>e)break;this._updateTile(t),this._pendingUpdates.dequeue()}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&(t.isReady&&t.decluttered)}flush(){for(;this._pendingUpdates.size;){const e=this._pendingUpdates.dequeue();null!=e&&this._updateTile(e)}for(const e of this._tiles.values())e.upload()}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const o=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;o.onMessage({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void o.onMessage({type:"append",clear:t.clear,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...r]=t.append;o.onMessage({type:"append",clear:t.clear,append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const d of r){const e=this._tiles.get(d.tileId);e&&e.onMessage({type:"update",modify:d,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const d=new o(e),l=this._tileInfoView.getTileBounds(s(),d),a=l[0],u=l[3],p=this._tileInfoView.getTileResolution(d.level),c=this._container.instanceStore.find(r.Label)?.instanceId,h=new n(d,p,a,u,this._fader,c,!0);if(this._fader.registerFeatureTile(h),h.stage=this.getStage(),!h.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return h}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let o=-1;o<=1;o++){if(0===s&&0===o)continue;const n=e.key.getNormalizedNeighbor(o,s,i).id,r=this._tiles.get(n);if(null!=r){const i=1<<t;e.copyPixelBufferedEntitesFrom(r,i,o,s)}t--}}}export{l as RenderState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as o,createLabelVVEvaluator as i}from"./labelingUtils.js";import{createFeatureSourceSchema as s}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class n{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t);return[{vvEvaluators:{0:i(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(o){const i=this.layer,{capabilities:s,editingInfo:a,objectIdField:l,globalIdField:n,datesInUnknownTimezone:p,dateFieldsTimeZone:d,orderBy:u,parsedUrl:c}=i,y=i.fieldsIndex.toJSON(),m=r(i),f=i.timeInfo?.toJSON(),h=i.spatialReference.toJSON(),g=e(c);let I=l;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(I=e)}const b=t(g.path),F=o.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:b,orderByFields:I,outSpatialReference:F,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:d,globalIdField:n,fieldsIndex:y,geometryType:m,featureIdInfo:{type:"object-id",fieldName:l},timeInfo:f,spatialReference:h,outSpatialReference:F,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:s.query.maxRecordCount,supportsCompactGeometry:s.query.supportsCompactGeometry,supportsDefaultSpatialReference:s.query.supportsDefaultSpatialReference,supportsFormatPBF:s.query.supportsFormatPBF,supportsMaxRecordCountFactor:s.query.supportsMaxRecordCountFactor,supportsQuantization:s.query.supportsQuantization,lastEditDate:a?.lastEditDate?.getTime(),snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,displayFilterInfo:o,customParameters:i,timeExtent:a,apiKey:l}=this.layer;return s({definitionExpression:r,displayFilterInfo:o,customParameters:i,timeExtent:a},e,t,l)}createProcessorSchema(e,t,r){const{fields:o,geometryType:i,orderBy:s,objectIdField:l,renderer:n,labelingInfo:p,labelsVisible:d}=this.layer,u={featureReduction:null,layerId:this.layer.id,fields:o.map((e=>e.toJSON())),geometryType:i,labelingInfo:p,labelsVisible:d,objectIdField:l,orderBy:s??"default",renderer:n?.clone()};return a(e,t,u,r)}get hasRequiredSupport(){return l(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy]}setGraphicOrigin(e){e.origin={type:"catalog",layer:this.layer}}}export{n as CatalogFootprintLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as o,createLabelVVEvaluator as i}from"./labelingUtils.js";import{createFeatureSourceSchema as s}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class n{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t);return[{vvEvaluators:{0:i(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(o){const i=this.layer,{capabilities:s,editingInfo:a,objectIdField:l,globalIdField:n,datesInUnknownTimezone:p,dateFieldsTimeZone:d,orderBy:u,parsedUrl:c}=i,y=i.fieldsIndex.toJSON(),m=r(i),f=i.timeInfo?.toJSON(),h=i.spatialReference.toJSON(),g=e(c);let b=l;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(b=e)}const I=t(g.path),S=o.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:I,orderByFields:b,outSpatialReference:S,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:d,globalIdField:n,fieldsIndex:y,geometryType:m,featureIdInfo:{type:"object-id",fieldName:l},timeInfo:f,spatialReference:h,outSpatialReference:S,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:s.query.maxRecordCount,supportsCompactGeometry:s.query.supportsCompactGeometry,supportsDefaultSpatialReference:s.query.supportsDefaultSpatialReference,supportsFormatPBF:s.query.supportsFormatPBF,supportsMaxRecordCountFactor:s.query.supportsMaxRecordCountFactor,supportsQuantization:s.query.supportsQuantization,lastEditDate:a?.lastEditDate?.getTime(),snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,displayFilterInfo:o,customParameters:i,timeExtent:a,apiKey:l}=this.layer;return s({definitionExpression:r,displayFilterInfo:o,customParameters:i,timeExtent:a},e,t,l)}createProcessorSchema(e,t,r){const{fields:o,geometryType:i,orderBy:s,objectIdField:l,renderer:n,labelingInfo:p,labelsVisible:d}=this.layer,u={featureReduction:null,labelingInfoSource:this.layer.id,fields:o.map((e=>e.toJSON())),geometryType:i,labelingInfo:p,labelsVisible:d,objectIdField:l,orderBy:s??"default",renderer:n?.clone()};return a(e,t,u,r)}get hasRequiredSupport(){return l(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy]}setGraphicOrigin(e){e.origin={type:"catalog",layer:this.layer}}}export{n as CatalogFootprintLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{createSnapshotInfo as i,createFeatureIdInfo as s}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as a}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as y}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as u}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,i=n(t,e)??p(t),s=r(t,e),o=[...t.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:d(t.renderer)},deconflictionEnabled:i,labelingInfo:o}]}async createServiceOptions(r){const o=this.layer,{capabilities:a,editingInfo:n,typeIdField:p,globalIdField:d,datesInUnknownTimezone:y,dateFieldsTimeZone:u,orderBy:c,subtypeField:m,refreshInterval:f}=o,h=o.fieldsIndex.toJSON(),b=l(o),I=o.timeInfo?.toJSON(),g=o.spatialReference.toJSON(),F=o.types?.map((e=>e.toJSON())),S=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(S.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let x=this.layer.objectIdField;if(c?.length){const e=!c[0].valueExpression&&c[0].field;e&&(x=e)}const R=t(S.path),j=i(R,!(null!=n?.lastEditDate)&&f>0,a,b,r.extent,o.fullExtent),E=r.spatialReference.toJSON();return{type:"feature-service",source:S,isSourceHosted:R,orderByFields:x,outSpatialReference:E,metadata:{typeIdField:p??void 0,types:F,timeReferenceUnknownClient:y,dateFieldsTimeZone:u,subtypeField:m,globalIdField:d,fieldsIndex:h,geometryType:b,featureIdInfo:s(o),timeInfo:I,spatialReference:g,outSpatialReference:E,subtypes:this.layer.subtypes?.map((e=>e.toJSON()))},queryMetadata:{maxRecordCount:a.query.maxRecordCount,supportsCompactGeometry:a.query.supportsCompactGeometry,supportsDefaultSpatialReference:a.query.supportsDefaultSpatialReference,supportsFormatPBF:a.query.supportsFormatPBF,supportsMaxRecordCountFactor:a.query.supportsMaxRecordCountFactor,supportsQuantization:a.query.supportsQuantization,lastEditDate:n?.lastEditDate?.getTime(),snapshotInfo:j}}}createSourceSchema(e,t){const{apiKey:r,definitionExpression:i,displayFilterInfo:s,customParameters:o,gdbVersion:a,historicMoment:l,subtypeCode:n,subtypeField:p,timeExtent:d}=this.layer;return y({definitionExpression:i,displayFilterInfo:s,customParameters:o,gdbVersion:a,historicMoment:l,subtypeCode:n,subtypeField:p,timeExtent:d},e,t,r)}createProcessorSchema(e,t,i){const{fields:s,renderer:o,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:p,objectIdField:d,trackInfo:y}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:o?.clone(),layerId:this.layer.id,featureReduction:r(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:d,orderBy:p??"default",trackInfo:y};return u(e,t,c,i)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,t){return o(this.layer,e,t)}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>r(this.layer,e),()=>a(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.subtypeCode,()=>this.layer.trackInfo]}}export{m as FeatureLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{createSnapshotInfo as i,createFeatureIdInfo as o}from"./featureServiceUtils.js";import{addFloorFilter as s,hasFloorFilter as a}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as y}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,i=n(t,e)??p(t),o=r(t,e),s=[...t.labelingInfo||[],...o?.labelingInfo||[]];return[{vvEvaluators:{0:d(t.renderer)},deconflictionEnabled:i,labelingInfo:s}]}async createServiceOptions(r){const s=this.layer,{capabilities:a,editingInfo:n,typeIdField:p,globalIdField:d,datesInUnknownTimezone:u,dateFieldsTimeZone:y,orderBy:c,subtypeField:m,refreshInterval:f}=s,h=s.fieldsIndex.toJSON(),b=l(s),I=s.timeInfo?.toJSON(),g=s.spatialReference.toJSON(),S=s.types?.map((e=>e.toJSON())),F=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(F.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let x=this.layer.objectIdField;if(c?.length){const e=!c[0].valueExpression&&c[0].field;e&&(x=e)}const R=t(F.path),j=i(R,!(null!=n?.lastEditDate)&&f>0,a,b,r.extent,s.fullExtent),E=r.spatialReference.toJSON();return{type:"feature-service",source:F,isSourceHosted:R,orderByFields:x,outSpatialReference:E,metadata:{typeIdField:p??void 0,types:S,timeReferenceUnknownClient:u,dateFieldsTimeZone:y,subtypeField:m,globalIdField:d,fieldsIndex:h,geometryType:b,featureIdInfo:o(s),timeInfo:I,spatialReference:g,outSpatialReference:E,subtypes:this.layer.subtypes?.map((e=>e.toJSON()))},queryMetadata:{maxRecordCount:a.query.maxRecordCount,supportsCompactGeometry:a.query.supportsCompactGeometry,supportsDefaultSpatialReference:a.query.supportsDefaultSpatialReference,supportsFormatPBF:a.query.supportsFormatPBF,supportsMaxRecordCountFactor:a.query.supportsMaxRecordCountFactor,supportsQuantization:a.query.supportsQuantization,lastEditDate:n?.lastEditDate?.getTime(),snapshotInfo:j}}}createSourceSchema(e,t){const{apiKey:r,definitionExpression:i,displayFilterInfo:o,customParameters:s,gdbVersion:a,historicMoment:l,subtypeCode:n,subtypeField:p,timeExtent:d}=this.layer;return u({definitionExpression:i,displayFilterInfo:o,customParameters:s,gdbVersion:a,historicMoment:l,subtypeCode:n,subtypeField:p,timeExtent:d},e,t,r)}createProcessorSchema(e,t,i){const{fields:o,renderer:s,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:p,objectIdField:d,trackInfo:u}=this.layer,c={fields:o.map((e=>e.toJSON())),renderer:s?.clone(),labelingInfoSource:this.layer.id,featureReduction:r(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:d,orderBy:p??"default",trackInfo:u};return y(e,t,c,i)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,t){return s(this.layer,e,t)}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>r(this.layer,e),()=>a(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.subtypeCode,()=>this.layer.trackInfo]}}export{m as FeatureLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as s}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";function u(t){if(!("openPorts"in t))throw new e("featurelayer:source-not-supported","source is not supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,l=o(r,e)??i(r),s=t(r,e),a=[...r.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:n(r.renderer)},deconflictionEnabled:l,labelingInfo:a}]}async createServiceOptions(e){const t=this.layer,{capabilities:o,objectIdField:i}=t,n=t.fieldsIndex.toJSON(),l=r(t),s=t.timeInfo?.toJSON(),a=t.spatialReference.toJSON();u(t.source);const p=await t.source.openPorts(),d=i,c=e.spatialReference.toJSON();return{type:"memory",source:p,orderByFields:d,outSpatialReference:c,metadata:{fieldsIndex:n,geometryType:l,featureIdInfo:{type:"object-id",fieldName:t.objectIdField},timeInfo:s,spatialReference:a,outSpatialReference:c,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:"datesInUnknownTimezone"in t?t.datesInUnknownTimezone:null,dateFieldsTimeZone:"dateFieldsTimeZone"in t?t.dateFieldsTimeZone:null},queryMetadata:{maxRecordCount:o.query.maxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsFormatPBF:o.query.supportsFormatPBF,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsQuantization:o.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,timeExtent:o,displayFilterInfo:i}=this.layer;return l({customParameters:null,definitionExpression:r,displayFilterInfo:i,timeExtent:o},e,t,null)}createProcessorSchema(e,r,o){const{fields:i,renderer:n,geometryType:l,labelingInfo:a,labelsVisible:u,orderBy:p,objectIdField:d}=this.layer,c="trackInfo"in this.layer?this.layer.trackInfo:null,y={fields:i.map((e=>e.toJSON())),renderer:n?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:u,objectIdField:d,orderBy:p??"default",trackInfo:c};return s(e,r,y,o)}get hasRequiredSupport(){return a(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.displayFilterInfo,()=>this.layer.orderBy,()=>"outFields"in this.layer?this.layer.outFields:null,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>"trackInfo"in this.layer?this.layer.trackInfo:null]}}export{p as InMemoryLayerAdapter};
5
+ import e from"../../../../../core/Error.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as s}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";function u(t){if(!("openPorts"in t))throw new e("featurelayer:source-not-supported","source is not supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,l=o(r,e)??i(r),s=t(r,e),a=[...r.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:n(r.renderer)},deconflictionEnabled:l,labelingInfo:a}]}async createServiceOptions(e){const t=this.layer,{capabilities:o,objectIdField:i}=t,n=t.fieldsIndex.toJSON(),l=r(t),s=t.timeInfo?.toJSON(),a=t.spatialReference.toJSON();u(t.source);const p=await t.source.openPorts(),c=i,d=e.spatialReference.toJSON();return{type:"memory",source:p,orderByFields:c,outSpatialReference:d,metadata:{fieldsIndex:n,geometryType:l,featureIdInfo:{type:"object-id",fieldName:t.objectIdField},timeInfo:s,spatialReference:a,outSpatialReference:d,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:"datesInUnknownTimezone"in t?t.datesInUnknownTimezone:null,dateFieldsTimeZone:"dateFieldsTimeZone"in t?t.dateFieldsTimeZone:null},queryMetadata:{maxRecordCount:o.query.maxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsFormatPBF:o.query.supportsFormatPBF,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsQuantization:o.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,timeExtent:o,displayFilterInfo:i}=this.layer;return l({customParameters:null,definitionExpression:r,displayFilterInfo:i,timeExtent:o},e,t,null)}createProcessorSchema(e,r,o){const{fields:i,renderer:n,geometryType:l,labelingInfo:a,labelsVisible:u,orderBy:p,objectIdField:c}=this.layer,d="trackInfo"in this.layer?this.layer.trackInfo:null,f={fields:i.map((e=>e.toJSON())),renderer:n?.clone(),labelingInfoSource:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:u,objectIdField:c,orderBy:p??"default",trackInfo:d};return s(e,r,f,o)}get hasRequiredSupport(){return a(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.displayFilterInfo,()=>this.layer.orderBy,()=>"outFields"in this.layer?this.layer.outFields:null,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>"trackInfo"in this.layer?this.layer.trackInfo:null]}}export{p as InMemoryLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{sqlAnd as e}from"../../../../../core/sql.js";import{systemIsSpatialFieldName as r}from"../../../../../layers/knowledgeGraph/constants.js";import t from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveFeatureReduction as o}from"./featureReductionUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as p}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as u}from"../support/rendererUtils.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??a(r);return[{vvEvaluators:{0:l(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(e){const r=this.layer,{capabilities:t,objectIdField:o}=r,i=r.fieldsIndex.toJSON(),a=s(r),l=r.spatialReference.toJSON(),n=await r.source.openPorts(),p=o,u=e.spatialReference.toJSON();return{type:"memory",source:n,orderByFields:p,outSpatialReference:u,metadata:{fieldsIndex:i,geometryType:a,featureIdInfo:{type:"object-id",fieldName:r.objectIdField},spatialReference:l,outSpatialReference:u,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:r.timeInfo?.toJSON(),timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:t.query.maxRecordCount,supportsCompactGeometry:t.query.supportsCompactGeometry,supportsDefaultSpatialReference:t.query.supportsDefaultSpatialReference,supportsFormatPBF:t.query.supportsFormatPBF,supportsMaxRecordCountFactor:t.query.supportsMaxRecordCountFactor,supportsQuantization:t.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r){const{definitionExpression:t,displayFilterInfo:o}=this.layer;return n({definitionExpression:t,displayFilterInfo:o,customParameters:null},e,r,null)}createProcessorSchema(e,r,t){const{fields:s,renderer:i,geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:u}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:i?.clone(),layerId:this.layer.id,featureReduction:o(this.layer,r),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:u,orderBy:"default"};return p(e,r,c,t)}get hasRequiredSupport(){return u(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>o(this.layer,e),()=>d(this.layer)]}hasFilters(e){return d(this.layer)}addFilters(o,s){if(d(this.layer)){const s=e(o?.where,`${r}=1`);if(!s)return o;o??=new t,o.where=s}return o}}function d(e){return"link-chart"===e.parentCompositeLayer.type&&"hidden"===e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode}export{c as KnowledgeGraphSublayerAdapter};
5
+ import{sqlAnd as e}from"../../../../../core/sql.js";import{systemIsSpatialFieldName as r}from"../../../../../layers/knowledgeGraph/constants.js";import t from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveFeatureReduction as o}from"./featureReductionUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as p}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as u}from"../support/rendererUtils.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??a(r);return[{vvEvaluators:{0:l(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(e){const r=this.layer,{capabilities:t,objectIdField:o}=r,i=r.fieldsIndex.toJSON(),a=s(r),l=r.spatialReference.toJSON(),n=await r.source.openPorts(),p=o,u=e.spatialReference.toJSON();return{type:"memory",source:n,orderByFields:p,outSpatialReference:u,metadata:{fieldsIndex:i,geometryType:a,featureIdInfo:{type:"object-id",fieldName:r.objectIdField},spatialReference:l,outSpatialReference:u,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:r.timeInfo?.toJSON(),timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:t.query.maxRecordCount,supportsCompactGeometry:t.query.supportsCompactGeometry,supportsDefaultSpatialReference:t.query.supportsDefaultSpatialReference,supportsFormatPBF:t.query.supportsFormatPBF,supportsMaxRecordCountFactor:t.query.supportsMaxRecordCountFactor,supportsQuantization:t.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r){const{definitionExpression:t,displayFilterInfo:o}=this.layer;return n({definitionExpression:t,displayFilterInfo:o,customParameters:null},e,r,null)}createProcessorSchema(e,r,t){const{fields:s,renderer:i,geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:u}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:i?.clone(),labelingInfoSource:this.layer.id,featureReduction:o(this.layer,r),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:u,orderBy:"default"};return p(e,r,c,t)}get hasRequiredSupport(){return u(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>o(this.layer,e),()=>d(this.layer)]}hasFilters(e){return d(this.layer)}addFilters(o,s){if(d(this.layer)){const s=e(o?.where,`${r}=1`);if(!s)return o;o??=new t,o.where=s}return o}}function d(e){return"link-chart"===e.parentCompositeLayer.type&&"hidden"===e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode}export{c as KnowledgeGraphSublayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as i}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t,e)??a(t);return[{vvEvaluators:{0:s(t.renderer)},deconflictionEnabled:r,labelingInfo:t.labelingInfo}]}async createServiceOptions(t){const o=this.layer,{capabilities:a}=o,s=o.fieldsIndex.toJSON(),l=r(o),i=o.timeInfo?.toJSON(),n=o.spatialReference.toJSON(),u=o.source.getSource(),c=this.layer.objectIdField,p=e(a);p.query.maxRecordCount=u.maxRecordCount;const d=t.spatialReference.toJSON();return{type:"ogc",source:u,orderByFields:c,outSpatialReference:d,metadata:{fieldsIndex:s,geometryType:l,featureIdInfo:{type:"object-id",fieldName:o.objectIdField},timeInfo:i,spatialReference:n,outSpatialReference:d,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:p.query.maxRecordCount,supportsCompactGeometry:p.query.supportsCompactGeometry,supportsDefaultSpatialReference:p.query.supportsDefaultSpatialReference,supportsFormatPBF:p.query.supportsFormatPBF,supportsMaxRecordCountFactor:p.query.supportsMaxRecordCountFactor,supportsQuantization:p.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{customParameters:r,timeExtent:o,apiKey:a}=this.layer;return l({customParameters:r,timeExtent:o},e,t,a)}createProcessorSchema(e,r,o){const{fields:a,renderer:s,geometryType:l,labelingInfo:n,labelsVisible:u,orderBy:c,objectIdField:p}=this.layer,d={fields:a.map((e=>e.toJSON())),renderer:s?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:n,labelsVisible:u,objectIdField:p,orderBy:c??"default"};return i(e,r,d,o)}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>t(this.layer,e),()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.renderer]}}export{u as OGCFeatureLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as i}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t,e)??a(t);return[{vvEvaluators:{0:s(t.renderer)},deconflictionEnabled:r,labelingInfo:t.labelingInfo}]}async createServiceOptions(t){const o=this.layer,{capabilities:a}=o,s=o.fieldsIndex.toJSON(),l=r(o),i=o.timeInfo?.toJSON(),n=o.spatialReference.toJSON(),u=o.source.getSource(),c=this.layer.objectIdField,p=e(a);p.query.maxRecordCount=u.maxRecordCount;const d=t.spatialReference.toJSON();return{type:"ogc",source:u,orderByFields:c,outSpatialReference:d,metadata:{fieldsIndex:s,geometryType:l,featureIdInfo:{type:"object-id",fieldName:o.objectIdField},timeInfo:i,spatialReference:n,outSpatialReference:d,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:p.query.maxRecordCount,supportsCompactGeometry:p.query.supportsCompactGeometry,supportsDefaultSpatialReference:p.query.supportsDefaultSpatialReference,supportsFormatPBF:p.query.supportsFormatPBF,supportsMaxRecordCountFactor:p.query.supportsMaxRecordCountFactor,supportsQuantization:p.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{customParameters:r,timeExtent:o,apiKey:a}=this.layer;return l({customParameters:r,timeExtent:o},e,t,a)}createProcessorSchema(e,r,o){const{fields:a,renderer:s,geometryType:l,labelingInfo:n,labelsVisible:u,orderBy:c,objectIdField:p}=this.layer,d={fields:a.map((e=>e.toJSON())),renderer:s?.clone(),labelingInfoSource:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:n,labelsVisible:u,objectIdField:p,orderBy:c??"default"};return i(e,r,d,o)}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>t(this.layer,e),()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.renderer]}}export{u as OGCFeatureLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{createSnapshotInfo as o}from"./featureServiceUtils.js";import{addFloorFilter as s,hasFloorFilter as i}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as a,getLayerDeconflictionEnabled as n,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as d}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=a(r,e)??n(r);return[{vvEvaluators:{0:p(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const s=this.layer,{capabilities:i,globalIdField:a,orderBy:n,refreshInterval:p}=s,u=s.fieldsIndex.toJSON(),d=l(s),c=s.timeInfo?.toJSON(),m=s.spatialReference.toJSON(),y=e(this.layer.parsedUrl);let f=this.layer.objectIdField;if(n?.length){const e=!n[0].valueExpression&&n[0].field;e&&(f=e)}const h=p>0,I=r(y.path),b=t.spatialReference.toJSON(),F=o(I,h,i,d,t.extent,s.fullExtent);return{type:"feature-service",source:y,isSourceHosted:I,orderByFields:f,outSpatialReference:b,metadata:{globalIdField:a,fieldsIndex:u,geometryType:d,featureIdInfo:{type:"object-id",fieldName:s.objectIdField},timeInfo:c,spatialReference:m,outSpatialReference:b,timeReferenceUnknownClient:s.datesInUnknownTimezone,dateFieldsTimeZone:s.dateFieldsTimeZone,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:i.query.maxRecordCount,supportsCompactGeometry:i.query.supportsCompactGeometry,supportsDefaultSpatialReference:i.query.supportsDefaultSpatialReference,supportsFormatPBF:i.query.supportsFormatPBF,supportsMaxRecordCountFactor:i.query.supportsMaxRecordCountFactor,supportsQuantization:i.query.supportsQuantization,lastEditDate:null,snapshotInfo:F}}}createSourceSchema(e,r){const{definitionExpression:t,displayFilterInfo:o,customParameters:s,timeExtent:i}=this.layer;return u({definitionExpression:t,displayFilterInfo:o,customParameters:s,timeExtent:i},e,r,null)}createProcessorSchema(e,r,o){const{fields:s,renderer:i,geometryType:l,labelingInfo:a,labelsVisible:n,orderBy:p,objectIdField:u}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:i?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:n,objectIdField:u,orderBy:p??"default"};return d(e,r,c,o)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,r){return s(this.layer,e,r)}getUpdateHashProperties(e){return[()=>this.layer.outFields,()=>this.layer.orderBy,()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>this.layer.customParameters,()=>i(this.layer,e)?e.floors:null]}}export{m as OrientedImageryLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{createSnapshotInfo as o}from"./featureServiceUtils.js";import{addFloorFilter as s,hasFloorFilter as i}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as a,getLayerDeconflictionEnabled as n,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as d}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=a(r,e)??n(r);return[{vvEvaluators:{0:p(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const s=this.layer,{capabilities:i,globalIdField:a,orderBy:n,refreshInterval:p}=s,u=s.fieldsIndex.toJSON(),d=l(s),c=s.timeInfo?.toJSON(),m=s.spatialReference.toJSON(),f=e(this.layer.parsedUrl);let y=this.layer.objectIdField;if(n?.length){const e=!n[0].valueExpression&&n[0].field;e&&(y=e)}const h=p>0,b=r(f.path),I=t.spatialReference.toJSON(),F=o(b,h,i,d,t.extent,s.fullExtent);return{type:"feature-service",source:f,isSourceHosted:b,orderByFields:y,outSpatialReference:I,metadata:{globalIdField:a,fieldsIndex:u,geometryType:d,featureIdInfo:{type:"object-id",fieldName:s.objectIdField},timeInfo:c,spatialReference:m,outSpatialReference:I,timeReferenceUnknownClient:s.datesInUnknownTimezone,dateFieldsTimeZone:s.dateFieldsTimeZone,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:i.query.maxRecordCount,supportsCompactGeometry:i.query.supportsCompactGeometry,supportsDefaultSpatialReference:i.query.supportsDefaultSpatialReference,supportsFormatPBF:i.query.supportsFormatPBF,supportsMaxRecordCountFactor:i.query.supportsMaxRecordCountFactor,supportsQuantization:i.query.supportsQuantization,lastEditDate:null,snapshotInfo:F}}}createSourceSchema(e,r){const{definitionExpression:t,displayFilterInfo:o,customParameters:s,timeExtent:i}=this.layer;return u({definitionExpression:t,displayFilterInfo:o,customParameters:s,timeExtent:i},e,r,null)}createProcessorSchema(e,r,o){const{fields:s,renderer:i,geometryType:l,labelingInfo:a,labelsVisible:n,orderBy:p,objectIdField:u}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:i?.clone(),labelingInfoSource:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:n,objectIdField:u,orderBy:p??"default"};return d(e,r,c,o)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,r){return s(this.layer,e,r)}getUpdateHashProperties(e){return[()=>this.layer.outFields,()=>this.layer.orderBy,()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>this.layer.customParameters,()=>i(this.layer,e)?e.floors:null]}}export{m as OrientedImageryLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import{toParquetJSONGeometryType as r}from"../../../../../layers/support/parquetUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as a,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class y{constructor(e){this.layer=e}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return null}getLabelingDeconflictionInfo(e){const r=this.layer,l=a(r,e)??i(r),o=t(r,e),n=[...r.labelingInfo||[],...o?.labelingInfo||[]];return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:l,labelingInfo:n}]}getUpdateHashProperties(e){return[()=>this.layer.outFields,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>this.layer.customParameters,()=>this.layer.orderBy,()=>this.layer.renderer,()=>this.layer.popupTemplate]}async createServiceOptions(t){const a=l(this.layer),i=t.spatialReference.toJSON(),s=this.layer.encoding;if(null==s)throw new e("parquet-layer:unsupported","creating a parquet layer view requires an encoding",{layer:this.layer});return{type:"parquet",source:{urls:this.layer.urls.items},outSpatialReference:i,geometryInfo:{geometryType:r(this.layer.geometryType),spatialReference:this.layer.spatialReference.toJSON(),encoding:s.toJSON()},metadata:{spatialReference:this.layer.spatialReference,outSpatialReference:i,fieldsIndex:this.layer.fieldsIndex.toJSON(),featureIdInfo:{type:"object-id",fieldName:this.layer.objectIdField},geometryType:a,types:null,subtypes:null,timeInfo:null,typeIdField:null,subtypeField:null,globalIdField:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}}}createSourceSchema(e,r){return{type:"parquet",mutable:{sourceRefreshVersion:r,availableFields:e.availableFields.includes("*")?this.layer.fields.map((e=>e.name)):e.availableFields,dataFilter:{customParameters:this.layer.customParameters??null}}}}createProcessorSchema(e,r,l){const a={fields:this.layer.fields.map((e=>e.toJSON())),renderer:this.layer.renderer?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:this.layer.geometryType,labelingInfo:this.layer.labelingInfo,labelsVisible:this.layer.labelsVisible,objectIdField:this.layer.objectIdField,orderBy:this.layer.orderBy};return o(e,r,a,l)}}export{y as ParquetLayerAdapter};
5
+ import e from"../../../../../core/Error.js";import{toParquetJSONGeometryType as r}from"../../../../../layers/support/parquetUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as a,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class y{constructor(e){this.layer=e}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return null}getLabelingDeconflictionInfo(e){const r=this.layer,l=a(r,e)??i(r),o=t(r,e),n=[...r.labelingInfo||[],...o?.labelingInfo||[]];return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:l,labelingInfo:n}]}getUpdateHashProperties(e){return[()=>this.layer.outFields,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>this.layer.customParameters,()=>this.layer.orderBy,()=>this.layer.renderer,()=>this.layer.popupTemplate]}async createServiceOptions(t){const a=l(this.layer),i=t.spatialReference.toJSON(),s=this.layer.encoding;if(null==s)throw new e("parquet-layer:unsupported","creating a parquet layer view requires an encoding",{layer:this.layer});return{type:"parquet",source:{urls:this.layer.urls.items},outSpatialReference:i,geometryInfo:{geometryType:r(this.layer.geometryType),spatialReference:this.layer.spatialReference.toJSON(),encoding:s.toJSON()},metadata:{spatialReference:this.layer.spatialReference,outSpatialReference:i,fieldsIndex:this.layer.fieldsIndex.toJSON(),featureIdInfo:{type:"object-id",fieldName:this.layer.objectIdField},geometryType:a,types:null,subtypes:null,timeInfo:null,typeIdField:null,subtypeField:null,globalIdField:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}}}createSourceSchema(e,r){return{type:"parquet",mutable:{sourceRefreshVersion:r,availableFields:e.availableFields.includes("*")?this.layer.fields.map((e=>e.name)):e.availableFields,dataFilter:{customParameters:this.layer.customParameters??null}}}}createProcessorSchema(e,r,l){const a={fields:this.layer.fields.map((e=>e.toJSON())),renderer:this.layer.renderer?.clone(),labelingInfoSource:this.layer.id,featureReduction:t(this.layer,r),geometryType:this.layer.geometryType,labelingInfo:this.layer.labelingInfo,labelsVisible:this.layer.labelsVisible,objectIdField:this.layer.objectIdField,orderBy:this.layer.orderBy};return o(e,r,a,l)}}export{y as ParquetLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getServiceGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";class o{constructor(e){this.layer=e}getLabelingDeconflictionInfo(t){const n=this.layer,a=r(n,t)??i(n),o=e(n,t),s=[...n.labelingInfo||[],...o?.labelingInfo||[]];return[{vvEvaluators:{0:l(n.renderer)},deconflictionEnabled:a,labelingInfo:s}]}async createServiceOptions(e){const r=this.layer,i=t(r),l=r.timeInfo?.toJSON()||null,n=r.spatialReference?r.spatialReference.toJSON():null,a=e.spatialReference.toJSON();return{type:"stream",source:this.layer.parsedUrl,outSpatialReference:a,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:i,featureIdInfo:{type:"object-id",fieldName:this.layer.objectIdField},timeInfo:l,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,spatialReference:n,outSpatialReference:a,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}createSourceSchema(e,t){const{definitionExpression:r,geometryDefinition:i,customParameters:l}=this.layer;return{type:"stream",mutable:{sourceRefreshVersion:t,availableFields:e.availableFields,dataFilter:{geometryDefinition:i?.toJSON(),definitionExpression:r,customParameters:l??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:l,renderer:a,geometryType:o,labelingInfo:s,labelsVisible:c,objectIdField:d,trackInfo:m}=this.layer,f={fields:l.map((e=>e.toJSON())),renderer:a?.clone(),layerId:this.layer.id,featureReduction:e(this.layer,r),geometryType:o,labelingInfo:s,labelsVisible:c,objectIdField:d,orderBy:"default",trackInfo:m};return n(t,r,f,i)}get hasRequiredSupport(){return a(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(t){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>e(this.layer,t),()=>this.layer.customParameters,()=>this.layer.geometryDefinition,()=>this.layer.definitionExpression,()=>this.layer.trackInfo]}}export{o as StreamLayerAdapter};
5
+ import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getServiceGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as o}from"../support/rendererUtils.js";class a{constructor(e){this.layer=e}getLabelingDeconflictionInfo(t){const n=this.layer,o=r(n,t)??i(n),a=e(n,t),s=[...n.labelingInfo||[],...a?.labelingInfo||[]];return[{vvEvaluators:{0:l(n.renderer)},deconflictionEnabled:o,labelingInfo:s}]}async createServiceOptions(e){const r=this.layer,i=t(r),l=r.timeInfo?.toJSON()||null,n=r.spatialReference?r.spatialReference.toJSON():null,o=e.spatialReference.toJSON();return{type:"stream",source:this.layer.parsedUrl,outSpatialReference:o,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:i,featureIdInfo:{type:"object-id",fieldName:this.layer.objectIdField},timeInfo:l,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,spatialReference:n,outSpatialReference:o,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}createSourceSchema(e,t){const{definitionExpression:r,geometryDefinition:i,customParameters:l}=this.layer;return{type:"stream",mutable:{sourceRefreshVersion:t,availableFields:e.availableFields,dataFilter:{geometryDefinition:i?.toJSON(),definitionExpression:r,customParameters:l??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:l,renderer:o,geometryType:a,labelingInfo:s,labelsVisible:c,objectIdField:d,trackInfo:f}=this.layer,m={fields:l.map((e=>e.toJSON())),renderer:o?.clone(),labelingInfoSource:this.layer.id,featureReduction:e(this.layer,r),geometryType:a,labelingInfo:s,labelsVisible:c,objectIdField:d,orderBy:"default",trackInfo:f};return n(t,r,m,i)}get hasRequiredSupport(){return o(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(t){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>e(this.layer,t),()=>this.layer.customParameters,()=>this.layer.geometryDefinition,()=>this.layer.definitionExpression,()=>this.layer.trackInfo]}}export{a as StreamLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createSnapshotInfo as i,createFeatureIdInfo as l}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as u}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as p}from"./labelingUtils.js";import{createFeatureSourceSchema as y}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as c}from"../schema/processor/SubtypeProcessorSchema.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer;return[{vvEvaluators:{},deconflictionEnabled:t.sublayers.some((e=>p(e))),labelingInfo:t.sublayers.toArray().filter((e=>!!e.labelingInfo)).flatMap((e=>e.labelingInfo))}]}async createServiceOptions(t){const r=this.layer,{capabilities:a,datesInUnknownTimezone:o,dateFieldsTimeZone:n,editingInfo:p,globalIdField:y,objectIdField:c,refreshInterval:m,subtypeField:d}=r,f=r.fieldsIndex.toJSON(),b=u(r),h=r.timeInfo?.toJSON(),S=r.spatialReference.toJSON(),g=e(this.layer.parsedUrl),F=c,I=!(null!=p?.lastEditDate)&&m>0,x=s(g.path),R=t.spatialReference.toJSON(),j=i(x,I,a,b,t.extent,r.fullExtent);return{type:"feature-service",source:g,isSourceHosted:x,orderByFields:F,outSpatialReference:R,metadata:{timeReferenceUnknownClient:o,dateFieldsTimeZone:n,subtypeField:d,globalIdField:y,fieldsIndex:f,geometryType:b,featureIdInfo:l(this.layer),timeInfo:h,spatialReference:S,outSpatialReference:R,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),typeIdField:null,types:null},queryMetadata:{maxRecordCount:a.query.maxRecordCount,supportsCompactGeometry:a.query.supportsCompactGeometry,supportsDefaultSpatialReference:a.query.supportsDefaultSpatialReference,supportsFormatPBF:a.query.supportsFormatPBF,supportsMaxRecordCountFactor:a.query.supportsMaxRecordCountFactor,supportsQuantization:a.query.supportsQuantization,lastEditDate:p?.lastEditDate?.getTime(),snapshotInfo:j}}}createSourceSchema(e,t){const{definitionExpression:r,customParameters:s,gdbVersion:a,historicMoment:i,subtypeField:l,timeExtent:o,apiKey:n,displayFilterInfo:u}=this.layer,p={queryScaleRanges:this.layer.sublayers.items.map((e=>({subtypeCode:e.subtypeCode,minScale:e.minScale,maxScale:e.maxScale}))),definitionExpression:r,displayFilterInfo:u,customParameters:s,gdbVersion:a,historicMoment:i,subtypeField:l,timeExtent:o};return y(p,e,t,n)}createProcessorSchema(e,t,r){const s={layerId:this.layer.id,subtypeField:this.layer.subtypeField,sublayers:Array.from(this.layer.sublayers,(e=>({featureReduction:null,geometryType:this.layer.geometryType,labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible,renderer:e.renderer,subtypeCode:e.subtypeCode,orderBy:null})))};return c(e,t,s,r)}addFilters(e,t){e=o(this.layer,e,t);const s=this.layer.sublayers.filter((e=>!d(e,t))).map((e=>e.subtypeCode));if(!s.length)return e;e??=new a;const i=`NOT ${this.layer.subtypeField} IN (${s.join(",")})`;return e.where=r(e.where,i),e}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>n(this.layer,e)?e.floors:null,()=>this.layer.outFields,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.sublayers.map((({renderer:e,labelsVisible:t,labelingInfo:r,visible:s,minScale:a,maxScale:i})=>({renderer:e,labelsVisible:t,labelingInfo:r,visible:s,minScale:a,maxScale:i})))]}setGraphicOrigin(e){const t=this.layer.fieldsIndex.get(this.layer.subtypeField),r=e.attributes[t.name],s=this.layer.sublayers.find((e=>e.subtypeCode===r));e.layer=e.sourceLayer=s}}function d(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{m as SubtypeGroupLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createSnapshotInfo as i,createFeatureIdInfo as l}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as u}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as p}from"./labelingUtils.js";import{createFeatureSourceSchema as c}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as y}from"../schema/processor/SubtypeProcessorSchema.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer;return[{vvEvaluators:{},deconflictionEnabled:t.sublayers.some((e=>p(e))),labelingInfo:t.sublayers.toArray().filter((e=>!!e.labelingInfo)).flatMap((e=>e.labelingInfo))}]}async createServiceOptions(t){const r=this.layer,{capabilities:a,datesInUnknownTimezone:o,dateFieldsTimeZone:n,editingInfo:p,globalIdField:c,objectIdField:y,refreshInterval:m,subtypeField:d}=r,f=r.fieldsIndex.toJSON(),b=u(r),h=r.timeInfo?.toJSON(),S=r.spatialReference.toJSON(),g=e(this.layer.parsedUrl),F=y,I=!(null!=p?.lastEditDate)&&m>0,x=s(g.path),R=t.spatialReference.toJSON(),j=i(x,I,a,b,t.extent,r.fullExtent);return{type:"feature-service",source:g,isSourceHosted:x,orderByFields:F,outSpatialReference:R,metadata:{timeReferenceUnknownClient:o,dateFieldsTimeZone:n,subtypeField:d,globalIdField:c,fieldsIndex:f,geometryType:b,featureIdInfo:l(this.layer),timeInfo:h,spatialReference:S,outSpatialReference:R,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),typeIdField:null,types:null},queryMetadata:{maxRecordCount:a.query.maxRecordCount,supportsCompactGeometry:a.query.supportsCompactGeometry,supportsDefaultSpatialReference:a.query.supportsDefaultSpatialReference,supportsFormatPBF:a.query.supportsFormatPBF,supportsMaxRecordCountFactor:a.query.supportsMaxRecordCountFactor,supportsQuantization:a.query.supportsQuantization,lastEditDate:p?.lastEditDate?.getTime(),snapshotInfo:j}}}createSourceSchema(e,t){const{definitionExpression:r,customParameters:s,gdbVersion:a,historicMoment:i,subtypeField:l,timeExtent:o,apiKey:n,displayFilterInfo:u}=this.layer,p={queryScaleRanges:this.layer.sublayers.items.map((e=>({subtypeCode:e.subtypeCode,minScale:e.minScale,maxScale:e.maxScale}))),definitionExpression:r,displayFilterInfo:u,customParameters:s,gdbVersion:a,historicMoment:i,subtypeField:l,timeExtent:o};return c(p,e,t,n)}createProcessorSchema(e,t,r){const s={labelingInfoSource:this.layer.id,subtypeField:this.layer.subtypeField,sublayers:Array.from(this.layer.sublayers,((e,t)=>({featureReduction:null,geometryType:this.layer.geometryType,labelingInfoSource:this.layer.id+`-${t}`,labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible,renderer:e.renderer,subtypeCode:e.subtypeCode,orderBy:null})))};return y(e,t,s,r)}addFilters(e,t){e=o(this.layer,e,t);const s=this.layer.sublayers.filter((e=>!d(e,t))).map((e=>e.subtypeCode));if(!s.length)return e;e??=new a;const i=`NOT ${this.layer.subtypeField} IN (${s.join(",")})`;return e.where=r(e.where,i),e}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>n(this.layer,e)?e.floors:null,()=>this.layer.outFields,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.sublayers.map((({renderer:e,labelsVisible:t,labelingInfo:r,visible:s,minScale:a,maxScale:i})=>({renderer:e,labelsVisible:t,labelingInfo:r,visible:s,minScale:a,maxScale:i})))]}setGraphicOrigin(e){const t=this.layer.fieldsIndex.get(this.layer.subtypeField),r=e.attributes[t.name],s=this.layer.sublayers.find((e=>e.subtypeCode===r));e.layer=e.sourceLayer=s}}function d(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{m as SubtypeGroupLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as p,convertToGeometry as f,convertFromNestedArray as g}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as k,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as F}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as j}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as T}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as L}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as C}from"../support/FeatureSetReaderJSON.js";let G;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),z=32;class M{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class W{static getOid(t){return k+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new M(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const r=new Set(this._nextObservationRecords.map((t=>t.objectId))),i=this._observationRecords.filter((t=>!r.has(t.objectId))).map((t=>t.objectId));let a,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":a=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":a=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":a=this._isStream?v:null}o=this._isStream?e?.end??Date.now():e?.end??-1/0;const n=t.map((t=>t.reader.getCursor()));let l;for(let c=this._nextObservationRecords.length-1;c>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);c--){const t=this._nextObservationRecords[c],e=n[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=a?e.readAttributeAsTimestamp(a):null;(null!=r?o-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),l??=t)}if(null!=l){const{chunkIndex:t,featureIndex:e,objectId:r,displayId:i}=l,a=n[t];s(a),a.setIndex(e);const o=new _(a.readGeometryWorldSpace(),{...a.readAttributes(),[y]:I.LatestObservation},null,r,i);this._latestObservationFeature=o}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=X(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=j.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,z))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new b;p(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);N(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,F,F)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new b;p(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends x{constructor(t){super(t),this.done=!1}}class q extends T{static async create(t,e,s,a,o,n){const l=new w({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>O.create(l,t)))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=L.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map((t=>t.chunkId)));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new U(t)}async*applyOverrideUpdate(t){P().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null==t)for(const e of a.observations()){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId)}}else{const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId)}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature());for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=W.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new W(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=C.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=C.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=A.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return g(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=m({paths:[e],spatialReference:s});if(null!=r)return g(t,r.paths,!1,!1)}return g(t,[e],!1,!1)}const r=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=G.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=G.toGeometry(e,i);if(null!=s&&"paths"in s)return g(t,s.paths,!1,!1)}}return g(t,[e],!1,!1)}function N(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function X(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
5
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromNestedArray as b}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as v,internalTimeReceivedField as k}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as F}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as O}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as j}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as x}from"./AAggregateStrategy.js";import{ASendState as T}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as D}from"../support/ComputedAttributeStorage.js";import w from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as L}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as C}from"../support/FeatureSetReaderJSON.js";let G;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),W=32;class z{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class M{static getOid(t){return v+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new g}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new z(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map((t=>t.objectId))),a=this._observationRecords.filter((t=>!i.has(t.objectId))).map((t=>t.objectId));let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?k:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map((t=>t.reader.getCursor()));let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new _(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:I.LatestObservation},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=X(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=O.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,W))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new g;m(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);N(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,F,F)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new g;m(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends T{constructor(t){super(t),this.done=!1}}class q extends x{static async create(t,e,s,a,o,n){const l=new D({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>j.create(l,t)))),d=t.featureFilter?await w.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=L.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map((t=>t.chunkId)));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new U(t)}async*applyOverrideUpdate(t){P().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,attributes:{},...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=M.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new M(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=C.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=C.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=A.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return b(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=p({paths:[e],spatialReference:s});if(null!=r)return b(t,r.paths,!1,!1)}return b(t,[e],!1,!1)}const r=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=G.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=G.toGeometry(e,i);if(null!=s&&"paths"in s)return b(t,s.paths,!1,!1)}}return b(t,[e],!1,!1)}function N(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function X(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{numericHash as e}from"../../../../../../core/string.js";import{validateLabelingInfo as s}from"../../../../../../layers/support/labelingInfo.js";import{getServiceGeometryType as l}from"../../layerAdapters/geometryUtils.js";import{createSymbolMeshSchemas as a}from"./symbols/SymbolSchema.js";async function o(e,a,o){const r=a.labelsVisible&&a.labelingInfo||[],i=l(a),t=s(r,i);return{type:"label",classes:await Promise.all(t.map(((s,l)=>n(e,s,a.labelsVisible,a.layerId,l,i,o))))}}async function n(s,l,o,n,r,i,t){const m=e(`${n} ${r}`),c=await a(l,{schemaOptions:s,uniforms:t,labelClassId:m});return{maxScale:l.maxScale,minScale:l.minScale,deconflictionEnabled:"none"!==l.deconflictionStrategy&&o,expression:l.labelExpressionInfo?.expression??l.labelExpression,where:l.where,meshes:c,labelClassId:m,geometryType:i}}export{o as createLabelMatcherSchema};
5
+ import{numericHash as e}from"../../../../../../core/string.js";import{validateLabelingInfo as s}from"../../../../../../layers/support/labelingInfo.js";import{getServiceGeometryType as l}from"../../layerAdapters/geometryUtils.js";import{createSymbolMeshSchemas as o}from"./symbols/SymbolSchema.js";async function a(e,o,a){const r=o.labelsVisible&&o.labelingInfo||[],i=l(o),t=s(r,i);return{type:"label",classes:await Promise.all(t.map(((s,l)=>n(e,s,o.labelsVisible,o.labelingInfoSource,l,i,a))))}}async function n(s,l,a,n,r,i,t){const m=e(`${n} ${r}`),c=await o(l,{schemaOptions:s,uniforms:t,labelClassId:m});return{maxScale:l.maxScale,minScale:l.minScale,deconflictionEnabled:"none"!==l.deconflictionStrategy&&a,expression:l.labelExpressionInfo?.expression??l.labelExpression,where:l.where,meshes:c,labelClassId:m,geometryType:i}}export{a as createLabelMatcherSchema};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{TechniqueType as t}from"../../../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{createLabelMatcherSchema as s}from"./LabelMatcherSchema.js";import{createMatcherSchema as i}from"./MatcherSchema.js";import{createStorageSchema as n,createTrackStorageSchema as a}from"./StorageSchema.js";import{createVisualVariableUniforms as l}from"./VisualVariablesSchema.js";async function o(e,r){const t=r.renderer,n=l(t);return{symbology:await i(e,t),labels:await s(e,r,n)}}async function u(e,r,t,s){const i=t.featureReduction;if(i)switch(i.type){case"binning":return f(i,e,r,t,s);case"cluster":return p(i,e,r,t,s)}if(t.trackInfo?.enabled)return d(t.trackInfo,e,r,t,s);const a=b(t.orderBy,t.renderer,t.objectIdField),l=n(t.renderer,r.filters),u=await o(e,t),c=g(u.symbology);return{storage:l,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:c,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:u},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map((e=>({...e.toJSON(),type:y(e,r)})))}function y(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function f(r,t,a,o,u){const y=c(r,o.fields),f=r.renderer,p=await i(t,f),d=n(f,[null,null]),b=l(f),m=await s(t,{geometryType:"polygon",layerId:o.layerId,labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},b),v=g(p),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:d,mesh:{properties:{sortKey:null,timeZone:a.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:a.currentUser},strategy:{type:"binning",fields:y,index:h,featureFilter:a.filters[0]},factory:{labels:m,symbology:p}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function p(r,t,a,o,u){const y=c(r,o.fields),f={type:"cluster",feature:await i(t,r.effectiveFeatureRenderer),cluster:await i(t,r.effectiveClusterRenderer)},p=l(r.effectiveFeatureRenderer),d={type:"cluster",feature:await s(t,o,p),cluster:await s(t,{geometryType:"point",layerId:o.layerId,labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},p)},b=n(r.effectiveFeatureRenderer,[null,null]),m=g(f);return{storage:b,mesh:{properties:{sortKey:null,timeZone:a.timeZone,displayRefreshVersion:u,returnMeshObjectId:m,currentUser:a.currentUser},strategy:{type:"cluster",fields:y,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:d,symbology:f}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function d(e,r,t,n,o){const u=c(e,n.fields),y={type:"track",previousObservation:await i(r,e.previousObservations.renderer),latestObservation:await i(r,e.latestObservations.renderer),trackLine:await i(r,e.trackLines.renderer)},f={type:"track",previousObservation:await s(r,{geometryType:n.geometryType,layerId:n.layerId,labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},l(e.previousObservations.renderer)),latestObservation:await s(r,{geometryType:n.geometryType,layerId:n.layerId,labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},l(e.latestObservations.renderer)),trackLine:await s(r,{geometryType:"polyline",layerId:n.layerId,labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},l(e.trackLines.renderer))},p=a(e,[null,null]),d=g(y);return{storage:p,mesh:{properties:{sortKey:null,timeZone:t.timeZone,returnMeshObjectId:d,displayRefreshVersion:o,currentUser:t.currentUser},strategy:{type:"track",featureFilter:t.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:f,symbology:y}},expressionProperties:{timeExtent:t.timeExtent?.toJSON()}}}function b(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function m(e){return e.techniqueType===t.AnimatedMarker}function g(e){if("simple"===e.type&&e.meshes.some(m))return!0;if("interval"===e.type){if(e.intervals.some((e=>e.meshes.some(m))))return!0;if(e.backgroundFill.some(m))return!0}if("map"===e.type){if(e.map.some((e=>e.symbol.some(m))))return!0;if(e.backgroundFill.some(m))return!0}return!1}export{u as createSimpleProcessorSchema,c as getAggregateFields};
5
+ import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{TechniqueType as t}from"../../../../engine/webgl/shaderGraph/techniques/TechniqueType.js";import{createLabelMatcherSchema as i}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as n,createTrackStorageSchema as a}from"./StorageSchema.js";import{createVisualVariableUniforms as l}from"./VisualVariablesSchema.js";async function o(e,r){const t=r.renderer,n=l(t);return{symbology:await s(e,t),labels:await i(e,r,n)}}async function c(e,r,t,i){const s=t.featureReduction;if(s)switch(s.type){case"binning":return b(s,e,r,t,i);case"cluster":return p(s,e,r,t,i)}if(t.trackInfo?.enabled)return y(t.trackInfo,e,r,t,i);const a=m(t.orderBy,t.renderer,t.objectIdField),l=n(t.renderer,r.filters),c=await o(e,t),u=g(c.symbology);return{storage:l,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:u,displayRefreshVersion:i,currentUser:r.currentUser},strategy:{type:"feature"},factory:c},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function u(e,r){return e.fields.map((e=>({...e.toJSON(),type:f(e,r)})))}function f(e,r){const{onStatisticExpression:t,onStatisticField:i,statisticType:s}=e;switch(s){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===i));return e?e.type:"esriFieldTypeString"}}}async function b(r,t,a,o,c){const f=u(r,o.fields),b=r.renderer,p=await s(t,b),y=n(b,[null,null]),m=l(b),d=await i(t,{geometryType:"polygon",labelingInfoSource:o.labelingInfoSource+"-binning",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=g(p),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:y,mesh:{properties:{sortKey:null,timeZone:a.timeZone,returnMeshObjectId:v,displayRefreshVersion:c,currentUser:a.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:a.filters[0]},factory:{labels:d,symbology:p}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function p(r,t,a,o,c){const f=u(r,o.fields),b={type:"cluster",feature:await s(t,r.effectiveFeatureRenderer),cluster:await s(t,r.effectiveClusterRenderer)},p=l(r.effectiveFeatureRenderer),y={type:"cluster",feature:await i(t,o,p),cluster:await i(t,{geometryType:"point",labelingInfoSource:o.labelingInfoSource+"-clusters",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},p)},m=n(r.effectiveFeatureRenderer,[null,null]),d=g(b);return{storage:m,mesh:{properties:{sortKey:null,timeZone:a.timeZone,displayRefreshVersion:c,returnMeshObjectId:d,currentUser:a.currentUser},strategy:{type:"cluster",fields:f,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:y,symbology:b}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function y(e,r,t,n,o){const c=u(e,n.fields),f={type:"track",previousObservation:await s(r,e.previousObservations.renderer),latestObservation:await s(r,e.latestObservations.renderer),trackLine:await s(r,e.trackLines.renderer)},b={type:"track",previousObservation:await i(r,{geometryType:n.geometryType,labelingInfoSource:n.labelingInfoSource+"-track-prev",labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},l(e.previousObservations.renderer)),latestObservation:await i(r,{geometryType:n.geometryType,labelingInfoSource:n.labelingInfoSource+"-track-latest",labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},l(e.latestObservations.renderer)),trackLine:await i(r,{geometryType:"polyline",labelingInfoSource:n.labelingInfoSource+"-track-line",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},l(e.trackLines.renderer))},p=a(e,[null,null]),y=g(f);return{storage:p,mesh:{properties:{sortKey:null,timeZone:t.timeZone,returnMeshObjectId:y,displayRefreshVersion:o,currentUser:t.currentUser},strategy:{type:"track",featureFilter:t.filters[0],fields:c,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:b,symbology:f}},expressionProperties:{timeExtent:t.timeExtent?.toJSON()}}}function m(e,t,i){const s=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||s||(e=[new r({field:i,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(s){return{byRenderer:!0,order:"asc"}}return null}function d(e){return e.techniqueType===t.AnimatedMarker}function g(e){if("simple"===e.type&&e.meshes.some(d))return!0;if("interval"===e.type){if(e.intervals.some((e=>e.meshes.some(d))))return!0;if(e.backgroundFill.some(d))return!0}if("map"===e.type){if(e.map.some((e=>e.symbol.some(d))))return!0;if(e.backgroundFill.some(d))return!0}return!1}export{c as createSimpleProcessorSchema,u as getAggregateFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function n(e,r){const s=a();return{type:"multi",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},keyField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>{const a=t(r);return{...e,[s]:a}}),{})}}async function o(r,{subtypeField:t,sublayers:a,layerId:i}){const n=await Promise.all(a.map((t=>{const a=s(t.renderer),n={...t,geometryType:t.geometryType??null,layerId:i};return e(r,n,a)})));return{type:"subtype",subtypeField:t,renderers:a.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:n[t]})),{})}}async function u(e,r,t,s){return{storage:n(r,t),mesh:{properties:{timeZone:r.timeZone,displayRefreshVersion:s,returnMeshObjectId:!1,sortKey:null,currentUser:r.currentUser},strategy:{type:"feature"},factory:{symbology:await i(e,t),labels:await o(e,t)}},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}export{u as createSubtypeProcessorSchema};
5
+ import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as i}from"../../../../../webgl/capabilities.js";async function a(e,{subtypeField:t,sublayers:s}){const i=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:i[t]})),{})}}function n(e,r){const s=i();return{type:"multi",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},keyField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>{const i=t(r);return{...e,[s]:i}}),{})}}async function o(r,{subtypeField:t,sublayers:i,labelingInfoSource:a}){const n=await Promise.all(i.map((t=>{const i=s(t.renderer),n={...t,geometryType:t.geometryType??null,labelingInfoSource:a};return e(r,n,i)})));return{type:"subtype",subtypeField:t,renderers:i.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:n[t]})),{})}}async function u(e,r,t,s){return{storage:n(r,t),mesh:{properties:{timeZone:r.timeZone,displayRefreshVersion:s,returnMeshObjectId:!1,sortKey:null,currentUser:r.currentUser},strategy:{type:"feature"},factory:{symbology:await a(e,t),labels:await o(e,t)}},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}export{u as createSubtypeProcessorSchema};