/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as o,subclass as r}from"../core/accessorSupport/decorators.js";import n from"../views/interactive/snapping/SnappingOptions.js";import a from"./Widget.js";import p from"./AreaMeasurement2D/AreaMeasurement2DViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{MeasurementWidgetContent as m}from"./support/MeasurementWidgetContent.js";import{messageBundle as u,tsx as g}from"./support/widget.js";const v="esri-area-measurement-2d",d={base:v,newMeasurementButton:`${v}__clear-button`};let c=class extends a{constructor(e,i){super(e,i),this.messages=null,this.messagesUnits=null,this.messagesCommon=null,this.viewModel=new p,t(s.getLogger(this),"Area Measurement 2D","arcgis-area-measurement-2d",{version:"5.0"})}get active(){return this.viewModel.active}get icon(){return"measure-area"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,messagesUnits:s,unit:o,unitOptions:r,viewModel:n,visible:a}=this,{active:p,measurementLabel:u,state:v,supported:c}=n;return g("div",{"aria-label":e.widgetLabel,class:this.classes(d.base,l.widget,l.panel),key:this,role:"region"},a?g(m,{active:p,measurementItems:[{key:"area",title:s?.measures.area,value:u?.area},{key:"perimeter",title:e.perimeter,value:u?.perimeter}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:d.newMeasurementButton,state:v,supported:c,unit:o,unitOptions:r,onNewMeasurementClick:()=>{i(n.start())},onUnitChange:e=>{this.unit=e}}):null)}};e([o({readOnly:!0})],c.prototype,"active",null),e([o()],c.prototype,"icon",null),e([o()],c.prototype,"label",null),e([o(),u("esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D")],c.prototype,"messages",void 0),e([o(),u("esri/core/t9n/Units")],c.prototype,"messagesUnits",void 0),e([o(),u("esri/t9n/common")],c.prototype,"messagesCommon",void 0),e([o({type:n})],c.prototype,"snappingOptions",null),e([o()],c.prototype,"uiStrings",void 0),e([o()],c.prototype,"unit",null),e([o()],c.prototype,"unitOptions",null),e([o()],c.prototype,"view",null),e([o({type:p})],c.prototype,"viewModel",void 0),e([o({type:Boolean})],c.prototype,"visible",null),c=e([r("esri.widgets.AreaMeasurement2D")],c);const w=c;export{w as default};
