/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../../core/accessorSupport/decorators.js";import a from"./createFlowStyle.js";import{loadImagery as n}from"./dataUtils.js";import l from"./FlowContainer.js";import h from"./FlowStrategy.js";let d=class extends i{constructor(){super(...arguments),this._loadImagery=(t,e,i,o,r)=>n(this.layer,t,e,i,o,r),this._createFlowMesh=(t,e,i,o)=>this.layer.createFlowMesh({meshType:t,flowData:i,simulationSettings:e},{signal:o}),this.attached=!1,this.type="flow",this.timeExtent=null,this.redrawOrRefetch=async()=>{this._updateVisualization()}}get updating(){return!this.attached||this._strategy.updating}attach(){const{layer:t}=this,e=()=>{this._loadImagery=(e,i,o,r,s)=>n(t,e,i,o,r,s),this._updateVisualization()};"multidimensionalDefinition"in t?this.addHandles(o(()=>t.multidimensionalDefinition,e)):this.addHandles([o(()=>t.mosaicRule,e),o(()=>t.rasterFunction,e),o(()=>t.definitionExpression,e)]),this.container=new l,this._strategy=new h({flowContainer:this.container}),this._updateVisualization()}detach(){this._strategy.destroy(),this.container?.removeAllChildren(),this.container=null,this.removeHandles()}update(t){t.stationary?this._strategy.update(t):this.layerView.requestUpdate()}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}moveEnd(){}async doRefresh(){}_updateVisualization(){const t=this.layer.renderer;if(null==t||"flow"!==t.type)return;const e=a(t,{loadImagery:this._loadImagery,createFlowMesh:this._createFlowMesh,timeExtent:this.timeExtent});this.container.flowStyle=e,this.layerView.requestUpdate()}};t([r()],d.prototype,"_strategy",void 0),t([r()],d.prototype,"attached",void 0),t([r()],d.prototype,"container",void 0),t([r()],d.prototype,"layer",void 0),t([r()],d.prototype,"layerView",void 0),t([r()],d.prototype,"type",void 0),t([r()],d.prototype,"updating",null),t([r()],d.prototype,"timeExtent",void 0),d=t([s("esri.views.2d.engine.flow.FlowView2D")],d);export{d as default};
