/*
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 s}from"tslib";import{onLocaleChange as e,fetchMessageBundle as t}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as a}from"../../core/asyncUtils.js";import{formatLength as i,formatVerticalLength as o,formatArea as m,formatVolume as n,formatDecimal as g}from"../../core/quantityFormatUtils.js";import{formatAngleDegrees as u}from"../../core/unitFormatUtils.js";import{property as h,subclass as l}from"../../core/accessorSupport/decorators.js";let _=class extends r{constructor(s){super(s)}initialize(){this.addHandles(e(()=>this._load())),this._load()}destroy(){this._messagesTask.abort()}async when(){await this._messagesTask.promise}_load(){return null!=this._messagesTask&&this._messagesTask.abort(),this._messagesTask=a(()=>t("esri/core/t9n/Units")),this._messagesTask.promise}get _messages(){return this._messagesTask.value}formatLength(s,e,t){return this._messages?i(this._messages,s,s.unit,e,t):""}formatVerticalLength(s,e,t){return this._messages?o(this._messages,s,s.unit,e,t):""}formatArea(s,e,t){return this._messages?m(this._messages,s,s.unit,e,t):""}formatVolume(s,e,t){return this._messages?n(this._messages,s,s.unit,e,t):""}formatDecimal(s,e,t){return this._messages?g(this._messages,s,s.unit,e,t):""}formatAngleDegrees(s,e,t,r,a){return u(s,e,t,r,a)}};s([h()],_.prototype,"_messagesTask",void 0),s([h()],_.prototype,"_messages",null),_=s([l("esri.applications.Components.QuantityFormatter")],_);const c=_;export{c as default};
