{
  "version": 3,
  "sources": ["../../../../src/lib/ui/hooks/useClipboardEvents.ts"],
  "sourcesContent": ["import {\n\tEditor,\n\tFileHelpers,\n\tTLClipboardWriteInfo,\n\tTLExternalContentSource,\n\tVecLike,\n\tactiveElementShouldCaptureKeys,\n\tassert,\n\tcompact,\n\tgetGlobalDocument,\n\tisDefined,\n\tpreventDefault,\n\tuniq,\n\tuseEditor,\n\tuseMaybeEditor,\n\tuseValue,\n} from '@tldraw/editor'\nimport lz from 'lz-string'\nimport { useCallback, useEffect } from 'react'\nimport { defaultHandleExternalTextContent } from '../../defaultExternalContentHandlers'\nimport { TLDRAW_CUSTOM_PNG_MIME_TYPE, getCanonicalClipboardReadType } from '../../utils/clipboard'\nimport { TLUiEventSource, useUiEvents } from '../context/events'\nimport { pasteFiles } from './clipboard/pasteFiles'\nimport { pasteUrl } from './clipboard/pasteUrl'\n\n/**\n * Resolves paste modifier keys into plain-text and position behavior.\n * Alt/Option inverts the paste-at-cursor user preference.\n *\n * @param isShift - Whether the Shift key is pressed (indicates plain text paste)\n * @param isAlt - Whether the Alt/Option key is pressed (inverts paste position preference)\n * @param pasteAtCursorPref - The user's preference for pasting at the cursor (true) or center (false)\n *\n * @internal\n */\nexport function resolvePasteModifiers(\n\tisShift: boolean,\n\tisAlt: boolean,\n\tpasteAtCursorPref: boolean\n) {\n\treturn {\n\t\tisPlainText: isShift,\n\t\tpasteAtCursor: isAlt ? !pasteAtCursorPref : pasteAtCursorPref,\n\t}\n}\n\n// Expected paste mime types. The earlier in this array they appear, the higher preference we give\n// them. For example, we prefer the `web image/png+tldraw` type to plain `image/png` as it does not\n// strip some of the extra metadata we write into it.\nconst expectedPasteFileMimeTypes = [\n\tTLDRAW_CUSTOM_PNG_MIME_TYPE,\n\t'image/png',\n\t'image/jpeg',\n\t'image/webp',\n\t'image/svg+xml',\n] satisfies string[]\n\n/**\n * Strip HTML tags from a string.\n * @param html - The HTML to strip.\n * @internal\n */\nfunction stripHtml(html: string) {\n\t// See <https://github.com/developit/preact-markup/blob/4788b8d61b4e24f83688710746ee36e7464f7bbc/src/parse-markup.js#L60-L69>\n\tconst doc = getGlobalDocument().implementation.createHTMLDocument('')\n\tdoc.documentElement.innerHTML = html.trim()\n\treturn doc.body.textContent || doc.body.innerText || ''\n}\n\n/**\n * Extract iframe src and dimensions from an HTML string containing an iframe element.\n * Tries width/height HTML attributes first, then falls back to pixel values in the\n * style attribute, then to sensible defaults.\n * Returns null if no valid iframe is found.\n * @internal\n */\nexport function extractIframeFromHtml(\n\thtml: string\n): { src: string; width: number; height: number } | null {\n\tif (!html.includes('<iframe')) return null\n\tconst doc = new DOMParser().parseFromString(html, 'text/html')\n\tconst iframe = doc.querySelector('iframe')\n\tif (!iframe) return null\n\tconst src = iframe.getAttribute('src')\n\tif (!src || !isValidHttpURL(src)) return null\n\n\tconst attrWidth = parseInt(iframe.getAttribute('width') || '', 10)\n\tconst attrHeight = parseInt(iframe.getAttribute('height') || '', 10)\n\n\tlet styleWidth = NaN\n\tlet styleHeight = NaN\n\tconst style = iframe.getAttribute('style')\n\tif (style) {\n\t\tconst wMatch = style.match(/\\bwidth:\\s*(\\d+)px/)\n\t\tconst hMatch = style.match(/\\bheight:\\s*(\\d+)px/)\n\t\tif (wMatch) styleWidth = parseInt(wMatch[1], 10)\n\t\tif (hMatch) styleHeight = parseInt(hMatch[1], 10)\n\t}\n\n\tconst width = attrWidth || styleWidth || 425\n\tconst height = attrHeight || styleHeight || 350\n\treturn { src, width, height }\n}\n\n/** @public */\nexport const isValidHttpURL = (url: string) => {\n\ttry {\n\t\tconst u = new URL(url)\n\t\treturn u.protocol === 'http:' || u.protocol === 'https:'\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/** @public */\nconst getValidHttpURLList = (url: string) => {\n\tconst urls = url.split(/[\\n\\s]/)\n\tfor (const url of urls) {\n\t\ttry {\n\t\t\tconst u = new URL(url)\n\t\t\tif (!(u.protocol === 'http:' || u.protocol === 'https:')) {\n\t\t\t\treturn\n\t\t\t}\n\t\t} catch {\n\t\t\treturn\n\t\t}\n\t}\n\treturn uniq(urls)\n}\n\n/** @public */\nconst isSvgText = (text: string) => {\n\treturn /^<svg/.test(text)\n}\n\n/**\n * Get whether to disallow clipboard events.\n *\n * @internal\n */\nfunction areShortcutsDisabled(editor: Editor) {\n\treturn (\n\t\teditor.menus.hasAnyOpenMenus() ||\n\t\tactiveElementShouldCaptureKeys(false, editor.getContainerDocument())\n\t)\n}\n\nimport { putPastedExternalContent } from './clipboard/putPastedContent'\nexport { putPastedExternalContent } from './clipboard/putPastedContent'\n\n/**\n * Handle text pasted into the editor.\n * @param editor - The editor instance.\n * @param data - The text to paste.\n * @param point - The point at which to paste the text.\n * @internal\n */\nconst handleText = (\n\teditor: Editor,\n\tdata: string,\n\tpoint?: VecLike,\n\tsources?: TLExternalContentSource[],\n\tclipboardPasteSource: 'native-event' | 'clipboard-read' = 'native-event'\n) => {\n\tconst validUrlList = getValidHttpURLList(data)\n\tif (validUrlList) {\n\t\tfor (const url of validUrlList) {\n\t\t\tpasteUrl(editor, url, point, sources, clipboardPasteSource)\n\t\t}\n\t} else if (isValidHttpURL(data)) {\n\t\tpasteUrl(editor, data, point, sources, clipboardPasteSource)\n\t} else if (isSvgText(data)) {\n\t\teditor.markHistoryStoppingPoint('paste')\n\t\tputPastedExternalContent(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: 'svg-text',\n\t\t\t\ttext: data,\n\t\t\t\tpoint,\n\t\t\t\tsources,\n\t\t\t},\n\t\t\t{ source: clipboardPasteSource, point }\n\t\t)\n\t} else {\n\t\teditor.markHistoryStoppingPoint('paste')\n\t\tputPastedExternalContent(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: data,\n\t\t\t\tpoint,\n\t\t\t\tsources,\n\t\t\t},\n\t\t\t{ source: clipboardPasteSource, point }\n\t\t)\n\t}\n}\n\n/**\n * Something found on the clipboard, either through the event's clipboard data or the browser's clipboard API.\n * @internal\n */\ntype ClipboardThing =\n\t| {\n\t\t\ttype: 'file'\n\t\t\tsource: Promise<File | null>\n\t  }\n\t| {\n\t\t\ttype: 'blob'\n\t\t\tsource: Promise<Blob | null>\n\t  }\n\t| {\n\t\t\ttype: 'url'\n\t\t\tsource: Promise<string>\n\t  }\n\t| {\n\t\t\ttype: 'html'\n\t\t\tsource: Promise<string>\n\t  }\n\t| {\n\t\t\ttype: 'text'\n\t\t\tsource: Promise<string>\n\t  }\n\t| {\n\t\t\ttype: string\n\t\t\tsource: Promise<string>\n\t  }\n\n/**\n * Handle a paste using event clipboard data. This is the \"original\"\n * paste method that uses the clipboard data from the paste event.\n * https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent/clipboardData\n *\n * @param editor - The editor\n * @param clipboardData - The clipboard data\n * @param point - The point to paste at\n * @internal\n */\nconst handlePasteFromEventClipboardData = async (\n\teditor: Editor,\n\tclipboardData: DataTransfer,\n\tpoint?: VecLike\n) => {\n\t// Do not paste while in any editing state\n\tif (editor.getEditingShapeId() !== null) return\n\n\tif (!clipboardData) {\n\t\tthrow Error('No clipboard data')\n\t}\n\n\tconst things: ClipboardThing[] = []\n\n\tfor (const item of Object.values(clipboardData.items)) {\n\t\tswitch (item.kind) {\n\t\t\tcase 'file': {\n\t\t\t\t// files are always blobs\n\t\t\t\tthings.push({\n\t\t\t\t\ttype: 'file',\n\t\t\t\t\tsource: new Promise((r) => r(item.getAsFile())) as Promise<File | null>,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'string': {\n\t\t\t\t// strings can be text or html\n\t\t\t\tif (item.type === 'text/html') {\n\t\t\t\t\tthings.push({\n\t\t\t\t\t\ttype: 'html',\n\t\t\t\t\t\tsource: new Promise((r) => item.getAsString(r)) as Promise<string>,\n\t\t\t\t\t})\n\t\t\t\t} else if (item.type === 'text/plain') {\n\t\t\t\t\tthings.push({\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\tsource: new Promise((r) => item.getAsString(r)) as Promise<string>,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthings.push({ type: item.type, source: new Promise((r) => item.getAsString(r)) })\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\thandleClipboardThings(editor, things, point, 'native-event')\n}\n\n/**\n * Handle a paste using items retrieved from the Clipboard API.\n * https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem\n *\n * @param editor - The editor\n * @param clipboardItems - The clipboard items to handle\n * @param point - The point to paste at\n * @internal\n */\nconst handlePasteFromClipboardApi = async ({\n\teditor,\n\tclipboardItems,\n\tpoint,\n\tfallbackFiles,\n\tclipboardPasteSource,\n}: {\n\teditor: Editor\n\tclipboardItems: ClipboardItem[]\n\tpoint?: VecLike\n\tfallbackFiles?: File[]\n\tclipboardPasteSource: 'native-event' | 'clipboard-read'\n}) => {\n\t// We need to populate the array of clipboard things\n\t// based on the ClipboardItems from the Clipboard API.\n\t// This is done in a different way than when using\n\t// the clipboard data from the paste event.\n\n\tconst things: ClipboardThing[] = []\n\n\tfor (const item of clipboardItems) {\n\t\tconst matchingTypes = expectedPasteFileMimeTypes.filter((t) => item.types.includes(t))\n\t\tif (matchingTypes.length > 0) {\n\t\t\tthings.push({\n\t\t\t\ttype: 'blob',\n\t\t\t\tsource: (async () => {\n\t\t\t\t\tfor (const type of matchingTypes) {\n\t\t\t\t\t\tconst blob = await item.getType(type)\n\t\t\t\t\t\t// Chrome 147 stable regression: web custom-format blobs come back as\n\t\t\t\t\t\t// 0 bytes when clipboard.read() runs inside a paste event. Fixed in\n\t\t\t\t\t\t// Chrome Canary; expected to ship to stable in a later release. Until\n\t\t\t\t\t\t// then, skip empty payloads and fall back to the next preferred type\n\t\t\t\t\t\t// (usually image/png, which means Cmd+V paste of a tldraw-copied PNG\n\t\t\t\t\t\t// loses the pHYs DPI chunk and pastes at 2x size on affected Chrome\n\t\t\t\t\t\t// stable versions). Right-click Paste continues to work at 1x because\n\t\t\t\t\t\t// that path calls clipboard.read() from a click handler, not a paste\n\t\t\t\t\t\t// event. Remove this workaround when the fix ships to stable.\n\t\t\t\t\t\t// https://issues.chromium.org/issues/505045934\n\t\t\t\t\t\tif (blob.size === 0) continue\n\t\t\t\t\t\treturn FileHelpers.rewriteMimeType(blob, getCanonicalClipboardReadType(type))\n\t\t\t\t\t}\n\t\t\t\t\treturn null\n\t\t\t\t})(),\n\t\t\t})\n\t\t}\n\n\t\tif (item.types.includes('text/html')) {\n\t\t\tthings.push({\n\t\t\t\ttype: 'html',\n\t\t\t\tsource: (async () => {\n\t\t\t\t\tconst blob = await item.getType('text/html')\n\t\t\t\t\treturn await FileHelpers.blobToText(blob)\n\t\t\t\t})(),\n\t\t\t})\n\t\t}\n\n\t\tif (item.types.includes('text/uri-list')) {\n\t\t\tthings.push({\n\t\t\t\ttype: 'url',\n\t\t\t\tsource: (async () => {\n\t\t\t\t\tconst blob = await item.getType('text/uri-list')\n\t\t\t\t\treturn await FileHelpers.blobToText(blob)\n\t\t\t\t})(),\n\t\t\t})\n\t\t}\n\n\t\tif (item.types.includes('text/plain')) {\n\t\t\tthings.push({\n\t\t\t\ttype: 'text',\n\t\t\t\tsource: (async () => {\n\t\t\t\t\tconst blob = await item.getType('text/plain')\n\t\t\t\t\treturn await FileHelpers.blobToText(blob)\n\t\t\t\t})(),\n\t\t\t})\n\t\t}\n\t}\n\n\tif (fallbackFiles?.length && things.length === 1 && things[0].type === 'text') {\n\t\tthings.pop()\n\t\tthings.push(\n\t\t\t...fallbackFiles.map((f): ClipboardThing => ({ type: 'file', source: Promise.resolve(f) }))\n\t\t)\n\t} else if (fallbackFiles?.length && things.length === 0) {\n\t\t// Files pasted in Safari from your computer don't have types, so we need to use the fallback files directly\n\t\t// if they're available. This only works if pasted keyboard shortcuts. Pasting from the menu in Safari seems to never\n\t\t// let you access files that are copied from your computer.\n\t\tthings.push(\n\t\t\t...fallbackFiles.map((f): ClipboardThing => ({ type: 'file', source: Promise.resolve(f) }))\n\t\t)\n\t}\n\n\treturn await handleClipboardThings(editor, things, point, clipboardPasteSource)\n}\n\nasync function handleClipboardThings(\n\teditor: Editor,\n\tthings: ClipboardThing[],\n\tpoint: VecLike | undefined,\n\tclipboardPasteSource: 'native-event' | 'clipboard-read'\n) {\n\t// 1. Handle files\n\t//\n\t// We need to handle files separately because if we want them to\n\t// be placed next to each other, we need to create them all at once.\n\n\tconst files = things.filter(\n\t\t(t) => (t.type === 'file' || t.type === 'blob') && t.source !== null\n\t) as Extract<ClipboardThing, { type: 'file' } | { type: 'blob' }>[]\n\n\t// Just paste the files, nothing else\n\tif (files.length) {\n\t\tif (files.length > editor.options.maxFilesAtOnce) {\n\t\t\tthrow Error('Too many files')\n\t\t}\n\t\tconst fileBlobs = compact(await Promise.all(files.map((t) => t.source)))\n\t\treturn await pasteFiles(editor, fileBlobs, point, undefined, clipboardPasteSource)\n\t}\n\n\t// 2. Generate clipboard results for non-file things\n\t//\n\t// Getting the source from the items is async, however they must be accessed syncronously;\n\t// we can't await them in a loop. So we'll map them to promises and await them all at once,\n\t// then make decisions based on what we find.\n\n\tconst results = await Promise.all<TLExternalContentSource>(\n\t\tthings\n\t\t\t.filter((t) => t.type !== 'file')\n\t\t\t.map(\n\t\t\t\t(t) =>\n\t\t\t\t\tnew Promise((r) => {\n\t\t\t\t\t\tconst thing = t as Exclude<ClipboardThing, { type: 'file' } | { type: 'blob' }>\n\n\t\t\t\t\t\tif (thing.type === 'file') {\n\t\t\t\t\t\t\tr({ type: 'error', data: null, reason: 'unexpected file' })\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthing.source.then((text) => {\n\t\t\t\t\t\t\t// first, see if we can find tldraw content, which is JSON inside of an html comment\n\t\t\t\t\t\t\tconst tldrawHtmlComment = text.match(/<div data-tldraw[^>]*>(.*)<\\/div>/)?.[1]\n\n\t\t\t\t\t\t\tif (tldrawHtmlComment) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t// First try parsing as plain JSON (version 2/3 formats)\n\t\t\t\t\t\t\t\t\tlet json\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tjson = JSON.parse(tldrawHtmlComment)\n\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t// Fall back to LZ decompression (legacy format)\n\t\t\t\t\t\t\t\t\t\tconst jsonComment = lz.decompressFromBase64(tldrawHtmlComment)\n\t\t\t\t\t\t\t\t\t\tif (jsonComment === null) {\n\t\t\t\t\t\t\t\t\t\t\tr({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\t\t\t\t\t\t\treason: `found tldraw data comment but could not parse`,\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tjson = JSON.parse(jsonComment)\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif (json.type !== 'application/tldraw') {\n\t\t\t\t\t\t\t\t\t\tr({\n\t\t\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\t\t\tdata: json,\n\t\t\t\t\t\t\t\t\t\t\treason: `found tldraw data comment but JSON was of a different type: ${json.type}`,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Handle versioned clipboard format\n\t\t\t\t\t\t\t\t\tif (json.version === 3) {\n\t\t\t\t\t\t\t\t\t\t// Version 3: Assets are plain, decompress only other data\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tconst otherData = JSON.parse(\n\t\t\t\t\t\t\t\t\t\t\t\tlz.decompressFromBase64(json.data.otherCompressed) || '{}'\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\tconst reconstructedData = {\n\t\t\t\t\t\t\t\t\t\t\t\tassets: json.data.assets || [],\n\t\t\t\t\t\t\t\t\t\t\t\t...otherData,\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tr({ type: 'tldraw', data: reconstructedData })\n\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\t\t\tr({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\t\t\t\tdata: json,\n\t\t\t\t\t\t\t\t\t\t\t\treason: `failed to decompress version 2 clipboard data: ${error}`,\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (json.version === 2) {\n\t\t\t\t\t\t\t\t\t\t// Version 2: Everything is plain, this had issues with encoding... :-/\n\t\t\t\t\t\t\t\t\t\t// TODO: nix this support after some time.\n\t\t\t\t\t\t\t\t\t\tr({ type: 'tldraw', data: json.data })\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// Version 1 or no version: Legacy format\n\t\t\t\t\t\t\t\t\t\tif (typeof json.data === 'string') {\n\t\t\t\t\t\t\t\t\t\t\tr({\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\t\t\t\tdata: json,\n\t\t\t\t\t\t\t\t\t\t\t\treason:\n\t\t\t\t\t\t\t\t\t\t\t\t\t'found tldraw json but data was a string instead of a TLClipboardModel object',\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tr({ type: 'tldraw', data: json.data })\n\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tr({\n\t\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\t\tdata: tldrawHtmlComment,\n\t\t\t\t\t\t\t\t\t\treason:\n\t\t\t\t\t\t\t\t\t\t\t'found tldraw json but data was a string instead of a TLClipboardModel object',\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (thing.type === 'html') {\n\t\t\t\t\t\t\t\t\tr({ type: 'text', data: text, subtype: 'html' })\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (thing.type === 'url') {\n\t\t\t\t\t\t\t\t\tr({ type: 'text', data: text, subtype: 'url' })\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// if we have not found a tldraw comment, Otherwise, try to parse the text as JSON directly.\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst json = JSON.parse(text)\n\t\t\t\t\t\t\t\t\tif (json.type === 'excalidraw/clipboard') {\n\t\t\t\t\t\t\t\t\t\t// If the clipboard contains content copied from excalidraw, then paste that\n\t\t\t\t\t\t\t\t\t\tr({ type: 'excalidraw', data: json })\n\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tr({ type: 'text', data: text, subtype: 'json' })\n\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// If we could not parse the text as JSON, then it's just text\n\t\t\t\t\t\t\t\t\tr({ type: 'text', data: text, subtype: 'text' })\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tr({ type: 'error', data: text, reason: 'unhandled case' })\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t)\n\t)\n\n\t// 3.\n\t//\n\t// Now that we know what kind of stuff we're dealing with, we can actual create some content.\n\t// There are priorities here, so order matters: we've already handled images and files, which\n\t// take first priority; then we want to handle tldraw content, then excalidraw content, then\n\t// html content, then links, and finally text content.\n\n\t// Try to paste tldraw content\n\tfor (const result of results) {\n\t\tif (result.type === 'tldraw') {\n\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\tputPastedExternalContent(\n\t\t\t\teditor,\n\t\t\t\t{ type: 'tldraw', content: result.data, point },\n\t\t\t\t{ source: clipboardPasteSource, point }\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Try to paste excalidraw content\n\tfor (const result of results) {\n\t\tif (result.type === 'excalidraw') {\n\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\tputPastedExternalContent(\n\t\t\t\teditor,\n\t\t\t\t{ type: 'excalidraw', content: result.data, point },\n\t\t\t\t{ source: clipboardPasteSource, point }\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Try to paste html content\n\tfor (const result of results) {\n\t\tif (result.type === 'text' && result.subtype === 'html') {\n\t\t\tconst rootNode = new DOMParser().parseFromString(result.data, 'text/html')\n\t\t\tconst bodyNode = rootNode.querySelector('body')\n\n\t\t\t// Check for iframe embeds in HTML before stripping content\n\t\t\tconst iframeInfo = extractIframeFromHtml(result.data)\n\t\t\tif (iframeInfo) {\n\t\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\t\teditor.putExternalContent({\n\t\t\t\t\ttype: 'embed',\n\t\t\t\t\turl: iframeInfo.src,\n\t\t\t\t\tpoint,\n\t\t\t\t\tembed: {\n\t\t\t\t\t\twidth: iframeInfo.width,\n\t\t\t\t\t\theight: iframeInfo.height,\n\t\t\t\t\t\tdoesResize: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// try to find a link\n\n\t\t\t// Edge on Windows 11 home appears to paste a link as a single <a/> in\n\t\t\t// the HTML document. If we're pasting a single like tag we'll just\n\t\t\t// assume the user meant to paste the URL.\n\t\t\tconst isHtmlSingleLink =\n\t\t\t\tbodyNode &&\n\t\t\t\tArray.from(bodyNode.children).filter((el) => el.nodeType === 1).length === 1 &&\n\t\t\t\tbodyNode.firstElementChild &&\n\t\t\t\tbodyNode.firstElementChild.tagName === 'A' &&\n\t\t\t\tbodyNode.firstElementChild.hasAttribute('href') &&\n\t\t\t\tbodyNode.firstElementChild.getAttribute('href') !== ''\n\n\t\t\tif (isHtmlSingleLink) {\n\t\t\t\tconst href = bodyNode.firstElementChild.getAttribute('href')!\n\t\t\t\thandleText(editor, href, point, results, clipboardPasteSource)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the html is NOT a link, and we have NO OTHER texty content, then paste the html as text\n\t\t\tif (!results.some((r) => r.type === 'text' && r.subtype !== 'html') && result.data.trim()) {\n\t\t\t\tconst html = stripHtml(result.data) ?? ''\n\t\t\t\tif (html) {\n\t\t\t\t\thandleText(editor, stripHtml(result.data), point, results, clipboardPasteSource)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If the html is NOT a link, and we have other texty content, then paste the html as a text shape\n\t\t\tif (results.some((r) => r.type === 'text' && r.subtype !== 'html')) {\n\t\t\t\tconst html = stripHtml(result.data) ?? ''\n\t\t\t\tif (html) {\n\t\t\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\t\t\tputPastedExternalContent(\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\ttext: html,\n\t\t\t\t\t\t\thtml: result.data,\n\t\t\t\t\t\t\tpoint,\n\t\t\t\t\t\t\tsources: results,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ source: clipboardPasteSource, point }\n\t\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Allow pasting any <iframe> embed code onto the canvas.\n\t\t// Extracts the iframe src and dimensions, then creates an embed shape.\n\t\tif (result.type === 'text' && result.subtype === 'text') {\n\t\t\tconst iframeInfo = extractIframeFromHtml(result.data)\n\t\t\tif (iframeInfo) {\n\t\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\t\teditor.putExternalContent({\n\t\t\t\t\ttype: 'embed',\n\t\t\t\t\turl: iframeInfo.src,\n\t\t\t\t\tpoint,\n\t\t\t\t\tembed: {\n\t\t\t\t\t\twidth: iframeInfo.width,\n\t\t\t\t\t\theight: iframeInfo.height,\n\t\t\t\t\t\tdoesResize: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// Try to paste a link\n\tfor (const result of results) {\n\t\tif (result.type === 'text' && result.subtype === 'url') {\n\t\t\tpasteUrl(editor, result.data, point, results, clipboardPasteSource)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Finally, if we haven't bailed on anything yet, we can paste text content\n\tfor (const result of results) {\n\t\tif (result.type === 'text' && result.subtype === 'text' && result.data.trim()) {\n\t\t\t// The clipboard may include multiple text items, but we only want to paste the first one\n\t\t\thandleText(editor, result.data, point, results, clipboardPasteSource)\n\t\t\treturn\n\t\t}\n\t}\n}\n\n/**\n * When the user copies or cuts, write the contents to the clipboard.\n *\n * @public\n */\nexport const handleNativeOrMenuCopy = async (\n\teditor: Editor,\n\tcontext: TLClipboardWriteInfo = { operation: 'copy', source: 'menu' }\n): Promise<boolean> => {\n\tconst nav = editor.getContainerWindow().navigator\n\tlet content = await editor.resolveAssetsInContent(\n\t\teditor.getContentFromCurrentPage(editor.getSelectedShapeIds())\n\t)\n\tif (!content) {\n\t\tnav?.clipboard?.writeText?.('')\n\t\treturn true\n\t}\n\n\tif (editor.options.onBeforeCopyToClipboard) {\n\t\tconst result = await editor.options.onBeforeCopyToClipboard({ editor, content, ...context })\n\t\tif (result === false) return false\n\t\tif (result != null) content = result\n\t}\n\n\t// Use versioned clipboard format for better compression\n\t// Version 3: Don't compress assets, only compress other data\n\tconst { assets, ...otherData } = content\n\tconst clipboardData = {\n\t\ttype: 'application/tldraw',\n\t\tkind: 'content',\n\t\tversion: 3,\n\t\tdata: {\n\t\t\tassets: assets || [], // Plain JSON, no compression\n\t\t\totherCompressed: lz.compressToBase64(JSON.stringify(otherData)), // Only compress non-asset data\n\t\t},\n\t}\n\n\t// Don't compress the final structure - just use plain JSON\n\tconst stringifiedClipboard = JSON.stringify(clipboardData)\n\n\tif (typeof nav === 'undefined') {\n\t\treturn true\n\t}\n\n\t// Extract the text from the clipboard\n\tconst textItems = content.shapes\n\t\t.map((shape) => {\n\t\t\tconst util = editor.getShapeUtil(shape)\n\t\t\treturn util.getText(shape)\n\t\t})\n\t\t.filter(isDefined)\n\n\tif (nav.clipboard?.write) {\n\t\tconst htmlBlob = new Blob([`<div data-tldraw>${stringifiedClipboard}</div>`], {\n\t\t\ttype: 'text/html',\n\t\t})\n\n\t\tlet textContent = textItems.join(' ')\n\n\t\t// This is a bug in chrome android where it won't paste content if\n\t\t// the text/plain content is \"\" so we need to always add an empty\n\t\t// space \uD83E\uDD2C\n\t\tif (textContent === '') {\n\t\t\ttextContent = ' '\n\t\t}\n\n\t\tconst CBI = editor.getContainerWindow().ClipboardItem\n\t\tnav.clipboard.write([\n\t\t\tnew CBI({\n\t\t\t\t'text/html': htmlBlob,\n\t\t\t\t// What is this second blob used for?\n\t\t\t\t'text/plain': new Blob([textContent], { type: 'text/plain' }),\n\t\t\t}),\n\t\t])\n\t} else if (nav.clipboard?.writeText) {\n\t\tnav.clipboard.writeText(`<div data-tldraw>${stringifiedClipboard}</div>`)\n\t}\n\treturn true\n}\n\n/** @public */\nexport function useMenuClipboardEvents() {\n\tconst editor = useMaybeEditor()\n\tconst trackEvent = useUiEvents()\n\n\tconst copy = useCallback(\n\t\tasync function onCopy(source: TLUiEventSource) {\n\t\t\tassert(editor, 'editor is required for copy')\n\t\t\tif (editor.getSelectedShapeIds().length === 0) return\n\n\t\t\tconst didCopy = await handleNativeOrMenuCopy(editor, { operation: 'copy', source: 'menu' })\n\t\t\tif (didCopy) {\n\t\t\t\ttrackEvent('copy', { source })\n\t\t\t}\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst cut = useCallback(\n\t\tasync function onCut(source: TLUiEventSource) {\n\t\t\tif (!editor) return\n\t\t\tif (editor.getSelectedShapeIds().length === 0) return\n\n\t\t\tconst didCopy = await handleNativeOrMenuCopy(editor, { operation: 'cut', source: 'menu' })\n\t\t\tif (didCopy) {\n\t\t\t\teditor.deleteShapes(editor.getSelectedShapeIds())\n\t\t\t\ttrackEvent('cut', { source })\n\t\t\t}\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst paste = useCallback(\n\t\tasync function onPaste(\n\t\t\tdata: DataTransfer | ClipboardItem[],\n\t\t\tsource: TLUiEventSource,\n\t\t\tpoint?: VecLike\n\t\t) {\n\t\t\tif (!editor) return\n\t\t\t// If we're editing a shape, or we are focusing an editable input, then\n\t\t\t// we would want the user's paste interaction to go to that element or\n\t\t\t// input instead; e.g. when pasting text into a text shape's content\n\t\t\tif (editor.getEditingShapeId() !== null) return\n\n\t\t\tconst win = editor.getContainerWindow()\n\t\t\tif (Array.isArray(data) && data[0] instanceof win.ClipboardItem) {\n\t\t\t\tif (\n\t\t\t\t\teditor.options.onClipboardPasteRaw?.({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\tsource: 'clipboard-read',\n\t\t\t\t\t\tclipboardItems: data,\n\t\t\t\t\t\tpoint,\n\t\t\t\t\t}) === false\n\t\t\t\t) {\n\t\t\t\t\ttrackEvent('paste', { source: 'menu' })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\thandlePasteFromClipboardApi({\n\t\t\t\t\teditor,\n\t\t\t\t\tclipboardItems: data,\n\t\t\t\t\tpoint,\n\t\t\t\t\tclipboardPasteSource: 'clipboard-read',\n\t\t\t\t})\n\t\t\t\ttrackEvent('paste', { source: 'menu' })\n\t\t\t} else {\n\t\t\t\tconst nav = win.navigator\n\t\t\t\tnav.clipboard.read().then((clipboardItems) => {\n\t\t\t\t\tpaste(clipboardItems, source, point)\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\treturn {\n\t\tcopy,\n\t\tcut,\n\t\tpaste,\n\t}\n}\n\n/** @public */\nexport function useNativeClipboardEvents() {\n\tconst editor = useEditor()\n\tconst ownerDocument = editor.getContainerDocument()\n\tconst trackEvent = useUiEvents()\n\n\tconst appIsFocused = useValue('editor.isFocused', () => editor.getInstanceState().isFocused, [\n\t\teditor,\n\t])\n\n\tuseEffect(() => {\n\t\tif (!appIsFocused) return\n\t\tconst copy = async (e: ClipboardEvent) => {\n\t\t\tif (\n\t\t\t\teditor.getSelectedShapeIds().length === 0 ||\n\t\t\t\teditor.getEditingShapeId() !== null ||\n\t\t\t\tareShortcutsDisabled(editor)\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tpreventDefault(e)\n\n\t\t\tconst didCopy = await handleNativeOrMenuCopy(editor, { operation: 'copy', source: 'native' })\n\t\t\tif (didCopy) {\n\t\t\t\ttrackEvent('copy', { source: 'kbd' })\n\t\t\t}\n\t\t}\n\n\t\tasync function cut(e: ClipboardEvent) {\n\t\t\tif (\n\t\t\t\teditor.getSelectedShapeIds().length === 0 ||\n\t\t\t\teditor.getEditingShapeId() !== null ||\n\t\t\t\tareShortcutsDisabled(editor)\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpreventDefault(e)\n\n\t\t\tconst didCopy = await handleNativeOrMenuCopy(editor, { operation: 'cut', source: 'native' })\n\t\t\tif (didCopy) {\n\t\t\t\teditor.deleteShapes(editor.getSelectedShapeIds())\n\t\t\t\ttrackEvent('cut', { source: 'kbd' })\n\t\t\t}\n\t\t}\n\n\t\tlet disablingMiddleClickPaste = false\n\t\tconst pointerUpHandler = (e: PointerEvent) => {\n\t\t\tif (e.button === 1) {\n\t\t\t\t// middle mouse button\n\t\t\t\tdisablingMiddleClickPaste = true\n\t\t\t\teditor.timers.requestAnimationFrame(() => {\n\t\t\t\t\tdisablingMiddleClickPaste = false\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Track native modifier state from the most recent keydown. We use this\n\t\t// instead of editor.inputs.getShiftKey() because the editor applies a\n\t\t// 150ms delay on modifier release (to prevent physical race conditions\n\t\t// with pointer events), which can cause false positives here.\n\t\tlet nativeShiftKey = false\n\t\tconst trackModifiers = (e: KeyboardEvent) => {\n\t\t\tnativeShiftKey = e.shiftKey\n\t\t}\n\n\t\tconst paste = (e: ClipboardEvent) => {\n\t\t\tif (disablingMiddleClickPaste) {\n\t\t\t\teditor.markEventAsHandled(e)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If we're editing a shape, or we are focusing an editable input, then\n\t\t\t// we would want the user's paste interaction to go to that element or\n\t\t\t// input instead; e.g. when pasting text into a text shape's content\n\t\t\tif (editor.getEditingShapeId() !== null || areShortcutsDisabled(editor)) return\n\n\t\t\t// Cmd+Shift+V / Ctrl+Shift+V = paste as plain text (no formatting).\n\t\t\t// If there's no plain text on the clipboard (e.g., a copied PNG), fall\n\t\t\t// through to the normal paste handler so the file still gets pasted.\n\t\t\tif (nativeShiftKey) {\n\t\t\t\tconst text = e.clipboardData?.getData('text/plain')\n\t\t\t\tif (text?.trim()) {\n\t\t\t\t\tconst point = editor.user.getIsPasteAtCursorMode()\n\t\t\t\t\t\t? editor.inputs.getCurrentPagePoint()\n\t\t\t\t\t\t: editor.getViewportPageBounds().center\n\t\t\t\t\teditor.markHistoryStoppingPoint('paste')\n\t\t\t\t\tdefaultHandleExternalTextContent(editor, { text, point })\n\t\t\t\t\tpreventDefault(e)\n\t\t\t\t\ttrackEvent('paste', { source: 'kbd' })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Cmd+V: paste at center by default, or at cursor when the preference is on.\n\t\t\t// (Cmd+Option+V and Cmd+Shift+Option+V are handled as actions in actions.tsx\n\t\t\t// because the browser only fires paste events for Cmd+V and Cmd+Shift+V.)\n\t\t\tconst point = editor.user.getIsPasteAtCursorMode()\n\t\t\t\t? editor.inputs.getCurrentPagePoint()\n\t\t\t\t: undefined\n\n\t\t\tif (\n\t\t\t\teditor.options.onClipboardPasteRaw?.({\n\t\t\t\t\teditor,\n\t\t\t\t\tsource: 'native-event',\n\t\t\t\t\tevent: e,\n\t\t\t\t\tclipboardData: e.clipboardData,\n\t\t\t\t\tpoint,\n\t\t\t\t}) === false\n\t\t\t) {\n\t\t\t\tpreventDefault(e)\n\t\t\t\ttrackEvent('paste', { source: 'kbd' })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst pasteFromEvent = () => {\n\t\t\t\tif (e.clipboardData) {\n\t\t\t\t\thandlePasteFromEventClipboardData(editor, e.clipboardData, point)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if we can read from the clipboard API, we want to try using that first. that allows\n\t\t\t// us to access most things, and doesn't strip out metadata added to tldraw's own\n\t\t\t// copy-as-png features - so copied shapes come back in at the correct size.\n\t\t\tconst win = editor.getContainerWindow()\n\t\t\tconst nav = win.navigator\n\t\t\tif (nav.clipboard?.read) {\n\t\t\t\t// We can't read files from the filesystem using the clipboard API though - they'll\n\t\t\t\t// just come in as the file names instead. So we'll use the clipboard event's files\n\t\t\t\t// as a fallback - if we only got text, but do have files, we use those instead.\n\t\t\t\tconst fallbackFiles = Array.from(e.clipboardData?.files || [])\n\t\t\t\tnav.clipboard.read().then(\n\t\t\t\t\t(clipboardItems) => {\n\t\t\t\t\t\tif (Array.isArray(clipboardItems) && clipboardItems[0] instanceof win.ClipboardItem) {\n\t\t\t\t\t\t\thandlePasteFromClipboardApi({\n\t\t\t\t\t\t\t\teditor,\n\t\t\t\t\t\t\t\tclipboardItems,\n\t\t\t\t\t\t\t\tpoint,\n\t\t\t\t\t\t\t\tfallbackFiles,\n\t\t\t\t\t\t\t\tclipboardPasteSource: 'native-event',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t() => {\n\t\t\t\t\t\t// if reading from the clipboard fails, try to use the event clipboard data\n\t\t\t\t\t\tpasteFromEvent()\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tpasteFromEvent()\n\t\t\t}\n\n\t\t\tpreventDefault(e)\n\t\t\ttrackEvent('paste', { source: 'kbd' })\n\t\t}\n\n\t\townerDocument?.addEventListener('copy', copy)\n\t\townerDocument?.addEventListener('cut', cut)\n\t\townerDocument?.addEventListener('paste', paste)\n\t\townerDocument?.addEventListener('pointerup', pointerUpHandler)\n\t\townerDocument?.addEventListener('keydown', trackModifiers, true)\n\t\townerDocument?.addEventListener('keyup', trackModifiers, true)\n\n\t\treturn () => {\n\t\t\townerDocument?.removeEventListener('copy', copy)\n\t\t\townerDocument?.removeEventListener('cut', cut)\n\t\t\townerDocument?.removeEventListener('paste', paste)\n\t\t\townerDocument?.removeEventListener('pointerup', pointerUpHandler)\n\t\t\townerDocument?.removeEventListener('keydown', trackModifiers, true)\n\t\t\townerDocument?.removeEventListener('keyup', trackModifiers, true)\n\t\t}\n\t}, [editor, trackEvent, appIsFocused, ownerDocument])\n}\n"],
  "mappings": "AAAA;AAAA,EAEC;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,QAAQ;AACf,SAAS,aAAa,iBAAiB;AACvC,SAAS,wCAAwC;AACjD,SAAS,6BAA6B,qCAAqC;AAC3E,SAA0B,mBAAmB;AAC7C,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAYlB,SAAS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