{"version":3,"file":"utils.mjs","sources":["../../../src/primitives/Comment/utils.ts"],"sourcesContent":["import type {\n  CommentBodyElement,\n  CommentBodyLink,\n  CommentBodyMention,\n  CommentBodyText,\n} from \"@liveblocks/core\";\n\nexport function isCommentBodyText(\n  element: CommentBodyElement\n): element is CommentBodyText {\n  return \"text\" in element && typeof element.text === \"string\";\n}\n\nexport function isCommentBodyMention(\n  element: CommentBodyElement\n): element is CommentBodyMention {\n  return \"type\" in element && element.type === \"mention\";\n}\n\nexport function isCommentBodyLink(\n  element: CommentBodyElement\n): element is CommentBodyLink {\n  return \"type\" in element && element.type === \"link\";\n}\n\n/**\n * Helper function to convert a URL (relative or absolute) to an absolute URL.\n *\n * @param url The URL to convert to an absolute URL (relative or absolute).\n * @returns The absolute URL or undefined if the URL is invalid.\n */\nexport function toAbsoluteUrl(url: string): string | undefined {\n  // Check if the URL already contains a scheme\n  if (url.startsWith(\"http://\") || url.startsWith(\"https://\")) {\n    return url;\n  } else if (url.startsWith(\"www.\")) {\n    // If the URL starts with \"www.\", prepend \"https://\"\n    return \"https://\" + url;\n  }\n\n  return;\n}\n"],"names":[],"mappings":"AAOO,SAAS,kBACd,OAC4B,EAAA;AAC5B,EAAA,OAAO,MAAU,IAAA,OAAA,IAAW,OAAO,OAAA,CAAQ,IAAS,KAAA,QAAA,CAAA;AACtD,CAAA;AAEO,SAAS,qBACd,OAC+B,EAAA;AAC/B,EAAO,OAAA,MAAA,IAAU,OAAW,IAAA,OAAA,CAAQ,IAAS,KAAA,SAAA,CAAA;AAC/C,CAAA;AAEO,SAAS,kBACd,OAC4B,EAAA;AAC5B,EAAO,OAAA,MAAA,IAAU,OAAW,IAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,CAAA;AAC/C,CAAA;AAQO,SAAS,cAAc,GAAiC,EAAA;AAE7D,EAAA,IAAI,IAAI,UAAW,CAAA,SAAS,KAAK,GAAI,CAAA,UAAA,CAAW,UAAU,CAAG,EAAA;AAC3D,IAAO,OAAA,GAAA,CAAA;AAAA,GACE,MAAA,IAAA,GAAA,CAAI,UAAW,CAAA,MAAM,CAAG,EAAA;AAEjC,IAAA,OAAO,UAAa,GAAA,GAAA,CAAA;AAAA,GACtB;AAEA,EAAA,OAAA;AACF;;;;"}