FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
Edit File: sc-format-bytes2.js
import{proxyCustomElement,HTMLElement}from"@stencil/core/internal/client";const scFormatBytesCss=":host{display:inline-block}",ScFormatBytesStyle0=scFormatBytesCss,ScFormatBytes=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.locale=void 0,this.value=0,this.unit="byte",this.display="short"}render(){if(isNaN(this.value))return"";const t="bit"===this.unit?["","kilo","mega","giga","tera"]:["","kilo","mega","giga","tera","peta"],e=Math.max(0,Math.min(Math.floor(Math.log10(this.value)/3),t.length-1)),s=t[e]+this.unit,a=parseFloat((this.value/Math.pow(1e3,e)).toPrecision(3));return new Intl.NumberFormat(this.locale,{style:"unit",unit:s,unitDisplay:this.display}).format(a)}static get style(){return ScFormatBytesStyle0}},[1,"sc-format-bytes",{locale:[1],value:[2],unit:[1],display:[1]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-format-bytes"].forEach((t=>{"sc-format-bytes"===t&&(customElements.get(t)||customElements.define(t,ScFormatBytes))}))}export{ScFormatBytes as S,defineCustomElement as d};
Save
Back