/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{debounce as r,isAbortError as i}from"../../../core/promiseUtils.js";import{property as o,subclass as a}from"../../../core/accessorSupport/decorators.js";import{projectAsync as n}from"../../../geometry/projectionUtils.js";import{LayerView3D as l}from"./LayerView3D.js";import{LayerViewPerformanceInfo as p}from"./support/LayerViewPerformanceInfo.js";import d from"../../layers/LayerView.js";import{RefreshableLayerView as c}from"../../layers/RefreshableLayerView.js";import{isInEffectiveScaleRange as u}from"../../support/layerViewUtils.js";const h=l=>{const d=l;let c=class extends d{constructor(){super(...arguments),this.fullExtentInLocalViewSpatialReference=null,this.refreshDebounced=r(async e=>{this.destroyed||await this._doRefresh(e).catch(e=>{i(e)||t.getLogger(this).error(e)})},2e3),this.ignoresMemoryFactor=!1,this.unloadedMemory=0}get visibleAtCurrentScale(){const e=this.layer,t="effectiveScaleRange"in e?e.effectiveScaleRange:null;return u(t,this.view.scale)}isUpdating(){return super.isUpdating()||this.subView?.updating}initialize(){this._initSubView(),"local"===this.view.viewingMode&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await n(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler())}destroy(){this.subView=s(this.subView)}async doRefresh(){return this._doRefresh()}async _doRefresh(e){this.suspended||await this.subView.doRefresh(e)}getFetchOptions(){}_suspendedChangeHandler(){this.suspended?this.subView.clear():this.refreshDebounced()}get test(){}get usedMemory(){return this.subView.usedMemory}get performanceInfo(){return new p(this.usedMemory)}};return e([o()],c.prototype,"suspended",void 0),e([o()],c.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([o({readOnly:!0})],c.prototype,"visibleAtCurrentScale",null),e([o()],c.prototype,"updating",void 0),e([o()],c.prototype,"subView",void 0),c=e([a("esri.views.3d.layers.DynamicLayerView3D")],c),c};class f extends(h(c(l(d)))){}export{f as DynamicLayerView3D,h as DynamicLayerView3DMixin};
