import{h as c}from"./moment.1703796278973.js";import"./index.17037962789732.js";import{S as l}from"./consts.1703796278973.js";import{a as s}from"./dayjs.min.1703796278973.js";const u=(e,o,n)=>{const t=document.createElement("a");t.download=`${o?"":e==null?void 0:e.name}${o}-${c(new Date).format(n||"YYYY_MM_DD")}.json`,t.style.display="none";const a=new Blob([JSON.stringify(e)]);t.href=URL.createObjectURL(a),document.body.appendChild(t),t.click(),document.body.removeChild(t)},f=(e,o,n)=>{const t=document.createElement("a");t.style.display="none",t.download=`${o}.${n}`,t.href=e,document.body.appendChild(t),t.click(),document.body.removeChild(t)},p=localStorage.getItem(l.VERSION_CODE)!=="community",y=e=>{const o=e||32,n="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",t=n.length;let a="";for(let r=0;r<o;r+=1)a+=n.charAt(Math.floor(Math.random()*t));return a},g=e=>{let o=0,n=0,t=0;const a="hh小时mm分钟ss秒";return e&&(e>=60*60*1e3&&(o=Math.trunc(e/(60*60*1e3))),e>=60*1e3&&(n=Math.trunc((e-o*60*60*1e3)/(60*1e3))),t=Math.trunc((e-o*(60*60*1e3)-n*60*1e3)/1e3)),a.replace("hh",o.toString()).replace("mm",n.toString()).replace("ss",t.toString())},b=e=>{const o=[],n={};return e.forEach(t=>{t.children||(t.children=[]),n[t.id]=t}),e.forEach(t=>{const a=n[t.parentId];a?a.children.push(t):o.push(t)}),o},w=e=>{let o=0;const n=new Date().getTime();return e==="today"?o=s().startOf("day").valueOf():e==="week"?o=s().subtract(6,"days").valueOf():e==="month"&&(o=s().subtract(29,"days").valueOf()),[s(o),s(n)]};export{b as A,u as a,f as d,w as g,p as i,y as r,g as t};
