/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["require","exports","../../../chunks/_rollupPluginBabelHelpers","../../../chunks/tslib.es6","../../../core/Accessor","../../../core/Handles","../../../core/maybe","../../../core/promiseUtils","../../../core/reactiveUtils","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass"],(function(e,i,o,t,s,r,n,l,a,c,d,h,p,u){"use strict";i.ElevationProfileView=function(i){function t(e){var o;return(o=i.call(this,e)||this)._implementation=null,o._loadingTask=null,o._handles=new r,o}o._inheritsLoose(t,i);var s=t.prototype;return s.initialize=function(){this._handles.add(a.watch((()=>({tool:this.tool,view:this.tool.viewModel.view,visible:this.tool.visible&&!!n.applySome(this.tool.viewModel.view,(e=>e.ready))})),(({tool:e,view:i,visible:o})=>{n.isSome(i)&&o?this._show(i,e):this._hide()}),a.syncAndInitial))},s.destroy=function(){this._handles=n.destroyMaybe(this._handles),this._hide()},s._show=function(i,t){var s=this;this._loadingTask=n.abortMaybe(this._loadingTask),this._loadingTask=l.createTask(function(){var r=o._asyncToGenerator((function*(o){if("2d"===i.type){const r=new Promise(((i,o)=>e(["./ElevationProfileView2D"],i,o))),n=(yield l.whenOrAbort(r,o)).ElevationProfileView2D;s._implementation=new n(i,t)}else if("3d"===i.type){const r=new Promise(((i,o)=>e(["./ElevationProfileView3D"],i,o))),n=(yield l.whenOrAbort(r,o)).ElevationProfileView3D;s._implementation=new n(i,t)}}));return function(e){return r.apply(this,arguments)}}())},s._hide=function(){this._loadingTask=n.abortMaybe(this._loadingTask),this._implementation=n.destroyMaybe(this._implementation)},t}(s),t.__decorate([c.property()],i.ElevationProfileView.prototype,"tool",void 0),i.ElevationProfileView=t.__decorate([u.subclass("esri.widgets.ElevationProfile.support.ElevationProfileView")],i.ElevationProfileView),Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
