Module 369364

1,775 characters · in 514.d733764d42c2ab66.js
Dependencies
Required by (1)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{m:()=>s});var r=n(243399),i=n(206311),a=n(411211),o=n(501974);function s(e,t){let n=[],s=!1,l=!1,u=(0,o.n)(e),c=u.dataLocale,d=a.Y.localeData[c];if(!d)throw TypeError("Invalid locale");let f=u.numberingSystem,p=d.digitalFormat[f];for(let e=0;e<i.u.length&&!s;e++){let a=i.u[e],o=t[a.valueField],c=u[a.styleSlot],d=u[a.displaySlot],{unit:f,numberFormatUnit:h}=a,m=Object.create(null);("seconds"===f||"milliseconds"===f||"microseconds"===f)&&"numeric"===("seconds"===f?u.milliseconds:"milliseconds"===f?u.microseconds:u.nanoseconds)&&("seconds"===f?o+=t.milliseconds/1e3+t.microseconds/1e6+t.nanoseconds/1e9:"milliseconds"===f?o+=t.microseconds/1e3+t.nanoseconds/1e6:o+=t.nanoseconds/1e3,void 0===u.fractionalDigits?(m.maximumFractionDigits=9,m.minimumFractionDigits=0):(m.maximumFractionDigits=u.fractionalDigits,m.minimumFractionDigits=u.fractionalDigits),m.roundingMode="trunc",s=!0);if(0!==o||"auto"!==d){let e;m.numberingSystem=u.numberingSystem,"2-digit"===c&&(m.minimumIntegerDigits=2),"2-digit"!==c&&"numeric"!==c&&(m.style="unit",m.unit=h,m.unitDisplay=c);let t=(0,r.Nt)(u.locale,m);l?(e=n[n.length-1]).push({type:"literal",value:p}):e=[],t.formatToParts(o).forEach(({type:t,value:n})=>{e.push({type:t,value:n,unit:h})}),l||(("2-digit"===c||"numeric"===c)&&(l=!0),n.push(e))}else l=!1}let h=Object.create(null);h.type="unit";let m=u.style;"digital"===m&&(m="short"),h.style=m;let g=(0,r.A4)(u.locale,h),v=[];for(let e of n){let t="";for(let{value:n}of e)t+=n;v.push(t)}let y=g.formatToParts(v),b=0,_=n.length,w=[];for(let{type:e,value:t}of y)if("element"===e){for(let e of((0,r.V1)(b<_,"Index out of bounds"),n[b]))w.push(e);b++}else(0,r.V1)("literal"===e,"Type must be literal"),w.push({type:"literal",value:t});return w}n(632459)}