/*
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 i}from"tslib";import o from"../../../core/Accessor.js";import{createTask as t}from"../../../core/asyncUtils.js";import{abortMaybe as e,destroyMaybe as s}from"../../../core/maybe.js";import{whenOrAbort as l}from"../../../core/promiseUtils.js";import{watch as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as m}from"../../../core/accessorSupport/decorators.js";let p=class extends o{constructor(i){super(i),this._implementation=null,this._loadingTask=null}initialize(){this.addHandles(r(()=>({tool:this.tool,view:this.tool.viewModel.view,visible:this.tool.visible&&!!this.tool.viewModel.view?.ready}),({tool:i,view:o,visible:t})=>{null!=o&&t?this._show(o,i):this._hide()},a))}destroy(){this._hide()}_show(i,o){this._loadingTask=e(this._loadingTask),this._loadingTask=t(async t=>{if("2d"===i.type){const e=import("./ElevationProfileView2D.js"),s=(await l(e,t)).ElevationProfileView2D;this._implementation=new s(i,o)}else if("3d"===i.type){const e=import("./ElevationProfileView3D.js"),s=(await l(e,t)).ElevationProfileView3D;this._implementation=new s(i,o)}})}_hide(){this._loadingTask=e(this._loadingTask),this._implementation=s(this._implementation)}};i([n()],p.prototype,"tool",void 0),p=i([m("esri.widgets.ElevationProfile.support.ElevationProfileView")],p);export{p as ElevationProfileView};
