@arcgis/core 4.29.4 → 4.29.5

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 (28) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{9f0c5822e9f2761054ea.js → 07ef6a6c4f3fce7508eb.js} +1 -1
  3. package/assets/esri/core/workers/chunks/47504e296bf82357f6bb.js +1 -0
  4. package/assets/esri/core/workers/chunks/{686a76adc741eef369ee.js → 5db9739e00f15613d1ea.js} +1 -1
  5. package/kernel.js +1 -1
  6. package/layers/support/Sublayer.js +1 -1
  7. package/package.json +1 -1
  8. package/support/revision.js +1 -1
  9. package/symbols/support/urlUtils.js +1 -1
  10. package/views/2d/engine/Stage.js +1 -1
  11. package/views/2d/engine/webgl/shaderGraph/techniques/Technique.js +1 -1
  12. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js +1 -1
  13. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  14. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +5 -0
  15. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  16. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  17. package/views/2d/layers/StreamLayerView2D.js +1 -1
  18. package/views/2d/layers/features/Processor.js +1 -1
  19. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  20. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  21. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  22. package/views/2d/layers/support/handleNoEngineError.js +5 -0
  23. package/views/MapView.js +1 -1
  24. package/widgets/BasemapLayerList.js +1 -1
  25. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  26. package/widgets/LayerList/support/layerListUtils.js +1 -1
  27. package/widgets/LayerList.js +1 -1
  28. package/assets/esri/core/workers/chunks/a48201b109e9e9aab2d6.js +0 -1
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,i=r;i="4.29.4";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,i=r;i="4.29.5";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as a}from"../../symbols.js";import s from"../../core/Collection.js";import l from"../../core/Error.js";import has from"../../core/has.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import y from"../../core/Loadable.js";import d from"../../core/Logger.js";import{MultiOriginJSONMixin as u}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as c}from"../../core/sql.js";import{objectToQuery as f}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as I,ensureType as w,Integer as v,ensureClass as j}from"../../core/accessorSupport/ensureType.js";import{OriginId as L,nameToId as D}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as E}from"../../core/accessorSupport/utils.js";import F from"../graphics/sources/support/QueryTask.js";import x from"./FeatureType.js";import P from"./Field.js";import O from"./FieldsIndex.js";import T from"./LabelClass.js";import{validateLabelingInfo as _}from"./labelingInfo.js";import A from"./LayerFloorInfo.js";import{getFeatureLayerCapabilities as V}from"./serviceCapabilitiesUtils.js";import{DataLayerSource as M}from"./source/DataLayerSource.js";import{MapLayerSource as N}from"./source/MapLayerSource.js";import q from"../../rest/support/AttachmentQuery.js";import R from"../../rest/support/Query.js";import{createPopupTemplate as C}from"../../support/popupUtils.js";import U from"../../geometry/Extent.js";import{featureGeometryTypeKebabDictionary as k}from"../../geometry/support/typeUtils.js";var Q;function B(e){return null!=e&&"esriSMS"===e.type}function J(e,r,t){const i=this.originIdOf(r)>=D(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function $(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(t.origin&&this.originIdOf(r)>=D(t.origin)||this._isOverridden(r)))}}function G(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function H(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=D(t.origin))}}let z=0;const K=new Set;K.add("layer"),K.add("parent"),K.add("loaded"),K.add("loadStatus"),K.add("loadError"),K.add("loadWarnings");let W=Q=class extends(u(n(y))){constructor(e){super(e),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise((async()=>{const{layer:r,url:t}=this;if(!r&&!t)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=r?await r.fetchSublayerInfo(this,e):(await o(t,{responseType:"json",query:{f:"json"},...e})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service"}))})()),this}readCapabilities(e,r){r=r.layerDefinition||r;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:o},data:{supportsAttachment:a},queryRelated:s}=V(r,this.url);return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:a},query:{supportsFormatPBF:o},queryRelated:s}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new O(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??z++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeOID"===t.type)return t.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const t=r.layerDefinition;return 1-.01*((null!=t?.transparency?t.transparency:t?.drawingInfo?.transparency)??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=I(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{spatialReference:e}=this.layer,r="gdbVersion"in this.layer?this.layer.gdbVersion:void 0,{capabilities:t,fieldsIndex:i}=this,o=has("featurelayer-pbf")&&t?.query.supportsFormatPBF,a=t?.operations?.supportsQueryAttachments??!1;return new F({url:this.url,pbfSupported:o,fieldsIndex:i,gdbVersion:r,sourceSpatialReference:e,queryAttachmentsSupported:a})}set renderer(e){if(e)for(const r of e.getSymbols())if(a(r)){d.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new N({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return w(s.ofType(Q),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${f(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=E(this),r=new Q;return E(r).store=e.clone(K),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return C(this,e)}createQuery(){return new R({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>L.SERVICE)i=new e({url:t});else{if(!r?.parsedUrl)throw new l("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=p(this.floorInfo)),this.originIdOf("labelingInfo")>L.SERVICE&&(i.labelingInfo=p(this.labelingInfo)),this.originIdOf("labelsVisible")>L.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>L.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>L.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>L.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>L.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>L.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>L.DEFAULTS&&(i.popupTemplate=p(this.popupTemplate)),this.originIdOf("renderer")>L.SERVICE&&(i.renderer=p(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>L.DEFAULTS&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t?.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load(),e=q.from(e);const t=this.capabilities;if(!t?.data?.supportsAttachment)throw new l("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:o,globalIds:a,num:s,size:n,start:p,where:y}=e;if(!t?.operations?.supportsQueryAttachments){if(i?.length>0||a?.length>0||n?.length>0||s||p||y)throw new l("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(o?.length||a?.length||y))throw new l("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features)for(const i of t.features)i.sourceLayer=this;return t}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=c(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>L.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>L.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>L.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>L.SERVICE)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some((e=>!e.labelPlacement))&&d.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=_(this.labelingInfo,k.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer})))}else e.showLabels=!1;i.opacity>L.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)B(e.symbol)&&r(e.symbol);"symbol"in e&&B(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&B(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,a;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",a="supportsModification"}const s=E(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(a&&!1===this.capabilities?.exportMap[a])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${a}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.removeAllHandles()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.layer?.capabilities?.exportMap?.supportsSublayersChanges;null==r||r||(d.getLogger(this).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;d.getLogger(i).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};W.test={isMapImageLayerOverridePolicy:e=>e===G||e===J,isTileImageLayerOverridePolicy:e=>e===$},e([m({readOnly:!0})],W.prototype,"capabilities",void 0),e([b("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],W.prototype,"readCapabilities",null),e([m()],W.prototype,"defaultPopupTemplate",null),e([m({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:J}}})],W.prototype,"definitionExpression",null),e([m({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([b("service","maxScaleRange",["minScale","maxScale"])],W.prototype,"readMaxScaleRange",null),e([m({type:[P],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],W.prototype,"fields",void 0),e([m({readOnly:!0})],W.prototype,"fieldsIndex",null),e([m({type:A,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:J},origins:{"web-scene":{read:!1,write:!1}}}})],W.prototype,"floorInfo",null),e([m({type:U,json:{read:{source:"layerDefinition.extent"}}})],W.prototype,"fullExtent",void 0),e([m({type:k.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:k.read}}}}})],W.prototype,"geometryType",void 0),e([m({type:String})],W.prototype,"globalIdField",void 0),e([b("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],W.prototype,"readGlobalIdFieldFromService",null),e([m({type:v,json:{write:{ignoreOrigin:!0}}})],W.prototype,"id",null),e([m({value:null,type:[T],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:G}}})],W.prototype,"labelingInfo",null),e([S("labelingInfo")],W.prototype,"writeLabelingInfo",null),e([m({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:G}}})],W.prototype,"labelsVisible",null),e([m({value:null})],W.prototype,"layer",null),e([m({type:String,json:{write:{overridePolicy:$}}})],W.prototype,"layerItemId",void 0),e([m({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:H}}})],W.prototype,"legendEnabled",void 0),e([m({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],W.prototype,"listMode",null),e([m({type:Number,value:0,json:{write:{overridePolicy:G}}})],W.prototype,"minScale",null),e([b("minScale",["minScale","layerDefinition.minScale"])],W.prototype,"readMinScale",null),e([m({type:Number,value:0,json:{write:{overridePolicy:G}}})],W.prototype,"maxScale",null),e([b("maxScale",["maxScale","layerDefinition.maxScale"])],W.prototype,"readMaxScale",null),e([m({type:String})],W.prototype,"objectIdField",void 0),e([b("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],W.prototype,"readObjectIdFieldFromService",null),e([m({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:G}}})],W.prototype,"opacity",null),e([b("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],W.prototype,"readOpacity",null),e([S("opacity")],W.prototype,"writeOpacity",null),e([m({json:{type:v,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:G}}})],W.prototype,"parent",void 0),e([S("parent")],W.prototype,"writeParent",null),e([m({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:H,writer(e,r,t){r[t]=!e}}}})],W.prototype,"popupEnabled",void 0),e([m({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:H}}})],W.prototype,"popupTemplate",void 0),e([m({readOnly:!0})],W.prototype,"queryTask",null),e([m({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G}}}}})],W.prototype,"renderer",null),e([m({types:{key:"type",base:null,typeMap:{"data-layer":M,"map-layer":N}},cast(e){if(e){if("mapLayerId"in e)return j(N,e);if("dataSource"in e)return j(M,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:G}}})],W.prototype,"source",null),e([m()],W.prototype,"sourceJSON",void 0),e([m({value:null,json:{type:[v],write:{target:"subLayerIds",allowNull:!0,overridePolicy:G}}})],W.prototype,"sublayers",null),e([h("sublayers")],W.prototype,"castSublayers",null),e([S("sublayers")],W.prototype,"writeSublayers",null),e([m({type:String,json:{name:"name",write:{overridePolicy:H}}})],W.prototype,"title",void 0),e([b("service","title",["name","layerDefinition.name"])],W.prototype,"readTitle",null),e([m({type:String})],W.prototype,"typeIdField",void 0),e([m({json:{read:!1},readOnly:!0,value:"sublayer"})],W.prototype,"type",void 0),e([b("typeIdField",["layerDefinition.typeIdField"])],W.prototype,"readTypeIdField",null),e([m({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],W.prototype,"types",void 0),e([m({type:String,json:{name:"layerUrl",write:{overridePolicy:$}}})],W.prototype,"url",null),e([m({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:G}}})],W.prototype,"visible",null),e([S("visible")],W.prototype,"writeVisible",null),W=Q=e([g("esri.layers.support.Sublayer")],W);const X=W;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as a}from"../../symbols.js";import s from"../../core/Collection.js";import l from"../../core/Error.js";import has from"../../core/has.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import y from"../../core/Loadable.js";import d from"../../core/Logger.js";import{MultiOriginJSONMixin as u}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as c}from"../../core/sql.js";import{objectToQuery as f}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as I,ensureType as w,Integer as v,ensureClass as j}from"../../core/accessorSupport/ensureType.js";import{OriginId as L,nameToId as D}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as E}from"../../core/accessorSupport/utils.js";import F from"../graphics/sources/support/QueryTask.js";import x from"./FeatureType.js";import P from"./Field.js";import O from"./FieldsIndex.js";import T from"./LabelClass.js";import{validateLabelingInfo as _}from"./labelingInfo.js";import A from"./LayerFloorInfo.js";import{getFeatureLayerCapabilities as V}from"./serviceCapabilitiesUtils.js";import{DataLayerSource as M}from"./source/DataLayerSource.js";import{MapLayerSource as N}from"./source/MapLayerSource.js";import{parseUrl as q}from"../../rest/utils.js";import R from"../../rest/support/AttachmentQuery.js";import C from"../../rest/support/Query.js";import{createPopupTemplate as U}from"../../support/popupUtils.js";import k from"../../geometry/Extent.js";import{featureGeometryTypeKebabDictionary as Q}from"../../geometry/support/typeUtils.js";var B;function J(e){return null!=e&&"esriSMS"===e.type}function $(e,r,t){const i=this.originIdOf(r)>=D(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function G(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(t.origin&&this.originIdOf(r)>=D(t.origin)||this._isOverridden(r)))}}function H(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function z(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=D(t.origin))}}let K=0;const W=new Set;W.add("layer"),W.add("parent"),W.add("loaded"),W.add("loadStatus"),W.add("loadError"),W.add("loadWarnings");let X=B=class extends(u(n(y))){constructor(e){super(e),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise((async()=>{const{layer:r,url:t}=this;if(!r&&!t)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=r?await r.fetchSublayerInfo(this,e):(await o(t,{responseType:"json",query:{f:"json"},...e})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service",layer:r,url:q(t)}))})()),this}readCapabilities(e,r){r=r.layerDefinition||r;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:o},data:{supportsAttachment:a},queryRelated:s}=V(r,this.url);return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:a},query:{supportsFormatPBF:o},queryRelated:s}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new O(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??K++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeOID"===t.type)return t.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const t=r.layerDefinition;return 1-.01*((null!=t?.transparency?t.transparency:t?.drawingInfo?.transparency)??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=I(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{spatialReference:e}=this.layer,r="gdbVersion"in this.layer?this.layer.gdbVersion:void 0,{capabilities:t,fieldsIndex:i}=this,o=has("featurelayer-pbf")&&t?.query.supportsFormatPBF,a=t?.operations?.supportsQueryAttachments??!1;return new F({url:this.url,pbfSupported:o,fieldsIndex:i,gdbVersion:r,sourceSpatialReference:e,queryAttachmentsSupported:a})}set renderer(e){if(e)for(const r of e.getSymbols())if(a(r)){d.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new N({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return w(s.ofType(B),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${f(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=E(this),r=new B;return E(r).store=e.clone(W),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return U(this,e)}createQuery(){return new C({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>L.SERVICE)i=new e({url:t});else{if(!r?.parsedUrl)throw new l("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=p(this.floorInfo)),this.originIdOf("labelingInfo")>L.SERVICE&&(i.labelingInfo=p(this.labelingInfo)),this.originIdOf("labelsVisible")>L.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>L.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>L.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>L.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>L.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>L.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>L.DEFAULTS&&(i.popupTemplate=p(this.popupTemplate)),this.originIdOf("renderer")>L.SERVICE&&(i.renderer=p(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>L.DEFAULTS&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t?.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load(),e=R.from(e);const t=this.capabilities;if(!t?.data?.supportsAttachment)throw new l("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:o,globalIds:a,num:s,size:n,start:p,where:y}=e;if(!t?.operations?.supportsQueryAttachments){if(i?.length>0||a?.length>0||n?.length>0||s||p||y)throw new l("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(o?.length||a?.length||y))throw new l("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features)for(const i of t.features)i.sourceLayer=this;return t}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=c(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>L.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>L.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>L.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>L.SERVICE)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some((e=>!e.labelPlacement))&&d.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=_(this.labelingInfo,Q.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer})))}else e.showLabels=!1;i.opacity>L.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)J(e.symbol)&&r(e.symbol);"symbol"in e&&J(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&J(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,a;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",a="supportsModification"}const s=E(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(a&&!1===this.capabilities?.exportMap[a])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${a}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.removeAllHandles()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.layer?.capabilities?.exportMap?.supportsSublayersChanges;null==r||r||(d.getLogger(this).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;d.getLogger(i).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};X.test={isMapImageLayerOverridePolicy:e=>e===H||e===$,isTileImageLayerOverridePolicy:e=>e===G},e([m({readOnly:!0})],X.prototype,"capabilities",void 0),e([b("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],X.prototype,"readCapabilities",null),e([m()],X.prototype,"defaultPopupTemplate",null),e([m({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:$}}})],X.prototype,"definitionExpression",null),e([m({readOnly:!0})],X.prototype,"effectiveScaleRange",null),e([b("service","maxScaleRange",["minScale","maxScale"])],X.prototype,"readMaxScaleRange",null),e([m({type:[P],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],X.prototype,"fields",void 0),e([m({readOnly:!0})],X.prototype,"fieldsIndex",null),e([m({type:A,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:$},origins:{"web-scene":{read:!1,write:!1}}}})],X.prototype,"floorInfo",null),e([m({type:k,json:{read:{source:"layerDefinition.extent"}}})],X.prototype,"fullExtent",void 0),e([m({type:Q.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:Q.read}}}}})],X.prototype,"geometryType",void 0),e([m({type:String})],X.prototype,"globalIdField",void 0),e([b("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],X.prototype,"readGlobalIdFieldFromService",null),e([m({type:v,json:{write:{ignoreOrigin:!0}}})],X.prototype,"id",null),e([m({value:null,type:[T],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:H}}})],X.prototype,"labelingInfo",null),e([S("labelingInfo")],X.prototype,"writeLabelingInfo",null),e([m({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:H}}})],X.prototype,"labelsVisible",null),e([m({value:null})],X.prototype,"layer",null),e([m({type:String,json:{write:{overridePolicy:G}}})],X.prototype,"layerItemId",void 0),e([m({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:z}}})],X.prototype,"legendEnabled",void 0),e([m({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],X.prototype,"listMode",null),e([m({type:Number,value:0,json:{write:{overridePolicy:H}}})],X.prototype,"minScale",null),e([b("minScale",["minScale","layerDefinition.minScale"])],X.prototype,"readMinScale",null),e([m({type:Number,value:0,json:{write:{overridePolicy:H}}})],X.prototype,"maxScale",null),e([b("maxScale",["maxScale","layerDefinition.maxScale"])],X.prototype,"readMaxScale",null),e([m({type:String})],X.prototype,"objectIdField",void 0),e([b("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],X.prototype,"readObjectIdFieldFromService",null),e([m({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:H}}})],X.prototype,"opacity",null),e([b("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],X.prototype,"readOpacity",null),e([S("opacity")],X.prototype,"writeOpacity",null),e([m({json:{type:v,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:H}}})],X.prototype,"parent",void 0),e([S("parent")],X.prototype,"writeParent",null),e([m({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:z,writer(e,r,t){r[t]=!e}}}})],X.prototype,"popupEnabled",void 0),e([m({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:z}}})],X.prototype,"popupTemplate",void 0),e([m({readOnly:!0})],X.prototype,"queryTask",null),e([m({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:H},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:H}}}}})],X.prototype,"renderer",null),e([m({types:{key:"type",base:null,typeMap:{"data-layer":M,"map-layer":N}},cast(e){if(e){if("mapLayerId"in e)return j(N,e);if("dataSource"in e)return j(M,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:H}}})],X.prototype,"source",null),e([m()],X.prototype,"sourceJSON",void 0),e([m({value:null,json:{type:[v],write:{target:"subLayerIds",allowNull:!0,overridePolicy:H}}})],X.prototype,"sublayers",null),e([h("sublayers")],X.prototype,"castSublayers",null),e([S("sublayers")],X.prototype,"writeSublayers",null),e([m({type:String,json:{name:"name",write:{overridePolicy:z}}})],X.prototype,"title",void 0),e([b("service","title",["name","layerDefinition.name"])],X.prototype,"readTitle",null),e([m({type:String})],X.prototype,"typeIdField",void 0),e([m({json:{read:!1},readOnly:!0,value:"sublayer"})],X.prototype,"type",void 0),e([b("typeIdField",["layerDefinition.typeIdField"])],X.prototype,"readTypeIdField",null),e([m({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],X.prototype,"types",void 0),e([m({type:String,json:{name:"layerUrl",write:{overridePolicy:G}}})],X.prototype,"url",null),e([m({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:H}}})],X.prototype,"visible",null),e([S("visible")],X.prototype,"writeVisible",null),X=B=e([g("esri.layers.support.Sublayer")],X);const Y=X;export{Y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.29.4",
3
+ "version": "4.29.5",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- const c="20240304",a="38b01779c6876d655f0c16d5aad92a1c2f6c7077";export{c as buildDate,a as commitHash};
5
+ const a="20240305",b="bba2f64408804c3983fca01a467bc20efb07d4a9";export{a as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{makeData as e,isAbsolute as a,join as r,isDataProtocol as t,dataComponents as i}from"../../core/urlUtils.js";import{f as n,w as l}from"../../chunks/persistableUrlUtils.js";function o(a,r,t){return r.imageData?e({mediaType:r.contentType||"image/png",isBase64:!0,data:r.imageData}):s(r.url,t)}function s(e,t){return p(t)&&!a(e)&&t?.layer?.parsedUrl?r(t.layer.parsedUrl.path,"images",e):n(e,t)}function u(e,a,r,n){if(t(e)){const t=i(e);if(!t)return;a.contentType=t.mediaType,a.imageData=t.data,r&&r.imageData===a.imageData&&r.url&&l(r.url,a,"url",n)}else l(e,a,"url",n)}const m={json:{read:{source:["imageData","url"],reader:o},write:{writer(e,a,r,t){u(e,a,this.source,t)}}}},c={readOnly:!0,json:{read:{source:["imageData","url"],reader(e,a,r){const t={};return a.imageData&&(t.imageData=a.imageData),a.contentType&&(t.contentType=a.contentType),a.url&&(t.url=s(a.url,r)),t}}}};function p(e){return!(null==e||"service"!==e.origin&&"portal-item"!==e.origin||"feature"!==e.layer?.type&&"stream"!==e.layer?.type)}export{s as read,o as readImageDataOrUrl,c as sourcePropertyDefinition,m as urlPropertyDefinition,u as writeImageDataAndUrl};
5
+ import{makeData as e,isAbsolute as r,join as t,isDataProtocol as a,dataComponents as n}from"../../core/urlUtils.js";import{f as i,w as u}from"../../chunks/persistableUrlUtils.js";function l(r,t,a){return t.imageData?e({mediaType:t.contentType||"image/png",isBase64:!0,data:t.imageData}):o(t.url,a)}function o(e,a){if(!r(e)){const r=p(a);if(r)return t(r,"images",e)}return i(e,a)}function s(e,r,t,i){if(a(e)){const a=n(e);if(!a)return;r.contentType=a.mediaType,r.imageData=a.data,t&&t.imageData===r.imageData&&t.url&&u(t.url,r,"url",i)}else u(e,r,"url",i)}const m={json:{read:{source:["imageData","url"],reader:l},write:{writer(e,r,t,a){s(e,r,this.source,a)}}}},c={readOnly:!0,json:{read:{source:["imageData","url"],reader(e,r,t){const a={};return r.imageData&&(a.imageData=r.imageData),r.contentType&&(a.contentType=r.contentType),r.url&&(a.url=o(r.url,t)),a}}}};function p(e){if(!e)return null;const{origin:r,layer:t}=e;if("service"!==r&&"portal-item"!==r)return null;const a=t?.type;return"feature"===a||"stream"===a?t.parsedUrl?.path:"map-image"===a||"tile"===a?e.url?.path:null}export{o as read,l as readImageDataOrUrl,c as sourcePropertyDefinition,m as urlPropertyDefinition,s as writeImageDataAndUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import has from"../../../core/has.js";import{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as n}from"../../../symbols/cim/cimAnalyzer.js";import{Container as a}from"./Container.js";import{ManagedCanvas as o}from"./ManagedCanvas.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as h}from"./webgl/definitions.js";import{WGLDrawPhase as d}from"./webgl/enums.js";import l from"./webgl/Painter.js";import{ArrayBufferPool as m}from"./webgl/PooledUint32Array.js";import{Profiler as c}from"./webgl/Profiler.js";import{TileReshuffleManager as u}from"./webgl/TileReshuffleManager.js";import{startup as p,shutdown as f}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{Timeline as g}from"../support/Timeline.js";import{resampleHermite as _}from"../../support/screenshotUtils.js";import{TextureWrapMode as b,SizedPixelFormat as w,RenderbufferFormat as R,PixelFormat as y,PixelType as x}from"../../webgl/enums.js";import{FramebufferObject as P}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as j}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as C}from"../../webgl/RenderingContext.js";import{TextureDescriptor as T}from"../../webgl/TextureDescriptor.js";import{createEmptyImageData as M}from"../../../core/imageUtils.js";const O=2e3;class v extends a{constructor(t,i){super(),this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new u,this._canvas=new o(t),this.context=new C(this._canvas.gl,i.contextOptions??{}),this.painter=new l(this.context,this),this._cimAnalyzer=new n(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const a=()=>this._highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new g,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new c(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return a()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor},this._taskHandle=r({render:e=>this.renderFrame(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._canvas.events.on("webgl-context-lost",(t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)}))),this._bufferPool=new m,p()}destroy(){f(),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._canvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._canvas=null}get textureManager(){return this.painter.textureManager}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=O,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._reshuffleManager.reshuffle(h),this._canvas.render(e,(()=>this._renderChildren(this.children,e)));for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=d.MAP;for(const s of e)s.processRender(t);if(this.children.some((e=>e.hasHighlight))){t.drawPhase=d.HIGHLIGHT;for(const r of e)r.processRender(t)}if(this.children.some((e=>e.hasLabels))){t.drawPhase=d.LABEL;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=d.DEBUG;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._canvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),n=Math.round(this.state.size[1]*e.resolutionScale),a=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:a,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new T(i,n);l.wrapMode=b.CLAMP_TO_EDGE,l.internalFormat=w.RGBA8,l.isImmutable=!0;const m=new P(o,l,new j(R.DEPTH_STENCIL,i,n)),c=o.getBoundFramebufferObject(),u=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,n),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:n-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(c),o.setViewport(u.x,u.y,u.width,u.height),this.requestRender();const f=await p;let g;return 1===e.outputScale?g=f:(g=new ImageData(Math.round(f.width*e.outputScale),Math.round(f.height*e.outputScale)),_(f,g,!0)),m.dispose(),g}async _readbackScreenshot(e,t){const r=M(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,y.RGBA,x.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{v as Stage,O as extraRenderTime};
5
+ import e from"../../../core/Error.js";import has from"../../../core/has.js";import{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as n}from"../../../symbols/cim/cimAnalyzer.js";import{Container as a}from"./Container.js";import{ManagedCanvas as o}from"./ManagedCanvas.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as h}from"./webgl/definitions.js";import{WGLDrawPhase as d}from"./webgl/enums.js";import l from"./webgl/Painter.js";import{ArrayBufferPool as m}from"./webgl/PooledUint32Array.js";import{Profiler as c}from"./webgl/Profiler.js";import{TileReshuffleManager as u}from"./webgl/TileReshuffleManager.js";import{startup as p,shutdown as f}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{Timeline as g}from"../support/Timeline.js";import{resampleHermite as _}from"../../support/screenshotUtils.js";import{TextureWrapMode as b,SizedPixelFormat as w,RenderbufferFormat as R,PixelFormat as y,PixelType as x}from"../../webgl/enums.js";import{FramebufferObject as P}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as j}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as C}from"../../webgl/RenderingContext.js";import{TextureDescriptor as T}from"../../webgl/TextureDescriptor.js";import{createEmptyImageData as M}from"../../../core/imageUtils.js";const O=2e3;class v extends a{constructor(t,i){super(),this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new u,this._canvas=new o(t),this.context=new C(this._canvas.gl,i.contextOptions??{}),this.painter=new l(this.context,this),this._cimAnalyzer=new n(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const a=()=>this._highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new g,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new c(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return a()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor},this._taskHandle=r({render:e=>this.renderFrame(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._canvas.events.on("webgl-context-lost",(t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)}))),this._bufferPool=new m,p()}destroy(){f(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._canvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._canvas=null}get textureManager(){return this.painter.textureManager}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=O,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._reshuffleManager.reshuffle(h),this._canvas.render(e,(()=>this._renderChildren(this.children,e)));for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=d.MAP;for(const s of e)s.processRender(t);if(this.children.some((e=>e.hasHighlight))){t.drawPhase=d.HIGHLIGHT;for(const r of e)r.processRender(t)}if(this.children.some((e=>e.hasLabels))){t.drawPhase=d.LABEL;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=d.DEBUG;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._canvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),n=Math.round(this.state.size[1]*e.resolutionScale),a=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:a,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new T(i,n);l.wrapMode=b.CLAMP_TO_EDGE,l.internalFormat=w.RGBA8,l.isImmutable=!0;const m=new P(o,l,new j(R.DEPTH_STENCIL,i,n)),c=o.getBoundFramebufferObject(),u=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,n),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:n-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(c),o.setViewport(u.x,u.y,u.width,u.height),this.requestRender();const f=await p;let g;return 1===e.outputScale?g=f:(g=new ImageData(Math.round(f.width*e.outputScale),Math.round(f.height*e.outputScale)),_(f,g,!0)),m.dispose(),g}async _readbackScreenshot(e,t){const r=M(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,y.RGBA,x.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{v as Stage,O as extraRenderTime};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{WGLDrawPhase as s,FeatureSymbologyDrawOrder as t}from"../../enums.js";class e{constructor(e){this.registryName=e,this.postProcessingEnabled=!1,this.overrideStencilRef=null,this.drawPhase=s.MAP|s.HITTEST|s.HIGHLIGHT|s.DEBUG,this.symbologyPlane=t.FILL}startup(){}shutdown(){}postProcess(s,t){}}export{e as Technique};
5
+ import{WGLDrawPhase as s,FeatureSymbologyDrawOrder as t}from"../../enums.js";class e{constructor(e){this.registryName=e,this.postProcessingEnabled=!1,this.overrideStencilRef=null,this.drawPhase=s.MAP|s.HITTEST|s.HIGHLIGHT|s.DEBUG,this.symbologyPlane=t.FILL}startup(){}shutdown(s){}postProcess(s,t){}}export{e as Technique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{DotDensityTechnique as e}from"./dotDensity/DotDensityTechnique.js";import{ComplexFillTechnique as i}from"./fill/ComplexFillTechnique.js";import{ComplexOutlineFillTechnique as l}from"./fill/ComplexOutlineFillTechnique.js";import{FillTechnique as t}from"./fill/FillTechnique.js";import{OutlineFillTechnique as n}from"./fill/OutlineFillTechnique.js";import{PatternFillTechnique as r}from"./fill/PatternFillTechnique.js";import{PatternOutlineFillTechnique as o}from"./fill/PatternOutlineFillTechnique.js";import{HeatmapTechnique as m}from"./heatmap/HeatmapTechnique.js";import{LabelTechnique as p}from"./labels/LabelTechnique.js";import{LineTechnique as u}from"./line/LineTechnique.js";import{TexturedLineTechnique as a}from"./line/TexturedLineTechnique.js";import{MarkerTechnique as f}from"./markers/MarkerTechnique.js";import{PieChartTechnique as s}from"./pieChart/PieChartTechnique.js";import{TextTechnique as c}from"./text/TextTechnique.js";const h={fill:new t("fill"),patternFill:new r("patternFill"),complexFill:new i("complexFill"),outlineFill:new n("outlineFill"),patternOutlineFill:new o("patternOutlineFill"),complexOutlineFill:new l("complexOutlineFill"),marker:new f("marker"),pieChart:new s("pieChart"),line:new u("line"),texturedLine:new a("texturedLine"),text:new c("text"),label:new p("label"),heatmap:new m("heatmap"),dotDensity:new e("dotDensity")};function F(){for(const e in h){h[e].startup()}}function T(){for(const e in h){h[e].shutdown()}}export{h as Techniques,T as shutdown,F as startup};
5
+ import{DotDensityTechnique as e}from"./dotDensity/DotDensityTechnique.js";import{ComplexFillTechnique as i}from"./fill/ComplexFillTechnique.js";import{ComplexOutlineFillTechnique as l}from"./fill/ComplexOutlineFillTechnique.js";import{FillTechnique as t}from"./fill/FillTechnique.js";import{OutlineFillTechnique as n}from"./fill/OutlineFillTechnique.js";import{PatternFillTechnique as r}from"./fill/PatternFillTechnique.js";import{PatternOutlineFillTechnique as o}from"./fill/PatternOutlineFillTechnique.js";import{HeatmapTechnique as m}from"./heatmap/HeatmapTechnique.js";import{LabelTechnique as p}from"./labels/LabelTechnique.js";import{LineTechnique as u}from"./line/LineTechnique.js";import{TexturedLineTechnique as a}from"./line/TexturedLineTechnique.js";import{MarkerTechnique as f}from"./markers/MarkerTechnique.js";import{PieChartTechnique as s}from"./pieChart/PieChartTechnique.js";import{TextTechnique as c}from"./text/TextTechnique.js";const h={fill:new t("fill"),patternFill:new r("patternFill"),complexFill:new i("complexFill"),outlineFill:new n("outlineFill"),patternOutlineFill:new o("patternOutlineFill"),complexOutlineFill:new l("complexOutlineFill"),marker:new f("marker"),pieChart:new s("pieChart"),line:new u("line"),texturedLine:new a("texturedLine"),text:new c("text"),label:new p("label"),heatmap:new m("heatmap"),dotDensity:new e("dotDensity")};function F(){for(const e in h){h[e].startup()}}function T(e){for(const i in h){h[i].shutdown(e)}}export{h as Techniques,T as shutdown,F as startup};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{tileSize as e,textureBindingRenderer0 as t,textureBindingRenderer1 as i}from"../../../definitions.js";import{isHighlight as s,isHittest as o,getFeatureUniforms as r,getSelectionDefines as n,getFeaturePipelineState as a,getViewUniforms as l}from"../featureTechniqueUtils.js";import{Technique as d}from"../Technique.js";import{DotDensityPointShader as u}from"./DotDensityPointShader.js";import{DotDensityPolygonShader as c}from"./DotDensityPolygonShader.js";import{DotDensityResources as h}from"./DotDensityResources.js";import{meshWriterRegistry as p}from"../mesh/MeshWriterRegistry.js";import{FillShader as m}from"../shaders/FillShader.js";import{ClearBufferBit as f}from"../../../../../../webgl/enums.js";class w extends d{constructor(){super(...arguments),this.shaders={polygon:new c,point:new u,fill:new m},this.meshWriter=p.DotDensityMeshWriter}render(e,t){s(e)||o(e)?this._renderPolygons(e,t):this._renderDotDensity(e,t)}_renderPolygons(e,t){const{context:i,painter:s}=e;s.setShader({shader:this.shaders.fill,uniforms:{...r(e,t.target),visualVariableColor:null,visualVariableOpacity:null},defines:{...n(e)},optionalAttributes:{zoomRange:!1},useComputeBuffer:o(e)}),s.setPipelineState(a(e)),s.submitDraw(i,t)}_renderDotDensity(s,o){const{context:d,painter:u,requiredLevel:c}=s,p=o.instance.getInput();this._resources||(this._resources=new h);const m=this._resources.getDotDensityTextures(d,e,p.seed),w=1/2**(c-o.target.key.level),g=e,x=g*window.devicePixelRatio*g*window.devicePixelRatio,D=1/w*(1/w),b=p.dotScale?s.state.scale/p.dotScale:1,y=p.dotValue*b*D;u.setShader({shader:this.shaders.polygon,uniforms:{...r(s,o.target),instance:{isActive:p.isActive,colors:p.colors,dotValue:Math.max(1,y)},draw:{dotTexture0:{unit:t,texture:m[0]},dotTexture1:{unit:i,texture:m[1]},tileZoomFactor:w,pixelRatio:window.devicePixelRatio,tileDotsOverArea:x/(e*window.devicePixelRatio*e*window.devicePixelRatio)}},defines:{...n(s),blending:p.blending},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState(a(s));const P=d.getViewport();d.setViewport(0,0,e,e);const S=d.getBoundFramebufferObject(),_=this._resources.getFBO(d);d.bindFramebuffer(_),d.setClearColor(0,0,0,0),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.updatePipelineState(d),d.clear(f.COLOR_BUFFER_BIT),u.submitDraw(d,o),d.bindFramebuffer(S),d.setViewport(P.x,P.y,P.width,P.height);const v=this._resources.getFBO(d).colorTexture;u.setShader({shader:this.shaders.point,uniforms:{view:l(s,o.target),instance:{dotSize:p.dotSize},draw:{locations:{unit:t,texture:v},tileZoomFactor:1,pixelRatio:window.devicePixelRatio}},defines:{...n(s)},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.submitDrawMesh(d,this._resources.getDotDensityMesh(d))}shutdown(){super.shutdown(),this._resources&&this._resources.destroy(),this._resources=null}}export{w as DotDensityTechnique};
5
+ import{tileSize as e,textureBindingRenderer0 as t,textureBindingRenderer1 as i}from"../../../definitions.js";import{isHighlight as o,isHittest as r,getFeatureUniforms as s,getSelectionDefines as n,getFeaturePipelineState as a,getViewUniforms as l}from"../featureTechniqueUtils.js";import{Technique as d}from"../Technique.js";import{DotDensityPointShader as u}from"./DotDensityPointShader.js";import{DotDensityPolygonShader as c}from"./DotDensityPolygonShader.js";import{DotDensityResources as h}from"./DotDensityResources.js";import{meshWriterRegistry as p}from"../mesh/MeshWriterRegistry.js";import{FillShader as m}from"../shaders/FillShader.js";import{ClearBufferBit as w}from"../../../../../../webgl/enums.js";class f extends d{constructor(){super(...arguments),this.shaders={polygon:new c,point:new u,fill:new m},this.meshWriter=p.DotDensityMeshWriter,this._resources=new Map}render(e,t){o(e)||r(e)?this._renderPolygons(e,t):this._renderDotDensity(e,t)}_renderPolygons(e,t){const{context:i,painter:o}=e;o.setShader({shader:this.shaders.fill,uniforms:{...s(e,t.target),visualVariableColor:null,visualVariableOpacity:null},defines:{...n(e)},optionalAttributes:{zoomRange:!1},useComputeBuffer:r(e)}),o.setPipelineState(a(e)),o.submitDraw(i,t)}_renderDotDensity(o,r){const{context:d,painter:u,requiredLevel:c}=o,h=r.instance.getInput(),p=this._getOrCreateResourcesRecord(d),m=p.getDotDensityTextures(d,e,h.seed),f=1/2**(c-r.target.key.level),g=e,x=g*window.devicePixelRatio*g*window.devicePixelRatio,D=1/f*(1/f),b=h.dotScale?o.state.scale/h.dotScale:1,y=h.dotValue*b*D;u.setShader({shader:this.shaders.polygon,uniforms:{...s(o,r.target),instance:{isActive:h.isActive,colors:h.colors,dotValue:Math.max(1,y)},draw:{dotTexture0:{unit:t,texture:m[0]},dotTexture1:{unit:i,texture:m[1]},tileZoomFactor:f,pixelRatio:window.devicePixelRatio,tileDotsOverArea:x/(e*window.devicePixelRatio*e*window.devicePixelRatio)}},defines:{...n(o),blending:h.blending},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState(a(o));const R=d.getViewport();d.setViewport(0,0,e,e);const P=d.getBoundFramebufferObject(),S=p.getFBO(d);d.bindFramebuffer(S),d.setClearColor(0,0,0,0),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.updatePipelineState(d),d.clear(w.COLOR_BUFFER_BIT),u.submitDraw(d,r),d.bindFramebuffer(P),d.setViewport(R.x,R.y,R.width,R.height);const v=p.getFBO(d).colorTexture;u.setShader({shader:this.shaders.point,uniforms:{view:l(o,r.target),instance:{dotSize:h.dotSize},draw:{locations:{unit:t,texture:v},tileZoomFactor:1,pixelRatio:window.devicePixelRatio}},defines:{...n(o)},optionalAttributes:{},useComputeBuffer:!1}),u.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1}),u.submitDrawMesh(d,p.getDotDensityMesh(d))}shutdown(e){super.shutdown(e),this._resources.get(e)?.destroy(),this._resources.delete(e)}_getOrCreateResourcesRecord(e){let t=this._resources.get(e);return null==t&&(t=new h,this._resources.set(e,t)),t}}export{f as DotDensityTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../../../../../../core/Logger.js";import{disposeMaybe as r}from"../../../../../../../core/maybe.js";import{PixelType as t,TextureWrapMode as a,RenderbufferFormat as i}from"../../../../../../webgl/enums.js";import{FramebufferObject as s}from"../../../../../../webgl/FramebufferObject.js";import{loadHeatmapTextureConfiguration as u}from"../../../../../../webgl/heatmapTextureUtils.js";import{RenderbufferDescriptor as l}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as o}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as n}from"../../../../../../webgl/TextureDescriptor.js";const m=()=>e.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.heatmap.HeatmapResources");class f{destroy(){this._accumulateFramebuffer=r(this._accumulateFramebuffer),this._resolveGradientTexture=r(this._resolveGradientTexture),this._prevGradientHash=null,this._qualityProfile=null}get initialized(){return null!=this._accumulateFramebuffer&&null!=this._resolveGradientTexture}get accumulateFramebuffer(){return this._accumulateFramebuffer}get resolveGradientTexture(){return this._resolveGradientTexture}loadQualityProfile(e){if(null==this._qualityProfile){const r=u(e,m());this._qualityProfile={...r,defines:{usesHalfFloatPrecision:r.dataType!==t.FLOAT}}}return this._qualityProfile}ensureAccumulateFBO(e,r,t){if(null==this._accumulateFramebuffer){const{dataType:u,samplingMode:o,pixelFormat:m,internalFormat:f}=this.loadQualityProfile(e),h=new n(r,t);h.pixelFormat=m,h.internalFormat=f,h.dataType=u,h.samplingMode=o,h.wrapMode=a.CLAMP_TO_EDGE;const c=new l(i.DEPTH_STENCIL,r,t);this._accumulateFramebuffer=new s(e,h,c)}else{const{width:e,height:a}=this._accumulateFramebuffer;e===r&&a===t||this._accumulateFramebuffer.resize(r,t)}return this._accumulateFramebuffer}ensureResolveGradientTexture(e,r,t){if(null==this._resolveGradientTexture){const r=new n;r.wrapMode=a.CLAMP_TO_EDGE,this._resolveGradientTexture=new o(e,r)}else this._prevGradientHash!==r&&(this._resolveGradientTexture.resize(t.length/4,1),this._resolveGradientTexture.setData(t),this._prevGradientHash=r);return this._resolveGradientTexture}}export{f as HeatmapResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isHighlight as r,isHittest as i,getFeatureUniforms as s,getSelectionDefines as a}from"../featureTechniqueUtils.js";import{Technique as u}from"../Technique.js";import{meshWriterRegistry as o}from"../mesh/MeshWriterRegistry.js";import{HeatmapAccumulateShader as n}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as l}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as h,StencilOperation as c,ClearBufferBit as m,TextureWrapMode as d,RenderbufferFormat as f,TextureSamplingMode as p,PixelType as _}from"../../../../../../webgl/enums.js";import{FramebufferObject as b}from"../../../../../../webgl/FramebufferObject.js";import{loadHeatmapTextureConfiguration as w}from"../../../../../../webgl/heatmapTextureUtils.js";import{RenderbufferDescriptor as F}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as v}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as g}from"../../../../../../webgl/TextureDescriptor.js";const x=()=>e.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.heatmap.HeatmapTechnique");class T extends u{constructor(){super(...arguments),this.meshWriter=o.HeatmapMeshWriter,this.shaders={accumulate:new n,resolve:new l},this.postProcessingEnabled=!0,this._isBound=!1,this.overrideStencilRef=P}shutdown(){super.shutdown(),this._prevFBO=null,this._accumulateFramebuffer=t(this._accumulateFramebuffer),this._resolveGradientTexture=t(this._resolveGradientTexture),this._prevGradientHash=null,this._qualityProfile=null,this._unbind()}render(e,t){const{context:u,painter:o,state:n}=e,l=t.instance.getInput(),{isFieldActive:h}=l,c=this._loadQualityProfile(u);if(r(e))return;i(e)||this._ensureBound(e,l),o.setShader({shader:this.shaders.accumulate,uniforms:{...s(e,t.target),kernelControls:{radius:R(l,n),isFieldActive:h?1:0}},defines:{...a(e),...c.defines},optionalAttributes:t.instance.optionalAttributes,useComputeBuffer:i(e)});const m=i(e)?y:E;o.setPipelineState(m),o.submitDraw(u,t)}postProcess(e,t){if(i(e)||r(e))return;if(null==this._prevFBO||null==this._prevViewport||null==this._accumulateFramebuffer||null==this._resolveGradientTexture)return;const{context:s,painter:a}=e,{defines:u}=this._loadQualityProfile(s),{minDensity:o,maxDensity:n,radius:l}=t.getInput(),h=8,c=9;a.setShader({shader:this.shaders.resolve,uniforms:{accumulatedDensity:{texture:{unit:h,texture:this._accumulateFramebuffer.colorTexture},minAndInvRange:[o,1/(n-o)],normalization:3/(l*l*Math.PI)},gradient:{texture:{unit:c,texture:this._resolveGradientTexture}}},defines:u,optionalAttributes:{},useComputeBuffer:!1}),s.bindFramebuffer(this._prevFBO),s.setViewport(0,0,this._prevViewport.width,this._prevViewport.height),s.bindTexture(this._accumulateFramebuffer.colorTexture,h),s.bindTexture(this._resolveGradientTexture,c),a.setPipelineState(G),a.submitDrawQuad(s),this._unbind()}_unbind(){this._prevFBO=null,this._prevViewport=null,this._isBound=!1}_ensureBound(e,t){if(this._isBound)return;const{context:r}=e;this._prevFBO=r.getBoundFramebufferObject(),this._prevViewport=r.getViewport(),this._ensureResources(e,t),this._updateResources(e,t),r.bindFramebuffer(this._accumulateFramebuffer),r.setViewport(0,0,this._accumulateFramebuffer.width,this._accumulateFramebuffer.height),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.clear(m.COLOR_BUFFER_BIT),this._isBound=!0}_ensureResources({context:e,state:t,pixelRatio:r},i){if(null==this._accumulateFramebuffer){const{dataType:s,samplingMode:a,pixelFormat:u,internalFormat:o}=this._loadQualityProfile(e),{width:n,height:l}=this._prevViewport,h=B(R(i,t),r),c=n*h,m=l*h,p=new g(c,m);p.pixelFormat=u,p.internalFormat=o,p.dataType=s,p.samplingMode=a,p.wrapMode=d.CLAMP_TO_EDGE;const _=new F(f.DEPTH_STENCIL,c,m);this._accumulateFramebuffer=new b(e,p,_)}if(null==this._resolveGradientTexture){const t=new g;t.wrapMode=d.CLAMP_TO_EDGE,this._resolveGradientTexture=new v(e,t)}}_updateResources({context:e,state:t,pixelRatio:r},i){const{gradient:s,gradientHash:a}=i;this._prevGradientHash!==a&&(this._resolveGradientTexture.resize(s.length/4,1),this._resolveGradientTexture.setData(s),this._prevGradientHash=a);const u=B(R(i,t),r),{width:o,height:n}=this._prevViewport,l=o*u,h=n*u,{width:c,height:d}=this._accumulateFramebuffer;c===l&&d===h||this._accumulateFramebuffer.resize(l,h),e.blitFramebuffer(this._prevFBO,this._accumulateFramebuffer,0,0,this._prevFBO.width,this._prevFBO.height,0,0,this._accumulateFramebuffer.width,this._accumulateFramebuffer.height,m.STENCIL_BUFFER_BIT,p.NEAREST)}_loadQualityProfile(e){if(null==this._qualityProfile){const t=w(e,x());this._qualityProfile={...t,defines:{usesHalfFloatPrecision:t.dataType!==_.FLOAT}}}return this._qualityProfile}}function B(e,t){const r=t>1.5?.25:.5;return e<1/(2*r)?1:r}function P(e){return e.key.level+1}const E={color:{write:[!0,!0,!0,!0],blendMode:"additive"},depth:!1,stencil:{write:!1,test:{ref:P,compare:h.GEQUAL,mask:255,op:{fail:c.KEEP,zFail:c.KEEP,zPass:c.REPLACE}}}},y={...E,stencil:!1},G={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1};function R(e,t){const{referenceScale:r,radius:i}=e;return i*(0!==r?r/t.scale:1)}export{T as HeatmapTechnique};
5
+ import{isHighlight as e,isHittest as t,getFeatureUniforms as r,getSelectionDefines as s}from"../featureTechniqueUtils.js";import{Technique as i}from"../Technique.js";import{HeatmapResources as n}from"./HeatmapResources.js";import{meshWriterRegistry as o}from"../mesh/MeshWriterRegistry.js";import{HeatmapAccumulateShader as u}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as a}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as d,StencilOperation as h,ClearBufferBit as l,TextureSamplingMode as c}from"../../../../../../webgl/enums.js";class p extends i{constructor(){super(...arguments),this.meshWriter=o.HeatmapMeshWriter,this.shaders={accumulate:new u,resolve:new a},this.postProcessingEnabled=!0,this._isBound=!1,this._resources=new Map,this.overrideStencilRef=f}shutdown(e){super.shutdown(e),this._resources.get(e)?.destroy(),this._resources.delete(e),this._prevFBO=null,this._unbind()}render(i,n){const{context:o,painter:u,state:a}=i,d=n.instance.getInput(),{isFieldActive:h}=d,l=this._getOrCreateResourcesRecord(o),c=l.loadQualityProfile(o);if(e(i))return;t(i)||this._bind(i,l,d),u.setShader({shader:this.shaders.accumulate,uniforms:{...r(i,n.target),kernelControls:{radius:g(d,a),isFieldActive:h?1:0}},defines:{...s(i),...c.defines},optionalAttributes:n.instance.optionalAttributes,useComputeBuffer:t(i)});const p=t(i)?b:_;u.setPipelineState(p),u.submitDraw(o,n)}postProcess(r,s){if(t(r)||e(r))return;const{context:i,painter:n}=r,o=this._resources.get(i);if(null==this._prevFBO||null==this._prevViewport||!o?.initialized)return;const{defines:u}=o.loadQualityProfile(i),{minDensity:a,maxDensity:d,radius:h}=s.getInput(),l=8,c=9,p=o.accumulateFramebuffer,m=o.resolveGradientTexture;n.setShader({shader:this.shaders.resolve,uniforms:{accumulatedDensity:{texture:{unit:l,texture:p.colorTexture},minAndInvRange:[a,1/(d-a)],normalization:3/(h*h*Math.PI)},gradient:{texture:{unit:c,texture:m}}},defines:u,optionalAttributes:{},useComputeBuffer:!1}),i.bindFramebuffer(this._prevFBO),i.setViewport(0,0,this._prevViewport.width,this._prevViewport.height),i.bindTexture(p.colorTexture,l),i.bindTexture(m,c),n.setPipelineState(w),n.submitDrawQuad(i),this._unbind()}_getOrCreateResourcesRecord(e){let t=this._resources.get(e);return null==t&&(t=new n,this._resources.set(e,t)),t}_unbind(){this._prevFBO=null,this._prevViewport=null,this._isBound=!1}_bind(e,t,r){if(this._isBound)return;const{context:s,state:i,pixelRatio:n}=e,o=s.getBoundFramebufferObject(),u=s.getViewport();this._prevFBO=o,this._prevViewport=u;const{gradient:a,gradientHash:d}=r;t.ensureResolveGradientTexture(s,d,a);const{width:h,height:p}=u,f=m(g(r,i),n),_=h*f,b=p*f,w=t.ensureAccumulateFBO(s,_,b);s.blitFramebuffer(o,w,0,0,o.width,o.height,0,0,w.width,w.height,l.STENCIL_BUFFER_BIT,c.NEAREST),s.bindFramebuffer(w),s.setViewport(0,0,w.width,w.height),s.setColorMask(!0,!0,!0,!0),s.setClearColor(0,0,0,0),s.clear(l.COLOR_BUFFER_BIT),this._isBound=!0}}function m(e,t){const r=t>1.5?.25:.5;return e<1/(2*r)?1:r}function f(e){return e.key.level+1}const _={color:{write:[!0,!0,!0,!0],blendMode:"additive"},depth:!1,stencil:{write:!1,test:{ref:f,compare:d.GEQUAL,mask:255,op:{fail:h.KEEP,zFail:h.KEEP,zPass:h.REPLACE}}}},b={..._,stencil:!1},w={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1};function g(e,t){const{referenceScale:r,radius:s}=e;return s*(0!==r?r/t.scale:1)}export{p as HeatmapTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(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 z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function Z(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let K=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),i=E(r);e.push({objectId:t,highlightFlags:i})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:i,filter:s,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(i),l=a?.toJSON(),h=s?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(s),n=this.featureContainer.getSortKeys(s),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return Z(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r),{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r),{})}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await Z(r,{features:[]}),s=F.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await Z(r,{features:[]}),s=S.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}queryAggregateIds(e,t){return Z(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return Z(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return Z(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return Z(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return Z(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return Z(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Z(r,{count:0,extent:null});return{count:i.count,extent:G.fromJSON(i.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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 i={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 s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this.layerAdapter.createServiceOptions(this.view),s=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(i,s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(i.source)&&(u=i.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_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 W(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new w,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(i)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(z)],K);const X=K;export{X as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as j}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as R}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as U}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import N from"./support/FeatureCommandQueue.js";import{handleNoEngineError as D}from"./support/handleNoEngineError.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as T}from"../tiling/FeatureTileSubscriptionManager.js";import M from"../../layers/FeatureLayerView.js";import $ from"../../layers/LayerView.js";import G from"../../layers/RefreshableLayerView.js";import P from"../../../geometry/Extent.js";function z(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 B="esri.views.2d.layers.FeatureLayerView2D",Z=4294967294;let K=class extends(M(G(V($)))){constructor(){super(...arguments),this._commandsQueue=new N({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new R,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await j(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({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 q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new U(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return D(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return D(i,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return D(i,{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return D(i,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return D(i,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return D(i,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return D(i,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return D(i,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return D(i,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await D(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await D(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){const r=this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return D(r,[])}queryAggregateCount(e,t){const r=this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return D(r,0)}queryAggregateJSON(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return D(r,{features:[]})}async queryFeaturesJSON(e,t){const r=this._worker.features.executeQuery(this._cleanUpQuery(e),t);return D(r,{features:[]})}queryObjectIds(e,t){const r=this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t);return D(r,[])}queryFeatureCount(e,t){const r=this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t);return D(r,0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await D(r,{count:0,extent:null});return{count:s.count,extent:P.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new T({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\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("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.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"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%Z+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%Z+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=z(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_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 W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(B)],K);const X=K;export{X 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.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import l from"../../layers/StreamLayerView.js";let h=class extends(l(c)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null}initialize(){this.addHandles([o((()=>this.layer.customParameters),(e=>this._worker.streamMessenger.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._worker.streamMessenger.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>{this._worker.streamMessenger.sendMessageToClient(e),this._isUserPaused&&"type"in e&&"clear"===e.type&&this.incrementSourceRefreshVersion()})),o((()=>this.layer.purgeOptions),(()=>this._update())),o((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor"),this._doResume()}destroy(){this._doPause()}get connectionError(){return this.pipelineErrorString?new r("stream-controller",this.pipelineErrorString):null}on(e,r){if(Array.isArray(e))return t(e.map((e=>this.on(e,r))));const o=["data-received","message-received"].includes(e);o&&this._worker.streamMessenger.enableEvent(e,!0);const n=super.on(e,r),i=this;return s((()=>{n.remove(),o&&(i._worker.closed||i.hasEventListener(e)||i._worker.streamMessenger.enableEvent(e,!1))}))}queryLatestObservations(e,t){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new r("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._worker.features.executeQueryForLatestObservations(this._cleanUpQuery(e),t).then((e=>{const r=a.fromJSON(e);return r.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),r}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){null!=this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=null)}_doResume(){this._refreshInterval=setInterval((()=>this.incrementSourceRefreshVersion()),this.layer.updateInterval)}_doDisconnect(){this._worker.streamMessenger.disconnect(),this._doPause()}_doConnect(){this._worker.streamMessenger.connect(),this.resume()}_doClear(){this._worker.streamMessenger.clear(),null==this._refreshInterval&&this.incrementSourceRefreshVersion()}_createClientOptions(){const e=super._createClientOptions(),r=this;return{...e,get container(){return r.featureContainer},setProperty:e=>{this.set(e.propertyName,e.value)}}}};e([n()],h.prototype,"pipelineConnectionStatus",void 0),e([n()],h.prototype,"pipelineErrorString",void 0),e([n({readOnly:!0})],h.prototype,"connectionError",null),e([n({readOnly:!0})],h.prototype,"_streamConnectionStatus",null),h=e([i("esri.views.2d.layers.StreamLayerView2D")],h);const p=h;export{p as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import{handleNoEngineError as l}from"./support/handleNoEngineError.js";import h from"../../layers/StreamLayerView.js";let p=class extends(h(c)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null}initialize(){this.addHandles([o((()=>this.layer.customParameters),(e=>this._worker.streamMessenger.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._worker.streamMessenger.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>{this._worker.streamMessenger.sendMessageToClient(e),this._isUserPaused&&"type"in e&&"clear"===e.type&&this.incrementSourceRefreshVersion()})),o((()=>this.layer.purgeOptions),(()=>this._update())),o((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor"),this._doResume()}destroy(){this._doPause()}get connectionError(){return this.pipelineErrorString?new r("stream-controller",this.pipelineErrorString):null}on(e,r){if(Array.isArray(e))return t(e.map((e=>this.on(e,r))));const o=["data-received","message-received"].includes(e);o&&this._worker.streamMessenger.enableEvent(e,!0);const n=super.on(e,r),i=this;return s((()=>{n.remove(),o&&(i._worker.closed||i.hasEventListener(e)||i._worker.streamMessenger.enableEvent(e,!1))}))}queryLatestObservations(e,t){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new r("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return l(this._worker.features.executeQueryForLatestObservations(this._cleanUpQuery(e),t).then((e=>{const r=a.fromJSON(e);return r.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),r})),new a({features:[]}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){null!=this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=null)}_doResume(){this._refreshInterval=setInterval((()=>this.incrementSourceRefreshVersion()),this.layer.updateInterval)}_doDisconnect(){this._worker.streamMessenger.disconnect(),this._doPause()}_doConnect(){this._worker.streamMessenger.connect(),this.resume()}_doClear(){this._worker.streamMessenger.clear(),null==this._refreshInterval&&this.incrementSourceRefreshVersion()}_createClientOptions(){const e=super._createClientOptions(),r=this;return{...e,get container(){return r.featureContainer},setProperty:e=>{this.set(e.propertyName,e.value)}}}};e([n()],p.prototype,"pipelineConnectionStatus",void 0),e([n()],p.prototype,"pipelineErrorString",void 0),e([n({readOnly:!0})],p.prototype,"connectionError",null),e([n({readOnly:!0})],p.prototype,"_streamConnectionStatus",null),p=e([i("esri.views.2d.layers.StreamLayerView2D")],p);const u=p;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{ProcessorTileMessageQueue as u}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as g}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as y}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as p}from"./support/ComputedAttributeStorage.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new _({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new p({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],r=new Map;for await(const a of t){let t=r.get(a.id);null==t&&(t=new u({concurrency:16,process:t=>this._process(t)}),r.set(a.id,t));const i=t.push(a).catch((t=>s(t)));e.push(i)}try{await Promise.all(e)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new y(this._source,this._attributeStore,r);break;case"binning":this._strategy=await g.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await d.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{l as default};
5
+ import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{ProcessorTileMessageQueue as u}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as g}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as y}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as p}from"./support/ComputedAttributeStorage.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new _({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new p({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],r=new Map;for await(const a of t){let t=r.get(a.id);null==t&&(t=new u({concurrency:16,process:t=>this._process(t)}),r.set(a.id,t));const i=t.push(a).catch((t=>s(t)));e.push(i)}try{await Promise.all(e)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new y(this._source,this._attributeStore,r);break;case"binning":this._strategy=await g.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await d.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e){this._source=t,this._attributeStore=e,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(){}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,(t=>t),(t=>t))}getDisplayAndObjectIds(t){return this.displayMap(t,(t=>t),((t,e,s)=>[t,s]))}}export{e as AProcessorStrategy,t as ASendState};
5
+ class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e){this._source=t,this._attributeStore=e,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(){}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,(t=>t),(t=>t))}getDisplayAndObjectIds(t){return this.displayMap(t,(t=>t),((t,e,s)=>[t,s]))}afterUpdateChunks(){}}export{e as AProcessorStrategy,t as ASendState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as i}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as r}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as o}from"./AProcessorStrategy.js";import{WithDisplayId as d}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as u}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import g from"../../../tiling/TileKey.js";const _=128;class m extends o{constructor(e){super(e),this.didSend=!1,this.done=!1}}class y{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new g(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=a(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,r){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const r=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null;if(null!=u)if(1===u){const n=new s([],[e,r]),l=new t(n,o.inner.getAttributes(),null);l.geometry.coords[0]-=i,a.push(l);const d=new t(n,o.inner.getAttributes(),null);d.geometry.coords[0]+=i,a.push(d)}else e>i+i/2?e-=u*i:e<-i/2&&(e+=u*i);if(e<i+_&&e>=-_&&r<i+_&&r>=-_){const i=new s([],[e,r]),n=new t(i,o.inner.getAttributes(),null);n.objectId=o.inner.id,n.displayId=o.displayId,a.push(n)}}return f.fromOptimizedFeatures(a,r,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count)),this._store.releaseAllIds(),this._store.incrementDisplayIdGeneration(),this._clusters.clear();const s=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),i=1+this._clusterRadius/this._indexOptions.cellSize,r=new Set;for(const a of t){if(r.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(a.id),l=new d(a.clone(),t);r.add(a.id),this._clusters.set(a.id,l);const o=a.centroidXWorld,u=a.centroidYWorld;for(let e=a.gridY-i;e<=a.gridY+i;e++)for(let t=a.gridX-i;t<=a.gridX+i;t++){if(e===a.gridY&&t===a.gridX)continue;const i=this._cells.get(n.createId(t,e));if(!i||r.has(i.id))continue;const d=Math.abs(i.centroidXWorld-o),c=Math.abs(i.centroidYWorld-u);d<s&&c<s&&(l.inner.merge(i),r.add(i.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class S extends l{static async create(e,t,s,i,n,a){const l=new c({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>r.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await h.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:a};return new S(e,t.clusterRadius,o,t.fields,i,n)}constructor(e,t,s,i,r,n){super(r,n,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new m(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new y(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new u(e.subscription,i,!0,e.done,{});yield a}}export{m as ClusterState,S as ClusterStrategy};
5
+ import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as i}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as r}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as o}from"./AProcessorStrategy.js";import{WithDisplayId as d}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as u}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import g from"../../../tiling/TileKey.js";const _=128;class m extends o{constructor(e){super(e),this.didSend=!1,this.done=!1}}class y{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new g(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=a(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,r){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const r=o.inner.getCentroidY(l),d=n.tile.lod,c=d.wrap?d.worldSize[0]:null,u=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=c)if(1===c){const n=new s([],[e,r]),l=new t(n,o.inner.getAttributes(),null);l.geometry.coords[0]-=i,l.objectId=u,l.displayId=h,a.push(l);const d=new s([],[e,r]),c=new t(d,o.inner.getAttributes(),null);c.geometry.coords[0]+=i,c.objectId=u,c.displayId=h,a.push(c)}else e>i+i/2?e-=c*i:e<-i/2&&(e+=c*i);if(e<i+_&&e>=-_&&r<i+_&&r>=-_){const i=new s([],[e,r]),n=new t(i,o.inner.getAttributes(),null);n.objectId=u,n.displayId=h,a.push(n)}}return f.fromOptimizedFeatures(a,r,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count));const s=[];for(const n of this._clusters.values())s.push(n.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,l=new Set;for(const a of t){if(l.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(a.id),s=new d(a.clone(),t);l.add(a.id),this._clusters.set(a.id,s);const o=a.centroidXWorld,c=a.centroidYWorld;for(let e=a.gridY-r;e<=a.gridY+r;e++)for(let t=a.gridX-r;t<=a.gridX+r;t++){if(e===a.gridY&&t===a.gridX)continue;const r=this._cells.get(n.createId(t,e));if(!r||l.has(r.id))continue;const d=Math.abs(r.centroidXWorld-o),u=Math.abs(r.centroidYWorld-c);d<i&&u<i&&(s.inner.merge(r),l.add(r.id))}}for(const n of s)this._store.releaseDisplayIdForObjectId(n)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class S extends l{static async create(e,t,s,i,n,a){const l=new u({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>r.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await h.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:a};return new S(e,t.clusterRadius,o,t.fields,i,n)}constructor(e,t,s,i,r,n){super(r,n,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new m(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new y(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{m as ClusterState,S as ClusterStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e,s){super(t,e),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._timeZone)}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
5
+ import{ASendState as e,AProcessorStrategy as t}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/OverrideChunk.js";class n extends e{}class a extends t{constructor(e,t,s){super(e,t),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._timeZone)}createState(e){return new n(e)}get aggregateQueryEngine(){return null}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),o=[];for(const n of this._source.chunks()){const e=n.reader.getCursor();for(;e.next();){const t=e.getObjectId(),n=e.getDisplayId(),a=r.get(t);if(null!=a){const e=s(n,a,t);o.push(e),r.delete(t)}}}return o}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const o of this._source.chunks()){const e=o.reader.getCursor();for(;e.next();){const o=e.getObjectId(),n=e.getDisplayId();t.has(n)&&!s.has(o)&&(r.push({...e.readLegacyFeatureWorldSpace(),displayId:n}),s.add(o))}}return{features:r,aggregates:[]}}async*applyOverride(e){const t=[],r=e.reader.getCursor();for(;r.next();){const e=r.getObjectId();t.push(e);const s=this._attributeStore.createDisplayIdForObjectId(e);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const n=this.getDisplayIds(t),a=this.getDisplayIds(e.removed),i=new o;i.applyOverrides(e);for(const o of this._sendStates.values())yield new s(o.subscription,null,n,!1,i.queryInfo);for(const o of this._sendStates.values()){const e=i.getTileReader(o.subscription.tile);yield new s(o.subscription,e,a,!1,i.queryInfo)}for(const s of e.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const e of this._sendStates.values())yield*this._update(e)}}removeChunks(e){for(const t of e)this.handledChunks.delete(t.chunkId),this.handledChunksForAttributeData.delete(t.chunkId),this._cleanupChunkIds(t)}afterUpdateChunks(){for(const e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this.handledChunksForIdCreation.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this.handledChunksForIdCreation.delete(e.chunkId)}}async _updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:s}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=s.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions)}}}*_update(e){const{subscription:t,handledChunks:s}=e;for(const o of this._source.chunks()){const{chunkId:n}=o;if(s.has(n))continue;s.add(n);const a=o.getTileReader(t.tile);a&&(yield new r(e.subscription,a,!1,o.end,o.queryInfo))}}}export{n as DefaultSendState,a as FeatureUpdateStrategy};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ async function n(n,r){try{return await n}catch(t){if("no-queryEngine"!==t.name)throw t;return r}}export{n as handleNoEngineError};