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