{"version":3,"file":"regex.mjs","names":[],"sources":["../../../../../src/components/Message/renderText/regex.ts"],"sourcesContent":["export function escapeRegExp(text: string) {\n  return text.replace(/[-[\\]{}()*+?.,/\\\\^$|#]/g, '\\\\$&');\n}\n\nexport const detectHttp = /(http(s?):\\/\\/)?(www\\.)?/i;\n\n// Module-level so they compile once. The global `codeRegex` and `regexMdLinks` are only used with\n// `String#match`, which resets `lastIndex`; `singleMatch` is non-global, so `.exec` ignores it.\nconst codeRegex = /```[a-z]*\\n[\\s\\S]*?\\n```|`[a-z]*[\\s\\S]*?`/gm;\nconst regexMdLinks = /\\[([^[]+)\\](\\(.*\\))/gm;\nconst singleMatch = /\\[([^[]+)\\]\\((.*)\\)/;\n\nexport const messageCodeBlocks = (message: string) => {\n  const matches = message.match(codeRegex);\n  return matches || [];\n};\n\nexport const matchMarkdownLinks = (message: string) => {\n  const matches = message.match(regexMdLinks);\n\n  const links = matches\n    ? matches.map((match) => {\n        const i = singleMatch.exec(match);\n        return i && [i[1], i[2]];\n      })\n    : [];\n\n  return links.flat();\n};\n"],"mappings":";AAAA,SAAgB,aAAa,MAAc;CACzC,OAAO,KAAK,QAAQ,2BAA2B,MAAM;AACvD;AAEA,IAAa,aAAa;AAI1B,IAAM,YAAY;AAClB,IAAM,eAAe;AACrB,IAAM,cAAc;AAEpB,IAAa,qBAAqB,YAAoB;CAEpD,OADgB,QAAQ,MAAM,SACvB,KAAW,CAAC;AACrB;AAEA,IAAa,sBAAsB,YAAoB;CACrD,MAAM,UAAU,QAAQ,MAAM,YAAY;CAS1C,QAPc,UACV,QAAQ,KAAK,UAAU;EACrB,MAAM,IAAI,YAAY,KAAK,KAAK;EAChC,OAAO,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE;CACzB,CAAC,IACD,CAAC,EAAA,CAEQ,KAAK;AACpB"}