import { Link } from "react-router-dom"; import Invoice from "./element/Invoice"; import { UrlRegex, FileExtensionRegex, MentionRegex, InvoiceRegex } from "./Const"; import { eventLink, profileLink } from "./Util"; export function extractLinks(fragments) { return fragments.map(f => { if (typeof f === "string") { return f.split(UrlRegex).map(a => { if (a.startsWith("http")) { try { const url = new URL(a); const vParam = url.searchParams.get('v') const isYoutube = (url.host === "www.youtube.com" || url.host === "youtube.com" ) && vParam const ext = url.pathname.toLowerCase().match(FileExtensionRegex); if (ext) { switch (ext[1]) { case "gif": case "jpg": case "jpeg": case "png": case "bmp": case "webp": { return ; } case "mp4": case "mov": case "mkv": case "avi": case "m4v": { return