{
  "version": 3,
  "sources": ["../../../../../src/lib/ui/hooks/clipboard/pasteUrl.ts"],
  "sourcesContent": ["import { Editor, TLExternalContentSource, VecLike } from '@bigbluebutton/editor'\nimport { pasteFiles } from './pasteFiles'\n\n/**\n * When the clipboard has plain text that is a valid URL, create a bookmark shape and insert it into\n * the scene\n *\n * @param editor - The editor instance.\n * @param url - The URL to paste.\n * @param point - The point at which to paste the file.\n * @internal\n */\nexport async function pasteUrl(\n\teditor: Editor,\n\turl: string,\n\tpoint?: VecLike,\n\tsources?: TLExternalContentSource[]\n) {\n\t// Lets see if its an image and we have CORs\n\ttry {\n\t\t// skip this step if the url doesn't contain an image extension, treat it as a regular bookmark\n\t\tif (new URL(url).pathname.match(/\\.(png|jpe?g|gif|svg|webp)$/i)) {\n\t\t\tconst resp = await fetch(url, { method: 'HEAD' })\n\t\t\tif (resp.headers.get('content-type')?.match(/^image\\//)) {\n\t\t\t\teditor.mark('paste')\n\t\t\t\tpasteFiles(editor, [url])\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} catch (err: any) {\n\t\tif (err.message !== 'Failed to fetch') {\n\t\t\tconsole.error(err)\n\t\t}\n\t}\n\n\teditor.mark('paste')\n\n\treturn await editor.putExternalContent({\n\t\ttype: 'url',\n\t\tpoint,\n\t\turl,\n\t\tsources,\n\t})\n}\n"],
  "mappings": "AACA,SAAS,kBAAkB;AAW3B,eAAsB,SACrB,QACA,KACA,OACA,SACC;AAED,MAAI;AAEH,QAAI,IAAI,IAAI,GAAG,EAAE,SAAS,MAAM,8BAA8B,GAAG;AAChE,YAAM,OAAO,MAAM,MAAM,KAAK,EAAE,QAAQ,OAAO,CAAC;AAChD,UAAI,KAAK,QAAQ,IAAI,cAAc,GAAG,MAAM,UAAU,GAAG;AACxD,eAAO,KAAK,OAAO;AACnB,mBAAW,QAAQ,CAAC,GAAG,CAAC;AACxB;AAAA,MACD;AAAA,IACD;AAAA,EACD,SAAS,KAAU;AAClB,QAAI,IAAI,YAAY,mBAAmB;AACtC,cAAQ,MAAM,GAAG;AAAA,IAClB;AAAA,EACD;AAEA,SAAO,KAAK,OAAO;AAEnB,SAAO,MAAM,OAAO,mBAAmB;AAAA,IACtC,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AACF;",
  "names": []
}
