/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../chunks/_rollupPluginBabelHelpers","../../../../chunks/tslib.es6","../../../../Graphic","../../../../core/HandleOwner","../../../../core/reactiveUtils","../../../../core/accessorSupport/decorators/property","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/ensureType","../../../../core/accessorSupport/decorators/subclass","./createFlowStyle","./dataUtils","./FlowContainer","./FlowStrategy"],(function(e,t,r,o,a,i,n,s,l,c,p,d,u,y){"use strict";let h=function(t){function o(){var r;return(r=t.apply(this,arguments)||this)._loadImagery=(e,t,o,a,i)=>d.loadImagery(r.layer,e,t,o,a,i),r._createFlowMesh=(e,t,o,a)=>r.layer.createFlowMesh({meshType:e,flowData:o,simulationSettings:t},{signal:a}),r.attached=!1,r.container=null,r.layer=null,r.type="flow",r.timeExtent=null,r.redrawOrRefetch=e._asyncToGenerator((function*(){r._updateVisualization()})),r}e._inheritsLoose(o,t);var i=o.prototype;return i.attach=function(){const{layer:e}=this,t=()=>{this._loadImagery=(t,r,o,a,i)=>d.loadImagery(e,t,r,o,a,i),this._updateVisualization()};"multidimensionalDefinition"in e?this.handles.add(a.watch((()=>e.multidimensionalDefinition),t)):this.handles.add([a.watch((()=>e.mosaicRule),t),a.watch((()=>e.renderingRule),t),a.watch((()=>e.definitionExpression),t)]),this.container=new u,this._strategy=new y({flowContainer:this.container}),this._updateVisualization()},i.detach=function(){this._strategy.destroy(),this.container.removeAllChildren(),this.container=null,this.handles.removeAll()},i.update=function(e){e.stationary?this._strategy.update(e):this.layerView.requestUpdate()},i.hitTest=function(e){return new r({attributes:{},geometry:e.clone(),layer:this.layer})},i.moveEnd=function(){},i.doRefresh=function(){var t=e._asyncToGenerator((function*(){}));function r(){return t.apply(this,arguments)}return r}(),i._updateVisualization=function(){const{renderer:e}=this.layer;if("flow"!==e.type)return;const t=p(e,{loadImagery:this._loadImagery,createFlowMesh:this._createFlowMesh,timeExtent:this.timeExtent});this.container.flowStyle=t,this.layerView.requestUpdate()},e._createClass(o,[{key:"updating",get:function(){return!this._strategy||this._strategy.updating}}]),o}(o.HandleOwner);t.__decorate([i.property()],h.prototype,"_strategy",void 0),t.__decorate([i.property()],h.prototype,"attached",void 0),t.__decorate([i.property()],h.prototype,"container",void 0),t.__decorate([i.property()],h.prototype,"layer",void 0),t.__decorate([i.property()],h.prototype,"layerView",void 0),t.__decorate([i.property()],h.prototype,"type",void 0),t.__decorate([i.property()],h.prototype,"updating",null),t.__decorate([i.property()],h.prototype,"timeExtent",void 0),h=t.__decorate([c.subclass("esri.views.2d.engine.flow.FlowView2D")],h);return h}));
