UNPKG

@aplus-frontend/ui

Version:

70 lines (69 loc) 1.74 kB
import { ApDownLoadNeedNameKeyDefault as p } from "../interface.mjs"; function u(r, t) { if (r === !0) { if (typeof t == "string") return [ { path: t, fileName: t } ]; if (Array.isArray(t)) return t.map((n) => ({ path: n?.[p.pathKey] ?? n, fileName: n?.[p.nameKey] ?? n })); if (typeof t == "object") return [ { path: t?.[p.pathKey], fileName: t?.[p.nameKey] } ]; } else if (typeof r == "object") { if (typeof t == "string") return [ { path: t, fileName: t } ]; if (Array.isArray(t)) return t.map((n) => ({ path: n?.[r?.pathKey || p.pathKey] ?? n, fileName: n?.[r?.nameKey || p.nameKey] ?? n })); if (typeof t == "object") return [ { path: t?.[r?.pathKey || p.pathKey], fileName: t?.[r?.nameKey || p.nameKey] } ]; } else { if (typeof t == "string") return [ { path: t, fileName: t } ]; if (Array.isArray(t)) return t.map((n) => typeof n == "string" ? { path: n, fileName: n } : n); if (typeof t == "object") return [t]; } return []; } function c(r, t) { r.length === 4 && (r = `#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`); const n = parseInt(r.slice(1, 3), 16), y = parseInt(r.slice(3, 5), 16), s = parseInt(r.slice(5, 7), 16), a = Math.round(t * 255).toString(16).padStart(2, "0"); return `#${n.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${s.toString(16).padStart(2, "0")}${a}`; } export { u as getFileInfo, c as getHexWithOpacity };