(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7478d1a2"],{"04c4":function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var s=i("c120"),r=i("ce76");const a=5e4,n={minX:0,minY:0,maxX:0,maxY:0};function o(e,t,i){n.minX=t[0],n.minY=t[1],n.maxX=t[2],n.maxY=t[3],e.search(n,i)}class c{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new r["a"](9,Object(s["a"])("esri-csp-restrictions")?e=>({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const e=new Array(this._idByBounds.size);let t=0;this._idByBounds.forEach((i,s)=>{e[t++]=s}),this._indexInvalid=!1,this._index.clear(),this._index.load(e)}else this._boundsToLoad.length&&(this._index.load(this._boundsToLoad.filter(e=>this._idByBounds.has(e))),this._boundsToLoad.length=0)}}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(e){const t=this._boundsById.get(e);this._boundsById.delete(e),t&&(this._idByBounds.delete(t),this._indexInvalid||this._index.remove(t))}forEachInBounds(e,t){this._loadIndex(),o(this._index,e,e=>t(this._idByBounds.get(e)))}get(e){return this._boundsById.get(e)}has(e){return this._boundsById.has(e)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(e,t){if(!this._indexInvalid){const t=this._boundsById.get(e);t&&(this._index.remove(t),this._idByBounds.delete(t))}this._boundsById.set(e,t),t&&(this._idByBounds.set(t,e),this._indexInvalid||(this._boundsToLoad.push(t),this._boundsToLoad.length>a&&this._loadIndex()))}}},"2ab4":function(e,t,i){"use strict";i.d(t,"a",(function(){return B}));var s=i("a4ee"),r=i("ce50"),a=i("b2b2"),n=i("477c"),o=i("59b2"),c=(i("b50f"),i("c120"),i("cea0"),i("d386")),l=i("d3cf"),h=i("b9c7"),u=i("69dd"),d=i("648c"),p=i("a5de"),f=i("a207"),m=i("f0b9"),b=i("9096"),y=i("c649"),_=i("e92d"),g=i("e431"),O=i("0b2d"),F=i("8188"),j=i("49a0"),v=i("1a54"),x=i("6655"),w=i("9392"),E=i("8152"),T=i("6517"),C=i("c1da"),R=i("01f2"),S=i("7585"),I=i("b7c2"),k=i("0278"),D=i("3bd5"),M=i("6061"),N=i("b7bd"),P=i("6795");const L=_["a"].getLogger("esri.views.3d.layers.support.HeatmapFeatureProcessor"),V=50;let U=class extends b["a"]{constructor(e){super(e),this.type="heatmap",this.filterVisibility={filterChanged(){},dirty:!1},this.preferredUpdatePolicy=I["m"].ASYNC,this.dataExtent=null,this._renderGeometries=new Map,this._material=new P["a"]({}),this._materialWithField=new P["a"]({isAttributeDriven:!0}),this._fieldTotal=0,this._memoryFactor=1}initialize(){this._featureStore=new T["a"]({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{colorBufferFloat:e,textureFloat:t}=this._renderView.capabilities,{floatBufferBlendWorking:i}=this._renderView.renderingContext.driverTest;if(null==t||!t.textureFloat)throw new r["a"]("heatmap:missing-texture-float","HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float.");if(null==e||!e.textureFloat)throw new r["a"]("heatmap:missing-color-buffer-float","HeatmapRenderer requires the WebGL2 extension EXT_color_buffer_float or the WebGL1 extension WEBGL_color_buffer_float.");if(null==e||!e.floatBlend)throw new r["a"]("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend.");if(!i)throw new r["a"]("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend. This device claims support for it, but does not actually support it.");this._memoryFactor=this.owner.view.resourceController.memoryController.memoryFactor,this.updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),n["a"]),this.updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),n["a"]),this.updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},n["c"]),this.updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(Object(a["k"])(e)&&t){let t=0;this._featureStore.forEach(i=>{var s;t+=null!=(s=i.attributes[e])?s:0}),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},n["a"]),this.handles.add([Object(n["e"])(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{var i;e&&!t&&L.warn(`Heatmap renderer field '${e}' for layer '${null!=(i=this.layer.title)?i:this.layer.id}' not found`)}),Object(n["e"])(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{var i;Object(a["k"])(e)&&!t&&L.warn(`Heatmap renderer field '${e.name}' for layer '${null!=(i=this.layer.title)?i:this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),this.owner.view.resourceController.memoryController.events.on("quality-changed",()=>{var e,t,i,s,r;this._memoryFactor=null!=(e=null==(t=this.owner)||null==(i=t.view)||null==(s=i.resourceController)||null==(r=s.memoryController)?void 0:r.memoryFactor)?e:1})])}destroy(){this._overlayRenderer.removeGeometries(Array.from(this._renderGeometries.values()),this.owner,D["a"].Geometry.REMOVE),this._renderGeometries.clear(),this._material=Object(a["e"])(this._material),this._materialWithField=Object(a["e"])(this._materialWithField),this._featureStore.clear(),this._featureStore=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this.updatingHandles.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get displayFeatureLimit(){var e,t;const i=this._memoryFactor,s=null==(e=this.owner)||null==(t=e.view)?void 0:t.qualitySettings,r=s?Math.ceil(s.heatmap.maxTotalNumberOfFeatures*i):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:r,maximumTotalNumberOfPrimitives:2*r,maximumNumberOfFeatures:r}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get scaleVisibilitySuspended(){return!1}get usedMemory(){var e,t,i,s,r;const n=this.usedMemoryPerFeature*this._featureStore.numFeatures,{R32F:o}=null==(e=this._renderView)||null==(t=e.capabilities)?void 0:t.colorBufferFloat,c=null!=o?1:4,l=4,h=null!=(i=Math.ceil((null==(s=this._overlayRenderer)||null==(r=s.overlays[0])?void 0:r.resolution)*this._densityMapPixelRatio))?i:0;return h*h*c*l+n+(Object(a["k"])(this._heatmapRenderer)?3*Math.min(this._heatmapRenderer.blurRadius,V):0)*c*l}get usedMemoryPerFeature(){if(0===this._featureStore.numFeatures)return 0;let e=0;this._featureStore.forEach(t=>e+=Object(m["b"])(t.attributes)),e/=this._featureStore.numFeatures;const t=Object(m["d"])(),i=6;return i*Object(m["c"])([0,0,0],t)+i*Object(m["c"])([0,0],t)+(this._heatmapRendererFieldIsNumeric?i*t:0)+e}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._featureStore.numFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get _overlayRenderer(){return this.owner.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return Object(a["t"])(this._overlayRenderer.spatialReference)}get _materialParameters(){return{...this._blurRadiusParameters,...this._densityParameters,colorRampData:this._colorRampData,pixelRatio:this._densityMapPixelRatio}}get _densityParameters(){const e=this._heatmapRenderer;return Object(a["j"])(e)?null:{minDensity:e.minPixelIntensity,maxDensity:e.maxPixelIntensity,fieldTotal:this._fieldTotal}}get _blurRadiusParameters(){return Object(a["b"])(this._heatmapRenderer,({referenceScale:e,blurRadius:t})=>({searchRadius:this._clampSearchRadius(t),resolutionForScale:0===e?0:Object(j["a"])(e,this.owner.view.spatialReference)}))}get _colorRampData(){return Object(a["b"])(this._heatmapRenderer,e=>Object(R["d"])(e.colorStops))}get _densityMapPixelRatio(){var e,t,i;const s=this._memoryFactor;return(null!=(e=null==(t=this.owner)||null==(i=t.view)?void 0:i.qualitySettings.heatmap.pixelRatio)?e:1)*Math.sqrt(s)}get _renderView(){return this.owner.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===(null==e?void 0:e.type)?e:null}get _heatmapRendererFieldName(){return Object(a["b"])(this._heatmapRenderer,e=>e.field)}get _heatmapRendererField(){return Object(a["b"])(this._heatmapRendererFieldName,e=>this.layer.fieldsIndex.get(e))}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return!Object(a["j"])(e)&&Object(C["p"])(e)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return A}maskOccludee(){return A}setObjectIdVisibility(){}async setup(){}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>Object(v["g"])(e,t))),this._featureStore.addMany(e.added.map(e=>new w["a"](Object(x["g"])(new E["a"],e.geometry),e.attributes,Object(a["b"])(e.centroid,e=>Object(x["g"])(new E["a"],e)),Object(v["g"])(e,t))));const i=e.added,s=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,s);const r=Object(a["o"])(s,({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}),n=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});r.length>0&&this._overlayRenderer.removeGeometries(r,this.owner,D["a"].Geometry.REMOVE),n.length>0&&this._overlayRenderer.addGeometries(n,this.owner,D["a"].Geometry.ADD,!0),(n.length>0||r.length>0)&&this._renderView.requestRender()}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,i=Object(a["k"])(t)?this._materialWithField:this._material,s=Object(O["f"])();Object(F["t"])(e.geometry,s,this._overlaySpatialReference),s[2]=S["a"];const r=[[N["a"].POSITION,{data:s,size:s.length}]],n=this._heatmapRendererFieldIsNumeric;var o;Object(a["k"])(t)&&r.push([N["a"].FEATUREATTRIBUTE,{data:[n&&null!=(o=e.attributes[t])?o:0],size:1}]);const c=new M["a"](new k["a"](r,null,I["h"].Point),i,{layerUid:this.layer.uid,graphicUid:e.uid});return Object(g["m"])(c.boundingSphere,s),c}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(Object(a["j"])(this._heatmapRendererFieldName)||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const i=this._heatmapRendererFieldName,s=(e,t)=>{var s;return e+(null!=(s=t.attributes[i])?s:0)};return e.reduce(s,0)-t.reduce(s,0)}_clampSearchRadius(e){return e>V&&L.warnOnce(`SceneView supports a maximum blurRadius of ${V} for HeatmapRenderer.`),Math.min(e,V)}};Object(s["a"])([Object(o["b"])()],U.prototype,"type",void 0),Object(s["a"])([Object(o["b"])({constructOnly:!0})],U.prototype,"owner",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"layer",null),Object(s["a"])([Object(o["b"])()],U.prototype,"featureStore",null),Object(s["a"])([Object(o["b"])()],U.prototype,"updating",null),Object(s["a"])([Object(o["b"])()],U.prototype,"updatingRemaining",null),Object(s["a"])([Object(o["b"])()],U.prototype,"suspendInfo",null),Object(s["a"])([Object(o["b"])()],U.prototype,"legendEnabled",null),Object(s["a"])([Object(o["b"])()],U.prototype,"filterVisibility",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"displayFeatureLimit",null),Object(s["a"])([Object(o["b"])()],U.prototype,"preferredUpdatePolicy",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"hasZ",null),Object(s["a"])([Object(o["b"])()],U.prototype,"hasM",null),Object(s["a"])([Object(o["b"])()],U.prototype,"dataExtent",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_featureStore",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_overlayRenderer",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_overlaySpatialReference",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_materialParameters",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_densityParameters",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_blurRadiusParameters",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_colorRampData",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_densityMapPixelRatio",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_renderGeometries",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_material",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_materialWithField",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_renderView",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_featuresArePoints",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_loadedPointGraphics",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_heatmapRenderer",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_heatmapRendererFieldName",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_heatmapRendererField",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_heatmapRendererFieldIsNumeric",null),Object(s["a"])([Object(o["b"])()],U.prototype,"_fieldTotal",void 0),Object(s["a"])([Object(o["b"])()],U.prototype,"_memoryFactor",void 0),U=Object(s["a"])([Object(c["a"])("esri.views.3d.layers.support.HeatmapFeatureProcessor")],U);const A=Object(y["b"])();var G=i("eec2"),q=i("9305");const B=e=>{let t=class extends e{constructor(){super(...arguments),this.controller=null,this.updatePolicy=I["m"].SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=d["b"].Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r["a"]("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add(()=>this.layer.renderer,e=>this._recreateProcessor(e),n["a"]),this.addResolvingPromise((async()=>{const e=await Object(G["a"])(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add(()=>this.updatePolicy,e=>this.processor.preferredUpdatePolicy=e),this.queryEngine=new f["a"]({layerView:this,priority:q["c"].FEATURE_QUERY_ENGINE}),this.notifyChange("updating"))}destroy(){this._destroyPendingController(),this.controller=Object(a["d"])(this.controller),this._set("processor",Object(a["d"])(this.processor)),this.queryEngine=Object(a["d"])(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=Object(a["d"])(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var t;let i=null;return null==(t=this.loadedGraphics)||t.forEach(t=>{t.uid===e&&(i=Object(l["c"])(t,this.layer))}),i}whenGraphicBounds(e,t){var i;return null==(i=this.processor)?void 0:i.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var i;return null==(i=this.processor)?void 0:i.computeAttachmentOrigin(e,t)}queryFeatures(e,t){return this.queryEngine.executeQuery(this._ensureQuery(e),Object(a["i"])(t,"signal"))}queryObjectIds(e,t){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),Object(a["i"])(t,"signal"))}queryFeatureCount(e,t){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),Object(a["i"])(t,"signal"))}queryExtent(e,t){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),Object(a["i"])(t,"signal"))}_ensureQuery(e){return Object(a["j"])(e)?this.createQuery():u["a"].from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,t,i;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(t=this.view)&&null!=(i=t.basemapTerrain)&&i.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(t){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await Object(n["g"])(()=>{var e,t;return null==(e=this.view)||null==(t=e.basemapTerrain)?void 0:t.ready}),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":return Promise.reject(new r["a"]("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType}))}}_recreateProcessor(e){var t,i;const s="heatmap"===(null==e?void 0:e.type),r="heatmap"===(null==(t=this.processor)?void 0:t.type),a=this.processor;if(a&&s===r)return;const n=s?new U({owner:this}):new p["a"]({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",n),null==a||a.destroy(),null==(i=this.queryEngine)||i.clear(),this.addResolvingPromise(n.setup())}_getResourceInfo(){var e,t;const i=this.controller instanceof h["a"]?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==i?void 0:i.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(t=null==i?void 0:i.serviceDataCount)?t:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return Object(s["a"])([Object(o["b"])()],t.prototype,"loadedGraphics",void 0),Object(s["a"])([Object(o["b"])()],t.prototype,"suspended",void 0),Object(s["a"])([Object(o["b"])({readOnly:!0})],t.prototype,"legendEnabled",null),Object(s["a"])([Object(o["b"])()],t.prototype,"updating",void 0),Object(s["a"])([Object(o["b"])()],t.prototype,"controller",void 0),Object(s["a"])([Object(o["b"])()],t.prototype,"processor",void 0),Object(s["a"])([Object(o["b"])({readOnly:!0})],t.prototype,"updatePolicy",void 0),Object(s["a"])([Object(o["b"])({readOnly:!0})],t.prototype,"suspendResumeExtentMode",void 0),Object(s["a"])([Object(o["b"])({type:Boolean})],t.prototype,"slicePlaneEnabled",void 0),Object(s["a"])([Object(o["b"])({readOnly:!0})],t.prototype,"suspendInfo",void 0),Object(s["a"])([Object(o["b"])()],t.prototype,"graphics3DProcessor",null),Object(s["a"])([Object(o["b"])()],t.prototype,"heatmapProcessor",null),t=Object(s["a"])([Object(c["a"])("esri.views.3d.layers.FeatureLikeLayerView3D")],t),t}},3895:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var s=i("ce6d"),r=i("fe80"),a=i("c47a");class n extends s["a"]{constructor(){super(...arguments),this._set=new Set}clear(){if(this._set.size>0){const e=this.toArray();this._set.clear(),this.emit("after-changes",{type:r["a"].REMOVE}),this.emit("change",{added:[],removed:e})}}get length(){return this._set.size}addMany(e){if(0!==e.length){for(const t of e)this._set.add(t);this.emit("after-changes",{type:r["a"].ADD}),this.emit("change",{added:e,removed:[]})}}remove(e){this._set.delete(e)&&(this.emit("after-changes",{type:r["a"].REMOVE}),this.emit("change",{added:[],removed:[e]}))}removeMany(e){const t=[];for(const i of e)this._set.delete(i)&&t.push(i);t.length>0&&(this.emit("after-changes",{type:r["a"].REMOVE}),this.emit("change",{added:[],removed:t}))}toArray(){return[...this._set]}find(e){let t;return Object(a["a"])(this._set,i=>!!e(i)&&(t=i,!0)),t}forEach(e){this._set.forEach(t=>e(t))}}},"563d":function(e,t,i){"use strict";i.d(t,"a",(function(){return R}));var s=i("a4ee"),r=(i("e06a"),i("2eab")),a=i("ce50"),n=i("e92d"),o=i("b2b2"),c=i("f4cc"),l=i("e041"),h=(i("cea0"),i("b50f"),i("c120"),i("2dd4"),i("d386")),u=i("59b2"),d=i("b0f5"),p=i("ce6d"),f=i("9096");let m=class extends(p["a"].EventedMixin(f["a"])){onFeature(e){this.emit("feature",e)}};m=Object(s["a"])([Object(h["a"])("esri.layers.graphics.sources.connections.StreamConnection")],m);const b=m,y=n["a"].getLogger("esri.layers.graphics.sources.connections.WebSocketConnection");var _;!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(_||(_={}));let g=class extends b{constructor(e){super(),this.errorString=null;const{geometryType:t,spatialReference:i,sourceSpatialReference:s}=e;this._config=e,this._featureZScaler=Object(d["a"])(t,s,i),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){Object(o["k"])(this._websocket)&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(Object(o["j"])(this._websocket))return"disconnected";switch(this._websocket.readyState){case _.CONNECTING:case _.OPEN:return"connected";case _.CLOSING:case _.CLOSED:return"disconnected"}}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,i=0){try{if(this.destroyed)return;const t=Object(l["e"])(e,this._config.customParameters);this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(s){const r=t/1e3;return this._config.maxReconnectionAttempts&&i>=this._config.maxReconnectionAttempts?(y.error(new a["a"]("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(y.error(new a["a"]("websocket-connection",`Failed to connect. Attempting to reconnect in ${r}s`,s)),await Object(c["a"])(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),i+1))}}_createWebSocket(e){return new Promise((t,i)=>{const s=new WebSocket(e);s.onopen=()=>{if(s.onopen=null,this.destroyed)return s.onclose=null,void s.close();s.onclose=e=>this._onClose(e),s.onerror=e=>this._onError(e),s.onmessage=e=>this._onMessage(e),t(s)},s.onclose=e=>{s.onopen=s.onclose=null,i(e)}})}async _handshake(e=1e4){const t=this._websocket;if(Object(o["j"])(t))return;const i=Object(c["g"])(),s=t.onmessage,{filter:r,outFields:n,spatialReference:l}=this._config;return i.timeout(e),t.onmessage=e=>{var o;let c=null;try{c=JSON.parse(e.data)}catch(h){}c&&"object"==typeof c||(y.error(new a["a"]("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),i.reject(),this.destroy()),(null==(o=c.spatialReference)?void 0:o.wkid)!==(null==l?void 0:l.wkid)&&(y.error(new a["a"]("websocket-connection","Protocol violation. Handshake failed - expected wkid of "+l.wkid,e.data)),i.reject(),this.destroy()),"json"!==c.format&&(y.error(new a["a"]("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),i.reject(),this.destroy()),r&&c.filter!==r&&y.error(new a["a"]("websocket-connection","Tried to set filter, but server doesn't support it")),n&&c.outFields!==n&&y.error(new a["a"]("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=s,i.resolve()},t.send(JSON.stringify({filter:r,outFields:n,format:"json",spatialReference:{wkid:l.wkid}})),i.promise}_onMessage(e){try{const t=JSON.parse(e.data);if("featureResult"!==t.type)throw new a["a"]("websocket-connection","Protocol violation - Expected to find message of type 'featureResult'",t);for(const e of t.features)Object(o["k"])(this._featureZScaler)&&this._featureZScaler(e.geometry),this.onFeature(e)}catch(t){return y.error(new a["a"]("websocket-connection","Failed to parse message",t)),void this.destroy()}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),y.error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&y.error("websocket-connection","WebSocket closed unexpectedly with error code "+e.code),this.destroyed||this._open()}};Object(s["a"])([Object(u["b"])()],g.prototype,"connectionStatus",null),Object(s["a"])([Object(u["b"])()],g.prototype,"errorString",void 0),g=Object(s["a"])([Object(h["a"])("esri.layers.graphics.sources.connections.WebSocketConnection")],g);var O=i("e9fc"),F=i("69dd"),j=i("a9ab"),v=i("5996");const x=n["a"].getLogger("esri.layers.graphics.sources.connections.GeoEventConnection"),w=1e4,E={maxQueryDepth:5,maxRecordCountFactor:3};let T=class extends g{constructor(e){super({...E,...e})}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||x.warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:i,outFields:s}=this._config;this.destroyed||this._setFilter(i,s)}_onMessage(e){let t;try{t=this._enrich(JSON.parse(e.data)),Object(o["k"])(this._featureZScaler)&&this._featureZScaler(t.geometry)}catch(i){return void x.error(new a["a"]("geoevent-connection","Failed to parse message",i))}this.onFeature(t)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},i=Object(r["default"])(e.path,{query:t,responseType:"json"}),s=(await i).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const i=e[0],{urls:s,token:r}=i,a=this._inferWebSocketBaseUrl(s);return Object(l["e"])(a+"/subscribe",{outSR:""+t.wkid,token:r})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(-1!==t.indexOf("wss"))return t;return x.error(new a["a"]("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const i=this._websocket;if(Object(o["j"])(i)||Object(o["j"])(e)&&Object(o["j"])(t))return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let r=!1;const n=Object(c["g"])(),l=()=>{r||(this.destroyed||this._websocket!==i||x.error(new a["a"]("geoevent-connection","Server timed out when setting filter")),n.reject())},h=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(x.error(new a["a"]("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString","Could not set service filter - "+t.error),n.reject(t.error)),i.onmessage=this._onMessage.bind(this),r=!0,n.resolve())};return i.onmessage=h,i.send(s),setTimeout(l,w),n.promise}_serializeFilter(e,t){const i={};if(Object(o["j"])(e)&&Object(o["j"])(t))return i;if(Object(o["k"])(e)&&e.geometry)try{const t=Object(j["a"])(e.geometry);if("extent"!==t.type)throw new a["a"]("Expected extent but found type "+t.type);i.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(s){x.error(new a["a"]("geoevent-connection","Encountered an error when setting connection geometryDefinition",s))}return Object(o["k"])(e)&&e.where&&"1 = 1"!==e.where&&(i.where=e.where),Object(o["k"])(t)&&(i.outFields=t.join(",")),i}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,i=e.attributes[t];if(!this._relatedFeatures.has(i))return x.warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:s,geometry:r}=this._relatedFeatures.get(i);for(const a in s)e.attributes[a]=s[a];return r&&(e.geometry=r),e.geometry||e.centroid||x.error(new a["a"]("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,i=this._queryRelatedFeatures(e),s=this._queryArchive(t);await i;const r=await s;if(!r)return;for(const a of r.features)this.onFeature(this._enrich(a))}catch(e){x.error(new a["a"]("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.resolve().then(i.bind(null,"5bd5"))).default)({url:e}),{capabilities:s}=await t.load(),r=s.query.supportsMaxRecordCountFactor,a=s.query.supportsPagination,n=s.query.supportsCentroid,c=this._config.maxRecordCountFactor,l=t.capabilities.query.maxRecordCount,h=r?l*c:l,u=new F["a"];if(u.outFields=Object(o["u"])(this._config.outFields,["*"]),u.where=Object(o["u"])(Object(o["i"])(this._config.filter,"where"),"1=1"),u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=v["a"].fromJSON(this._config.spatialReference),n&&(u.returnCentroid=!0),r&&(u.maxRecordCountFactor=c),a)return u.num=h,t.destroy(),this._queryPages(e,u);const d=await Object(O["executeQuery"])(e,u,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,i=[],s=0){t.start=Object(o["k"])(t.num)?s*t.num:null;const{data:r}=await Object(O["executeQuery"])(e,t,this._config.sourceSpatialReference);return r.exceededTransferLimit&&si.push(e)),this._queryPages(e,t,i,s+1)):(i.forEach(e=>r.features.push(e)),r)}_addRelatedFeatures(e){const t=new Map,i=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const r of i){const e=r.attributes[s];t.set(e,r)}this._relatedFeatures=t}};T=Object(s["a"])([Object(h["a"])("esri.layers.graphics.sources.connections.GeoEventConnection")],T);const C=T;function R(e,t,i,s,r,a,n,o){const c=0===e.path.indexOf("wss://")||0===e.path.indexOf("ws://"),l={source:e,sourceSpatialReference:t,spatialReference:i,geometryType:s,filter:r,maxReconnectionAttempts:a,maxReconnectionInterval:n,customParameters:o};return c?new g(l):new C(l)}},6517:function(e,t,i){"use strict";i.d(t,"a",(function(){return d}));var s=i("ce50"),r=i("ce6d"),a=i("e92d"),n=i("b2b2"),o=i("4261"),c=i("9180"),l=i("6655"),h=i("04c4"),u=i("461f");class d{constructor(e){this.geometryInfo=e,this._boundsStore=new h["a"],this._featuresById=new Map,this._markedIds=new Set,this.events=new r["a"],this.featureAdapter=u["a"]}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){if(!this.numFeatures)return null;const e=Object(c["l"])(c["a"]);return this._featuresById.forEach(t=>{const i=this._boundsStore.get(t.objectId);i&&(e[0]=Math.min(i[0],e[0]),e[1]=Math.min(i[1],e[1]),e[2]=Math.max(i[2],e[2]),e[3]=Math.max(i[3],e[3]))}),e}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{Object(n["k"])(t.geometry)&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t,i){for(const s of e){const e=this._boundsStore.get(s.objectId);e&&t(Object(o["s"])(i,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}startMarkingUsedFeatures(){this._boundsStore.invalidateIndex(),this._markedIds.clear()}sweep(){let e=!1;this._featuresById.forEach((t,i)=>{this._markedIds.has(i)||(e=!0,this._remove(t))}),this._markedIds.clear(),e&&this._emitChanged()}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const t=e.objectId;if(null==t)return void a["a"].getLogger("esri.layers.graphics.data.FeatureStore").error(new s["a"]("featurestore:invalid-feature","feature id is missing",{feature:e}));const i=this._featuresById.get(t);let r;if(this._markedIds.add(t),i?(e.displayId=i.displayId,r=this._boundsStore.get(t),this._boundsStore.delete(t)):Object(n["k"])(this.onFeatureAdd)&&this.onFeatureAdd(e),Object(n["j"])(e.geometry)||!e.geometry.coords||!e.geometry.coords.length)return this._boundsStore.set(t,null),void this._featuresById.set(t,e);r=Object(l["s"])(Object(n["k"])(r)?r:Object(c["l"])(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),Object(n["k"])(r)&&this._boundsStore.set(t,r),this._featuresById.set(t,e)}_remove(e){return Object(n["k"])(this.onFeatureRemove)&&this.onFeatureRemove(e),this._markedIds.delete(e.objectId),this._boundsStore.delete(e.objectId),this._featuresById.delete(e.objectId),e}}},"7ab1":function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var s=i("971e"),r=i("38a4"),a=i("b2b2");const n="__esri_stream_id__",o="__esri_timestamp__",c=1e3;class l{constructor(e,t,i,s,r=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=i,this._purgeOptions=s,this.store=e,this.objectIdField=t,this.purgeInterval=r,this._useGeneratedIds=this.objectIdField===n}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.objectIdField]=t,e.objectId=t}else e.objectId=e.attributes[this.objectIdField];if(this._addOrUpdated.set(e.objectId,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return Object(a["j"])(this._trackIdLessObservations)&&(this._trackIdLessObservations=new s["a"](1e5)),void this._trackIdLessObservations.enqueue(e.objectId);const t=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(t)){const e=Object(a["k"])(this._purgeOptions)&&null!=this._purgeOptions.maxObservations?this._purgeOptions.maxObservations:c,i=Object(r["f"])(e,0,c);this._trackIdToObservations.set(t,new s["a"](i))}const i=this._trackIdToObservations.get(t).enqueue(e.objectId);Object(a["k"])(i)&&(this._addOrUpdated.has(i)?this._addOrUpdated.delete(i):this._removed.push(i))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),i=performance.now();i-this._lastPurge>=this.purgeInterval&&(this._purge(i),this._lastPurge=i);const s=[];if(Object(a["k"])(t))for(const r of t){const e=this.store.removeById(r);Object(a["k"])(e)&&s.push(e)}if(Object(a["k"])(e))for(const r of e)r.attributes[o]=i,this.store.add(r);(e||s)&&this.store.update(e,s)}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach(i=>e[t++]=i),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;Object(a["k"])(t)&&(this._purgeSomeByDisplayCount(t),this._purgeByAge(t),this._purgeByAgeReceived(e,t),this._purgeTracks())}_purgeSomeByDisplayCount(e){if(!e.displayCount)return;let t=this.store.size;if(t>e.displayCount){if(this._timeInfo.trackIdField)for(const i of this._trackIdToObservations.values())if(t>e.displayCount&&i.size){const e=Object(a["t"])(i.dequeue());this._removed.push(e),t--}if(Object(a["k"])(this._trackIdLessObservations)){let i=t-e.displayCount;for(;i-- >0;){const e=this._trackIdLessObservations.dequeue();Object(a["k"])(e)&&this._removed.push(e)}}}}_purgeByAge(e){var t;if(!e.age||null==(t=this._timeInfo)||!t.startTimeField)return;const i=60*e.age*1e3,s=this._maxAge-i;this.store.forEach(e=>{e.attributes[this._timeInfo.startTimeField]{e.attributes[o]{0===e.size&&this._trackIdToObservations.delete(t)})}}},"971e":function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var s=i("b2b2");class r{constructor(e){this.size=0,this._start=0,this.maxSize=e,this._buffer=new Array(e)}get entries(){return this._buffer}enqueue(e){if(this.size===this.maxSize){const t=this._buffer[this._start];return this._buffer[this._start]=e,this._start=(this._start+1)%this.maxSize,t}return this._buffer[(this._start+this.size++)%this.maxSize]=e,null}dequeue(){if(0===this.size)return null;const e=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,e}peek(){return 0===this.size?null:this._buffer[this._start]}find(e){if(0===this.size)return null;for(const t of this._buffer)if(Object(s["k"])(t)&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;Object(s["k"])(t);)e&&e(t),t=this.dequeue()}}},a7bf:function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return C}));var s=i("a4ee"),r=i("ce50"),a=i("59b2"),n=(i("b50f"),i("c120"),i("cea0"),i("d386")),o=(i("e06a"),i("8d60")),c=i("fc29"),l=i("9096"),h=i("b2b2"),u=i("fab3"),d=i("7ab1"),p=i("563d"),f=i("3895"),m=i("74e2");const b=2500;let y=class extends o["a"]{getObjectId(){return this.objectId}};Object(s["a"])([Object(a["b"])({type:Number,json:{read:!0}})],y.prototype,"objectId",void 0),y=Object(s["a"])([Object(n["a"])("esri.layers.graphics.controllers.StreamGraphic")],y);class _{constructor(e){this.onUpdate=e,this._idToGraphic=new Map}destroy(){this._idToGraphic.clear()}add(e){this._idToGraphic.set(e.objectId,e)}get(e){return this._idToGraphic.get(e)}forEach(e){this._idToGraphic.forEach(e)}removeById(e){const t=this._idToGraphic.get(e);return t?(t.sourceLayer=t.layer=null,this._idToGraphic.delete(e),t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._idToGraphic.size}}let g=class extends(Object(l["b"])(Object(u["b"])(c["a"]))){constructor(){super(...arguments),this._updateInfo={websocket:0,client:0},this.graphics=new f["a"]}initialize(){this.addResolvingPromise(this.layer.when(()=>this._startup()))}destroy(){this.clear()}_clearInterval(){this._updateIntervalId&&(clearInterval(this._updateIntervalId),this._updateIntervalId=0)}clear(){this._clearInterval(),this.connection&&(this.connection.destroy(),this.connection=null),this.store&&(this.store.destroy(),this.store=null),this.graphics.clear(),this.handles.removeAll()}get updating(){return!this.connection||"connected"===this.connection.connectionStatus}_startup(){const{parsedUrl:e,spatialReference:t,definitionExpression:i,geometryDefinition:s,objectIdField:r,timeInfo:a,purgeOptions:n,maxReconnectionAttempts:o,maxReconnectionInterval:c,customParameters:l}=this.layer,h=m["a"].toJSON(this.layer.geometryType),u=t,f=this.layerView.view.spatialReference,b={geometry:s,where:i};this.clear(),this._set("connection",Object(p["a"])(e,u,f,h,b,o,c,l)),this._outSpatialReference=f.toJSON(),this.store=new _(this._onUpdate.bind(this)),this.featuresManager=new d["a"](this.store,r,a.toJSON(),n),this.handles.add([this.connection.on("feature",e=>this._onFeature(e)),this.layer.watch("definitionExpression",()=>this._startup()),this.layer.watch("geometryDefinition",()=>this._startup()),this.layer.watch("purgeOptions",()=>this._startup())]),this._initUpdateInterval()}_onFeature(e){this._updateInfo.websocket++,this.layerView.hasEventListener("data-received")&&this.layerView.emit("data-received",{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry});try{Object(h["k"])(e.geometry)&&!e.geometry.spatialReference&&(e.geometry.spatialReference=this._outSpatialReference);const t=y.fromJSON(e);t.sourceLayer=t.layer=this.layer,this.featuresManager.add(t)}catch{}}_onUpdate(e,t){Object(h["k"])(t)&&this.graphics.removeMany(t),Object(h["k"])(e)&&(this._updateInfo.client+=e.length,this.graphics.addMany(e))}_initUpdateInterval(){this._clearInterval();const{updateInterval:e}=this.layer;let t=performance.now();this._updateIntervalId=setInterval(()=>{const e=performance.now(),i=e-t;if(i>b){t=e;const s=Math.round(this._updateInfo.client/(i/1e3)),r=Math.round(this._updateInfo.websocket/(i/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.layerView.emit("update-rate",{client:s,websocket:r})}this.featuresManager.checkForUpdates()},e)}pauseStream(){this._clearInterval()}resumeStream(){this._initUpdateInterval()}};Object(s["a"])([Object(a["b"])()],g.prototype,"connection",void 0),Object(s["a"])([Object(a["b"])()],g.prototype,"layer",void 0),Object(s["a"])([Object(a["b"])()],g.prototype,"layerView",void 0),Object(s["a"])([Object(a["b"])({readOnly:!0})],g.prototype,"updating",null),g=Object(s["a"])([Object(n["a"])("esri.layers.graphics.controllers.StreamController")],g);var O=i("69dd"),F=i("2ab4"),j=i("66af"),v=i("b7c2"),x=i("365a"),w=i("96d4");const E=e=>{let t=class extends e{constructor(...e){super(...e),this.connectionError=null,this.connectionStatus="disconnected",this.filter=null}};return Object(s["a"])([Object(a["b"])({readOnly:!0})],t.prototype,"connectionError",void 0),Object(s["a"])([Object(a["b"])({aliasOf:"controller.connection.connectionStatus",readOnly:!0})],t.prototype,"connectionStatus",void 0),Object(s["a"])([Object(a["b"])({type:w["a"]})],t.prototype,"filter",void 0),t=Object(s["a"])([Object(n["a"])("esri.layers.mixins.StreamLayerView")],t),t};let T=class extends(E(Object(F["a"])(Object(j["a"])(x["a"])))){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=v["m"].ASYNC,this.hasZ=!0,this.hasM=!1}initialize(){this.handles.add([this.watch("suspended",e=>{this.controller&&(e?this.controller.pauseStream():this.controller.resumeStream())})])}get connectionError(){const e=this.get("controller.connection.errorString");if(e)return new r["a"]("stream-controller",e)}createQuery(){return new O["a"]({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(e,t){return this.queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),null==t?void 0:t.signal)}createController(){return new g({layer:this.layer,layerView:this})}beforeSetController(){}};Object(s["a"])([Object(a["b"])({readOnly:!0})],T.prototype,"updatePolicy",void 0),Object(s["a"])([Object(a["b"])({readOnly:!0})],T.prototype,"connectionError",null),Object(s["a"])([Object(a["b"])()],T.prototype,"controller",void 0),Object(s["a"])([Object(a["b"])({readOnly:!0})],T.prototype,"hasZ",void 0),Object(s["a"])([Object(a["b"])({readOnly:!0})],T.prototype,"hasM",void 0),T=Object(s["a"])([Object(n["a"])("esri.views.3d.layers.StreamLayerView3D")],T);const C=T},b9c7:function(e,t,i){"use strict";i.d(t,"a",(function(){return D}));var s=i("a4ee"),r=i("fc29"),a=i("792b"),n=i("2c4f"),o=(i("c120"),i("ce50")),c=i("af40"),l=i("7ffa"),h=i("e92d"),u=i("b2b2"),d=i("fab3"),p=i("f4cc"),f=i("477c"),m=i("59b2"),b=(i("cea0"),i("d386")),y=i("54b4"),_=i("e2e8"),g=i("a796"),O=i("e60a"),F=i("8d60"),j=i("1219"),v=i("c128"),x=i("7533"),w=i("35c9"),E=i("a957"),T=i("ee83");const C=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class R{constructor(e,t,i){this.loadingGraphics=new Map,this.loadedGraphics=new Map,this.pendingGraphics=new Map,this._enabled=!0,this.tileFetcher=e,this.view=i,this.tilingScheme=new T["a"](t),this.loadedSymbols=C.map(e=>new w["a"](new v["a"]({material:{color:[e[0],e[1],e[2],.6]},outline:{color:"black",size:1}}))),this.loadingSymbols=[new w["a"](new v["a"]({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}}))],this.pendingSymbols=[new w["a"](new v["a"]({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}}))],this.dataExtentSymbol=new w["a"](new v["a"]({material:{color:[0,0,0,0]},outline:{color:"green",size:4}}))}destroy(){this.enabled=!1}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this.loadingGraphics,{filter:e=>e.isFetching,symbols:this.loadingSymbols}),this._synchronizeMaps(this.loadedGraphics,{filter:e=>!e.isFetching,symbols:this.loadedSymbols}),this._synchronizeMaps(this.pendingGraphics,{filter:e=>!e.isFetching,symbols:this.pendingSymbols}),this.showDataExtent(this.tileFetcher.filterExtent)):(this.loadingGraphics.forEach(e=>{this.view.graphics.removeMany(e)}),this.loadingGraphics.clear(),this.loadedGraphics.forEach(e=>{this.view.graphics.removeMany(e)}),this.loadedGraphics.clear(),this.pendingGraphics.forEach(e=>{this.view.graphics.removeMany(e)}),this.pendingGraphics.clear(),this.dataExtentGraphic&&(this.view.graphics.remove(this.dataExtentGraphic),this.dataExtentGraphic=null))}showDataExtent(e){if(this.dataExtentGraphic&&(this.view.graphics.remove(this.dataExtentGraphic),this.dataExtentGraphic=null),!e)return;const t=j["a"].fromExtent(e);this.dataExtentGraphic=new F["a"]({geometry:t,symbol:this.dataExtentSymbol}),this.view.graphics.add(this.dataExtentGraphic)}_synchronizeMaps(e,t){const i=[];e.forEach((e,s)=>{const r=this.tileFetcher.test.getFeatureTileById(s);r&&t.filter(r)||(this.view.graphics.removeMany(e),i.push(s))}),i.forEach(t=>e.delete(t)),this.tileFetcher.test.forEachFeatureTile(i=>{if(t.filter(i)&&!e.has(i.id)){const[s,r,a]=i.descriptor.lij;this.tilingScheme.ensureMaxLod(s);const n=this.tilingScheme.getExtentGeometry(s,r,a),o=[new F["a"]({geometry:n,symbol:t.symbols[s%t.symbols.length]}),new F["a"]({geometry:n.center,symbol:new x["a"]({verticalOffset:{screenLength:40/.75},callout:{type:"line",color:"white",border:{color:"black"}},symbolLayers:[new E["a"]({text:`${s}/${r}/${a}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})]})})];e.set(i.id,o),this.view.graphics.addMany(o)}})}}var S=i("6611"),I=i("d347");const k=h["a"].getLogger("esri.layers.graphics.controllers.FeatureTileController3D");let D=class extends(Object(d["b"])(r["a"])){constructor(e){super(e),this.type="feature-tile-3d",this.watchUpdatingTracking=new I["a"],this.serviceDataExtent=null,this.serviceDataCount=U.NO_SERVICE_DATA_COUNT,this.vertexLimitExceeded=!1,this.displayFeatureLimit=null,this.suspended=!1,this.tileFetcher=null,this.handles=new c["a"],this.fetchDataInfoPromise=null,this.fetchDataInfoAbortController=null,this.lifeCycleAbortController=new AbortController}set extent(e){if(e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void k.error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(t&&e&&t.equals(e))return;const i=e?e.clone():null;this._set("extent",i)}get updating(){return!!(Object(u["k"])(this.tileFetcher)&&this.tileFetcher.updating||null!=this.fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this.watchUpdatingTracking&&this.watchUpdatingTracking.updating)}get updatingTotal(){return this.updating&&Object(u["k"])(this.tileFetcher)?this.tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&Object(u["k"])(this.tileFetcher)?this.tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&Object(u["k"])(this.tileFetcher)?this.tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return Object(u["k"])(this.tileFetcher)?this.tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(!Object(u["k"])(this.tileFetcher)||!this.tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return Object(u["k"])(this.displayFeatureLimit)?this.displayFeatureLimit.maximumNumberOfFeatures:0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&(null==e?this._clearOverride("maximumNumberOfFeatures"):this._override("maximumNumberOfFeatures",e))}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get mode(){var e,t;const i=this.layerView.layer;if("feature"===i.type&&Object(u["k"])(i.infoFor3D))return"snapshot";if(!1===(null==(e=this.layerView.view.qualitySettings)||null==(t=e.graphics3D)?void 0:t.snapshotAvailable)||this.serviceDataCount===U.NO_SERVICE_DATA_COUNT||this.vertexLimitExceeded)return"tiles";const s=this.layerView.view,r=s&&s.featureTiles,a=r&&r.tilingScheme;if(i&&i.minScale&&this.serviceDataExtent&&a){const e=this._approximateExtentSizeAtScale(i.minScale,a);if((this.serviceDataExtent.width/e+this.serviceDataExtent.height/e)/2>U.MAX_SNAPSHOT_MIN_SCALE_FACTOR)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&Object(u["k"])(this.tileFetcher)&&this.tileFetcher.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,s=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),r=t.levels[0];return s*((r.tileSize[0]/(r.scale/e)+r.tileSize[1]/(r.scale/e))/2)}get tileDescriptors(){return"snapshot"===this.mode?new n["a"]([{id:"dummy-tile-full-extent",lij:[0,0,0]}]):this.layerView.view.featureTiles?this.layerView.view.featureTiles.tiles:new n["a"]}get test(){return{fetchDataInfoPromise:this.fetchDataInfoPromise,tileFetcher:this.tileFetcher}}initialize(){this.watchUpdatingTracking.add(()=>this.vertexLimitInfo,()=>this.watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this.lifeCycleAbortController.signal))),this.watchUpdatingTracking.add(()=>this.mode,()=>this._modeChanged(),f["a"]),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this.watchUpdatingTracking.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){const e=this.layerView.layer;if(!e.get("capabilities.operations.supportsQuery")&&"ogc-feature"!==e.type)throw new o["a"]("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this.tileFetcher=Object(u["d"])(this.tileFetcher),this.handles=Object(u["d"])(this.handles),this.tilesHandle=Object(u["s"])(this.tilesHandle),this.lifeCycleAbortController&&(this.lifeCycleAbortController.abort(),this.lifeCycleAbortController=null),this.watchUpdatingTracking.destroy(),this._set("watchUpdatingTracking",null)}suspend(){this.suspended||(this.suspended=!0,Object(u["k"])(this.tileFetcher)&&this.tileFetcher.suspend())}resume(){this.suspended&&(this.suspended=!1,Object(u["k"])(this.tileFetcher)&&this.tileFetcher.resume())}restart(){const e=()=>{Object(u["k"])(this.tileFetcher)&&this.tileFetcher.restart()};this.watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){const e=()=>{Object(u["k"])(this.tileFetcher)&&this.tileFetcher.refetch()};this.watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=Object(f["g"])(()=>{var t;return null==(t=e.featureTiles)?void 0:t.tilingScheme},this.lifeCycleAbortController.signal);this.watchUpdatingTracking.addPromise(t),t.then(()=>{const{layerView:t,tileDescriptors:i}=this,s=t.layer,r=new O["a"]({context:this.context,filterExtent:this.extent,tileDescriptors:i,features:this.graphics});this.tileFetcher=r,this.suspended?this.tileFetcher.suspend():this.tileFetcher.resume();const a=this.layerView.view.resourceController;a&&(this.handles.add(a.memoryController.events.on("quality-changed",e=>{r.memoryFactor=e})),this.tileFetcher.memoryFactor=a.memoryController.memoryFactor);const n="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;n&&this.handles.add(Object(f["e"])(()=>{var e,t,i;return null==(e=this.layerView.view)||null==(t=e.qualitySettings)||null==(i=t.graphics3D)?void 0:i[n]},e=>r.lodFactor=e||1,f["a"]));const o=e=>{r.maximumNumberOfFeatures=e,r.useTileCount=this.serviceDataCount>e},c=e=>r.useTileCount=e>this.maximumNumberOfFeatures;"ogc-feature"!==s.type&&this.watchUpdatingTracking.add(()=>s.createQueryVersion,()=>this._dataFilterChanged()),this.watchUpdatingTracking.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this.watchUpdatingTracking.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),this.handles.add([s.on("apply-edits",e=>this._applyEdits(e)),this.watch("extent",e=>r.filterExtent=e,!0),this.watch("tileDescriptors",e=>r.tileDescriptors=e,!0),Object(f["e"])(()=>this.maximumNumberOfFeatures,o,f["d"]),Object(f["e"])(()=>this.serviceDataCount,c,f["d"]),Object(f["e"])(()=>S["a"].FEATURE_TILE_FETCH_SHOW_TILES,t=>{t&&r&&!r.debugger?(r.debugger=new R(r,e.featureTiles.tilingScheme.toTileInfo(),e),r.debugger.update()):!t&&this.tileFetcher&&r.debugger&&(r.debugger.destroy(),r.debugger=null)},f["d"])]),this.supportsExceedsLimitQuery||this.watchUpdatingTracking.add(()=>this.maxTotalSnapshotVertices,()=>this.watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this.lifeCycleAbortController.signal)))}).catch(()=>{})}_modeChanged(){switch(this.mode){case"tiles":this.tilesHandle||(this.tilesHandle=this.layerView.view.featureTiles.addClient());break;default:k.warn("Unhandled feature layer mode "+this.mode);case"snapshot":Object(u["k"])(this.tilesHandle)&&(this.tilesHandle.remove(),this.tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this.refetch()}_applyEdits(e){Object(u["j"])(this.tileFetcher)||this.tileFetcher.applyEdits(e).then(e=>{e&&(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this.watchUpdatingTracking.addPromise(this._updateServiceDataExtent(this.lifeCycleAbortController.signal))}).catch(e=>{if(!Object(p["m"])(e))throw e})}_availableFieldsChanged(e,t){Object(u["k"])(this.tileFetcher)&&V(this.tileFetcher.availableFields,t)&&this.refetch()}_requiredFieldsChanged(e,t){Object(u["k"])(this.tileFetcher)&&V(this.tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.outStatistics=[new g["a"]({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=e.createQuery();return t.outSpatialReference=this.layerView.view.spatialReference,e.capabilities.query.supportsCacheHint&&(t.cacheHint=!0),t}_fullExtentIsAccurate(){const e=this.layerView.layer;if(e.definitionExpression)return!1;switch(e.type){case"feature":return Object(y["c"])(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){Object(p["m"])(t)||this._set("serviceDataExtent",Object(l["a"])(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,s=i.capabilities.query.supportsExtent,r=Object(l["a"])(t.fullExtentInLocalViewSpatialReference),a=i.fullExtent,n=this._fullExtentIsAccurate(),o=this.serviceDataCount;if(s&&o<=U.MAX_FEATURE_COUNT_FOR_EXTENT&&(!r||!n)&&"queryExtent"in i){const t=this._createDataInfoQuery(),s=await i.queryExtent(t,{timeout:U.QUERY_EXTENT_TIMEOUT,signal:e});this._set("serviceDataExtent",s.extent)}else if(r)this._set("serviceDataExtent",r);else if(Object(u["k"])(a)){const s="portalItem"in i?i.portalItem:null,r=await Object(_["projectGeometry"])(a,t.view.spatialReference,s,e);this._set("serviceDataExtent",r)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t))return void this._set("serviceDataCount",U.NO_SERVICE_DATA_COUNT);const i=await Object(a["d"])(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:U.QUERY_STATISTICS_TIMEOUT,signal:e}));if(!0===i.ok)this._set("serviceDataCount",i.value);else{if(Object(p["m"])(i.error))throw i.error;this._set("serviceDataCount",U.NO_SERVICE_DATA_COUNT)}}get vertexLimitInfo(){if(Object(u["j"])(this.displayFeatureLimit)||Object(u["j"])(this.displayFeatureLimit.averageSymbolComplexity))return null;const{averageSymbolComplexity:e,maximumTotalNumberOfPrimitives:t}=this.displayFeatureLimit,{primitivesPerCoordinate:i,primitivesPerFeature:s}=e,r=this._get("vertexLimitInfo");return Object(u["j"])(r)||r.maximumTotalNumberOfPrimitives!==t||r.primitivesPerCoordinate!==i||r.primitivesPerFeature!==s?{primitivesPerCoordinate:i,primitivesPerFeature:s,maximumTotalNumberOfPrimitives:t}:r}get supportsExceedsLimitQuery(){const e=this.layerView.layer;return e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateVertexLimitExceeded(e,t){const i=this.vertexLimitInfo;if(Object(u["j"])(i))return void this._set("vertexLimitExceeded",!1);const s=i.primitivesPerFeature<=0,r=this.minimumNumberOfVerticesForGeometry>1;if(!s&&!r)return void this._set("vertexLimitExceeded",!1);const{primitivesPerFeature:n,primitivesPerCoordinate:o,maximumTotalNumberOfPrimitives:c}=i;let l;0!==n&&Object(u["k"])(e)&&await e;const h=this.serviceDataCount,d=h!==U.NO_SERVICE_DATA_COUNT;if(l=d?Math.ceil((c-h*n)/(o||1)):Math.ceil(c/(o||1)),r&&(l=Math.min(l,L)),d&&this.minimumNumberOfVerticesForGeometry*h>l)return void this._set("vertexLimitExceeded",!0);if(!this.supportsExceedsLimitQuery)return void this._set("vertexLimitExceeded",this.maxTotalSnapshotVertices>l);const f=await Object(a["d"])(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(l),{timeout:U.QUERY_STATISTICS_TIMEOUT,signal:t}));if(!1===f.ok){if(Object(p["m"])(f.error))throw f.error;return void this._set("vertexLimitExceeded",!1)}const m=f.value.features[0];m&&m.attributes?this._set("vertexLimitExceeded",!!m.attributes.exceedslimit):this._set("vertexLimitExceeded",!1)}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),s=Object(p["j"])([i,this._updateVertexLimitExceeded(i,t)]),r=s.then(()=>this._updateServiceDataExtent(t)).catch(e=>{Object(p["m"])(e)||k.error("#fetchServiceDataInfo()",e)}).then(()=>{r===this.fetchDataInfoPromise&&(this.fetchDataInfoPromise=null,this.fetchDataInfoAbortController=null),e=null});return e&&(this.fetchDataInfoPromise=r),this.fetchDataInfoAbortController=e,s.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){const e=this.fetchDataInfoAbortController;e&&(this.fetchDataInfoAbortController=null,this.fetchDataInfoPromise=null,e.abort())}get debug(){return{storedFeatures:Object(u["k"])(this.tileFetcher)?this.tileFetcher.storedFeatures:0,totalFeatures:Object(u["k"])(this.tileFetcher)?this.tileFetcher.totalFeatures:0,totalVertices:Object(u["k"])(this.tileFetcher)?this.tileFetcher.totalVertices:0}}};Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"type",void 0),Object(s["a"])([Object(m["b"])({constructOnly:!0})],D.prototype,"graphics",void 0),Object(s["a"])([Object(m["b"])({constructOnly:!0})],D.prototype,"layerView",void 0),Object(s["a"])([Object(m["b"])({constructOnly:!0})],D.prototype,"context",void 0),Object(s["a"])([Object(m["b"])()],D.prototype,"extent",null),Object(s["a"])([Object(m["b"])()],D.prototype,"updating",null),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"watchUpdatingTracking",void 0),Object(s["a"])([Object(m["b"])()],D.prototype,"updatingTotal",null),Object(s["a"])([Object(m["b"])()],D.prototype,"updatingRemaining",null),Object(s["a"])([Object(m["b"])()],D.prototype,"expectedFeatureDiff",null),Object(s["a"])([Object(m["b"])()],D.prototype,"memoryForUnusedFeatures",null),Object(s["a"])([Object(m["b"])()],D.prototype,"maximumNumberOfFeaturesExceeded",null),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"serviceDataExtent",void 0),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"serviceDataCount",void 0),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"vertexLimitExceeded",void 0),Object(s["a"])([Object(m["b"])()],D.prototype,"displayFeatureLimit",void 0),Object(s["a"])([Object(m["b"])({type:Number})],D.prototype,"maximumNumberOfFeatures",null),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"mode",null),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"maxTotalSnapshotVertices",null),Object(s["a"])([Object(m["b"])({readOnly:!0,dependsOn:["mode"]})],D.prototype,"tileDescriptors",null),Object(s["a"])([Object(m["b"])()],D.prototype,"tileFetcher",void 0),Object(s["a"])([Object(m["b"])()],D.prototype,"fetchDataInfoPromise",void 0),Object(s["a"])([Object(m["b"])({readOnly:!0})],D.prototype,"vertexLimitInfo",null),D=Object(s["a"])([Object(b["a"])("esri.layers.graphics.controllers.FeatureTileController3D")],D);const M=1e4,N=12e3,P=1e4,L=5e6;function V(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}var U;!function(e){function t(){e.MAX_FEATURE_COUNT_FOR_EXTENT=M,e.QUERY_STATISTICS_TIMEOUT=N,e.QUERY_EXTENT_TIMEOUT=P}e.NO_SERVICE_DATA_COUNT=1/0,e.MAX_SNAPSHOT_MIN_SCALE_FACTOR=5,e.reset=t}(U||(U={})),U.reset()},e60a:function(e,t,i){"use strict";i.d(t,"a",(function(){return N})),i.d(t,"b",(function(){return V}));var s=i("a4ee"),r=i("fc29"),a=i("af40"),n=i("e92d"),o=i("28eb"),c=i("b2b2"),l=i("f4cc"),h=i("5815"),u=i("3795"),d=i("59b2"),p=i("b50f"),f=(i("c120"),i("cea0"),i("d386")),m=i("9180"),b=i("1a54"),y=i("79e4"),_=i("69dd"),g=i("3c9c"),O=i("3563");class F{constructor(e,t){this.highestResolutionVersion=null,this.versions=[],this.ref(e,t)}get isReferenced(){return 0!==this.versions.length}get isSingle(){return 1===this.versions.length&&1===this.versions[0].refCount}ref(e,t){const i=this.feature;v.oldVersion=i,this.feature&&Object.defineProperty(e,"uid",{value:this.feature.uid,configurable:!0});for(const r of this.versions)if(r.resolution===t){r.refCount++;const t=this.highestResolutionVersion===r&&!Object(O["a"])(e,r.feature);return(t||this.highestResolutionVersion!==r)&&(r.feature=e),v.newVersion=t?e:i,v}const s={feature:e,resolution:t,refCount:1};return this.versions.push(s),!this.highestResolutionVersion||t0&&(this.refCount--,!this.isReferenced)?(v.newVersion=null,v):(v.newVersion=this._feature,v)}get feature(){return this._feature}}const v={oldVersion:null,newVersion:null},x=16438,w=new Set;class E{constructor(e){this.descriptor=e,this.fetchStatus=R.FETCH_NEEDED,this._features=null,this._numVertices=0,this._featureLimit=0,this.featuresMissing=!0,this._shuffled=!1,this._numFeatures=T,this._emptyFeatureRatio=0,this._estimatedSize=-1,this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._availableFields=w,this._displayingFeatures=null,this.alive=!0,this.filtered=!1}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){return!this.filtered&&(this.featuresMissing||this.features&&this.featureLimit!==this.features.length)}get features(){return this._features}get featureLimit(){return this._featureLimit}set featureLimit(e){this._featureLimit!==e&&(this._featureLimit=e,this._estimatedUnusedSizeDirty=!0)}get availableFields(){return this._availableFields}setFeatures(e,t,i){this._availableFields=Object(c["u"])(i,w),this._features=e,this._shuffled=!1,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,e&&e.length>0?(this._emptyFeatureRatio=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+Object(b["k"])(t.geometry),0)):(this._emptyFeatureRatio=0,this._numVertices=0)}get emptyFeatureRatio(){return this._emptyFeatureRatio}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures:this._features?this._features.length:0}set numFeatures(e){this._numFeatures=e}get hasPreciseFeatureCount(){return this._numFeatures>T}get needsFeatureCount(){return this._numFeatures===T}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateMemoryEstimates(),this._estimatedSize}get estimatedUnusedSize(){return this._estimatedUnusedSize}updateMemoryEstimates(){if(this._estimatedSize<0){if(this._estimatedSize=0,this._estimatedUnusedSize=0,this._features)for(let e=0;e=this.featureLimit&&(this._estimatedUnusedSize+=t)}return!0}if(this._estimatedUnusedSizeDirty){if(this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._features)for(let e=this.featureLimit;eObject(b["g"])(t,e)-Object(b["g"])(i,e)),Object(p["m"])(this._features,x),this._shuffled=!0,this._estimatedUnusedSizeDirty=!0}reduceFeatures(e,t,i){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let s=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&(this.featureLimit=this._features.length,this.fetchStatus===R.DONE&&this._features.length>0&&(this.fetchStatus=R.REFETCH_NEEDED,s=!0)),!this._shuffled&&e<1&&this._shuffle(i);const r=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));return this._features.length>r&&(this._features.length=r,this.featuresMissing=!0,this.fetchStatus===R.FULL&&(this.fetchStatus=R.DONE)),s}get cache(){return{availableFields:this._availableFields,features:this.features,numFeatures:this._numFeatures,emptyFeatureRatio:this._emptyFeatureRatio,fetchStatus:this.fetchStatus,featuresMissing:this.featuresMissing}}set cache(e){this.requestController=null,this._availableFields=e.availableFields,this._features=e.features,this._numFeatures=e.numFeatures,this._emptyFeatureRatio=e.emptyFeatureRatio,this.fetchStatus=e.fetchStatus,this.featuresMissing=e.featuresMissing,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0}}const T=-1,C=-2;var R;function S(e,t,i){if(Object(c["j"])(t)||Object(c["j"])(e)||i!==t.length||i>e.length)return!1;for(let s=0;se+=t.estimatedUnusedSize),e}get totalVertices(){let e=0;return this.featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this.featureTiles.forEach(t=>e+=t.numFeatures),e}set filterExtent(e){if(e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void M.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||t&&e&&t.equals(e))return;const i=e?e.clone():null;this._set("filterExtent",i),this._reclip(i,t)}initialize(){this.handles.add(Object(u["b"])(this,"tileDescriptors","change",()=>this._setDirty(),()=>this._setDirty())),this.objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?F:j;const e=this.context.scheduler;Object(c["k"])(e)&&(this._frameTask=e.registerTask(D["c"].FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){this._frameTask.remove(),this.handles=Object(c["d"])(this.handles),this.featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this.featureTiles.clear(),this.displayingFeatureReferences.clear(),this.pendingEdits&&(this.pendingEdits.controller.abort(),this.pendingEdits=null)}get paused(){return this.suspended||!!this.pendingEdits}restart(){this.featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),Object(c["k"])(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this.featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),Object(c["k"])(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this.suspended||(this.suspended=!0,this._pause(),this._setDirty())}resume(){this.suspended&&(this.suspended=!1,this._unpause())}_pause(){this.paused&&(this.featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this.paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this.featureTiles.forEach(t=>{Object(c["j"])(t.displayingFeatures)||0===t.displayingFeatures.length||(Object(c["j"])(e)?e=new Set(t.availableFields):e.forEach(i=>{t.availableFields.has(i)||Object(c["t"])(e).delete(i)}))}),Object(c["k"])(e)?e:new Set}applyEdits(e){this.pendingEdits||(this.pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this.pendingEdits;t.count++;const i=t.edits.then(()=>e.result.catch(e=>{if(Object(l["m"])(e))throw e;return null}).then(e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e)):e).then(e=>(0==--t.count&&(this.pendingEdits===t&&(this.pendingEdits=null),Object(c["k"])(this.context.memoryCache)&&this.context.memoryCache.clear(),this._unpause(),this._updated()),e)));return t.edits=i,this._updated(),i}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,i=t&&this.availableFields.has(t),s=new Set,r=this.objectIdField;e.forEach(({objectId:e,globalId:a})=>{if((!e||e<0)&&t){i||M.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`);const e=this.features.find(e=>e.attributes&&e.attributes[t]===a);e&&s.add(Object(b["g"])(e,r))}else s.add(e)}),this.featureTiles.forEach(e=>{if(!e.features)return;const t=e.features.filter(e=>!s.has(Object(b["g"])(e,this.objectIdField)));t.length!==e.features.length&&(e.setFeatures(t,0,e.availableFields),this._invalidateCounts())})}async _applyEditsAddUpdateFeatures(e,t,i){const s=[],r=new Set;if(e.forEach(e=>s.push(e.objectId)),t.forEach(e=>{s.push(e.objectId),r.add(e.objectId)}),0===s.length)return;const a=[];this.featureTiles.forEach(e=>{const t=this._applyEditsAddUpdateTile(e,s,r,i);t&&a.push(t)}),await Object(l["j"])(a)}async _applyEditsAddUpdateTile(e,t,i,s){if(!e.features)return;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=t;const a=await this._queryFeatures(r,s);let n=null;if(i.size>0){const t=e.features.filter(e=>!i.has(Object(b["g"])(e,this.objectIdField)));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),e.setFeatures(n,0,q(e.availableFields,a.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:Q})}_setDirty(){this._dirty=!0,this._updated()}get running(){return this.updating}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.constructed)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run(()=>this._addTiles(t,e))||!e.run(()=>this._filterExtentTiles(t,e))||!e.run(()=>this._removeTiles(t,e))||e.done)return void this._setDirty();const i=this._sortTiles(t);e.run(()=>this._displayTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,e))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!this.suspended&&(this.tileDescriptors.forEach(i=>{const s=this.featureTiles.get(i.id);s?s.alive=!0:t.done||(e.push(this._addTile(i)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(const i of e){if(t.done)break;i.alive&&(i.filtered=!i.intersects(this.filterExtent),i.filtered&&(this._clearTile(i),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let i=e.length-1;i>=0&&!t.done;i--){const s=e[i];s.alive||(this._removeTile(s),i!==e.length-1&&(e[i]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_displayTiles(e,t){const i=this._updateRatio(e),s=e=>{const t=this._fullRatio<1?i(e)*this._farRatio:1;return e.reduceFeatures(t,this.memoryFactor,this.objectIdField)&&this._setDirty(),this._showTile(e)};for(const r of e)if(!t.run(()=>s(r))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this.paused)return!1;let i=!1;for(const s of e){if(!s.needsFetching)continue;const e=Object(c["k"])(this.context.memoryCache)?this.context.memoryCache.pop(s.id):null;if(Object(c["k"])(e))s.cache=e,this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(s)){const e=new AbortController,r=this._fetchTileCount(s,e.signal);this._handleRequest(s,r,e,()=>s.numFeatures=C),i=!0,t.madeProgress()}if(t.done)return!0}}if(i)return t.hasProgressed;for(const s of e)if(s.needsFetching){const e=new AbortController,i=this._fetchTile(s,e.signal);if(this._handleRequest(s,i,e,e=>{s.setFeatures([],0,null),this._invalidateCounts(),s.featuresMissing=!1,this.context.logFetchError(M,e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateMemoryEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.constructed)return;const i=new Array;this.featureTiles.forEach(s=>{Object(c["j"])(s.displayingFeatures)||0===s.displayingFeatures.length||(s.intersectionIncludingBorrowed(t,z),s.intersectionIncludingBorrowed(e,H),Object(m["o"])(z,H)||i.push(s))}),this._refreshDisplayingFeatures(i),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,i=this.changes.updates;for(const s of e)if(!Object(c["j"])(s.displayingFeatures))for(const e of s.displayingFeatures){const s=Object(b["g"])(e,this.objectIdField);if(t.has(s))continue;t.add(s);const{feature:r}=this.displayingFeatureReferences.get(s);i.removes.push(r),i.adds.push(r)}this._applyChanges()}_updated(){let e=0;this.paused||this.featureTiles.forEach(t=>t.isFetching?++e:0);const t=this._dirty||e>0||!!this.pendingEdits;if(this._set("updating",t),t){let t=0,i=0,s=0,r=0,a=0;const n=this.displayingFeatureReferences.size/this.numDisplayingFeatureReferences;this.featureTiles.forEach(e=>{if(++i,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),i=Object(c["k"])(e.displayingFeatures)?e.displayingFeatures.length*n:0;a+=t-i}e.needsFetching?++r:e.numFeatures>0&&(++s,t+=e.numFeatures)}),r+=e;let o=0,l=0;t?(l=t,o=Math.min(r*t/s,t)):(l=i,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",l),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=Object(o["c"])(this.featureTiles,e=>e.perTileMaximumNumberOfFeaturesExceeded);this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=L(e),i=e=>1/(1<e&&this.featureTiles.forEach(e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.features&&(e.features.length>=t||e.fetchStatus===R.FULL)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){const t=new E(e);return this.featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this.featureTiles.forEach(i=>{if(!(Object(c["j"])(i.displayingFeatures)||e===i||e.descriptor.lij&&i.descriptor.lij&&!Object(k["i"])(e.descriptor.lij,i.descriptor.lij))){Object(c["j"])(e.displayingFeatures)&&(e.displayingFeatures=[]),e.descriptor.extent&&i.descriptor.extent&&(Object(c["j"])(e.extentIncludingBorrowedFeatures)&&(e.extentIncludingBorrowedFeatures=Object(m["f"])(e.descriptor.extent)),Object(m["p"])(e.extentIncludingBorrowedFeatures,i.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const s of i.displayingFeatures){e.displayingFeatures.push(s);const i=this.displayingFeatureReferences.get(Object(b["g"])(s,this.objectIdField));i.ref(i.feature,t),this.numDisplayingFeatureReferences++}}}),e.featureLimit=Object(c["k"])(e.displayingFeatures)?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this.featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=R.DONE):e.fetchStatus=R.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;Object(c["k"])(t)&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===R.REFETCHING?R.REFETCH_NEEDED:R.FETCH_NEEDED}async _fetchTile(e,t){const i=this._maximumFeaturesForTile(e);if(i<=0)return A(e);const s=this._getMaxRecordCount(e),r=Math.ceil(i/s);if(P(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=i&&r>_["a"].MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=Math.ceil(i/s),e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/s);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:n,exceededTransferLimit:o,fields:c}=await this._queryFeatures(a,t),l=o?a.maxRecordCountFactor>=_["a"].MAX_MAX_RECORD_COUNT_FACTOR?R.FULL:R.DONE:R.FULL;return await this._frameTask.schedule(()=>{e.featuresMissing=n.length{u&&(s+=Object(c["t"])(h.num)),a+=d.length,r+=this._removeEmptyFeatures(d),e.featuresMissing=s0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(i/s),e.num=Math.min(e.maxRecordCountFactor*s,i)):e.num=Math.min(s),!0)}_getEffectiveTileResolution(e){if(null==e.descriptor.resolution)return null;const t=this.context.viewingMode===g["a"].Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){if(!this.supportsResolution)return;const i=this._getEffectiveTileResolution(t);null!=i&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new y["a"]({mode:"view",originPosition:"upper-left",tolerance:i,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=i))}_removeEmptyFeatures(e){const t=e.length;for(let i=0;i0&&this.context.capabilities.supportsResultType?t:Object(c["k"])(i)&&i>0?i:B}_useTileQuery(e){return(!P(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,i,s){e.fetchStatus=e.needsRefetching?R.REFETCHING:R.FETCHING,e.requestController=i;let r=!1;t.then(t=>{e.requestController=null,e.fetchStatus=t}).catch(t=>{e.requestController===i&&(e.requestController=null,e.fetchStatus=R.DONE),Object(l["m"])(t)?r=!0:s(t)}).then(()=>{r||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.handles&&!this.handles.has("scheduleUpdated")&&this.handles.add(Object(h["b"])(()=>{this.handles.remove("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(Object(c["k"])(e.displayingFeatures)&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=Object(c["k"])(e.displayingFeatures)&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const i=e.descriptor.resolution,s=this.changes.updates,r=this.changes.adds,a=Math.min(e.featureLimit,t.length);e.featureLimit=a;for(let n=0;n0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this.changes.adds,i=this.changes.removes,s=Math.min(t.length,i.length);let r=0;for(;rs&&this.features.addMany(0===r?t:t.slice(r)),i.length>s&&this.features.removeMany(0===r?i:i.slice(r)),t.length=0,i.length=0}_clearTile(e){if(this._hideTile(e),e.features&&Object(c["k"])(this.context.memoryCache)){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this.featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce((e,t)=>e+(t.features?t.features.length:0),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,i=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(i*s/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this.featureTiles.get(e),forEachFeatureTile:e=>this.featureTiles.forEach(e)}}};function P(e){return"dummy-tile-full-extent"===e.id}function L(e){let t=0;for(const i of e)i.features&&i.features.length>0&&i.alive&&(t=Math.max(t,i.descriptor.lij[0]));return t}function V(e){const t=e.capabilities.query;return{supportsMultipleResolutions:U(e),supportsPagination:!(!t||!t.supportsPagination),supportsResultType:!(!t||!t.supportsResultType),supportsCacheHint:!(!t||!t.supportsCacheHint),supportsQuantization:!(!t||!t.supportsQuantization),supportsQuantizationEditMode:!(!t||!t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!t||!t.supportsMaxRecordCountFactor),supportsFormatPBF:!(!t||!t.supportsFormatPBF)}}function U(e){switch(e.geometryType){case"polyline":return!0;case"polygon":return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}function A(e){return e.setFeatures([],0,null),e.featuresMissing=!1,R.DONE}function G(e){return Object(c["j"])(e)?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(Object(c["j"])(e)||Object(c["j"])(t))return G(t);const i=new Set;for(const{name:s}of t)e.has(s)&&i.add(s);return i}Object(s["a"])([Object(d["b"])({constructOnly:!0})],N.prototype,"features",void 0),Object(s["a"])([Object(d["b"])()],N.prototype,"tileDescriptors",void 0),Object(s["a"])([Object(d["b"])({value:1/0})],N.prototype,"maximumNumberOfFeatures",null),Object(s["a"])([Object(d["b"])({value:1})],N.prototype,"memoryFactor",null),Object(s["a"])([Object(d["b"])({value:1})],N.prototype,"lodFactor",null),Object(s["a"])([Object(d["b"])()],N.prototype,"useTileCount",null),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"updating",void 0),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"updatingTotal",void 0),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"updatingRemaining",void 0),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"expectedFeatureDiff",void 0),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"memoryForUnusedFeatures",null),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"maximumNumberOfFeaturesExceeded",void 0),Object(s["a"])([Object(d["b"])({constructOnly:!0})],N.prototype,"maximumNumberOfFeaturesExceededThrottle",void 0),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"totalVertices",null),Object(s["a"])([Object(d["b"])({readOnly:!0})],N.prototype,"totalFeatures",null),Object(s["a"])([Object(d["b"])()],N.prototype,"filterExtent",null),Object(s["a"])([Object(d["b"])({constructOnly:!0})],N.prototype,"context",void 0),N=Object(s["a"])([Object(f["a"])("esri.views.3d.layers.support.FeatureTileFetcher3D")],N);const B=2e3,z=Object(m["l"])(),H=Object(m["l"])(),Q=6e5,W=200},eec2:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var s=i("b2b2"),r=i("9786"),a=i("e2e8");function n(e){const t=e.view.spatialReference,i=e.layer.fullExtent,n=Object(s["k"])(i)&&i.spatialReference;if(Object(s["j"])(i)||!n)return Promise.resolve(null);if(n.equals(t))return Promise.resolve(i.clone());const o=Object(r["d"])(i,t);return Object(s["k"])(o)?Promise.resolve(o):e.view.state.isLocal?Object(a["projectGeometry"])(i,t,e.layer.portalItem).then(t=>!e.destroyed&&t?t:void 0).catch(()=>null):Promise.resolve(null)}}}]); //# sourceMappingURL=chunk-7478d1a2.bf467598.js.map