prlg-ui 1.8.226 → 1.8.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Image-CI35GQJh.cjs → Image-BPcE12gU.cjs} +1 -1
- package/dist/{Image-BythEdJc.js → Image-BU_5eHO2.js} +1 -1
- package/dist/blocks/index.cjs.js +1 -1
- package/dist/blocks/index.es.js +3 -3
- package/dist/parseFileSize.util-DE7Sk0nR.cjs +1 -0
- package/dist/parseFileSize.util-EJk-rAI5.js +55 -0
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.es.js +88 -87
- package/dist/reka-ui/index.cjs.js +4 -4
- package/dist/reka-ui/index.es.js +2273 -2257
- package/dist/rekaUI.d.ts +15 -1
- package/dist/ru-DQ91TLXh.js +742 -0
- package/dist/ru-aZ6Jw9om.cjs +1 -0
- package/dist/{uploadFile.util-DCFkx3w3.cjs → uploadFile.util-B_xj5G6-.cjs} +1 -1
- package/dist/{uploadFile.util-DhavPrlY.js → uploadFile.util-vuFr0xb6.js} +1 -1
- package/dist/utils/index.cjs.js +1 -1
- package/dist/utils/index.es.js +23 -22
- package/package.json +2 -2
- package/dist/parseFileSize.util-Bg1rLRLQ.cjs +0 -1
- package/dist/parseFileSize.util-CxVk4CvB.js +0 -785
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),d=require("./FileIcon-p0fI09Hd.cjs"),f=require("./CloseIcon-DY724cRE.cjs"),y=require("./parseFileSize.util-
|
|
1
|
+
"use strict";const e=require("vue"),d=require("./FileIcon-p0fI09Hd.cjs"),f=require("./CloseIcon-DY724cRE.cjs"),y=require("./parseFileSize.util-DE7Sk0nR.cjs");class I{stack=[];baseZIndex={confirm:1400,modal:1300,drawer:1200,popover:1100,tooltip:1e3};step=10;childStep=50;idCounter=0;listeners=new Set;subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}notify(){this.listeners.forEach(a=>a())}register(a,o){const i=++this.idCounter,l=o?this.stack.find(u=>u.id===o):void 0;let s;if(l)s=l.zIndex+this.childStep;else{const u=this.stack.filter(c=>c.type===a&&!c.parentId);s=(u.length?Math.max(...u.map(c=>c.zIndex)):this.baseZIndex[a])+this.step}const n={id:i,type:a,parentId:o??null,zIndex:s};return this.stack.push(n),this.notify(),n}unregister(a){this.stack=this.stack.filter(o=>o.id!==a),this.notify()}getTop(){return this.stack.length?this.stack[this.stack.length-1]:null}isTop(a){return this.getTop()?.id===a}getStack(){return[...this.stack]}}const v=new I,g=Symbol("OVERLAY_PARENT");function _(t){const a=e.inject(g,null),o=e.ref(null);return e.onMounted(()=>{o.value=v.register(t,a??null)}),e.onUnmounted(()=>{o.value&&v.unregister(o.value.id)}),e.watch(o,i=>{i&&e.provide(g,i.id)},{immediate:!0}),{zIndex:o,isTop:()=>o.value?v.isTop(o.value.id):!1}}function h(t){return t.startsWith("image/")?"image":t==="application/pdf"?"pdf":t==="application/msword"||t==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"word":t==="application/vnd.ms-excel"||t==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"excel":"other"}const z={key:1,class:"file__title"},E={key:2,class:"file__info"},V={key:0,class:"file__type"},C={key:1,class:"file__info-separator"},N={key:2,class:"file__size"},w=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(t,{emit:a}){const o=a,i=e.useId(),l=e.ref(null);async function s(r,c="image"){const m=await(await fetch(r)).blob(),k=m.type.split("/")[1]||"",B=k?`${c}.${k}`:c;return new File([m],B,{type:m.type})}const n=e.computed(()=>l.value&&l.value.mime?h(l.value.mime):null),u=e.computed(()=>{switch(n.value){case"pdf":return d.PdfIcon;case"word":return d.WordIcon;case"excel":return d.ExcelIcon;case"other":default:return d.FileIcon}});return e.onMounted(async()=>{if(typeof t.file=="string"){const r=await s(t.file);l.value={id:i,url:t.file,name:r.name,mime:r.type,size:r.size}}else l.value=t.file}),(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file",{"file--outlined":r.outlined}])},[r.removable&&typeof r.file!="string"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"file__remove",onClick:c[0]||(c[0]=p=>o("remove",r.file))},[e.createVNode(e.unref(f.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),{class:"file__icon"})),l.value&&l.value.name&&r.viewName?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(l.value?l.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("div",E,[l.value.mime?(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0),l.value.mime&&l.value.size?(e.openBlock(),e.createElementBlock("div",C)):e.createCommentVNode("",!0),l.value.size?(e.openBlock(),e.createElementBlock("div",N,e.toDisplayString(l.value?e.unref(y.formatFileSize)(l.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),F=f._export_sfc(w,[["__scopeId","data-v-7c3d1c11"]]),b={class:"image-full-modal__wrapper"},S={class:"image-full-modal__header"},$={class:"image-full-modal__main"},x=["src","alt"],M=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(t,{expose:a}){const o=e.ref(!1),{zIndex:i}=_("modal");return a({open:()=>{o.value=!0},close:()=>{o.value=!1}}),(l,s)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image-full-modal",style:e.normalizeStyle({zIndex:e.unref(i)?.zIndex})},[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:s[0]||(s[0]=n=>o.value=!1)}),e.createElementVNode("div",b,[e.createElementVNode("div",S,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:s[1]||(s[1]=n=>o.value=!1)},[e.createVNode(e.unref(f.CloseIcon))])]),e.createElementVNode("div",$,[e.createElementVNode("img",{src:l.src,alt:l.alt},null,8,x)]),s[2]||(s[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])],4)):e.createCommentVNode("",!0)]),_:1})]))}}),O=f._export_sfc(M,[["__scopeId","data-v-26b5c867"]]),T=["src","alt"],R={key:1,class:"image__info"},D={key:0,class:"image__size"},q=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean},viewInfo:{type:Boolean,default:!1}},setup(t){const a=e.useId(),o=e.useTemplateRef("imageFullModal"),i=e.ref(null);async function l(n,u="image"){const c=await(await fetch(n)).blob(),p=c.type.split("/")[1]||"",m=p?`${u}.${p}`:u;return new File([c],m,{type:c.type})}const s=e.computed(()=>typeof t.file=="string"?t.file:t.file.url);return e.onMounted(async()=>{if(t.viewInfo)if(typeof t.file=="string"){const n=await l(t.file);i.value={id:a,url:t.file,name:n.name,mime:n.type,size:n.size}}else i.value=t.file}),(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${n.size}`,{"image--full-screen":n.fullScreen}])},[n.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:u[0]||(u[0]=r=>o.value?.open())},[e.createVNode(e.unref(d.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:s.value,alt:n.alt},null,8,T),n.viewInfo&&i.value&&(i.value.mime||i.value.size)&&n.size==="large"?(e.openBlock(),e.createElementBlock("div",R,[i.value.size?(e.openBlock(),e.createElementBlock("div",D,e.toDisplayString(i.value?e.unref(y.formatFileSize)(i.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),n.fullScreen?(e.openBlock(),e.createBlock(O,{key:0,ref:"imageFullModal",src:s.value,alt:n.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),A=f._export_sfc(q,[["__scopeId","data-v-903c99cc"]]);exports.File=F;exports.Image=A;exports.getFileTypeByMime=h;exports.useOverlay=_;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inject as O, ref as h, onMounted as z, onUnmounted as T, watch as V, provide as R, defineComponent as w, useId as C, computed as I, createElementBlock as d, openBlock as o, normalizeClass as x, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as N, toDisplayString as y, Teleport as A, Transition as P, withCtx as Z, normalizeStyle as j, createElementVNode as m, useTemplateRef as W, Fragment as Y } from "vue";
|
|
2
2
|
import { F as D, E as L, W as K, P as U, a as q } from "./FileIcon-C277kDuk.js";
|
|
3
3
|
import { C as E, _ as F } from "./CloseIcon-DwfoI5oL.js";
|
|
4
|
-
import { f as M } from "./parseFileSize.util-
|
|
4
|
+
import { f as M } from "./parseFileSize.util-EJk-rAI5.js";
|
|
5
5
|
class G {
|
|
6
6
|
stack = [];
|
|
7
7
|
baseZIndex = {
|
package/dist/blocks/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-BPcE12gU.cjs"),f=require("../CloseIcon-DY724cRE.cjs"),p=require("../FileIcon-p0fI09Hd.cjs"),m=require("../SendIcon-NKtDMH_Z.cjs"),_=require("../parseFileSize.util-DE7Sk0nR.cjs"),v=require("../uploadFile.util-B_xj5G6-.cjs"),h={class:"chat-file__content"},k=e.defineComponent({__name:"ChatFile",props:{file:{}},emits:["deleteFile"],setup(s,{emit:n}){const i=n,r=e.computed(()=>URL.createObjectURL(s.file));return(t,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-file",{"chat-file--image":e.unref(u.getFileTypeByMime)(t.file.type)==="image"}])},[e.createElementVNode("button",{class:"chat-file__delete",onClick:c[0]||(c[0]=l=>i("deleteFile",t.file))},[e.createVNode(e.unref(f.CloseIcon))]),e.createElementVNode("div",h,[e.unref(u.getFileTypeByMime)(t.file.type)==="image"?(e.openBlock(),e.createBlock(e.unref(u.Image),{key:0,file:r.value,size:"large",fullScreen:""},null,8,["file"])):(e.openBlock(),e.createBlock(e.unref(u.File),{key:1,file:r.value,outlined:!1},null,8,["file"]))])],2))}}),g=f._export_sfc(k,[["__scopeId","data-v-12b8458b"]]),B={class:"chat-field-actions"},y={ref:"overlay",class:"chat-field-actions__overlay"},b=["onClick"],C={class:"chat-field-actions__overlay-item__label"},V=["disabled"],F=e.defineComponent({__name:"ChatFieldActions",props:e.mergeModels({actions:{},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const n=e.useModel(s,"modelValue"),i=e.useTemplateRef("button"),r=e.useTemplateRef("overlay"),t=e.ref(!1),c=e.reactive({image:{icon:e.shallowRef(m.ImageIcon),label:"Добавить изображение"},file:{icon:e.shallowRef(p.FileIcon),label:"Добавить файл"}}),l=a=>{v.openFileDialog({accept:a==="image"?["image"]:["pdf","excel","word"],maxFileSize:"5mb",maxFiles:1}).then(o=>{n.value?n.value=s.multiple?[...n.value,...o]:o:n.value=[...o],t.value=!1})};return e.onMounted(()=>{_.onClickOutside(r.value,()=>{t.value=!1},{ignore:[i.value]})}),(a,o)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.actions,d=>(e.openBlock(),e.createElementBlock("div",{class:"chat-field-actions__overlay-item",key:d,onClick:R=>l(d)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c[d].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",C,e.toDisplayString(c[d].label),1)],8,b))),128))],512),[[e.vShow,t.value]])]),_:1}),e.createElementVNode("button",{ref:"button",onClick:o[0]||(o[0]=d=>t.value=!t.value),class:e.normalizeClass(["chat-field-actions__button",{"chat-field-actions__button--active":t.value}]),disabled:a.disabled},[e.createVNode(e.unref(m.PlusRoundedIcon))],10,V)]))}}),E=f._export_sfc(F,[["__scopeId","data-v-62b95e1b"]]),N={class:"chat-field"},M={key:0,class:"chat-field__files"},T={class:"chat-field__wrapper"},I=["maxlength","placeholder"],S={key:1,class:"chat-field__footer"},$={key:1,class:"chat-field__char-count"},w=e.defineComponent({__name:"ChatField",props:e.mergeModels({viewActions:{type:Boolean,default:!1},actions:{default:()=>["file","image"]},placeholder:{default:"Введите сообщение"},maxLength:{},smallText:{},error:{type:Boolean},errorText:{},disabled:{type:Boolean,default:!1}},{message:{required:!0},messageModifiers:{},files:{},filesModifiers:{}}),emits:e.mergeModels(["sendMessage"],["update:message","update:files"]),setup(s,{emit:n}){const i=n,r=e.useModel(s,"message"),t=e.useModel(s,"files"),c=l=>{t.value&&(t.value=t.value.filter(a=>a.name!==l.name))};return(l,a)=>(e.openBlock(),e.createElementBlock("div",N,[t.value&&t.value.length>0?(e.openBlock(),e.createElementBlock("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,o=>(e.openBlock(),e.createBlock(g,{key:o.name,file:o,onDeleteFile:c},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",T,[l.viewActions&&l.actions.length>0?(e.openBlock(),e.createBlock(E,{key:0,modelValue:t.value,"onUpdate:modelValue":a[0]||(a[0]=o=>t.value=o),actions:l.actions,disabled:l.disabled},null,8,["modelValue","actions","disabled"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=o=>r.value=o),class:"chat-field__input",maxlength:l.maxLength,placeholder:l.placeholder},null,8,I),[[e.vModelText,r.value]]),e.createElementVNode("button",{class:"chat-field__button",onClick:a[2]||(a[2]=o=>i("sendMessage"))},[e.createVNode(e.unref(m.SendIcon))])]),l.smallText||l.error&&l.errorText||l.maxLength?(e.openBlock(),e.createElementBlock("div",S,[l.smallText||l.error&&l.errorText?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["chat-field__small",{"chat-field__small--error":l.error}])},e.toDisplayString(l.error?l.errorText:l.smallText),3)):e.createCommentVNode("",!0),l.maxLength?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(r.value.length)+" / "+e.toDisplayString(l.maxLength),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),L={class:"bonus-summary"},D=e.defineComponent({__name:"BonusSummary",setup(s){return(n,i)=>(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(e.unref(m.BonusIcon),{class:"bonus-summary__icon"}),i[0]||(i[0]=e.createElementVNode("div",{class:"bonus-summary__number"},"123",-1))]))}});exports.BonusSummary=D;exports.ChatField=w;
|
package/dist/blocks/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as g, computed as V, createElementBlock as o, openBlock as a, normalizeClass as C, unref as c, createElementVNode as n, createVNode as v, createBlock as p, mergeModels as y, useModel as b, useTemplateRef as F, ref as L, reactive as w, shallowRef as k, onMounted as S, Transition as R, withCtx as D, withDirectives as B, Fragment as I, renderList as T, resolveDynamicComponent as U, toDisplayString as h, vShow as z, createCommentVNode as _, vModelText as N } from "vue";
|
|
2
|
-
import { g as $, I as O, F as x } from "../Image-
|
|
2
|
+
import { g as $, I as O, F as x } from "../Image-BU_5eHO2.js";
|
|
3
3
|
import { C as A, _ as M } from "../CloseIcon-DwfoI5oL.js";
|
|
4
4
|
import { F as E } from "../FileIcon-C277kDuk.js";
|
|
5
5
|
import { I as P, P as j, S as q, B as H } from "../SendIcon-Cx3-Nh9T.js";
|
|
6
|
-
import { o as G } from "../parseFileSize.util-
|
|
7
|
-
import { o as J } from "../uploadFile.util-
|
|
6
|
+
import { o as G } from "../parseFileSize.util-EJk-rAI5.js";
|
|
7
|
+
import { o as J } from "../uploadFile.util-vuFr0xb6.js";
|
|
8
8
|
const K = { class: "chat-file__content" }, Q = /* @__PURE__ */ g({
|
|
9
9
|
__name: "ChatFile",
|
|
10
10
|
props: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("vue"),e=require("./ru-aZ6Jw9om.cjs"),u=new WeakMap;function f(n){const r=m.unref(n);return r?.$el??r}function x(n){return typeof n=="string"?document.querySelector(n):f(n)}function y(n,r,o={}){const t=x(n);if(!t)return()=>{};const i=u.get(t);i&&(i(),u.delete(t));const a=d=>{const c=d.target instanceof Node?d.target:null;if(!c)return;const p=(m.toValue(o.ignore)??[]).map(s=>typeof s=="string"?document.querySelector(s):f(s)).filter(s=>s!=null);t.contains(c)||p.some(s=>s.contains(c))||r(d)};document.addEventListener("mousedown",a,{capture:!0}),document.addEventListener("touchstart",a,{capture:!0});const l=()=>{document.removeEventListener("mousedown",a,{capture:!0}),document.removeEventListener("touchstart",a,{capture:!0}),u.delete(t)};return u.set(t,l),l}e.dayjs.extend(e.localizedFormat);e.dayjs.extend(e.relativeTime);e.dayjs.extend(e.isToday);e.dayjs.extend(e.isBetween);e.dayjs.extend(e.isSameOrBefore);e.dayjs.extend(e.isSameOrAfter);e.dayjs.extend(e.duration);e.dayjs.extend(e.customParseFormat);e.dayjs.extend(e.dayOfYear);e.dayjs.locale("ru");const g=n=>{const r=["b","kb","mb","gb","tb"],o=n.match(/[a-zA-Z]+/)?.[0]||"b",t=parseFloat(n.replace(o,"")),i=r.indexOf(o.toLowerCase());return t*Math.pow(1024,i)};function v(n){if(isNaN(n)||n<0)return"0 Б";const r=["Б","КБ","МБ","ГБ","ТБ"];let o=0,t=n;for(;t>=1024&&o<r.length-1;)t=t/1024,o++;return`${t%1===0?t:t.toFixed(0)} ${r[o]}`}exports.formatFileSize=v;exports.onClickOutside=y;exports.parseFileSize=g;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { toValue as p, unref as x } from "vue";
|
|
2
|
+
import { d as n, l as g, r as v, i as w, a as E, b as h, c as F, e as L, f as S, g as b } from "./ru-DQ91TLXh.js";
|
|
3
|
+
const u = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function m(t) {
|
|
5
|
+
const r = x(t);
|
|
6
|
+
return r?.$el ?? r;
|
|
7
|
+
}
|
|
8
|
+
function y(t) {
|
|
9
|
+
return typeof t == "string" ? document.querySelector(t) : m(t);
|
|
10
|
+
}
|
|
11
|
+
function z(t, r, o = {}) {
|
|
12
|
+
const e = y(t);
|
|
13
|
+
if (!e) return () => {
|
|
14
|
+
};
|
|
15
|
+
const s = u.get(e);
|
|
16
|
+
s && (s(), u.delete(e));
|
|
17
|
+
const i = (c) => {
|
|
18
|
+
const d = c.target instanceof Node ? c.target : null;
|
|
19
|
+
if (!d) return;
|
|
20
|
+
const f = (p(o.ignore) ?? []).map((a) => typeof a == "string" ? document.querySelector(a) : m(a)).filter((a) => a != null);
|
|
21
|
+
e.contains(d) || f.some((a) => a.contains(d)) || r(c);
|
|
22
|
+
};
|
|
23
|
+
document.addEventListener("mousedown", i, { capture: !0 }), document.addEventListener("touchstart", i, { capture: !0 });
|
|
24
|
+
const l = () => {
|
|
25
|
+
document.removeEventListener("mousedown", i, { capture: !0 }), document.removeEventListener("touchstart", i, { capture: !0 }), u.delete(e);
|
|
26
|
+
};
|
|
27
|
+
return u.set(e, l), l;
|
|
28
|
+
}
|
|
29
|
+
n.extend(g);
|
|
30
|
+
n.extend(v);
|
|
31
|
+
n.extend(w);
|
|
32
|
+
n.extend(E);
|
|
33
|
+
n.extend(h);
|
|
34
|
+
n.extend(F);
|
|
35
|
+
n.extend(L);
|
|
36
|
+
n.extend(S);
|
|
37
|
+
n.extend(b);
|
|
38
|
+
n.locale("ru");
|
|
39
|
+
const C = (t) => {
|
|
40
|
+
const r = ["b", "kb", "mb", "gb", "tb"], o = t.match(/[a-zA-Z]+/)?.[0] || "b", e = parseFloat(t.replace(o, "")), s = r.indexOf(o.toLowerCase());
|
|
41
|
+
return e * Math.pow(1024, s);
|
|
42
|
+
};
|
|
43
|
+
function T(t) {
|
|
44
|
+
if (isNaN(t) || t < 0) return "0 Б";
|
|
45
|
+
const r = ["Б", "КБ", "МБ", "ГБ", "ТБ"];
|
|
46
|
+
let o = 0, e = t;
|
|
47
|
+
for (; e >= 1024 && o < r.length - 1; )
|
|
48
|
+
e = e / 1024, o++;
|
|
49
|
+
return `${e % 1 === 0 ? e : e.toFixed(0)} ${r[o]}`;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
T as f,
|
|
53
|
+
z as o,
|
|
54
|
+
C as p
|
|
55
|
+
};
|