import{proxyCustomElement,HTMLElement}from"@stencil/core/internal/client";import{m as maybeConvertAmount}from"./currency.js";const UNIT_TYPES={kg:"kilogram",lb:"pound",g:"gram",oz:"ounce"},ScFormatNumber=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.value=0,this.locale=void 0,this.type="decimal",this.noGrouping=!1,this.currency="USD",this.currencyDisplay="symbol",this.minimumIntegerDigits=void 0,this.minimumFractionDigits=null,this.maximumFractionDigits=void 0,this.minimumSignificantDigits=void 0,this.maximumSignificantDigits=void 0,this.noConvert=void 0,this.unit="lb"}render(){if(isNaN(this.value))return"";const i=navigator.language||(null===navigator||void 0===navigator?void 0:navigator.browserLanguage)||(navigator.languages||["en"])[0],t=this.noConvert||"currency"!==this.type?this.value:maybeConvertAmount(this.value,this.currency.toUpperCase()),n=t%1==0?0:2;return new Intl.NumberFormat(this.locale||i,{style:this.type,currency:this.currency.toUpperCase(),currencyDisplay:this.currencyDisplay,useGrouping:!this.noGrouping,minimumIntegerDigits:this.minimumIntegerDigits,minimumFractionDigits:null!==this.minimumFractionDigits?this.minimumFractionDigits:n,maximumFractionDigits:this.maximumFractionDigits,minimumSignificantDigits:this.minimumSignificantDigits,maximumSignificantDigits:this.maximumSignificantDigits,unit:UNIT_TYPES[this.unit]}).format(t)}},[0,"sc-format-number",{value:[2],locale:[1025],type:[1],noGrouping:[4,"no-grouping"],currency:[1],currencyDisplay:[1,"currency-display"],minimumIntegerDigits:[2,"minimum-integer-digits"],minimumFractionDigits:[2,"minimum-fraction-digits"],maximumFractionDigits:[2,"maximum-fraction-digits"],minimumSignificantDigits:[2,"minimum-significant-digits"],maximumSignificantDigits:[2,"maximum-significant-digits"],noConvert:[4,"no-convert"],unit:[1]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-format-number"].forEach((i=>{"sc-format-number"===i&&(customElements.get(i)||customElements.define(i,ScFormatNumber))}))}export{ScFormatNumber as S,defineCustomElement as d};