/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./byteSizeEstimations","./Cyclical","./mathUtils","./maybe","./string","./unitUtils","../intl/number"],(function(t,e,r,n,i,a,o,c){"use strict";function u(t,e,r){return t.units[e][r]}function m(t,e,r,n=2,i="abbr"){return`${c.formatNumber(e,{minimumFractionDigits:n,maximumFractionDigits:n})} ${u(t,r,i)}`}function l(t,e,r,n=2,i="abbr"){return`${c.formatNumber(e,{minimumFractionDigits:n,maximumFractionDigits:n,signDisplay:"exceptZero"})} ${u(t,r,i)}`}function f(t,e,r,n=2,i="abbr"){const a=o.preferredMetricLengthUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function s(t,e,r,n=2,i="abbr"){const a=o.preferredMetricLengthUnit(e,r);return l(t,o.convertUnit(e,r,a),a,n,i)}function g(t,e,r,n=2,i="abbr"){const a=o.preferredMetricVerticalLengthUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function b(t,e,r,n=2,i="abbr"){const a=o.preferredMetricVerticalLengthUnit(e,r);return l(t,o.convertUnit(e,r,a),a,n,i)}function p(t,e,r,n=2,i="abbr"){const a=o.preferredImperialLengthUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function U(t,e,r,n=2,i="abbr"){const a=o.preferredImperialLengthUnit(e,r);return l(t,o.convertUnit(e,r,a),a,n,i)}function h(t,e,r,n=2,i="abbr"){const a=o.preferredImperialVerticalLengthUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function d(t,e,r,n=2,i="abbr"){const a=o.preferredImperialVerticalLengthUnit(e,r);return l(t,o.convertUnit(e,r,a),a,n,i)}function v(t,e,r,n=2,i="abbr"){const a=o.preferredMetricAreaUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function D(t,e,r,n=2,i="abbr"){const a=o.preferredImperialAreaUnit(e,r);return m(t,o.convertUnit(e,r,a),a,n,i)}function M(t,e,r=2){let n=o.convertUnit(t,e,"degrees"),i=n-Math.floor(n);n-=i,i*=60;let a=i-Math.floor(i);return i-=a,a*=60,`${n.toFixed()}° ${i.toFixed()}' ${a.toFixed(r)}"`}function L(t,e,n,a,u){const m=r.cyclicalDegrees.normalize(y(o.convertUnit(t,e,"degrees"),n,a),0,!0);return u=i.unwrapOr(u,2),c.formatNumber(m,{style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:u,minimumFractionDigits:u})}function y(t,e,r){if(e===r)return t;switch(r){case"arithmetic":return F(t);case"geographic":return I(t)}}function F(t){return 90-t}function I(t){return-t-90}function x(t,e,r,n,a){r!==n&&(t=-t);const u=o.convertUnit(t,e,"degrees")%360;return a=i.unwrapOr(a,2),c.formatNumber(u,{style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:a,minimumFractionDigits:a,signDisplay:"exceptZero"})}const S=["B","kB","MB","GB","TB"];function B(t,r){let i=0===r?0:Math.floor(Math.log(r)/Math.log(e.ByteSizeUnit.KILOBYTES));i=n.clamp(i,0,S.length-1);const o=c.formatNumber(r/e.ByteSizeUnit.KILOBYTES**i,{maximumFractionDigits:2});return a.replace(t.units.bytes[S[i]],{fileSize:o})}t.formatAngleDegrees=L,t.formatDMS=M,t.formatDecimal=m,t.formatFileSize=B,t.formatImperialArea=D,t.formatImperialLength=p,t.formatImperialRelativeLength=U,t.formatImperialRelativeVerticalLength=d,t.formatImperialVerticalLength=h,t.formatMetricArea=v,t.formatMetricLength=f,t.formatMetricRelativeLength=s,t.formatMetricRelativeVerticalLength=b,t.formatMetricVerticalLength=g,t.formatRelativeAngleDegrees=x,t.formatRelativeDecimal=l,t.unitName=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
