/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../core/maybe","../../core/promiseUtils","../../core/reactiveUtils"],(function(e,n,o,t,i){"use strict";function a(e,a,r){const c=s(e,a);e.view.activeTool=c;let u=t.onAbort(r,(()=>l(e,a)));return t.createTask(function(){var t=n._asyncToGenerator((function*(n){yield i.whenOnce((()=>!c.active),n),u=o.removeMaybe(u),l(e,a)}));return function(e){return t.apply(this,arguments)}}(),r)}function r(e,n){return i.watch((()=>e.interactive),(()=>l(e,n)),i.syncAndInitial)}function l(e,n){e.interactive?s(e,n):c(e)}function s(e,n){c(e);const{view:o,analysis:t}=e,i=new n({view:o,analysis:t,analysisViewData:e});return e.tool=i,o.tools.add(i),i}function c(e){const{view:n,tool:t}=e;o.isNone(t)||(n.tools.remove(t),e.tool=null)}e.activateTemporaryAnalysisViewTool=a,e.connectAnalysisViewToTool=r,e.removeAnalysisViewTool=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
