export const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]); export const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1); export async function blobToBase64(blob) { const bytes = new Uint8Array(await blob.arrayBuffer()); let s = ""; for (let i = 0; i < bytes.length; i += 0x8000) s += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000)); return btoa(s); } export const fileName = (p) => String(p).split(/[\\/]/).pop();