/*
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","../core/promiseUtils","../core/accessorSupport/decorators/aliasOf","../core/arrayUtils","../core/has","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/property","../core/accessorSupport/decorators/subclass","./Widget","./LineOfSight/LineOfSightViewModel","./support/decorators/accessibleHandler","./support/decorators/messageBundle","./support/jsxFactory","./support/widgetUtils"],(function(e,t,n,s,i,o,r,a,l,u,c,d,p,_,h){"use strict";const y={button:"esri-button",buttonDisabled:"esri-button--disabled",widgetIcon:"esri-icon-line-of-sight",base:"esri-line-of-sight esri-widget esri-widget--panel",container:"esri-line-of-sight__container",actionSection:"esri-line-of-sight__actions",hint:"esri-line-of-sight__hint",hintText:"esri-line-of-sight__hint-text",panelError:"esri-line-of-sight__panel--error",newAnalysisButton:"esri-line-of-sight__new-analysis-button esri-button--primary",secondaryButton:"esri-line-of-sight__secondary-button esri-button--secondary"},g={newAnalysisButton:"esri-line-of-sight__new-button",continueButton:"esri-line-of-sight__continue-button",doneButton:"esri-line-of-sight__done-button"};let f=function(t){function s(e,n){var s;return(s=t.call(this,e,n)||this).iconClass=y.widgetIcon,s.label=void 0,s.messages=null,s.view=null,s.viewModel=new c,s}e._inheritsLoose(s,t);var i=s.prototype;return i.render=function(){return _.tsx("div",{class:y.base,role:"presentation"},this.renderContainerNode())},i.renderContainerNode=function(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const t=[this._renderNewAnalysisButton()];return"creating"===this.viewModel.state?(e=this._renderHint(),t.unshift(this._renderDoneButton())):"created"===this.viewModel.state&&this.viewModel.targets.length>0&&t.unshift(this._renderContinueButton()),_.tsx("div",{class:y.container},e,_.tsx("div",{class:y.actionSection},t))},i._renderUnsupportedMessage=function(){return _.tsx("div",{class:y.panelError,key:"esri-line-of-sight__unsupported"},_.tsx("p",null,this.messages.unsupported))},i._renderHint=function(){return _.tsx("div",{class:y.hint,key:"esri-line-of-sight__hint"},_.tsx("p",{class:y.hintText},this.messages.hint))},i._renderNewAnalysisButton=function(){return this._renderButton(this._onNewAnalysis,this.messages.newAnalysis,y.newAnalysisButton,g.newAnalysisButton)},i._renderDoneButton=function(){return this._renderButton(this._onDone,this.messages.done,y.secondaryButton,g.doneButton)},i._renderContinueButton=function(){return this._renderButton(this._onContinue,this.messages.continueAnalysis,y.secondaryButton,g.newAnalysisButton)},i._renderButton=function(e,t,n,s){const i="disabled"===this.viewModel.state;return _.tsx("button",{disabled:i,class:this.classes(n,y.button,i&&y.buttonDisabled),bind:this,onclick:e,key:s,type:"button","data-id":s},t)},i._onNewAnalysis=function(){n.ignoreAbortErrors(this.viewModel.start())},i._onDone=function(){this.viewModel.stop()},i._onContinue=function(){this.viewModel.continue()},e._createClass(s,[{key:"analysis",get:function(){return this.viewModel.analysis},set:function(e){this.viewModel.analysis=e}},{key:"test",get:function(){return{IDS:g,projector:this._projector}}}]),s}(u);t.__decorate([s.aliasOf("viewModel.active")],f.prototype,"active",void 0),t.__decorate([a.property({constructOnly:!0,nonNullable:!0})],f.prototype,"analysis",null),t.__decorate([a.property()],f.prototype,"iconClass",void 0),t.__decorate([a.property({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],f.prototype,"label",void 0),t.__decorate([a.property(),p.messageBundle("esri/widgets/LineOfSight/t9n/LineOfSight")],f.prototype,"messages",void 0),t.__decorate([s.aliasOf("viewModel.view")],f.prototype,"view",void 0),t.__decorate([a.property({type:c})],f.prototype,"viewModel",void 0),t.__decorate([s.aliasOf("viewModel.visible")],f.prototype,"visible",void 0),t.__decorate([d.accessibleHandler()],f.prototype,"_onNewAnalysis",null),t.__decorate([d.accessibleHandler()],f.prototype,"_onDone",null),t.__decorate([d.accessibleHandler()],f.prototype,"_onContinue",null),f=t.__decorate([l.subclass("esri.widgets.LineOfSight")],f);return f}));
