UNPKG

@glodon-aiot/react-components

Version:

aiot react components

30 lines (29 loc) 801 B
function c(i) { const t = i.split(/(```[\s\S]*?```|`[^`]*?`|<code>[\s\S]*?<\/code>)/); let s = ""; for (let e = 0; e < t.length; e++) if (e % 2 === 0) { let l = t[e].replaceAll(/\\\[([\s\S]*?)\\\]/g, (r, n) => `$$${n}$$`).replaceAll(/\\\(([\s\S]*?)\\\)/g, (r, n) => `$${n}$`); s += l; } else s += t[e]; return s; } function p(i) { var n; const t = (() => { try { return new URL(i); } catch (o) { return null; } })(); if (!t) return null; const e = ((n = t.pathname.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "", l = ["jpg", "jpeg", "gif", "png"], r = ["mp4", "wmv", "avi", "mov"]; return l.includes(e) ? "image" : r.includes(e) ? "video" : null; } export { p as checkMediaType, c as replaceLatexDelimiters };