react-smart-copy 1.23.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -1806
- package/dist/capture.cjs +3 -3
- package/dist/capture.d.cts +1 -1
- package/dist/capture.d.ts +1 -1
- package/dist/capture.js +3 -3
- package/dist/chunks/{clipboard-adapter-CtH4VELE.d.cts → clipboard-adapter-CfaIbZpv.d.cts} +2 -2
- package/dist/chunks/{clipboard-adapter-Ds0irroN.d.ts → clipboard-adapter-Chm6zq60.d.ts} +2 -2
- package/dist/chunks/{clipboard-adapter-DEXkXxwV.js → clipboard-adapter-CmKDTFdO.js} +3 -3
- package/dist/chunks/{clipboard-adapter-DEXkXxwV.js.map → clipboard-adapter-CmKDTFdO.js.map} +1 -1
- package/dist/chunks/{clipboard-adapter-Cfz-rzw3.cjs → clipboard-adapter-UIFc_Qso.cjs} +3 -3
- package/dist/chunks/{clipboard-adapter-Cfz-rzw3.cjs.map → clipboard-adapter-UIFc_Qso.cjs.map} +1 -1
- package/dist/chunks/{contrast-C6CVklEI.cjs → contrast-C9d8QuaF.cjs} +2 -2
- package/dist/chunks/{contrast-C6CVklEI.cjs.map → contrast-C9d8QuaF.cjs.map} +1 -1
- package/dist/chunks/{contrast-DpK2JIVu.js → contrast-DUaZq5SA.js} +2 -2
- package/dist/chunks/{contrast-DpK2JIVu.js.map → contrast-DUaZq5SA.js.map} +1 -1
- package/dist/chunks/{copy-interceptor-CZWzGOkL.d.cts → copy-interceptor-BClcHS_P.d.cts} +2 -2
- package/dist/chunks/{copy-interceptor-C6NABy1l.d.ts → copy-interceptor-D8c9EDnO.d.ts} +2 -2
- package/dist/chunks/{core-Cp2HSpaz.js → core-BH2uIumi.js} +5 -5
- package/dist/chunks/{core-Cp2HSpaz.js.map → core-BH2uIumi.js.map} +1 -1
- package/dist/chunks/{core-DYf_Lhbe.cjs → core-DmncxMt3.cjs} +5 -5
- package/dist/chunks/{core-DYf_Lhbe.cjs.map → core-DmncxMt3.cjs.map} +1 -1
- package/dist/chunks/{deadline-C29AlS_Q.js → deadline-CbwnZ3Oq.js} +2 -2
- package/dist/chunks/{deadline-C29AlS_Q.js.map → deadline-CbwnZ3Oq.js.map} +1 -1
- package/dist/chunks/{deadline-DkiB8ZHE.cjs → deadline-j2hD7JKz.cjs} +2 -2
- package/dist/chunks/{deadline-DkiB8ZHE.cjs.map → deadline-j2hD7JKz.cjs.map} +1 -1
- package/dist/chunks/{errors-9h8sdFFX.js → errors-CT-FfUtU.js} +2 -2
- package/dist/chunks/errors-CT-FfUtU.js.map +1 -0
- package/dist/chunks/{errors-BwOF6T_M.cjs → errors-DFmEAC4E.cjs} +2 -2
- package/dist/chunks/errors-DFmEAC4E.cjs.map +1 -0
- package/dist/chunks/{field-BHo5y-t_.js → field-CK3NxfkM.js} +43 -14
- package/dist/chunks/field-CK3NxfkM.js.map +1 -0
- package/dist/chunks/{field-Bytz2WfN.cjs → field-CNEcZqa9.cjs} +43 -14
- package/dist/chunks/field-CNEcZqa9.cjs.map +1 -0
- package/dist/chunks/{index-vz0iW5V2.d.cts → index-CqYzvxSN.d.cts} +4 -4
- package/dist/chunks/{index-mr7sSAgP.d.ts → index-Q_QeSwGr.d.ts} +4 -4
- package/dist/chunks/{paste-adapter--SPL4PRE.d.cts → paste-adapter-B6eucH3E.d.cts} +2 -2
- package/dist/chunks/{paste-adapter-uahXnTYk.d.ts → paste-adapter-CfIDT3mp.d.ts} +2 -2
- package/dist/chunks/{paste-reader-Bo01IMC_.cjs → paste-reader-BWQaYNaV.cjs} +2 -2
- package/dist/chunks/paste-reader-BWQaYNaV.cjs.map +1 -0
- package/dist/chunks/{paste-reader-D9i7yMXF.js → paste-reader-D6uOTDBM.js} +2 -2
- package/dist/chunks/paste-reader-D6uOTDBM.js.map +1 -0
- package/dist/chunks/{payload-DI5AorDz.js → payload-BWQ6sPtS.js} +3 -3
- package/dist/chunks/{payload-DI5AorDz.js.map → payload-BWQ6sPtS.js.map} +1 -1
- package/dist/chunks/{payload-DGw-JOo7.js → payload-BrQWGwyx.js} +2 -2
- package/dist/chunks/{payload-DGw-JOo7.js.map → payload-BrQWGwyx.js.map} +1 -1
- package/dist/chunks/{payload-Cl_8hCI5.d.ts → payload-CcvSx_Hq.d.ts} +4 -2
- package/dist/chunks/{payload-CcwKJ_bU.d.cts → payload-qkAWVXWA.d.cts} +4 -2
- package/dist/chunks/{payload-CUymxwim.cjs → payload-sBxkG7jH.cjs} +2 -2
- package/dist/chunks/{payload-CUymxwim.cjs.map → payload-sBxkG7jH.cjs.map} +1 -1
- package/dist/chunks/{payload-J6GjHuh3.cjs → payload-tTK6REua.cjs} +3 -3
- package/dist/chunks/{payload-J6GjHuh3.cjs.map → payload-tTK6REua.cjs.map} +1 -1
- package/dist/chunks/{share-Bop47Znn.js → share-CU91L4EK.js} +6 -6
- package/dist/chunks/{share-Bop47Znn.js.map → share-CU91L4EK.js.map} +1 -1
- package/dist/chunks/{share-e7FenIr2.d.ts → share-DVR_DhHc.d.ts} +3 -3
- package/dist/chunks/{share-C0esXvRK.d.cts → share-hIwth7Dh.d.cts} +3 -3
- package/dist/chunks/{share-ayDz974N.cjs → share-nx7M4Z0t.cjs} +6 -6
- package/dist/chunks/{share-ayDz974N.cjs.map → share-nx7M4Z0t.cjs.map} +1 -1
- package/dist/chunks/{url-D4PGsRm8.cjs → url-BrhVUwn7.cjs} +2 -2
- package/dist/chunks/{url-D4PGsRm8.cjs.map → url-BrhVUwn7.cjs.map} +1 -1
- package/dist/chunks/{url-BcMYVCXQ.js → url-COID0BLY.js} +2 -2
- package/dist/chunks/{url-BcMYVCXQ.js.map → url-COID0BLY.js.map} +1 -1
- package/dist/code.cjs +1 -1
- package/dist/code.cjs.map +1 -1
- package/dist/code.d.cts +1 -1
- package/dist/code.d.ts +1 -1
- package/dist/code.js +1 -1
- package/dist/code.js.map +1 -1
- package/dist/color.cjs +2 -2
- package/dist/color.d.cts +1 -1
- package/dist/color.d.ts +1 -1
- package/dist/color.js +2 -2
- package/dist/core.cjs +5 -5
- package/dist/core.d.cts +5 -5
- package/dist/core.d.ts +5 -5
- package/dist/core.js +5 -5
- package/dist/email.cjs +357 -0
- package/dist/email.cjs.map +1 -0
- package/dist/email.d.cts +163 -0
- package/dist/email.d.ts +163 -0
- package/dist/email.js +351 -0
- package/dist/email.js.map +1 -0
- package/dist/files.cjs +1 -1
- package/dist/files.cjs.map +1 -1
- package/dist/files.d.cts +3 -59
- package/dist/files.d.ts +3 -59
- package/dist/files.js +1 -1
- package/dist/files.js.map +1 -1
- package/dist/image.cjs +2 -2
- package/dist/image.cjs.map +1 -1
- package/dist/image.js +2 -2
- package/dist/image.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -19
- package/dist/index.d.ts +43 -19
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/link.cjs +3 -3
- package/dist/link.d.cts +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +3 -3
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/number.cjs +1 -1
- package/dist/number.d.cts +1 -1
- package/dist/number.d.ts +1 -1
- package/dist/number.js +1 -1
- package/dist/otp.cjs +1 -1
- package/dist/otp.js +1 -1
- package/dist/rich.cjs +3 -3
- package/dist/rich.cjs.map +1 -1
- package/dist/rich.d.cts +2 -2
- package/dist/rich.d.ts +2 -2
- package/dist/rich.js +3 -3
- package/dist/rich.js.map +1 -1
- package/dist/secrets.cjs +1 -1
- package/dist/secrets.cjs.map +1 -1
- package/dist/secrets.d.cts +1 -1
- package/dist/secrets.d.ts +1 -1
- package/dist/secrets.js +1 -1
- package/dist/secrets.js.map +1 -1
- package/dist/share.cjs +1 -1
- package/dist/share.d.cts +1 -1
- package/dist/share.d.ts +1 -1
- package/dist/share.js +1 -1
- package/dist/structured.cjs +2 -2
- package/dist/structured.cjs.map +1 -1
- package/dist/structured.js +2 -2
- package/dist/structured.js.map +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.cjs.map +1 -1
- package/dist/table.d.cts +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/table.js.map +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +2 -2
- package/package.json +35 -6
- package/dist/chunks/errors-9h8sdFFX.js.map +0 -1
- package/dist/chunks/errors-BwOF6T_M.cjs.map +0 -1
- package/dist/chunks/field-BHo5y-t_.js.map +0 -1
- package/dist/chunks/field-Bytz2WfN.cjs.map +0 -1
- package/dist/chunks/paste-reader-Bo01IMC_.cjs.map +0 -1
- package/dist/chunks/paste-reader-D9i7yMXF.js.map +0 -1
package/dist/code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":[],"sources":["../src/code/inspect.ts","../src/code/lines.ts","../src/code/normalize.ts","../src/code/element.ts","../src/code/payload.ts","../src/code/paste.ts"],"sourcesContent":["import { copyFailure } from '../core/errors';\n\n/**\n * What a character in code can be suspicious for.\n *\n * - `bidi-control`: reorders how text is displayed (Trojan Source, CVE-2021-42574).\n * - `invisible`: renders as nothing (zero-width spaces, tag characters, Hangul fillers).\n * - `control`: a control character other than tab, line feed, carriage return or form feed.\n * - `unusual-space`: a space that is not U+0020 (no-break, em, ideographic and similar spaces).\n * - `confusable-punctuation`: typographic punctuation in place of ASCII, as word\n * processors and chat apps write it (curly quotes, dashes, a Greek question mark).\n * - `mixed-script`: a Cyrillic or Greek letter inside a Latin word (a homoglyph attack).\n */\nexport type CodeFindingKind = 'bidi-control' | 'invisible' | 'control' | 'unusual-space' | 'confusable-punctuation' | 'mixed-script';\n\n/** Every finding kind, in a stable order. */\nexport const CODE_FINDING_KINDS: readonly CodeFindingKind[] = Object.freeze([\n 'bidi-control',\n 'invisible',\n 'control',\n 'unusual-space',\n 'confusable-punctuation',\n 'mixed-script',\n]);\n\n/**\n * `danger`: the code can run differently from how it reads (a bidi override, an\n * invisible identifier, a lookalike letter). `warning`: likely a copy artifact\n * that breaks the code or hides in it (curly quotes, a zero-width space).\n */\nexport type CodeFindingSeverity = 'danger' | 'warning';\n\nexport interface CodeFinding {\n readonly kind: CodeFindingKind;\n readonly severity: CodeFindingSeverity;\n /** Offset in the inspected text, in UTF-16 code units (as `String.prototype.slice` counts). */\n readonly index: number;\n /** Length in UTF-16 code units: 1, or 2 for a character outside the Basic Multilingual Plane. */\n readonly length: number;\n /** 1-based line. Lines end at `\\n`, `\\r\\n` or `\\r`. */\n readonly line: number;\n /** 1-based column in UTF-16 code units, as most editors count it. */\n readonly column: number;\n readonly codePoint: number;\n /** Developer-facing, e.g. `U+202E RIGHT-TO-LEFT OVERRIDE`. */\n readonly label: string;\n /** The safe replacement `cleanCode` writes (`''` removes it), or `null` when there is none to guess. */\n readonly replacement: string | null;\n}\n\nexport interface InspectCodeOptions {\n /** Which kinds to look for. Default: all of {@link CODE_FINDING_KINDS}. */\n readonly kinds?: readonly CodeFindingKind[];\n /** Stop after this many findings and set `truncated`. Default {@link DEFAULT_CODE_MAX_FINDINGS}. */\n readonly maxFindings?: number;\n}\n\nexport interface CodeInspection {\n /** In order of position. */\n readonly findings: readonly CodeFinding[];\n /** Whether any finding is `danger`. */\n readonly danger: boolean;\n /** Whether `maxFindings` stopped the scan early. */\n readonly truncated: boolean;\n}\n\nexport const DEFAULT_CODE_MAX_FINDINGS = 1000;\n\n/* ------------------------------------------------------------ Character table */\n\ninterface Rule {\n readonly kind: CodeFindingKind;\n readonly severity: CodeFindingSeverity;\n readonly replacement: string | null;\n readonly name: string;\n}\n\nconst rule = (kind: CodeFindingKind, severity: CodeFindingSeverity, replacement: string | null, name: string): Rule => ({\n kind,\n severity,\n replacement,\n name,\n});\n\n/** Characters with a fixed verdict. Ranges and context-dependent ones are handled in `classify`. */\nconst TABLE = /* @__PURE__ */ new Map<number, Rule>([\n // Explicit embeddings, overrides and isolates: what Trojan Source uses.\n [0x202a, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT EMBEDDING')],\n [0x202b, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT EMBEDDING')],\n [0x202c, rule('bidi-control', 'danger', '', 'POP DIRECTIONAL FORMATTING')],\n [0x202d, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT OVERRIDE')],\n [0x202e, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT OVERRIDE')],\n [0x2066, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT ISOLATE')],\n [0x2067, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT ISOLATE')],\n [0x2068, rule('bidi-control', 'danger', '', 'FIRST STRONG ISOLATE')],\n [0x2069, rule('bidi-control', 'danger', '', 'POP DIRECTIONAL ISOLATE')],\n // Implicit marks: they nudge the display order of neutral characters, but cannot reorder tokens.\n [0x200e, rule('bidi-control', 'warning', '', 'LEFT-TO-RIGHT MARK')],\n [0x200f, rule('bidi-control', 'warning', '', 'RIGHT-TO-LEFT MARK')],\n [0x061c, rule('bidi-control', 'warning', '', 'ARABIC LETTER MARK')],\n // Letters that render as blank space: an identifier made of them is invisible.\n [0x115f, rule('invisible', 'danger', '', 'HANGUL CHOSEONG FILLER')],\n [0x1160, rule('invisible', 'danger', '', 'HANGUL JUNGSEONG FILLER')],\n [0x3164, rule('invisible', 'danger', '', 'HANGUL FILLER')],\n [0xffa0, rule('invisible', 'danger', '', 'HALFWIDTH HANGUL FILLER')],\n [0x200b, rule('invisible', 'warning', '', 'ZERO WIDTH SPACE')],\n [0x2060, rule('invisible', 'warning', '', 'WORD JOINER')],\n [0x2061, rule('invisible', 'warning', '', 'FUNCTION APPLICATION')],\n [0x2062, rule('invisible', 'warning', '', 'INVISIBLE TIMES')],\n [0x2063, rule('invisible', 'warning', '', 'INVISIBLE SEPARATOR')],\n [0x2064, rule('invisible', 'warning', '', 'INVISIBLE PLUS')],\n [0xfeff, rule('invisible', 'warning', '', 'ZERO WIDTH NO-BREAK SPACE')],\n [0x00ad, rule('invisible', 'warning', '', 'SOFT HYPHEN')],\n [0x034f, rule('invisible', 'warning', '', 'COMBINING GRAPHEME JOINER')],\n [0x180e, rule('invisible', 'warning', '', 'MONGOLIAN VOWEL SEPARATOR')],\n [0x17b4, rule('invisible', 'warning', '', 'KHMER VOWEL INHERENT AQ')],\n [0x17b5, rule('invisible', 'warning', '', 'KHMER VOWEL INHERENT AA')],\n // Line and paragraph separators end a line in JavaScript but not in most editors.\n [0x2028, rule('control', 'warning', '\\n', 'LINE SEPARATOR')],\n [0x2029, rule('control', 'warning', '\\n', 'PARAGRAPH SEPARATOR')],\n [0x0085, rule('control', 'warning', '\\n', 'NEXT LINE')],\n [0x00a0, rule('unusual-space', 'warning', ' ', 'NO-BREAK SPACE')],\n [0x1680, rule('unusual-space', 'warning', ' ', 'OGHAM SPACE MARK')],\n [0x202f, rule('unusual-space', 'warning', ' ', 'NARROW NO-BREAK SPACE')],\n [0x205f, rule('unusual-space', 'warning', ' ', 'MEDIUM MATHEMATICAL SPACE')],\n [0x3000, rule('unusual-space', 'warning', ' ', 'IDEOGRAPHIC SPACE')],\n [0x2018, rule('confusable-punctuation', 'warning', \"'\", 'LEFT SINGLE QUOTATION MARK')],\n [0x2019, rule('confusable-punctuation', 'warning', \"'\", 'RIGHT SINGLE QUOTATION MARK')],\n [0x201a, rule('confusable-punctuation', 'warning', \"'\", 'SINGLE LOW-9 QUOTATION MARK')],\n [0x201b, rule('confusable-punctuation', 'warning', \"'\", 'SINGLE HIGH-REVERSED-9 QUOTATION MARK')],\n [0x2032, rule('confusable-punctuation', 'warning', \"'\", 'PRIME')],\n [0x02bc, rule('confusable-punctuation', 'warning', \"'\", 'MODIFIER LETTER APOSTROPHE')],\n [0x201c, rule('confusable-punctuation', 'warning', '\"', 'LEFT DOUBLE QUOTATION MARK')],\n [0x201d, rule('confusable-punctuation', 'warning', '\"', 'RIGHT DOUBLE QUOTATION MARK')],\n [0x201e, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE LOW-9 QUOTATION MARK')],\n [0x201f, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE HIGH-REVERSED-9 QUOTATION MARK')],\n [0x2033, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE PRIME')],\n [0x2010, rule('confusable-punctuation', 'warning', '-', 'HYPHEN')],\n [0x2011, rule('confusable-punctuation', 'warning', '-', 'NON-BREAKING HYPHEN')],\n [0x2012, rule('confusable-punctuation', 'warning', '-', 'FIGURE DASH')],\n [0x2013, rule('confusable-punctuation', 'warning', '-', 'EN DASH')],\n [0x2212, rule('confusable-punctuation', 'warning', '-', 'MINUS SIGN')],\n // Word and macOS turn \"--\" into an em dash: \"--force\" comes back as \"\\u2014force\".\n [0x2014, rule('confusable-punctuation', 'warning', '--', 'EM DASH')],\n [0x2015, rule('confusable-punctuation', 'warning', '--', 'HORIZONTAL BAR')],\n [0x2026, rule('confusable-punctuation', 'warning', '...', 'HORIZONTAL ELLIPSIS')],\n [0x2044, rule('confusable-punctuation', 'warning', '/', 'FRACTION SLASH')],\n [0x2215, rule('confusable-punctuation', 'warning', '/', 'DIVISION SLASH')],\n [0x037e, rule('confusable-punctuation', 'warning', ';', 'GREEK QUESTION MARK')],\n]);\n\n/**\n * Latin lookalikes for Cyrillic and Greek letters: these make a homoglyph attack.\n * Written as code points, so neither this file nor the built bundle holds a homoglyph itself.\n */\nconst LOOKALIKE_CODE_POINTS: readonly (readonly [number, string])[] = [\n [0x0430, 'a'], [0x0435, 'e'], [0x0456, 'i'], [0x0458, 'j'], [0x043e, 'o'], [0x0440, 'p'], [0x0441, 'c'], [0x0443, 'y'],\n [0x0445, 'x'], [0x0455, 's'], [0x0501, 'd'], [0x051b, 'q'], [0x051d, 'w'], [0x04bb, 'h'], [0x04cf, 'l'], [0x0410, 'A'],\n [0x0412, 'B'], [0x0415, 'E'], [0x041a, 'K'], [0x041c, 'M'], [0x041d, 'H'], [0x041e, 'O'], [0x0420, 'P'], [0x0421, 'C'],\n [0x0422, 'T'], [0x0425, 'X'], [0x0423, 'Y'], [0x0406, 'I'], [0x0408, 'J'], [0x0405, 'S'], [0x0500, 'D'], [0x051a, 'Q'],\n [0x051c, 'W'], [0x04ba, 'H'], [0x04c0, 'I'], [0x03b1, 'a'], [0x03bf, 'o'], [0x03bd, 'v'], [0x03c1, 'p'], [0x03b9, 'i'],\n [0x03c5, 'u'], [0x03c7, 'x'], [0x0391, 'A'], [0x0392, 'B'], [0x0395, 'E'], [0x0396, 'Z'], [0x0397, 'H'], [0x0399, 'I'],\n [0x039a, 'K'], [0x039c, 'M'], [0x039d, 'N'], [0x039f, 'O'], [0x03a1, 'P'], [0x03a4, 'T'], [0x03a5, 'Y'], [0x03a7, 'X'],\n];\nconst LOOKALIKES = /* @__PURE__ */ new Map<string, string>(\n /* @__PURE__ */ LOOKALIKE_CODE_POINTS.map(([codePoint, latin]): [string, string] => [String.fromCharCode(codePoint), latin]),\n);\n\nconst LATIN = /\\p{Script=Latin}/u;\nconst FOREIGN = /[\\p{Script=Cyrillic}\\p{Script=Greek}]/u;\nconst FOREIGN_LETTER = /^[\\p{Script=Cyrillic}\\p{Script=Greek}]$/u;\n/** Identifier-like runs: letters, marks, digits, `_` and `$`. */\nconst WORD = /[\\p{L}\\p{M}\\p{Nd}_$]+/gu;\n/** Joiners are part of emoji sequences and of Arabic and Indic spelling. */\nconst JOINS = /[\\p{L}\\p{M}\\p{Extended_Pictographic}]/u;\nconst JOINS_ASCII = /[\\0-\\x7f]/;\nconst CJK = /[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\u3000-\\u303f\\uff00-\\uffef]/u;\n\n/** A character with a glyph: not a space, a control or a format character. */\nconst VISIBLE = /^[^\\s\\p{Cc}\\p{Cf}\\p{Zs}]/u;\n\nconst hex = (codePoint: number): string => `U+${codePoint.toString(16).toUpperCase().padStart(4, '0')}`;\n\nconst isSelector = (codePoint: number): boolean => (codePoint >= 0xfe00 && codePoint <= 0xfe0f) || (codePoint >= 0xe0100 && codePoint <= 0xe01ef);\n\nconst joinsHere = (char: string | undefined): boolean => char !== undefined && !JOINS_ASCII.test(char) && JOINS.test(char);\n\n/** The verdict for one character, given its neighbours (code points, `undefined` at the text's edges). */\nfunction classify(codePoint: number, before: number | undefined, after: number | undefined): Rule | null {\n const fixed = TABLE.get(codePoint);\n if (fixed !== undefined) return fixed;\n if (codePoint === 0x200c || codePoint === 0x200d) {\n // Inside a word or an emoji sequence (both sides non-ASCII letters, marks or pictographs) a joiner is spelling.\n const charBefore = before === undefined ? undefined : String.fromCodePoint(before);\n const charAfter = after === undefined ? undefined : String.fromCodePoint(after);\n if (joinsHere(charBefore) && joinsHere(charAfter)) return null;\n return rule('invisible', 'warning', '', codePoint === 0x200c ? 'ZERO WIDTH NON-JOINER' : 'ZERO WIDTH JOINER');\n }\n if (isSelector(codePoint)) {\n // One selector after a visible character picks its glyph (an emoji's colour form); a run of them smuggles data,\n // and after a space, a control or nothing at all a selector selects nothing.\n const base = before === undefined ? '' : String.fromCodePoint(before);\n if (VISIBLE.test(base) && !isSelector(before as number) && (after === undefined || !isSelector(after))) return null;\n return rule('invisible', 'warning', '', 'VARIATION SELECTOR');\n }\n // Tag characters spell invisible ASCII (\"ASCII smuggling\", hidden prompt text).\n if (codePoint >= 0xe0000 && codePoint <= 0xe007f) return rule('invisible', 'danger', '', 'TAG CHARACTER');\n if (codePoint === 0x09 || codePoint === 0x0a || codePoint === 0x0c || codePoint === 0x0d) return null;\n if (codePoint < 0x20 || (codePoint >= 0x7f && codePoint <= 0x9f)) return rule('control', 'warning', '', 'CONTROL CHARACTER');\n if (codePoint >= 0x2000 && codePoint <= 0x200a) return rule('unusual-space', 'warning', ' ', 'SPACE');\n if (codePoint >= 0xff01 && codePoint <= 0xff5e) {\n // Full-width punctuation is normal next to CJK text, as in a Chinese or Japanese comment.\n const charBefore = before === undefined ? '' : String.fromCodePoint(before);\n const charAfter = after === undefined ? '' : String.fromCodePoint(after);\n if (CJK.test(charBefore) || CJK.test(charAfter)) return null;\n return rule('confusable-punctuation', 'warning', String.fromCharCode(codePoint - 0xfee0), 'FULLWIDTH FORM');\n }\n return null;\n}\n\n/* ----------------------------------------------------------------- Scanning */\n\nexport interface RawFinding {\n readonly index: number;\n readonly length: number;\n readonly codePoint: number;\n readonly rule: Rule;\n}\n\nconst ALL = /* @__PURE__ */ new Set<CodeFindingKind>(CODE_FINDING_KINDS);\n\nexport function kindSet(kinds: readonly CodeFindingKind[] | undefined, name: string): ReadonlySet<CodeFindingKind> {\n if (kinds === undefined) return ALL;\n if (!Array.isArray(kinds) || !(kinds as readonly unknown[]).every((kind) => ALL.has(kind as CodeFindingKind))) {\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a list of: ${CODE_FINDING_KINDS.join(', ')}.`);\n }\n return new Set(kinds);\n}\n\n/** Every suspicious character in `text`, in order of position. Stops once `limit` are found. */\nexport function scan(text: string, kinds: ReadonlySet<CodeFindingKind>, limit: number): RawFinding[] {\n const found: RawFinding[] = [];\n let before: number | undefined;\n for (let index = 0; index < text.length && found.length < limit; ) {\n const codePoint = text.codePointAt(index) as number;\n const length = codePoint > 0xffff ? 2 : 1;\n // Only characters outside printable ASCII can be suspicious; skip the rest fast.\n if (codePoint < 0x20 || codePoint >= 0x7f) {\n const verdict = classify(codePoint, before, text.codePointAt(index + length));\n if (verdict !== null && kinds.has(verdict.kind)) found.push({ index, length, codePoint, rule: verdict });\n }\n before = codePoint;\n index += length;\n }\n if (kinds.has('mixed-script') && FOREIGN.test(text)) {\n const mixed: RawFinding[] = [];\n for (const match of text.matchAll(WORD)) {\n const word = match[0];\n if (!LATIN.test(word) || !FOREIGN.test(word)) continue;\n let offset = 0;\n for (const char of word) {\n if (FOREIGN_LETTER.test(char)) {\n const lookalike = LOOKALIKES.get(char);\n const codePoint = char.codePointAt(0) as number;\n mixed.push({\n index: (match.index) + offset,\n length: char.length,\n codePoint,\n rule:\n lookalike === undefined\n ? rule('mixed-script', 'warning', null, 'NON-LATIN LETTER IN A LATIN WORD')\n : rule('mixed-script', 'danger', lookalike, `LOOKALIKE OF \"${lookalike}\"`),\n });\n }\n offset += char.length;\n }\n }\n return merge(found, mixed).slice(0, limit);\n }\n return found;\n}\n\nfunction merge(a: readonly RawFinding[], b: readonly RawFinding[]): RawFinding[] {\n if (b.length === 0) return [...a];\n const out: RawFinding[] = [];\n let i = 0;\n let j = 0;\n while (i < a.length || j < b.length) {\n const next = j >= b.length || (i < a.length && (a[i] as RawFinding).index < (b[j] as RawFinding).index) ? a[i++] : b[j++];\n out.push(next as RawFinding);\n }\n return out;\n}\n\n/** Offsets where each line starts. */\nfunction lineStarts(text: string): number[] {\n const starts = [0];\n for (let index = 0; index < text.length; index += 1) {\n const char = text.charCodeAt(index);\n if (char === 0x0a || (char === 0x0d && text.charCodeAt(index + 1) !== 0x0a)) starts.push(index + 1);\n }\n return starts;\n}\n\nexport function toFindings(text: string, raw: readonly RawFinding[]): CodeFinding[] {\n if (raw.length === 0) return [];\n const starts = lineStarts(text);\n return raw.map(({ index, length, codePoint, rule: { kind, severity, replacement, name } }) => {\n let low = 0;\n let high = starts.length - 1;\n while (low < high) {\n const mid = (low + high + 1) >> 1;\n if ((starts[mid] as number) <= index) low = mid;\n else high = mid - 1;\n }\n return {\n kind,\n severity,\n index,\n length,\n line: low + 1,\n column: index - (starts[low] as number) + 1,\n codePoint,\n label: `${hex(codePoint)} ${name}`,\n replacement,\n };\n });\n}\n\nexport function positiveLimit(value: number | undefined, fallback: number, name: string): number {\n if (value === undefined) return fallback;\n if (value === Infinity || (Number.isInteger(value) && value > 0)) return value;\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a positive integer or Infinity (received ${String(value)}).`);\n}\n\n/**\n * Finds characters that make code read differently from how it runs, or that a\n * copy through a word processor or chat app slipped in: bidirectional overrides\n * (Trojan Source), invisible characters and identifiers, control characters,\n * unusual spaces, curly quotes and dashes, and Cyrillic or Greek lookalikes inside\n * Latin words. Works anywhere, including on the server.\n *\n * @example\n * const { danger, findings } = inspectCode(pasted);\n * if (danger) warn(findings.map((f) => `${f.line}:${f.column} ${f.label}`));\n */\nexport function inspectCode(code: string, options: InspectCodeOptions = {}): CodeInspection {\n const kinds = kindSet(options.kinds, 'kinds');\n const max = positiveLimit(options.maxFindings, DEFAULT_CODE_MAX_FINDINGS, 'maxFindings');\n // One past the limit tells whether more were left.\n const raw = scan(code, kinds, max === Infinity ? Infinity : max + 1);\n const truncated = raw.length > max;\n const findings = toFindings(code, truncated ? raw.slice(0, max) : raw);\n return { findings, danger: findings.some((finding) => finding.severity === 'danger'), truncated };\n}\n\nexport interface CleanCodeOptions {\n /** Which kinds to fix. Default: all. Findings without a `replacement` are never changed. */\n readonly kinds?: readonly CodeFindingKind[];\n}\n\nexport interface CleanCode {\n readonly code: string;\n /** What was replaced or removed, in order, with positions in the original text. */\n readonly fixed: readonly CodeFinding[];\n /** What is still in `code` (positions in `code`): findings without a safe replacement. */\n readonly remaining: readonly CodeFinding[];\n}\n\n/** Applies the replacement of each (fixable) finding, from the end so earlier offsets stay valid. */\nfunction applyFixes(text: string, fixable: readonly RawFinding[]): string {\n let out = text;\n for (let at = fixable.length - 1; at >= 0; at -= 1) {\n const { index, length, rule: verdict } = fixable[at] as RawFinding;\n out = out.slice(0, index) + (verdict.replacement as string) + out.slice(index + length);\n }\n return out;\n}\n\nconst fixableIn = (text: string, kinds: ReadonlySet<CodeFindingKind>): RawFinding[] =>\n scan(text, kinds, Infinity).filter((finding) => finding.rule.replacement !== null);\n\n/**\n * Maps an offset in the text after `fixes` back to the text they were applied to.\n * The offset is never inside a replacement: replacements are ASCII (or a line\n * feed), which is never suspicious, so a later pass can't find anything in them.\n */\nfunction beforeFixes(index: number, fixes: readonly RawFinding[]): number {\n let shift = 0;\n for (const { index: at, length, rule: verdict } of fixes) {\n if (index < at + shift) break;\n shift += (verdict.replacement as string).length - length;\n }\n return index - shift;\n}\n\n/**\n * Fixes until nothing fixable is left: removing a character can expose another\n * finding (a zero-width space between `a` and a Cyrillic letter hides a mixed\n * word). Every pass removes or replaces suspicious characters with ASCII, which is\n * never suspicious, so this ends. Returns what was fixed, positioned in `text`.\n */\nexport function fixAll(text: string, kinds: ReadonlySet<CodeFindingKind>): { readonly text: string; readonly fixed: readonly RawFinding[] } {\n const passes: RawFinding[][] = [];\n let out = text;\n for (let fixable = fixableIn(out, kinds); fixable.length > 0; fixable = fixableIn(out, kinds)) {\n passes.push(fixable);\n out = applyFixes(out, fixable);\n }\n const fixed = passes.flatMap((found, pass) =>\n found.map((finding) => {\n let index = finding.index;\n for (let earlier = pass - 1; earlier >= 0; earlier -= 1) index = beforeFixes(index, passes[earlier] as RawFinding[]);\n return { ...finding, index };\n }),\n );\n return { text: out, fixed: fixed.sort((x, y) => x.index - y.index) };\n}\n\n/**\n * Replaces what {@link inspectCode} finds with safe ASCII: removes bidi controls,\n * invisible and control characters, turns unusual spaces into spaces, curly quotes\n * and dashes into `'` `\"` `-`, and lookalike letters into the Latin letters they\n * imitate. Letters with no lookalike are reported in `remaining`, never guessed.\n *\n * @example\n * cleanCode('const s = \\u201Chi\\u201D;').code; // 'const s = \"hi\";'\n */\nexport function cleanCode(code: string, options: CleanCodeOptions = {}): CleanCode {\n const kinds = kindSet(options.kinds, 'kinds');\n const { text, fixed } = fixAll(code, kinds);\n return { code: text, fixed: toFindings(code, fixed), remaining: toFindings(text, scan(text, kinds, Infinity)) };\n}\n","/**\n * Code as lines of styled runs. Plain text is one unstyled run per line; a\n * highlighted element keeps each token's colour. Every transform works on this\n * one model, so the plain text and the HTML of a copy always hold the same code.\n */\n\nexport interface Run {\n readonly text: string;\n /** Inline CSS for the run, `''` for none. */\n readonly style: string;\n}\n\nexport type Line = readonly Run[];\n\n/** Line breaks: CRLF, LF, CR, and the Unicode line and paragraph separators and NEL. */\nconst BREAK = /\\r\\n|[\\n\\r\\u2028\\u2029\\u0085]/;\n\nexport const lineText = (line: Line): string => line.map((run) => run.text).join('');\n\n/** Splits runs into lines. */\nexport function toLines(runs: readonly Run[]): Line[] {\n const lines: Run[][] = [[]];\n let carriageReturn = false;\n for (const run of runs) {\n // A CRLF split across two runs is one line break.\n const text = carriageReturn && run.text.startsWith('\\n') ? run.text.slice(1) : run.text;\n if (run.text !== '') carriageReturn = run.text.endsWith('\\r');\n const parts = text.split(BREAK);\n parts.forEach((part, at) => {\n if (at > 0) lines.push([]);\n if (part !== '') (lines[lines.length - 1] as Run[]).push({ text: part, style: run.style });\n });\n }\n return lines;\n}\n\n/** The characters of a line from `from` to `to` (UTF-16 offsets), with their styles. */\nexport function slice(line: Line, from: number, to = Infinity): Line {\n const out: Run[] = [];\n let offset = 0;\n for (const run of line) {\n const start = Math.max(from - offset, 0);\n const end = Math.min(to - offset, run.text.length);\n if (start < end) out.push(start === 0 && end === run.text.length ? run : { text: run.text.slice(start, end), style: run.style });\n offset += run.text.length;\n }\n return out;\n}\n\nexport interface Edit {\n readonly index: number;\n readonly length: number;\n readonly text: string;\n}\n\n/** Applies non-overlapping replacements of at least one character, sorted by `index`; the new text keeps the style of what it replaces. */\nexport function edit(line: Line, edits: readonly Edit[]): Line {\n if (edits.length === 0) return line;\n const out: Run[] = [];\n let at = 0;\n for (const { index, length, text } of edits) {\n out.push(...slice(line, at, index));\n if (text !== '') out.push({ text, style: (slice(line, index, index + length)[0] as Run).style });\n at = index + length;\n }\n out.push(...slice(line, at));\n return out;\n}\n","import { copyFailure } from '../core/errors';\nimport { fixAll, kindSet, type CodeFindingKind } from './inspect';\nimport { edit, lineText, slice, toLines, type Line } from './lines';\n\n/** Built-in prompt styles for terminal and REPL sessions. */\nexport type PromptStyle = 'shell' | 'powershell' | 'cmd' | 'python' | 'ipython' | 'node';\n\n/** Every built-in prompt style. `'auto'` tries all but `node`, whose `> ` is too common to guess. */\nexport const PROMPT_STYLES: readonly PromptStyle[] = Object.freeze(['shell', 'powershell', 'cmd', 'python', 'ipython', 'node']);\n\n/**\n * A custom prompt. `command` matches the prompt at the start of a command line,\n * `continuation` the prompt of the lines that continue it. Matches must start at\n * the beginning of the line; the `g` and `y` flags are ignored.\n */\nexport interface PromptPattern {\n readonly command: RegExp;\n readonly continuation?: RegExp;\n}\n\nexport interface CodeTextOptions {\n /**\n * Copy a terminal or REPL session as the commands to run: prompts are removed\n * and output lines are dropped. `'auto'` (the default for copying) does this only\n * when the first line starts with a `$`, `PS>`, `C:\\>`, `>>>` or `In [1]:`\n * prompt; `false` keeps the text as it is.\n */\n readonly prompt?: 'auto' | false | PromptStyle | PromptPattern;\n /** Copy a unified diff as the code after (`'after'`) or before (`'before'`) the change. Default `false`. */\n readonly diff?: false | 'after' | 'before';\n /**\n * Remove line numbers typed into the text (`1: code`, ` 12 | code`). Only\n * applied when every line starts with a number and the numbers count up by one.\n * Default `false`.\n */\n readonly lineNumbers?: boolean;\n /** Remove the indentation every line shares. Default `true`. */\n readonly dedent?: boolean;\n /** Default `true`. */\n readonly trimTrailingWhitespace?: boolean;\n /** Remove blank lines at the start and the end. Default `true`. */\n readonly trimBlankLines?: boolean;\n /** Default `'lf'`. */\n readonly lineEnding?: 'lf' | 'crlf';\n /** End with a line break. Default `false`. */\n readonly finalNewline?: boolean;\n /**\n * Fix what `inspectCode` finds (see `cleanCode`): `true` for every kind, or a\n * list of kinds. Default `false` when copying, `true` when pasting.\n */\n readonly clean?: boolean | readonly CodeFindingKind[];\n}\n\nexport interface Resolved {\n readonly prompt: Prompt | 'auto' | null;\n readonly diff: 'after' | 'before' | null;\n readonly lineNumbers: boolean;\n readonly dedent: boolean;\n readonly trimTrailingWhitespace: boolean;\n readonly trimBlankLines: boolean;\n readonly eol: string;\n readonly finalNewline: boolean;\n readonly clean: ReadonlySet<CodeFindingKind> | null;\n}\n\n/* ------------------------------------------------------------------ Prompts */\n\ninterface Prompt {\n readonly command: RegExp;\n readonly continuation: RegExp | null;\n /** Shell rules: a line continues after `\\`, inside a heredoc or an open quote, with an optional `> ` prompt. */\n readonly shell: boolean;\n}\n\nconst PROMPTS: Readonly<Record<PromptStyle, Prompt>> = {\n // `$` after an optional `(venv) `, `user@host`, and a `~/path`; `#` and `%` are left out: they start comments.\n shell: { command: /^(?:\\([^()\\s]{1,64}\\) )?(?:[\\w.-]{1,64}@[\\w.-]{1,253}:?)?(?:[~/][^\\s$]{0,1024})? ?\\$(?: |$)/, continuation: null, shell: true },\n powershell: { command: /^PS(?: [^>\\r\\n]{0,1024})?> ?/, continuation: /^>> ?/, shell: false },\n cmd: { command: /^[A-Za-z]:\\\\[^>\\r\\n]{0,1024}> ?/, continuation: /^More\\? ?/, shell: false },\n python: { command: /^>>>(?: |$)/, continuation: /^\\.\\.\\.(?: |$)/, shell: false },\n ipython: { command: /^In \\[\\d{0,9}\\]: ?/, continuation: /^ {0,64}\\.{3,}: ?/, shell: false },\n node: { command: /^>(?: |$)/, continuation: /^\\.\\.\\.(?: |$)/, shell: false },\n};\n\nconst AUTO: readonly PromptStyle[] = ['powershell', 'cmd', 'ipython', 'python', 'shell'];\n\n/** A user pattern without `g` / `y`, so `exec` is stateless. */\nfunction stateless(pattern: unknown, name: string): RegExp {\n if (!(pattern instanceof RegExp)) throw copyFailure('invalid-payload', `\\`prompt.${name}\\` must be a RegExp.`);\n return new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ''));\n}\n\nfunction resolvePrompt(prompt: CodeTextOptions['prompt'], fallback: 'auto' | false): Prompt | 'auto' | null {\n const value = prompt ?? fallback;\n if (value === false) return null;\n if (value === 'auto') return 'auto';\n if (typeof value === 'string') {\n if (!Object.prototype.hasOwnProperty.call(PROMPTS, value)) {\n throw copyFailure('invalid-payload', `\\`prompt\\` must be 'auto', false, a PromptPattern or one of: ${PROMPT_STYLES.join(', ')}.`);\n }\n return PROMPTS[value];\n }\n // Plain-JS callers can pass anything.\n if (typeof (value as unknown) !== 'object' || (value as unknown) === null) {\n throw copyFailure('invalid-payload', `\\`prompt\\` must be 'auto', false, a PromptPattern or one of: ${PROMPT_STYLES.join(', ')}.`);\n }\n return {\n command: stateless(value.command, 'command'),\n continuation: value.continuation === undefined ? null : stateless(value.continuation, 'continuation'),\n shell: false,\n };\n}\n\n/** The length of the prompt at the start of `text`, or -1. */\nfunction promptLength(pattern: RegExp, text: string): number {\n const match = pattern.exec(text);\n return match?.index === 0 ? match[0].length : -1;\n}\n\n/** Whether a shell command goes on to the next line: a trailing `\\`, an open heredoc or an open quote. */\ninterface ShellState {\n quote: '\"' | \"'\" | null;\n heredoc: string | null;\n /** The next line continues because this one ended with an unescaped `\\`. */\n escaped: boolean;\n}\n\nconst HEREDOC = /<<-?[ \\t]*(['\"]?)([A-Za-z_][\\w-]{0,63})\\1/;\n\nfunction readShell(text: string, state: ShellState): void {\n if (state.heredoc !== null) {\n if (text.replace(/^\\t+/, '') === state.heredoc) state.heredoc = null;\n state.escaped = false;\n return;\n }\n let escaped = false;\n for (let at = 0; at < text.length; at += 1) {\n const char = text.charAt(at);\n if (escaped) escaped = false;\n else if (char === '\\\\' && state.quote !== \"'\") escaped = true;\n else if (state.quote === null && (char === '\"' || char === \"'\")) state.quote = char;\n else if (char === state.quote) state.quote = null;\n else if (state.quote !== null) continue;\n else if (char === '#') break; // A comment: quotes after it don't count.\n else if (char === '<' && state.heredoc === null) {\n const heredoc = HEREDOC.exec(text.slice(at));\n if (heredoc?.index === 0) state.heredoc = heredoc[2] as string;\n }\n }\n state.escaped = escaped;\n}\n\nconst continues = (state: ShellState): boolean => state.escaped || state.quote !== null || state.heredoc !== null;\n\nfunction firstNonBlank(lines: readonly Line[]): string {\n for (const line of lines) {\n const text = lineText(line);\n if (text.trim() !== '') return text;\n }\n return '';\n}\n\n/** Keeps the commands of a session, without prompts; drops its output. */\nfunction stripPrompts(lines: readonly Line[], setting: Prompt | 'auto'): Line[] {\n let prompt: Prompt;\n if (setting === 'auto') {\n const first = firstNonBlank(lines);\n const style = AUTO.find((name) => promptLength(PROMPTS[name].command, first) >= 0);\n if (style === undefined) return [...lines];\n prompt = PROMPTS[style];\n } else {\n prompt = setting;\n }\n const out: Line[] = [];\n const shell: ShellState = { quote: null, heredoc: null, escaped: false };\n let inCommand = false;\n /** Shell continuation lines carry a `> ` prompt (PS2) when the first one does. */\n let ps2: boolean | null = null;\n for (const line of lines) {\n const text = lineText(line);\n if (prompt.shell && continues(shell)) {\n if (ps2 === null) ps2 = /^>(?: |$)/.test(text);\n const cut = ps2 ? (text.startsWith('> ') ? 2 : text === '>' ? 1 : 0) : 0;\n const rest = slice(line, cut);\n out.push(rest);\n readShell(lineText(rest), shell);\n continue;\n }\n const command = promptLength(prompt.command, text);\n if (command >= 0) {\n const rest = slice(line, command);\n out.push(rest);\n inCommand = true;\n ps2 = null;\n if (prompt.shell) readShell(lineText(rest), shell);\n continue;\n }\n const continuation = inCommand && prompt.continuation !== null ? promptLength(prompt.continuation, text) : -1;\n if (continuation >= 0) {\n out.push(slice(line, continuation));\n continue;\n }\n inCommand = false; // Output.\n }\n return out;\n}\n\n/* --------------------------------------------------------------------- Diff */\n\nconst DIFF_HEADER = /^(?:diff |index |--- |\\+\\+\\+ |new file mode|deleted file mode|old mode|new mode|similarity index|dissimilarity index|rename from|rename to|copy from|copy to|Binary files)/;\n\n/** Keeps one side of a unified diff, without the `+`, `-` and space markers. */\nfunction pickSide(lines: readonly Line[], side: 'after' | 'before'): Line[] {\n const keep = side === 'after' ? '+' : '-';\n const drop = side === 'after' ? '-' : '+';\n const out: Line[] = [];\n // A diff that starts with file headers stays in the header until its first hunk.\n let header = /^(?:diff |--- |index )/.test(firstNonBlank(lines));\n for (const line of lines) {\n const text = lineText(line);\n if (text.startsWith('diff --git ')) header = true;\n if (header) {\n if (text.startsWith('@@')) header = false;\n else if (DIFF_HEADER.test(text) || text.trim() === '') continue;\n else header = false; // Not a header after all: the hunk starts here.\n }\n if (text.startsWith('@@') || text.startsWith('\\\\ ')) continue;\n const marker = text.charAt(0);\n if (marker === drop) continue;\n out.push(marker === keep || marker === ' ' ? slice(line, 1) : line);\n }\n return out;\n}\n\n/* ------------------------------------------------------------- Line numbers */\n\nconst NUMBERED = /^[ \\t]*(\\d{1,9})(?:[ \\t]*[:|\\u2502](?: |$)|[ \\t]+|$)/;\n\nfunction stripLineNumbers(lines: readonly Line[]): Line[] {\n const cuts: number[] = [];\n let expected: number | null = null;\n for (const line of lines) {\n const match = NUMBERED.exec(lineText(line));\n if (match === null) return [...lines];\n const number = Number(match[1]);\n if (expected !== null && number !== expected) return [...lines];\n expected = number + 1;\n cuts.push(match[0].length);\n }\n // A single line can't show that the numbers count.\n if (cuts.length < 2) return [...lines];\n return lines.map((line, at) => slice(line, cuts[at] as number));\n}\n\n/* ------------------------------------------------------------ Whitespace */\n\nfunction trimEnd(line: Line): Line {\n const text = lineText(line);\n const end = text.replace(/[ \\t]+$/, '').length;\n return end === text.length ? line : slice(line, 0, end);\n}\n\nfunction dedentLines(lines: readonly Line[]): Line[] {\n let common: string | null = null;\n for (const line of lines) {\n const text = lineText(line);\n if (text.trim() === '') continue;\n const indent = /^[ \\t]*/.exec(text)?.[0] as string;\n if (common === null) {\n common = indent;\n } else {\n let shared = 0;\n while (shared < common.length && shared < indent.length && common[shared] === indent[shared]) shared += 1;\n common = common.slice(0, shared);\n }\n if (common === '') return [...lines];\n }\n if (common === null) return [...lines];\n const width = common.length;\n return lines.map((line) => slice(line, Math.min(width, /^[ \\t]*/.exec(lineText(line))?.[0].length as number)));\n}\n\n/* ------------------------------------------------------------------ Options */\n\nconst oneOf = <const T extends string | boolean>(value: unknown, allowed: readonly T[], fallback: NoInfer<T>, name: string): T => {\n if (value === undefined) return fallback;\n if ((allowed as readonly unknown[]).includes(value)) return value as T;\n throw copyFailure('invalid-payload', `\\`${name}\\` must be one of: ${allowed.map((option) => JSON.stringify(option)).join(', ')}.`);\n};\n\nconst flag = (value: unknown, fallback: boolean, name: string): boolean => oneOf(value, [true, false], fallback, name);\n\nexport interface Defaults {\n readonly prompt: 'auto' | false;\n readonly clean: boolean;\n}\n\nexport function resolveText(options: CodeTextOptions, defaults: Defaults): Resolved {\n const clean = options.clean ?? defaults.clean;\n return {\n prompt: resolvePrompt(options.prompt, defaults.prompt),\n diff: oneOf(options.diff, [false, 'after', 'before'], false, 'diff') || null,\n lineNumbers: flag(options.lineNumbers, false, 'lineNumbers'),\n dedent: flag(options.dedent, true, 'dedent'),\n trimTrailingWhitespace: flag(options.trimTrailingWhitespace, true, 'trimTrailingWhitespace'),\n trimBlankLines: flag(options.trimBlankLines, true, 'trimBlankLines'),\n eol: oneOf(options.lineEnding, ['lf', 'crlf'], 'lf', 'lineEnding') === 'crlf' ? '\\r\\n' : '\\n',\n finalNewline: flag(options.finalNewline, false, 'finalNewline'),\n clean: clean === false ? null : kindSet(clean === true ? undefined : clean, 'clean'),\n };\n}\n\n/* ----------------------------------------------------------------- Pipeline */\n\nexport interface Transformed {\n readonly lines: readonly Line[];\n /** How many characters `clean` replaced or removed. */\n readonly fixed: number;\n}\n\nexport function transform(input: readonly Line[], options: Resolved): Transformed {\n let lines: Line[] = [...input];\n let fixed = 0;\n const kinds = options.clean;\n if (kinds !== null) {\n lines = lines.map((line) => {\n const { fixed: found } = fixAll(lineText(line), kinds);\n fixed += found.length;\n return edit(\n line,\n found.map(({ index, length, rule: { replacement } }) => ({ index, length, text: replacement as string })),\n );\n });\n }\n if (options.diff !== null) lines = pickSide(lines, options.diff);\n // Prompts are found after the shared indentation, as in a session indented inside a list.\n if (options.prompt !== null) lines = stripPrompts(options.dedent ? dedentLines(lines) : lines, options.prompt);\n if (options.lineNumbers) lines = stripLineNumbers(lines);\n if (options.trimTrailingWhitespace) lines = lines.map(trimEnd);\n if (options.trimBlankLines) {\n const blank = (line: Line) => lineText(line).trim() === '';\n let start = 0;\n let end = lines.length;\n while (start < end && blank(lines[start] as Line)) start += 1;\n while (end > start && blank(lines[end - 1] as Line)) end -= 1;\n lines = lines.slice(start, end);\n }\n if (options.dedent) lines = dedentLines(lines);\n return { lines, fixed };\n}\n\n/** The text of transformed lines. */\nexport function render(lines: readonly Line[], options: Pick<Resolved, 'eol' | 'finalNewline'>): string {\n const text = lines.map(lineText).join(options.eol);\n return options.finalNewline && text !== '' ? text + options.eol : text;\n}\n\n/**\n * Code as it should be copied or saved: a terminal session becomes its commands,\n * a diff one side of the change, typed line numbers and shared indentation are\n * removed, line endings are normalised. Works anywhere, including on the server.\n *\n * @example\n * normalizeCode('$ npm install react-smart-copy\\nadded 1 package'); // 'npm install react-smart-copy'\n */\nexport function normalizeCode(code: string, options: CodeTextOptions = {}): string {\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n return render(transform(toLines([{ text: code, style: '' }]), resolved).lines, resolved);\n}\n","import { copyFailure } from '../core/errors';\nimport type { Run } from './lines';\n\n/** Never code: scripts, embedded content, form controls (the block's own Copy button) and media. */\nconst SKIP = new Set([\n 'script', 'style', 'template', 'noscript', 'head', 'button', 'input', 'textarea', 'select', 'option', 'datalist',\n 'dialog', 'svg', 'math', 'canvas', 'iframe', 'object', 'embed', 'img', 'picture', 'video', 'audio', 'source', 'track',\n]);\n\n/** Elements that start their own line. */\nconst BLOCK = new Set([\n 'address', 'article', 'aside', 'blockquote', 'dd', 'details', 'div', 'dl', 'dt', 'figcaption', 'figure', 'footer',\n 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'li', 'main', 'nav', 'ol', 'p', 'pre', 'section',\n 'summary', 'table', 'tbody', 'tfoot', 'thead', 'tr', 'ul',\n]);\n\n/**\n * Line-number gutters by the class names highlighters give them (Prism, highlight.js,\n * Rouge, Pygments, react-syntax-highlighter, CodeMirror and others).\n */\n/** Whitespace between table rows and cells is never rendered. */\nconst TABLE_PARTS = new Set(['table', 'thead', 'tbody', 'tfoot', 'tr', 'colgroup']);\n\nconst GUTTER = /(?:^|[\\s_-])(?:gutter|linenos?|lineno|line-?numbers?|ln-numbers?|line-?nums?)(?:$|[\\s_-])/i;\nconst NO_SELECT = /(?:^|;)\\s*(?:-webkit-)?user-select\\s*:\\s*none/i;\n\n/** Colours as browsers serialise them. Anything else (`url(...)`, `var(...)`) is never copied into the HTML. */\nconst SAFE_COLOR =\n /^(?:#[\\da-f]{3,8}|[a-z]{3,20}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\([\\d\\s.,%/+-]{1,80}\\)|color\\([a-z\\d-]{1,24}[\\d\\s.,%/+-]{1,80}\\))$/i;\nconst TRANSPARENT = /^(?:transparent|rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\))$/i;\n\nexport interface ExtractOptions {\n /** A CSS selector for more parts to leave out. */\n readonly ignore?: string | undefined;\n /** Keep each token's colour and weight, for the HTML flavour. */\n readonly styles: boolean;\n}\n\nexport interface Extracted {\n readonly runs: readonly Run[];\n /** The block's own text and background colour, as CSS. */\n readonly blockStyle: string;\n}\n\ninterface Look {\n readonly color: string;\n readonly bold: boolean;\n readonly italic: boolean;\n readonly decoration: string;\n}\n\nexport function assertElement(value: unknown, name: string): asserts value is Element {\n if (typeof value !== 'object' || value === null || (value as { nodeType?: unknown }).nodeType !== 1) {\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a string or an Element.`);\n }\n}\n\nfunction lookOf(style: CSSStyleDeclaration): Look {\n const weight = style.fontWeight;\n const decoration = `${style.textDecorationLine || style.textDecoration} `;\n return {\n color: SAFE_COLOR.test(style.color) ? style.color : '',\n bold: weight === 'bold' || weight === 'bolder' || Number(weight) >= 600,\n italic: style.fontStyle === 'italic' || style.fontStyle.startsWith('oblique'),\n decoration: ['underline', 'line-through'].filter((line) => decoration.includes(line)).join(' '),\n };\n}\n\n/**\n * The code a rendered block shows, as styled runs: line-number gutters, hidden\n * and unselectable parts (`user-select: none`), `aria-hidden` decorations,\n * buttons and anything marked `data-copy-ignore` are left out.\n */\nexport function extract(root: Element, options: ExtractOptions): Extracted {\n const { ignore } = options;\n if (ignore !== undefined) {\n try {\n root.matches(ignore);\n } catch (cause) {\n throw copyFailure('invalid-payload', `\\`ignore\\` is not a valid CSS selector: ${ignore}`, cause);\n }\n }\n const view = root.ownerDocument.defaultView;\n const computed = (element: Element): CSSStyleDeclaration | null => (view === null ? null : view.getComputedStyle(element));\n const rootStyle = computed(root);\n const base: Look = rootStyle === null ? { color: '', bold: false, italic: false, decoration: '' } : lookOf(rootStyle);\n const runs: Run[] = [];\n const styles = new Map<Element, string>();\n let last = '';\n\n const push = (text: string, style: string): void => {\n if (text === '') return;\n const previous = runs[runs.length - 1];\n if (previous?.style === style) runs[runs.length - 1] = { text: previous.text + text, style };\n else runs.push({ text, style });\n last = text.charAt(text.length - 1);\n };\n const breakLine = (): void => {\n if (last !== '' && last !== '\\n') push('\\n', '');\n };\n\n const styleOf = (element: Element): string => {\n let style = styles.get(element);\n if (style === undefined) {\n const declared = computed(element);\n style = '';\n if (declared !== null) {\n const look = lookOf(declared);\n if (look.color !== '' && look.color !== base.color) style += `color:${look.color};`;\n if (look.bold && !base.bold) style += 'font-weight:bold;';\n if (look.italic && !base.italic) style += 'font-style:italic;';\n if (look.decoration !== '' && look.decoration !== base.decoration) style += `text-decoration:${look.decoration};`;\n }\n styles.set(element, style);\n }\n return style;\n };\n\n const leftOut = (element: Element): boolean => {\n if (SKIP.has(element.localName)) return true;\n if (element.hasAttribute('hidden') || element.hasAttribute('data-copy-ignore') || element.getAttribute('aria-hidden') === 'true') return true;\n if (GUTTER.test(element.getAttribute('class') ?? '') || NO_SELECT.test(element.getAttribute('style') ?? '')) return true;\n if (ignore !== undefined && element.matches(ignore)) return true;\n const style = computed(element);\n return style !== null && (style.display === 'none' || style.userSelect === 'none' || style.getPropertyValue('-webkit-user-select') === 'none');\n };\n\n const walk = (parent: Element): void => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node.nodeType === 3) {\n const { data } = node as Text;\n if (TABLE_PARTS.has(parent.localName) && data.trim() === '') continue;\n push(data, options.styles ? styleOf(parent) : '');\n } else if (node.nodeType === 1) {\n const element = node as Element;\n if (leftOut(element)) continue;\n if (element.localName === 'br') {\n push('\\n', '');\n } else if (BLOCK.has(element.localName)) {\n breakLine();\n walk(element);\n breakLine();\n } else {\n walk(element);\n }\n }\n }\n };\n walk(root);\n\n let blockStyle = '';\n if (options.styles && rootStyle !== null) {\n if (base.color !== '') blockStyle += `color:${base.color};`;\n const background = rootStyle.backgroundColor;\n if (SAFE_COLOR.test(background) && !TRANSPARENT.test(background)) blockStyle += `background-color:${background};`;\n }\n return { runs, blockStyle };\n}\n","import { copyFailure } from '../core/errors';\nimport type { HtmlPayload, TextPayload } from '../core/payload';\nimport { assertElement, extract } from './element';\nimport { toLines, type Line } from './lines';\nimport { render, resolveText, transform, type CodeTextOptions } from './normalize';\n\n/** Code to copy: a string, or a rendered (and possibly highlighted) code block. */\nexport type CodeSource = string | Element;\n\nexport interface CodeFromElementOptions extends CodeTextOptions {\n /**\n * A CSS selector for more parts of the block to leave out. Gutters, hidden and\n * `user-select: none` parts, `aria-hidden` decorations, buttons and anything with\n * `data-copy-ignore` are always left out.\n */\n readonly ignore?: string;\n}\n\nexport interface CodePayloadOptions extends CodeFromElementOptions {\n /**\n * Add an HTML flavour (`<pre><code>`), so the code stays monospaced when pasted\n * into Google Docs, Word, Slack, Teams or a mail; from an element, with its\n * syntax colours. Editors and terminals still paste the plain text. Default `true`.\n */\n readonly html?: boolean;\n /** Written as `class=\"language-<name>\"` on the `<code>` element. Letters, digits and `_ + # . -` only. */\n readonly language?: string;\n}\n\nconst LANGUAGE = /^[A-Za-z0-9_+#.-]{1,64}$/;\nconst MONOSPACE = \"font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,'Liberation Mono',monospace;white-space:pre;\";\n\n/** HTML can't hold U+0000: parsers turn it into U+FFFD, so the HTML says so itself (the text flavour keeps it). */\nconst escapeHtml = (text: string): string =>\n text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"').replace(/\\0/g, '\\uFFFD');\n\nfunction toHtml(lines: readonly Line[], blockStyle: string, language: string | undefined): string {\n const body = lines\n .map((line) => line.map(({ text, style }) => (style === '' ? escapeHtml(text) : `<span style=\"${escapeHtml(style)}\">${escapeHtml(text)}</span>`)).join(''))\n .join('\\n');\n const cls = language === undefined ? '' : ` class=\"language-${language}\"`;\n return `<pre style=\"${escapeHtml(MONOSPACE + blockStyle)}\"><code${cls}>${body}</code></pre>`;\n}\n\n/**\n * The code a rendered block shows, ready to run or save: see {@link extract} for\n * what is left out, and {@link CodeTextOptions} for prompts, diffs and whitespace.\n *\n * @example\n * codeFromElement(preRef.current, { prompt: 'shell' });\n */\nexport function codeFromElement(element: Element, options: CodeFromElementOptions = {}): string {\n assertElement(element, 'element');\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n const { runs } = extract(element, { ignore: options.ignore, styles: false });\n return render(transform(toLines(runs), resolved).lines, resolved);\n}\n\n/**\n * A copy payload for code: plain text for editors and terminals, plus\n * monospaced HTML (with the block's syntax colours when you pass the element)\n * for documents and chat. A terminal session is copied as its commands\n * (`prompt: 'auto'`). Code that ends up empty gives an empty text payload, which\n * `copy()` reports as an `invalid-payload` error.\n *\n * @example\n * const { copy } = useCopy();\n * <button onClick={() => copy(() => codePayload(preRef.current!, { language: 'tsx' }))}>Copy</button>\n */\nexport function codePayload(source: CodeSource, options: CodePayloadOptions = {}): HtmlPayload | TextPayload {\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n const withHtml = options.html ?? true;\n if (typeof withHtml !== 'boolean') throw copyFailure('invalid-payload', '`html` must be a boolean.');\n const { language } = options;\n if (language !== undefined && (typeof language !== 'string' || !LANGUAGE.test(language))) {\n throw copyFailure('invalid-payload', '`language` may only hold letters, digits and _ + # . - (at most 64).');\n }\n let lines: Line[];\n let blockStyle = '';\n if (typeof source === 'string') {\n lines = toLines([{ text: source, style: '' }]);\n } else {\n assertElement(source, 'source');\n const extracted = extract(source, { ignore: options.ignore, styles: withHtml });\n lines = toLines(extracted.runs);\n blockStyle = extracted.blockStyle;\n }\n const out = transform(lines, resolved).lines;\n const text = render(out, resolved);\n if (!withHtml || text === '') return { kind: 'text', value: text };\n return { kind: 'html', text, html: toHtml(out, blockStyle, language) };\n}\n","import { copyFailure, isCopyFailure } from '../core/errors';\nimport { asTextField, insertText } from '../core/text-field';\nimport { extract } from './element';\nimport { inspectCode, positiveLimit, type CodeFinding } from './inspect';\nimport { lineText, toLines, type Line } from './lines';\nimport { render, resolveText, transform, type CodeTextOptions } from './normalize';\nimport { parseInertHtml } from '../core/inert-html';\n\nexport const DEFAULT_CODE_MAX_LENGTH = 2_000_000;\n\nexport interface PasteToCodeOptions extends Omit<CodeTextOptions, 'finalNewline'> {\n /**\n * Indentation for every line after the first, which lands where the cursor is.\n * `pasteAsCode` sets it to the cursor line's indentation.\n */\n readonly indent?: string;\n /**\n * Longest paste to process, in UTF-16 code units. Longer pastes throw a\n * `too-large` error (`pasteAsCode` leaves them to the browser): code is never cut.\n * Default {@link DEFAULT_CODE_MAX_LENGTH}.\n */\n readonly maxLength?: number;\n}\n\nexport interface PasteCode {\n readonly code: string;\n /** `text` for the plain-text flavour; `html` when only HTML was on the clipboard. */\n readonly source: 'text' | 'html';\n /** What the pasted text held, before anything was fixed (positions in the pasted text, at most 1000). */\n readonly findings: readonly CodeFinding[];\n /** How many characters `clean` replaced or removed. */\n readonly fixed: number;\n /** What is still in `code` (positions in `code`), e.g. a non-Latin letter with no lookalike. */\n readonly remaining: readonly CodeFinding[];\n /** Whether `remaining` holds a `danger` finding. */\n readonly danger: boolean;\n}\n\n/** The clipboard flavours: a `PasteResult` from `usePaste`, or anything with `text` / `html`. */\nexport interface CodePasteSource {\n readonly text?: string | null;\n readonly html?: string | null;\n}\n\nconst INDENT = /^[ \\t]*$/;\n\nfunction indentLines(lines: readonly Line[], indent: string): Line[] {\n if (indent === '') return [...lines];\n return lines.map((line, at) => (at === 0 || lineText(line) === '' ? line : [{ text: indent, style: '' }, ...line]));\n}\n\n/**\n * Code for what was pasted: the plain text (or, when only HTML was copied, the\n * text of its code), cleaned of invisible and lookalike characters, curly quotes\n * and odd spaces, dedented, and re-indented with `indent`. Every finding is\n * reported. Returns `null` when there is nothing to paste.\n *\n * @example\n * usePaste({ accept: ['text'], onPaste: (result) => {\n * const pasted = pasteToCode(result);\n * if (pasted?.danger) showWarning(pasted.remaining);\n * } });\n */\nexport function pasteToCode(source: CodePasteSource, options: PasteToCodeOptions = {}): PasteCode | null {\n const resolved = resolveText(options, { prompt: false, clean: true });\n const maxLength = positiveLimit(options.maxLength, DEFAULT_CODE_MAX_LENGTH, 'maxLength');\n const indent = options.indent ?? '';\n if (typeof indent !== 'string' || !INDENT.test(indent)) throw copyFailure('invalid-payload', '`indent` may only hold spaces and tabs.');\n let text = source.text ?? '';\n let from: PasteCode['source'] = 'text';\n if (text === '' && typeof source.html === 'string' && source.html.trim() !== '' && typeof DOMParser !== 'undefined') {\n if (source.html.length > maxLength) throw copyFailure('too-large', `The pasted HTML is longer than maxLength (${String(maxLength)}).`);\n const body = parseInertHtml(source.html).body;\n text = extract(body, { styles: false }).runs.map((run) => run.text).join('');\n from = 'html';\n }\n if (text.length > maxLength) throw copyFailure('too-large', `The pasted text is longer than maxLength (${String(maxLength)}).`);\n if (text.trim() === '') return null;\n const { lines, fixed } = transform(toLines([{ text, style: '' }]), resolved);\n const code = render(indentLines(lines, indent), { eol: resolved.eol, finalNewline: false });\n const remaining = inspectCode(code, { maxFindings: Infinity }).findings;\n return {\n code,\n source: from,\n findings: inspectCode(text).findings,\n fixed,\n remaining,\n danger: remaining.some((finding) => finding.severity === 'danger'),\n };\n}\n\n/** Structural paste event: a DOM `ClipboardEvent` and React's `onPaste` event both fit. */\nexport interface CodePasteEvent {\n readonly clipboardData: { getData(format: string): string } | null;\n readonly currentTarget: EventTarget | null;\n readonly target: EventTarget | null;\n readonly defaultPrevented: boolean;\n preventDefault(): void;\n}\n\nexport interface PasteAsCodeOptions extends Omit<PasteToCodeOptions, 'indent'> {\n /** Indent the pasted lines to the cursor line's indentation, as code editors do. Default `true`. */\n readonly indentToCursor?: boolean;\n /**\n * Called before the code is inserted. Return `false` to cancel the paste, e.g.\n * when `danger` is set and the user declines.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- the callback may return nothing\n readonly onPaste?: (result: PasteCode) => boolean | void;\n}\n\n/**\n * A paste handler for code fields (`<textarea>`, or a text `<input>` for one-line\n * commands): pastes the code from {@link pasteToCode} at the cursor with the\n * browser's undo intact. Returns whether it took over the paste: `false` leaves\n * the paste to the browser (nothing to paste, a field it can't write to, invalid\n * options, or a paste past `maxLength`).\n *\n * @example\n * <textarea onPaste={pasteAsCode} />\n * <textarea onPaste={(event) => pasteAsCode(event, { onPaste: (r) => !r.danger || confirm('Paste anyway?') })} />\n */\nexport function pasteAsCode(event: CodePasteEvent, options: PasteAsCodeOptions = {}): boolean {\n if (event.defaultPrevented || event.clipboardData === null) return false;\n const field = asTextField(event.currentTarget) ?? asTextField(event.target);\n if (field === null || field.disabled || field.readOnly) return false;\n const { indentToCursor, onPaste, ...rest } = options;\n let indent = '';\n if (indentToCursor !== false && field.nodeName === 'TEXTAREA' && field.selectionStart !== null) {\n const before = field.value.slice(0, field.selectionStart);\n indent = /^[ \\t]*/.exec(before.slice(before.lastIndexOf('\\n') + 1))?.[0] as string;\n }\n let result: PasteCode | null;\n try {\n result = pasteToCode({ text: event.clipboardData.getData('text/plain'), html: event.clipboardData.getData('text/html') }, { ...rest, indent });\n } catch (error) {\n if (isCopyFailure(error)) return false; // Invalid options or too large: the native paste still happens.\n throw error;\n }\n if (result === null) return false;\n event.preventDefault();\n if (onPaste?.(result) === false) return true;\n insertText(field, result.code);\n return true;\n}\n"],"mappings":";;;;;;AAgBA,MAAa,qBAAiD,OAAO,OAAO;CAC1E;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AA2CD,MAAa,4BAA4B;AAWzC,MAAM,QAAQ,MAAuB,UAA+B,aAA4B,UAAwB;CACtH;CACA;CACA;CACA;AACF;;AAGA,MAAM,wBAAwB,IAAI,IAAkB;CAElD,CAAC,MAAQ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AG;CACxE;CACA,IAAI;CACJ,IAAI;EACF,SAAS,YAAY;GAAE,MAAM,MAAM,cAAc,QAAQ,YAAY;GAAG,MAAM,MAAM,cAAc,QAAQ,WAAW;EAAE,GAAG;GAAE,GAAG;GAAM;EAAO,CAAC;CAC/I,SAAS,OAAO;EACd,IAAI,cAAc,KAAK,GAAG,OAAO;EACjC,MAAM;CACR;CACA,IAAI,WAAW,MAAM,OAAO;CAC5B,MAAM,eAAe;CACrB,IAAI,UAAU,MAAM,MAAM,OAAO,OAAO;CACxC,WAAW,OAAO,OAAO,IAAI;CAC7B,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../src/code/inspect.ts","../src/code/lines.ts","../src/code/normalize.ts","../src/code/element.ts","../src/code/payload.ts","../src/code/paste.ts"],"sourcesContent":["import { copyFailure } from '../core/errors';\n\n/**\n * What a character in code can be suspicious for.\n *\n * - `bidi-control`: reorders how text is displayed (Trojan Source, CVE-2021-42574).\n * - `invisible`: renders as nothing (zero-width spaces, tag characters, Hangul fillers).\n * - `control`: a control character other than tab, line feed, carriage return or form feed.\n * - `unusual-space`: a space that is not U+0020 (no-break, em, ideographic and similar spaces).\n * - `confusable-punctuation`: typographic punctuation in place of ASCII, as word\n * processors and chat apps write it (curly quotes, dashes, a Greek question mark).\n * - `mixed-script`: a Cyrillic or Greek letter inside a Latin word (a homoglyph attack).\n */\nexport type CodeFindingKind = 'bidi-control' | 'invisible' | 'control' | 'unusual-space' | 'confusable-punctuation' | 'mixed-script';\n\n/** Every finding kind, in a stable order. */\nexport const CODE_FINDING_KINDS: readonly CodeFindingKind[] = Object.freeze([\n 'bidi-control',\n 'invisible',\n 'control',\n 'unusual-space',\n 'confusable-punctuation',\n 'mixed-script',\n]);\n\n/**\n * `danger`: the code can run differently from how it reads (a bidi override, an\n * invisible identifier, a lookalike letter). `warning`: likely a copy artifact\n * that breaks the code or hides in it (curly quotes, a zero-width space).\n */\nexport type CodeFindingSeverity = 'danger' | 'warning';\n\nexport interface CodeFinding {\n readonly kind: CodeFindingKind;\n readonly severity: CodeFindingSeverity;\n /** Offset in the inspected text, in UTF-16 code units (as `String.prototype.slice` counts). */\n readonly index: number;\n /** Length in UTF-16 code units: 1, or 2 for a character outside the Basic Multilingual Plane. */\n readonly length: number;\n /** 1-based line. Lines end at `\\n`, `\\r\\n` or `\\r`. */\n readonly line: number;\n /** 1-based column in UTF-16 code units, as most editors count it. */\n readonly column: number;\n readonly codePoint: number;\n /** Developer-facing, e.g. `U+202E RIGHT-TO-LEFT OVERRIDE`. */\n readonly label: string;\n /** The safe replacement `cleanCode` writes (`''` removes it), or `null` when there is none to guess. */\n readonly replacement: string | null;\n}\n\nexport interface InspectCodeOptions {\n /** Which kinds to look for. Default: all of {@link CODE_FINDING_KINDS}. */\n readonly kinds?: readonly CodeFindingKind[];\n /** Stop after this many findings and set `truncated`. Default {@link DEFAULT_CODE_MAX_FINDINGS}. */\n readonly maxFindings?: number;\n}\n\nexport interface CodeInspection {\n /** In order of position. */\n readonly findings: readonly CodeFinding[];\n /** Whether any finding is `danger`. */\n readonly danger: boolean;\n /** Whether `maxFindings` stopped the scan early. */\n readonly truncated: boolean;\n}\n\nexport const DEFAULT_CODE_MAX_FINDINGS = 1000;\n\n/* ------------------------------------------------------------ Character table */\n\ninterface Rule {\n readonly kind: CodeFindingKind;\n readonly severity: CodeFindingSeverity;\n readonly replacement: string | null;\n readonly name: string;\n}\n\nconst rule = (kind: CodeFindingKind, severity: CodeFindingSeverity, replacement: string | null, name: string): Rule => ({\n kind,\n severity,\n replacement,\n name,\n});\n\n/** Characters with a fixed verdict. Ranges and context-dependent ones are handled in `classify`. */\nconst TABLE = /* @__PURE__ */ new Map<number, Rule>([\n // Explicit embeddings, overrides and isolates: what Trojan Source uses.\n [0x202a, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT EMBEDDING')],\n [0x202b, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT EMBEDDING')],\n [0x202c, rule('bidi-control', 'danger', '', 'POP DIRECTIONAL FORMATTING')],\n [0x202d, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT OVERRIDE')],\n [0x202e, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT OVERRIDE')],\n [0x2066, rule('bidi-control', 'danger', '', 'LEFT-TO-RIGHT ISOLATE')],\n [0x2067, rule('bidi-control', 'danger', '', 'RIGHT-TO-LEFT ISOLATE')],\n [0x2068, rule('bidi-control', 'danger', '', 'FIRST STRONG ISOLATE')],\n [0x2069, rule('bidi-control', 'danger', '', 'POP DIRECTIONAL ISOLATE')],\n // Implicit marks: they nudge the display order of neutral characters, but cannot reorder tokens.\n [0x200e, rule('bidi-control', 'warning', '', 'LEFT-TO-RIGHT MARK')],\n [0x200f, rule('bidi-control', 'warning', '', 'RIGHT-TO-LEFT MARK')],\n [0x061c, rule('bidi-control', 'warning', '', 'ARABIC LETTER MARK')],\n // Letters that render as blank space: an identifier made of them is invisible.\n [0x115f, rule('invisible', 'danger', '', 'HANGUL CHOSEONG FILLER')],\n [0x1160, rule('invisible', 'danger', '', 'HANGUL JUNGSEONG FILLER')],\n [0x3164, rule('invisible', 'danger', '', 'HANGUL FILLER')],\n [0xffa0, rule('invisible', 'danger', '', 'HALFWIDTH HANGUL FILLER')],\n [0x200b, rule('invisible', 'warning', '', 'ZERO WIDTH SPACE')],\n [0x2060, rule('invisible', 'warning', '', 'WORD JOINER')],\n [0x2061, rule('invisible', 'warning', '', 'FUNCTION APPLICATION')],\n [0x2062, rule('invisible', 'warning', '', 'INVISIBLE TIMES')],\n [0x2063, rule('invisible', 'warning', '', 'INVISIBLE SEPARATOR')],\n [0x2064, rule('invisible', 'warning', '', 'INVISIBLE PLUS')],\n [0xfeff, rule('invisible', 'warning', '', 'ZERO WIDTH NO-BREAK SPACE')],\n [0x00ad, rule('invisible', 'warning', '', 'SOFT HYPHEN')],\n [0x034f, rule('invisible', 'warning', '', 'COMBINING GRAPHEME JOINER')],\n [0x180e, rule('invisible', 'warning', '', 'MONGOLIAN VOWEL SEPARATOR')],\n [0x17b4, rule('invisible', 'warning', '', 'KHMER VOWEL INHERENT AQ')],\n [0x17b5, rule('invisible', 'warning', '', 'KHMER VOWEL INHERENT AA')],\n // Line and paragraph separators end a line in JavaScript but not in most editors.\n [0x2028, rule('control', 'warning', '\\n', 'LINE SEPARATOR')],\n [0x2029, rule('control', 'warning', '\\n', 'PARAGRAPH SEPARATOR')],\n [0x0085, rule('control', 'warning', '\\n', 'NEXT LINE')],\n [0x00a0, rule('unusual-space', 'warning', ' ', 'NO-BREAK SPACE')],\n [0x1680, rule('unusual-space', 'warning', ' ', 'OGHAM SPACE MARK')],\n [0x202f, rule('unusual-space', 'warning', ' ', 'NARROW NO-BREAK SPACE')],\n [0x205f, rule('unusual-space', 'warning', ' ', 'MEDIUM MATHEMATICAL SPACE')],\n [0x3000, rule('unusual-space', 'warning', ' ', 'IDEOGRAPHIC SPACE')],\n [0x2018, rule('confusable-punctuation', 'warning', \"'\", 'LEFT SINGLE QUOTATION MARK')],\n [0x2019, rule('confusable-punctuation', 'warning', \"'\", 'RIGHT SINGLE QUOTATION MARK')],\n [0x201a, rule('confusable-punctuation', 'warning', \"'\", 'SINGLE LOW-9 QUOTATION MARK')],\n [0x201b, rule('confusable-punctuation', 'warning', \"'\", 'SINGLE HIGH-REVERSED-9 QUOTATION MARK')],\n [0x2032, rule('confusable-punctuation', 'warning', \"'\", 'PRIME')],\n [0x02bc, rule('confusable-punctuation', 'warning', \"'\", 'MODIFIER LETTER APOSTROPHE')],\n [0x201c, rule('confusable-punctuation', 'warning', '\"', 'LEFT DOUBLE QUOTATION MARK')],\n [0x201d, rule('confusable-punctuation', 'warning', '\"', 'RIGHT DOUBLE QUOTATION MARK')],\n [0x201e, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE LOW-9 QUOTATION MARK')],\n [0x201f, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE HIGH-REVERSED-9 QUOTATION MARK')],\n [0x2033, rule('confusable-punctuation', 'warning', '\"', 'DOUBLE PRIME')],\n [0x2010, rule('confusable-punctuation', 'warning', '-', 'HYPHEN')],\n [0x2011, rule('confusable-punctuation', 'warning', '-', 'NON-BREAKING HYPHEN')],\n [0x2012, rule('confusable-punctuation', 'warning', '-', 'FIGURE DASH')],\n [0x2013, rule('confusable-punctuation', 'warning', '-', 'EN DASH')],\n [0x2212, rule('confusable-punctuation', 'warning', '-', 'MINUS SIGN')],\n // Word and macOS turn \"--\" into an em dash: \"--force\" comes back as \"\\u2014force\".\n [0x2014, rule('confusable-punctuation', 'warning', '--', 'EM DASH')],\n [0x2015, rule('confusable-punctuation', 'warning', '--', 'HORIZONTAL BAR')],\n [0x2026, rule('confusable-punctuation', 'warning', '...', 'HORIZONTAL ELLIPSIS')],\n [0x2044, rule('confusable-punctuation', 'warning', '/', 'FRACTION SLASH')],\n [0x2215, rule('confusable-punctuation', 'warning', '/', 'DIVISION SLASH')],\n [0x037e, rule('confusable-punctuation', 'warning', ';', 'GREEK QUESTION MARK')],\n]);\n\n/**\n * Latin lookalikes for Cyrillic and Greek letters: these make a homoglyph attack.\n * Written as code points, so neither this file nor the built bundle holds a homoglyph itself.\n */\nconst LOOKALIKE_CODE_POINTS: readonly (readonly [number, string])[] = [\n [0x0430, 'a'], [0x0435, 'e'], [0x0456, 'i'], [0x0458, 'j'], [0x043e, 'o'], [0x0440, 'p'], [0x0441, 'c'], [0x0443, 'y'],\n [0x0445, 'x'], [0x0455, 's'], [0x0501, 'd'], [0x051b, 'q'], [0x051d, 'w'], [0x04bb, 'h'], [0x04cf, 'l'], [0x0410, 'A'],\n [0x0412, 'B'], [0x0415, 'E'], [0x041a, 'K'], [0x041c, 'M'], [0x041d, 'H'], [0x041e, 'O'], [0x0420, 'P'], [0x0421, 'C'],\n [0x0422, 'T'], [0x0425, 'X'], [0x0423, 'Y'], [0x0406, 'I'], [0x0408, 'J'], [0x0405, 'S'], [0x0500, 'D'], [0x051a, 'Q'],\n [0x051c, 'W'], [0x04ba, 'H'], [0x04c0, 'I'], [0x03b1, 'a'], [0x03bf, 'o'], [0x03bd, 'v'], [0x03c1, 'p'], [0x03b9, 'i'],\n [0x03c5, 'u'], [0x03c7, 'x'], [0x0391, 'A'], [0x0392, 'B'], [0x0395, 'E'], [0x0396, 'Z'], [0x0397, 'H'], [0x0399, 'I'],\n [0x039a, 'K'], [0x039c, 'M'], [0x039d, 'N'], [0x039f, 'O'], [0x03a1, 'P'], [0x03a4, 'T'], [0x03a5, 'Y'], [0x03a7, 'X'],\n];\nconst LOOKALIKES = /* @__PURE__ */ new Map<string, string>(\n /* @__PURE__ */ LOOKALIKE_CODE_POINTS.map(([codePoint, latin]): [string, string] => [String.fromCharCode(codePoint), latin]),\n);\n\nconst LATIN = /\\p{Script=Latin}/u;\nconst FOREIGN = /[\\p{Script=Cyrillic}\\p{Script=Greek}]/u;\nconst FOREIGN_LETTER = /^[\\p{Script=Cyrillic}\\p{Script=Greek}]$/u;\n/** Identifier-like runs: letters, marks, digits, `_` and `$`. */\nconst WORD = /[\\p{L}\\p{M}\\p{Nd}_$]+/gu;\n/** Joiners are part of emoji sequences and of Arabic and Indic spelling. */\nconst JOINS = /[\\p{L}\\p{M}\\p{Extended_Pictographic}]/u;\nconst JOINS_ASCII = /[\\0-\\x7f]/;\nconst CJK = /[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\u3000-\\u303f\\uff00-\\uffef]/u;\n\n/** A character with a glyph: not a space, a control or a format character. */\nconst VISIBLE = /^[^\\s\\p{Cc}\\p{Cf}\\p{Zs}]/u;\n\nconst hex = (codePoint: number): string => `U+${codePoint.toString(16).toUpperCase().padStart(4, '0')}`;\n\nconst isSelector = (codePoint: number): boolean => (codePoint >= 0xfe00 && codePoint <= 0xfe0f) || (codePoint >= 0xe0100 && codePoint <= 0xe01ef);\n\nconst joinsHere = (char: string | undefined): boolean => char !== undefined && !JOINS_ASCII.test(char) && JOINS.test(char);\n\n/** The verdict for one character, given its neighbours (code points, `undefined` at the text's edges). */\nfunction classify(codePoint: number, before: number | undefined, after: number | undefined): Rule | null {\n const fixed = TABLE.get(codePoint);\n if (fixed !== undefined) return fixed;\n if (codePoint === 0x200c || codePoint === 0x200d) {\n // Inside a word or an emoji sequence (both sides non-ASCII letters, marks or pictographs) a joiner is spelling.\n const charBefore = before === undefined ? undefined : String.fromCodePoint(before);\n const charAfter = after === undefined ? undefined : String.fromCodePoint(after);\n if (joinsHere(charBefore) && joinsHere(charAfter)) return null;\n return rule('invisible', 'warning', '', codePoint === 0x200c ? 'ZERO WIDTH NON-JOINER' : 'ZERO WIDTH JOINER');\n }\n if (isSelector(codePoint)) {\n // One selector after a visible character picks its glyph (an emoji's colour form); a run of them smuggles data,\n // and after a space, a control or nothing at all a selector selects nothing.\n const base = before === undefined ? '' : String.fromCodePoint(before);\n if (VISIBLE.test(base) && !isSelector(before as number) && (after === undefined || !isSelector(after))) return null;\n return rule('invisible', 'warning', '', 'VARIATION SELECTOR');\n }\n // Tag characters spell invisible ASCII (\"ASCII smuggling\", hidden prompt text).\n if (codePoint >= 0xe0000 && codePoint <= 0xe007f) return rule('invisible', 'danger', '', 'TAG CHARACTER');\n if (codePoint === 0x09 || codePoint === 0x0a || codePoint === 0x0c || codePoint === 0x0d) return null;\n if (codePoint < 0x20 || (codePoint >= 0x7f && codePoint <= 0x9f)) return rule('control', 'warning', '', 'CONTROL CHARACTER');\n if (codePoint >= 0x2000 && codePoint <= 0x200a) return rule('unusual-space', 'warning', ' ', 'SPACE');\n if (codePoint >= 0xff01 && codePoint <= 0xff5e) {\n // Full-width punctuation is normal next to CJK text, as in a Chinese or Japanese comment.\n const charBefore = before === undefined ? '' : String.fromCodePoint(before);\n const charAfter = after === undefined ? '' : String.fromCodePoint(after);\n if (CJK.test(charBefore) || CJK.test(charAfter)) return null;\n return rule('confusable-punctuation', 'warning', String.fromCharCode(codePoint - 0xfee0), 'FULLWIDTH FORM');\n }\n return null;\n}\n\n/* ----------------------------------------------------------------- Scanning */\n\nexport interface RawFinding {\n readonly index: number;\n readonly length: number;\n readonly codePoint: number;\n readonly rule: Rule;\n}\n\nconst ALL = /* @__PURE__ */ new Set<CodeFindingKind>(CODE_FINDING_KINDS);\n\nexport function kindSet(kinds: readonly CodeFindingKind[] | undefined, name: string): ReadonlySet<CodeFindingKind> {\n if (kinds === undefined) return ALL;\n if (!Array.isArray(kinds) || !(kinds as readonly unknown[]).every((kind) => ALL.has(kind as CodeFindingKind))) {\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a list of: ${CODE_FINDING_KINDS.join(', ')}.`);\n }\n return new Set(kinds);\n}\n\n/** Every suspicious character in `text`, in order of position. Stops once `limit` are found. */\nexport function scan(text: string, kinds: ReadonlySet<CodeFindingKind>, limit: number): RawFinding[] {\n const found: RawFinding[] = [];\n let before: number | undefined;\n for (let index = 0; index < text.length && found.length < limit; ) {\n const codePoint = text.codePointAt(index) as number;\n const length = codePoint > 0xffff ? 2 : 1;\n // Only characters outside printable ASCII can be suspicious; skip the rest fast.\n if (codePoint < 0x20 || codePoint >= 0x7f) {\n const verdict = classify(codePoint, before, text.codePointAt(index + length));\n if (verdict !== null && kinds.has(verdict.kind)) found.push({ index, length, codePoint, rule: verdict });\n }\n before = codePoint;\n index += length;\n }\n if (kinds.has('mixed-script') && FOREIGN.test(text)) {\n const mixed: RawFinding[] = [];\n for (const match of text.matchAll(WORD)) {\n const word = match[0];\n if (!LATIN.test(word) || !FOREIGN.test(word)) continue;\n let offset = 0;\n for (const char of word) {\n if (FOREIGN_LETTER.test(char)) {\n const lookalike = LOOKALIKES.get(char);\n const codePoint = char.codePointAt(0) as number;\n mixed.push({\n index: (match.index) + offset,\n length: char.length,\n codePoint,\n rule:\n lookalike === undefined\n ? rule('mixed-script', 'warning', null, 'NON-LATIN LETTER IN A LATIN WORD')\n : rule('mixed-script', 'danger', lookalike, `LOOKALIKE OF \"${lookalike}\"`),\n });\n }\n offset += char.length;\n }\n }\n return merge(found, mixed).slice(0, limit);\n }\n return found;\n}\n\nfunction merge(a: readonly RawFinding[], b: readonly RawFinding[]): RawFinding[] {\n if (b.length === 0) return [...a];\n const out: RawFinding[] = [];\n let i = 0;\n let j = 0;\n while (i < a.length || j < b.length) {\n const next = j >= b.length || (i < a.length && (a[i] as RawFinding).index < (b[j] as RawFinding).index) ? a[i++] : b[j++];\n out.push(next as RawFinding);\n }\n return out;\n}\n\n/** Offsets where each line starts. */\nfunction lineStarts(text: string): number[] {\n const starts = [0];\n for (let index = 0; index < text.length; index += 1) {\n const char = text.charCodeAt(index);\n if (char === 0x0a || (char === 0x0d && text.charCodeAt(index + 1) !== 0x0a)) starts.push(index + 1);\n }\n return starts;\n}\n\nexport function toFindings(text: string, raw: readonly RawFinding[]): CodeFinding[] {\n if (raw.length === 0) return [];\n const starts = lineStarts(text);\n return raw.map(({ index, length, codePoint, rule: { kind, severity, replacement, name } }) => {\n let low = 0;\n let high = starts.length - 1;\n while (low < high) {\n const mid = (low + high + 1) >> 1;\n if ((starts[mid] as number) <= index) low = mid;\n else high = mid - 1;\n }\n return {\n kind,\n severity,\n index,\n length,\n line: low + 1,\n column: index - (starts[low] as number) + 1,\n codePoint,\n label: `${hex(codePoint)} ${name}`,\n replacement,\n };\n });\n}\n\nexport function positiveLimit(value: number | undefined, fallback: number, name: string): number {\n if (value === undefined) return fallback;\n if (value === Infinity || (Number.isInteger(value) && value > 0)) return value;\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a positive integer or Infinity (received ${String(value)}).`);\n}\n\n/**\n * Finds characters that make code read differently from how it runs, or that a\n * copy through a word processor or chat app slipped in: bidirectional overrides\n * (Trojan Source), invisible characters and identifiers, control characters,\n * unusual spaces, curly quotes and dashes, and Cyrillic or Greek lookalikes inside\n * Latin words. Works anywhere, including on the server.\n *\n * @example\n * const { danger, findings } = inspectCode(pasted);\n * if (danger) warn(findings.map((f) => `${f.line}:${f.column} ${f.label}`));\n */\nexport function inspectCode(code: string, options: InspectCodeOptions = {}): CodeInspection {\n const kinds = kindSet(options.kinds, 'kinds');\n const max = positiveLimit(options.maxFindings, DEFAULT_CODE_MAX_FINDINGS, 'maxFindings');\n // One past the limit tells whether more were left.\n const raw = scan(code, kinds, max === Infinity ? Infinity : max + 1);\n const truncated = raw.length > max;\n const findings = toFindings(code, truncated ? raw.slice(0, max) : raw);\n return { findings, danger: findings.some((finding) => finding.severity === 'danger'), truncated };\n}\n\nexport interface CleanCodeOptions {\n /** Which kinds to fix. Default: all. Findings without a `replacement` are never changed. */\n readonly kinds?: readonly CodeFindingKind[];\n}\n\nexport interface CleanCode {\n readonly code: string;\n /** What was replaced or removed, in order, with positions in the original text. */\n readonly fixed: readonly CodeFinding[];\n /** What is still in `code` (positions in `code`): findings without a safe replacement. */\n readonly remaining: readonly CodeFinding[];\n}\n\n/** Applies the replacement of each (fixable) finding, from the end so earlier offsets stay valid. */\nfunction applyFixes(text: string, fixable: readonly RawFinding[]): string {\n let out = text;\n for (let at = fixable.length - 1; at >= 0; at -= 1) {\n const { index, length, rule: verdict } = fixable[at] as RawFinding;\n out = out.slice(0, index) + (verdict.replacement as string) + out.slice(index + length);\n }\n return out;\n}\n\nconst fixableIn = (text: string, kinds: ReadonlySet<CodeFindingKind>): RawFinding[] =>\n scan(text, kinds, Infinity).filter((finding) => finding.rule.replacement !== null);\n\n/**\n * Maps an offset in the text after `fixes` back to the text they were applied to.\n * The offset is never inside a replacement: replacements are ASCII (or a line\n * feed), which is never suspicious, so a later pass can't find anything in them.\n */\nfunction beforeFixes(index: number, fixes: readonly RawFinding[]): number {\n let shift = 0;\n for (const { index: at, length, rule: verdict } of fixes) {\n if (index < at + shift) break;\n shift += (verdict.replacement as string).length - length;\n }\n return index - shift;\n}\n\n/**\n * Fixes until nothing fixable is left: removing a character can expose another\n * finding (a zero-width space between `a` and a Cyrillic letter hides a mixed\n * word). Every pass removes or replaces suspicious characters with ASCII, which is\n * never suspicious, so this ends. Returns what was fixed, positioned in `text`.\n */\nexport function fixAll(text: string, kinds: ReadonlySet<CodeFindingKind>): { readonly text: string; readonly fixed: readonly RawFinding[] } {\n const passes: RawFinding[][] = [];\n let out = text;\n for (let fixable = fixableIn(out, kinds); fixable.length > 0; fixable = fixableIn(out, kinds)) {\n passes.push(fixable);\n out = applyFixes(out, fixable);\n }\n const fixed = passes.flatMap((found, pass) =>\n found.map((finding) => {\n let index = finding.index;\n for (let earlier = pass - 1; earlier >= 0; earlier -= 1) index = beforeFixes(index, passes[earlier] as RawFinding[]);\n return { ...finding, index };\n }),\n );\n return { text: out, fixed: fixed.sort((x, y) => x.index - y.index) };\n}\n\n/**\n * Replaces what {@link inspectCode} finds with safe ASCII: removes bidi controls,\n * invisible and control characters, turns unusual spaces into spaces, curly quotes\n * and dashes into `'` `\"` `-`, and lookalike letters into the Latin letters they\n * imitate. Letters with no lookalike are reported in `remaining`, never guessed.\n *\n * @example\n * cleanCode('const s = \\u201Chi\\u201D;').code; // 'const s = \"hi\";'\n */\nexport function cleanCode(code: string, options: CleanCodeOptions = {}): CleanCode {\n const kinds = kindSet(options.kinds, 'kinds');\n const { text, fixed } = fixAll(code, kinds);\n return { code: text, fixed: toFindings(code, fixed), remaining: toFindings(text, scan(text, kinds, Infinity)) };\n}\n","/**\n * Code as lines of styled runs. Plain text is one unstyled run per line; a\n * highlighted element keeps each token's colour. Every transform works on this\n * one model, so the plain text and the HTML of a copy always hold the same code.\n */\n\nexport interface Run {\n readonly text: string;\n /** Inline CSS for the run, `''` for none. */\n readonly style: string;\n}\n\nexport type Line = readonly Run[];\n\n/** Line breaks: CRLF, LF, CR, and the Unicode line and paragraph separators and NEL. */\nconst BREAK = /\\r\\n|[\\n\\r\\u2028\\u2029\\u0085]/;\n\nexport const lineText = (line: Line): string => line.map((run) => run.text).join('');\n\n/** Splits runs into lines. */\nexport function toLines(runs: readonly Run[]): Line[] {\n const lines: Run[][] = [[]];\n let carriageReturn = false;\n for (const run of runs) {\n // A CRLF split across two runs is one line break.\n const text = carriageReturn && run.text.startsWith('\\n') ? run.text.slice(1) : run.text;\n if (run.text !== '') carriageReturn = run.text.endsWith('\\r');\n const parts = text.split(BREAK);\n parts.forEach((part, at) => {\n if (at > 0) lines.push([]);\n if (part !== '') (lines[lines.length - 1] as Run[]).push({ text: part, style: run.style });\n });\n }\n return lines;\n}\n\n/** The characters of a line from `from` to `to` (UTF-16 offsets), with their styles. */\nexport function slice(line: Line, from: number, to: number = Infinity): Line {\n const out: Run[] = [];\n let offset = 0;\n for (const run of line) {\n const start = Math.max(from - offset, 0);\n const end = Math.min(to - offset, run.text.length);\n if (start < end) out.push(start === 0 && end === run.text.length ? run : { text: run.text.slice(start, end), style: run.style });\n offset += run.text.length;\n }\n return out;\n}\n\nexport interface Edit {\n readonly index: number;\n readonly length: number;\n readonly text: string;\n}\n\n/** Applies non-overlapping replacements of at least one character, sorted by `index`; the new text keeps the style of what it replaces. */\nexport function edit(line: Line, edits: readonly Edit[]): Line {\n if (edits.length === 0) return line;\n const out: Run[] = [];\n let at = 0;\n for (const { index, length, text } of edits) {\n out.push(...slice(line, at, index));\n if (text !== '') out.push({ text, style: (slice(line, index, index + length)[0] as Run).style });\n at = index + length;\n }\n out.push(...slice(line, at));\n return out;\n}\n","import { copyFailure } from '../core/errors';\nimport { fixAll, kindSet, type CodeFindingKind } from './inspect';\nimport { edit, lineText, slice, toLines, type Line } from './lines';\n\n/** Built-in prompt styles for terminal and REPL sessions. */\nexport type PromptStyle = 'shell' | 'powershell' | 'cmd' | 'python' | 'ipython' | 'node';\n\n/** Every built-in prompt style. `'auto'` tries all but `node`, whose `> ` is too common to guess. */\nexport const PROMPT_STYLES: readonly PromptStyle[] = Object.freeze(['shell', 'powershell', 'cmd', 'python', 'ipython', 'node']);\n\n/**\n * A custom prompt. `command` matches the prompt at the start of a command line,\n * `continuation` the prompt of the lines that continue it. Matches must start at\n * the beginning of the line; the `g` and `y` flags are ignored.\n */\nexport interface PromptPattern {\n readonly command: RegExp;\n readonly continuation?: RegExp;\n}\n\nexport interface CodeTextOptions {\n /**\n * Copy a terminal or REPL session as the commands to run: prompts are removed\n * and output lines are dropped. `'auto'` (the default for copying) does this only\n * when the first line starts with a `$`, `PS>`, `C:\\>`, `>>>` or `In [1]:`\n * prompt; `false` keeps the text as it is.\n */\n readonly prompt?: 'auto' | false | PromptStyle | PromptPattern;\n /** Copy a unified diff as the code after (`'after'`) or before (`'before'`) the change. Default `false`. */\n readonly diff?: false | 'after' | 'before';\n /**\n * Remove line numbers typed into the text (`1: code`, ` 12 | code`). Only\n * applied when every line starts with a number and the numbers count up by one.\n * Default `false`.\n */\n readonly lineNumbers?: boolean;\n /** Remove the indentation every line shares. Default `true`. */\n readonly dedent?: boolean;\n /** Default `true`. */\n readonly trimTrailingWhitespace?: boolean;\n /** Remove blank lines at the start and the end. Default `true`. */\n readonly trimBlankLines?: boolean;\n /** Default `'lf'`. */\n readonly lineEnding?: 'lf' | 'crlf';\n /** End with a line break. Default `false`. */\n readonly finalNewline?: boolean;\n /**\n * Fix what `inspectCode` finds (see `cleanCode`): `true` for every kind, or a\n * list of kinds. Default `false` when copying, `true` when pasting.\n */\n readonly clean?: boolean | readonly CodeFindingKind[];\n}\n\nexport interface Resolved {\n readonly prompt: Prompt | 'auto' | null;\n readonly diff: 'after' | 'before' | null;\n readonly lineNumbers: boolean;\n readonly dedent: boolean;\n readonly trimTrailingWhitespace: boolean;\n readonly trimBlankLines: boolean;\n readonly eol: string;\n readonly finalNewline: boolean;\n readonly clean: ReadonlySet<CodeFindingKind> | null;\n}\n\n/* ------------------------------------------------------------------ Prompts */\n\ninterface Prompt {\n readonly command: RegExp;\n readonly continuation: RegExp | null;\n /** Shell rules: a line continues after `\\`, inside a heredoc or an open quote, with an optional `> ` prompt. */\n readonly shell: boolean;\n}\n\nconst PROMPTS: Readonly<Record<PromptStyle, Prompt>> = {\n // `$` after an optional `(venv) `, `user@host`, and a `~/path`; `#` and `%` are left out: they start comments.\n shell: { command: /^(?:\\([^()\\s]{1,64}\\) )?(?:[\\w.-]{1,64}@[\\w.-]{1,253}:?)?(?:[~/][^\\s$]{0,1024})? ?\\$(?: |$)/, continuation: null, shell: true },\n powershell: { command: /^PS(?: [^>\\r\\n]{0,1024})?> ?/, continuation: /^>> ?/, shell: false },\n cmd: { command: /^[A-Za-z]:\\\\[^>\\r\\n]{0,1024}> ?/, continuation: /^More\\? ?/, shell: false },\n python: { command: /^>>>(?: |$)/, continuation: /^\\.\\.\\.(?: |$)/, shell: false },\n ipython: { command: /^In \\[\\d{0,9}\\]: ?/, continuation: /^ {0,64}\\.{3,}: ?/, shell: false },\n node: { command: /^>(?: |$)/, continuation: /^\\.\\.\\.(?: |$)/, shell: false },\n};\n\nconst AUTO: readonly PromptStyle[] = ['powershell', 'cmd', 'ipython', 'python', 'shell'];\n\n/** A user pattern without `g` / `y`, so `exec` is stateless. */\nfunction stateless(pattern: unknown, name: string): RegExp {\n if (!(pattern instanceof RegExp)) throw copyFailure('invalid-payload', `\\`prompt.${name}\\` must be a RegExp.`);\n return new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ''));\n}\n\nfunction resolvePrompt(prompt: CodeTextOptions['prompt'], fallback: 'auto' | false): Prompt | 'auto' | null {\n const value = prompt ?? fallback;\n if (value === false) return null;\n if (value === 'auto') return 'auto';\n if (typeof value === 'string') {\n if (!Object.prototype.hasOwnProperty.call(PROMPTS, value)) {\n throw copyFailure('invalid-payload', `\\`prompt\\` must be 'auto', false, a PromptPattern or one of: ${PROMPT_STYLES.join(', ')}.`);\n }\n return PROMPTS[value];\n }\n // Plain-JS callers can pass anything.\n if (typeof (value as unknown) !== 'object' || (value as unknown) === null) {\n throw copyFailure('invalid-payload', `\\`prompt\\` must be 'auto', false, a PromptPattern or one of: ${PROMPT_STYLES.join(', ')}.`);\n }\n return {\n command: stateless(value.command, 'command'),\n continuation: value.continuation === undefined ? null : stateless(value.continuation, 'continuation'),\n shell: false,\n };\n}\n\n/** The length of the prompt at the start of `text`, or -1. */\nfunction promptLength(pattern: RegExp, text: string): number {\n const match = pattern.exec(text);\n return match?.index === 0 ? match[0].length : -1;\n}\n\n/** Whether a shell command goes on to the next line: a trailing `\\`, an open heredoc or an open quote. */\ninterface ShellState {\n quote: '\"' | \"'\" | null;\n heredoc: string | null;\n /** The next line continues because this one ended with an unescaped `\\`. */\n escaped: boolean;\n}\n\nconst HEREDOC = /<<-?[ \\t]*(['\"]?)([A-Za-z_][\\w-]{0,63})\\1/;\n\nfunction readShell(text: string, state: ShellState): void {\n if (state.heredoc !== null) {\n if (text.replace(/^\\t+/, '') === state.heredoc) state.heredoc = null;\n state.escaped = false;\n return;\n }\n let escaped = false;\n for (let at = 0; at < text.length; at += 1) {\n const char = text.charAt(at);\n if (escaped) escaped = false;\n else if (char === '\\\\' && state.quote !== \"'\") escaped = true;\n else if (state.quote === null && (char === '\"' || char === \"'\")) state.quote = char;\n else if (char === state.quote) state.quote = null;\n else if (state.quote !== null) continue;\n else if (char === '#') break; // A comment: quotes after it don't count.\n else if (char === '<' && state.heredoc === null) {\n const heredoc = HEREDOC.exec(text.slice(at));\n if (heredoc?.index === 0) state.heredoc = heredoc[2] as string;\n }\n }\n state.escaped = escaped;\n}\n\nconst continues = (state: ShellState): boolean => state.escaped || state.quote !== null || state.heredoc !== null;\n\nfunction firstNonBlank(lines: readonly Line[]): string {\n for (const line of lines) {\n const text = lineText(line);\n if (text.trim() !== '') return text;\n }\n return '';\n}\n\n/** Keeps the commands of a session, without prompts; drops its output. */\nfunction stripPrompts(lines: readonly Line[], setting: Prompt | 'auto'): Line[] {\n let prompt: Prompt;\n if (setting === 'auto') {\n const first = firstNonBlank(lines);\n const style = AUTO.find((name) => promptLength(PROMPTS[name].command, first) >= 0);\n if (style === undefined) return [...lines];\n prompt = PROMPTS[style];\n } else {\n prompt = setting;\n }\n const out: Line[] = [];\n const shell: ShellState = { quote: null, heredoc: null, escaped: false };\n let inCommand = false;\n /** Shell continuation lines carry a `> ` prompt (PS2) when the first one does. */\n let ps2: boolean | null = null;\n for (const line of lines) {\n const text = lineText(line);\n if (prompt.shell && continues(shell)) {\n if (ps2 === null) ps2 = /^>(?: |$)/.test(text);\n const cut = ps2 ? (text.startsWith('> ') ? 2 : text === '>' ? 1 : 0) : 0;\n const rest = slice(line, cut);\n out.push(rest);\n readShell(lineText(rest), shell);\n continue;\n }\n const command = promptLength(prompt.command, text);\n if (command >= 0) {\n const rest = slice(line, command);\n out.push(rest);\n inCommand = true;\n ps2 = null;\n if (prompt.shell) readShell(lineText(rest), shell);\n continue;\n }\n const continuation = inCommand && prompt.continuation !== null ? promptLength(prompt.continuation, text) : -1;\n if (continuation >= 0) {\n out.push(slice(line, continuation));\n continue;\n }\n inCommand = false; // Output.\n }\n return out;\n}\n\n/* --------------------------------------------------------------------- Diff */\n\nconst DIFF_HEADER = /^(?:diff |index |--- |\\+\\+\\+ |new file mode|deleted file mode|old mode|new mode|similarity index|dissimilarity index|rename from|rename to|copy from|copy to|Binary files)/;\n\n/** Keeps one side of a unified diff, without the `+`, `-` and space markers. */\nfunction pickSide(lines: readonly Line[], side: 'after' | 'before'): Line[] {\n const keep = side === 'after' ? '+' : '-';\n const drop = side === 'after' ? '-' : '+';\n const out: Line[] = [];\n // A diff that starts with file headers stays in the header until its first hunk.\n let header = /^(?:diff |--- |index )/.test(firstNonBlank(lines));\n for (const line of lines) {\n const text = lineText(line);\n if (text.startsWith('diff --git ')) header = true;\n if (header) {\n if (text.startsWith('@@')) header = false;\n else if (DIFF_HEADER.test(text) || text.trim() === '') continue;\n else header = false; // Not a header after all: the hunk starts here.\n }\n if (text.startsWith('@@') || text.startsWith('\\\\ ')) continue;\n const marker = text.charAt(0);\n if (marker === drop) continue;\n out.push(marker === keep || marker === ' ' ? slice(line, 1) : line);\n }\n return out;\n}\n\n/* ------------------------------------------------------------- Line numbers */\n\nconst NUMBERED = /^[ \\t]*(\\d{1,9})(?:[ \\t]*[:|\\u2502](?: |$)|[ \\t]+|$)/;\n\nfunction stripLineNumbers(lines: readonly Line[]): Line[] {\n const cuts: number[] = [];\n let expected: number | null = null;\n for (const line of lines) {\n const match = NUMBERED.exec(lineText(line));\n if (match === null) return [...lines];\n const number = Number(match[1]);\n if (expected !== null && number !== expected) return [...lines];\n expected = number + 1;\n cuts.push(match[0].length);\n }\n // A single line can't show that the numbers count.\n if (cuts.length < 2) return [...lines];\n return lines.map((line, at) => slice(line, cuts[at] as number));\n}\n\n/* ------------------------------------------------------------ Whitespace */\n\nfunction trimEnd(line: Line): Line {\n const text = lineText(line);\n const end = text.replace(/[ \\t]+$/, '').length;\n return end === text.length ? line : slice(line, 0, end);\n}\n\nfunction dedentLines(lines: readonly Line[]): Line[] {\n let common: string | null = null;\n for (const line of lines) {\n const text = lineText(line);\n if (text.trim() === '') continue;\n const indent = /^[ \\t]*/.exec(text)?.[0] as string;\n if (common === null) {\n common = indent;\n } else {\n let shared = 0;\n while (shared < common.length && shared < indent.length && common[shared] === indent[shared]) shared += 1;\n common = common.slice(0, shared);\n }\n if (common === '') return [...lines];\n }\n if (common === null) return [...lines];\n const width = common.length;\n return lines.map((line) => slice(line, Math.min(width, /^[ \\t]*/.exec(lineText(line))?.[0].length as number)));\n}\n\n/* ------------------------------------------------------------------ Options */\n\nconst oneOf = <const T extends string | boolean>(value: unknown, allowed: readonly T[], fallback: NoInfer<T>, name: string): T => {\n if (value === undefined) return fallback;\n if ((allowed as readonly unknown[]).includes(value)) return value as T;\n throw copyFailure('invalid-payload', `\\`${name}\\` must be one of: ${allowed.map((option) => JSON.stringify(option)).join(', ')}.`);\n};\n\nconst flag = (value: unknown, fallback: boolean, name: string): boolean => oneOf(value, [true, false], fallback, name);\n\nexport interface Defaults {\n readonly prompt: 'auto' | false;\n readonly clean: boolean;\n}\n\nexport function resolveText(options: CodeTextOptions, defaults: Defaults): Resolved {\n const clean = options.clean ?? defaults.clean;\n return {\n prompt: resolvePrompt(options.prompt, defaults.prompt),\n diff: oneOf(options.diff, [false, 'after', 'before'], false, 'diff') || null,\n lineNumbers: flag(options.lineNumbers, false, 'lineNumbers'),\n dedent: flag(options.dedent, true, 'dedent'),\n trimTrailingWhitespace: flag(options.trimTrailingWhitespace, true, 'trimTrailingWhitespace'),\n trimBlankLines: flag(options.trimBlankLines, true, 'trimBlankLines'),\n eol: oneOf(options.lineEnding, ['lf', 'crlf'], 'lf', 'lineEnding') === 'crlf' ? '\\r\\n' : '\\n',\n finalNewline: flag(options.finalNewline, false, 'finalNewline'),\n clean: clean === false ? null : kindSet(clean === true ? undefined : clean, 'clean'),\n };\n}\n\n/* ----------------------------------------------------------------- Pipeline */\n\nexport interface Transformed {\n readonly lines: readonly Line[];\n /** How many characters `clean` replaced or removed. */\n readonly fixed: number;\n}\n\nexport function transform(input: readonly Line[], options: Resolved): Transformed {\n let lines: Line[] = [...input];\n let fixed = 0;\n const kinds = options.clean;\n if (kinds !== null) {\n lines = lines.map((line) => {\n const { fixed: found } = fixAll(lineText(line), kinds);\n fixed += found.length;\n return edit(\n line,\n found.map(({ index, length, rule: { replacement } }) => ({ index, length, text: replacement as string })),\n );\n });\n }\n if (options.diff !== null) lines = pickSide(lines, options.diff);\n // Prompts are found after the shared indentation, as in a session indented inside a list.\n if (options.prompt !== null) lines = stripPrompts(options.dedent ? dedentLines(lines) : lines, options.prompt);\n if (options.lineNumbers) lines = stripLineNumbers(lines);\n if (options.trimTrailingWhitespace) lines = lines.map(trimEnd);\n if (options.trimBlankLines) {\n const blank = (line: Line) => lineText(line).trim() === '';\n let start = 0;\n let end = lines.length;\n while (start < end && blank(lines[start] as Line)) start += 1;\n while (end > start && blank(lines[end - 1] as Line)) end -= 1;\n lines = lines.slice(start, end);\n }\n if (options.dedent) lines = dedentLines(lines);\n return { lines, fixed };\n}\n\n/** The text of transformed lines. */\nexport function render(lines: readonly Line[], options: Pick<Resolved, 'eol' | 'finalNewline'>): string {\n const text = lines.map(lineText).join(options.eol);\n return options.finalNewline && text !== '' ? text + options.eol : text;\n}\n\n/**\n * Code as it should be copied or saved: a terminal session becomes its commands,\n * a diff one side of the change, typed line numbers and shared indentation are\n * removed, line endings are normalised. Works anywhere, including on the server.\n *\n * @example\n * normalizeCode('$ npm install react-smart-copy\\nadded 1 package'); // 'npm install react-smart-copy'\n */\nexport function normalizeCode(code: string, options: CodeTextOptions = {}): string {\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n return render(transform(toLines([{ text: code, style: '' }]), resolved).lines, resolved);\n}\n","import { copyFailure } from '../core/errors';\nimport type { Run } from './lines';\n\n/** Never code: scripts, embedded content, form controls (the block's own Copy button) and media. */\nconst SKIP = new Set([\n 'script', 'style', 'template', 'noscript', 'head', 'button', 'input', 'textarea', 'select', 'option', 'datalist',\n 'dialog', 'svg', 'math', 'canvas', 'iframe', 'object', 'embed', 'img', 'picture', 'video', 'audio', 'source', 'track',\n]);\n\n/** Elements that start their own line. */\nconst BLOCK = new Set([\n 'address', 'article', 'aside', 'blockquote', 'dd', 'details', 'div', 'dl', 'dt', 'figcaption', 'figure', 'footer',\n 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'li', 'main', 'nav', 'ol', 'p', 'pre', 'section',\n 'summary', 'table', 'tbody', 'tfoot', 'thead', 'tr', 'ul',\n]);\n\n/**\n * Line-number gutters by the class names highlighters give them (Prism, highlight.js,\n * Rouge, Pygments, react-syntax-highlighter, CodeMirror and others).\n */\n/** Whitespace between table rows and cells is never rendered. */\nconst TABLE_PARTS = new Set(['table', 'thead', 'tbody', 'tfoot', 'tr', 'colgroup']);\n\nconst GUTTER = /(?:^|[\\s_-])(?:gutter|linenos?|lineno|line-?numbers?|ln-numbers?|line-?nums?)(?:$|[\\s_-])/i;\nconst NO_SELECT = /(?:^|;)\\s*(?:-webkit-)?user-select\\s*:\\s*none/i;\n\n/** Colours as browsers serialise them. Anything else (`url(...)`, `var(...)`) is never copied into the HTML. */\nconst SAFE_COLOR =\n /^(?:#[\\da-f]{3,8}|[a-z]{3,20}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\([\\d\\s.,%/+-]{1,80}\\)|color\\([a-z\\d-]{1,24}[\\d\\s.,%/+-]{1,80}\\))$/i;\nconst TRANSPARENT = /^(?:transparent|rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\))$/i;\n\nexport interface ExtractOptions {\n /** A CSS selector for more parts to leave out. */\n readonly ignore?: string | undefined;\n /** Keep each token's colour and weight, for the HTML flavour. */\n readonly styles: boolean;\n}\n\nexport interface Extracted {\n readonly runs: readonly Run[];\n /** The block's own text and background colour, as CSS. */\n readonly blockStyle: string;\n}\n\ninterface Look {\n readonly color: string;\n readonly bold: boolean;\n readonly italic: boolean;\n readonly decoration: string;\n}\n\nexport function assertElement(value: unknown, name: string): asserts value is Element {\n if (typeof value !== 'object' || value === null || (value as { nodeType?: unknown }).nodeType !== 1) {\n throw copyFailure('invalid-payload', `\\`${name}\\` must be a string or an Element.`);\n }\n}\n\nfunction lookOf(style: CSSStyleDeclaration): Look {\n const weight = style.fontWeight;\n const decoration = `${style.textDecorationLine || style.textDecoration} `;\n return {\n color: SAFE_COLOR.test(style.color) ? style.color : '',\n bold: weight === 'bold' || weight === 'bolder' || Number(weight) >= 600,\n italic: style.fontStyle === 'italic' || style.fontStyle.startsWith('oblique'),\n decoration: ['underline', 'line-through'].filter((line) => decoration.includes(line)).join(' '),\n };\n}\n\n/**\n * The code a rendered block shows, as styled runs: line-number gutters, hidden\n * and unselectable parts (`user-select: none`), `aria-hidden` decorations,\n * buttons and anything marked `data-copy-ignore` are left out.\n */\nexport function extract(root: Element, options: ExtractOptions): Extracted {\n const { ignore } = options;\n if (ignore !== undefined) {\n try {\n root.matches(ignore);\n } catch (cause) {\n throw copyFailure('invalid-payload', `\\`ignore\\` is not a valid CSS selector: ${ignore}`, cause);\n }\n }\n const view = root.ownerDocument.defaultView;\n const computed = (element: Element): CSSStyleDeclaration | null => (view === null ? null : view.getComputedStyle(element));\n const rootStyle = computed(root);\n const base: Look = rootStyle === null ? { color: '', bold: false, italic: false, decoration: '' } : lookOf(rootStyle);\n const runs: Run[] = [];\n const styles = new Map<Element, string>();\n let last = '';\n\n const push = (text: string, style: string): void => {\n if (text === '') return;\n const previous = runs[runs.length - 1];\n if (previous?.style === style) runs[runs.length - 1] = { text: previous.text + text, style };\n else runs.push({ text, style });\n last = text.charAt(text.length - 1);\n };\n const breakLine = (): void => {\n if (last !== '' && last !== '\\n') push('\\n', '');\n };\n\n const styleOf = (element: Element): string => {\n let style = styles.get(element);\n if (style === undefined) {\n const declared = computed(element);\n style = '';\n if (declared !== null) {\n const look = lookOf(declared);\n if (look.color !== '' && look.color !== base.color) style += `color:${look.color};`;\n if (look.bold && !base.bold) style += 'font-weight:bold;';\n if (look.italic && !base.italic) style += 'font-style:italic;';\n if (look.decoration !== '' && look.decoration !== base.decoration) style += `text-decoration:${look.decoration};`;\n }\n styles.set(element, style);\n }\n return style;\n };\n\n const leftOut = (element: Element): boolean => {\n if (SKIP.has(element.localName)) return true;\n if (element.hasAttribute('hidden') || element.hasAttribute('data-copy-ignore') || element.getAttribute('aria-hidden') === 'true') return true;\n if (GUTTER.test(element.getAttribute('class') ?? '') || NO_SELECT.test(element.getAttribute('style') ?? '')) return true;\n if (ignore !== undefined && element.matches(ignore)) return true;\n const style = computed(element);\n return style !== null && (style.display === 'none' || style.userSelect === 'none' || style.getPropertyValue('-webkit-user-select') === 'none');\n };\n\n const walk = (parent: Element): void => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node.nodeType === 3) {\n const { data } = node as Text;\n if (TABLE_PARTS.has(parent.localName) && data.trim() === '') continue;\n push(data, options.styles ? styleOf(parent) : '');\n } else if (node.nodeType === 1) {\n const element = node as Element;\n if (leftOut(element)) continue;\n if (element.localName === 'br') {\n push('\\n', '');\n } else if (BLOCK.has(element.localName)) {\n breakLine();\n walk(element);\n breakLine();\n } else {\n walk(element);\n }\n }\n }\n };\n walk(root);\n\n let blockStyle = '';\n if (options.styles && rootStyle !== null) {\n if (base.color !== '') blockStyle += `color:${base.color};`;\n const background = rootStyle.backgroundColor;\n if (SAFE_COLOR.test(background) && !TRANSPARENT.test(background)) blockStyle += `background-color:${background};`;\n }\n return { runs, blockStyle };\n}\n","import { copyFailure } from '../core/errors';\nimport type { HtmlPayload, TextPayload } from '../core/payload';\nimport { assertElement, extract } from './element';\nimport { toLines, type Line } from './lines';\nimport { render, resolveText, transform, type CodeTextOptions } from './normalize';\n\n/** Code to copy: a string, or a rendered (and possibly highlighted) code block. */\nexport type CodeSource = string | Element;\n\nexport interface CodeFromElementOptions extends CodeTextOptions {\n /**\n * A CSS selector for more parts of the block to leave out. Gutters, hidden and\n * `user-select: none` parts, `aria-hidden` decorations, buttons and anything with\n * `data-copy-ignore` are always left out.\n */\n readonly ignore?: string;\n}\n\nexport interface CodePayloadOptions extends CodeFromElementOptions {\n /**\n * Add an HTML flavour (`<pre><code>`), so the code stays monospaced when pasted\n * into Google Docs, Word, Slack, Teams or a mail; from an element, with its\n * syntax colours. Editors and terminals still paste the plain text. Default `true`.\n */\n readonly html?: boolean;\n /** Written as `class=\"language-<name>\"` on the `<code>` element. Letters, digits and `_ + # . -` only. */\n readonly language?: string;\n}\n\nconst LANGUAGE = /^[A-Za-z0-9_+#.-]{1,64}$/;\nconst MONOSPACE = \"font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,'Liberation Mono',monospace;white-space:pre;\";\n\n/** HTML can't hold U+0000: parsers turn it into U+FFFD, so the HTML says so itself (the text flavour keeps it). */\nconst escapeHtml = (text: string): string =>\n text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"').replace(/\\0/g, '\\uFFFD');\n\nfunction toHtml(lines: readonly Line[], blockStyle: string, language: string | undefined): string {\n const body = lines\n .map((line) => line.map(({ text, style }) => (style === '' ? escapeHtml(text) : `<span style=\"${escapeHtml(style)}\">${escapeHtml(text)}</span>`)).join(''))\n .join('\\n');\n const cls = language === undefined ? '' : ` class=\"language-${language}\"`;\n return `<pre style=\"${escapeHtml(MONOSPACE + blockStyle)}\"><code${cls}>${body}</code></pre>`;\n}\n\n/**\n * The code a rendered block shows, ready to run or save: see {@link extract} for\n * what is left out, and {@link CodeTextOptions} for prompts, diffs and whitespace.\n *\n * @example\n * codeFromElement(preRef.current, { prompt: 'shell' });\n */\nexport function codeFromElement(element: Element, options: CodeFromElementOptions = {}): string {\n assertElement(element, 'element');\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n const { runs } = extract(element, { ignore: options.ignore, styles: false });\n return render(transform(toLines(runs), resolved).lines, resolved);\n}\n\n/**\n * A copy payload for code: plain text for editors and terminals, plus\n * monospaced HTML (with the block's syntax colours when you pass the element)\n * for documents and chat. A terminal session is copied as its commands\n * (`prompt: 'auto'`). Code that ends up empty gives an empty text payload, which\n * `copy()` reports as an `invalid-payload` error.\n *\n * @example\n * const { copy } = useCopy();\n * <button onClick={() => copy(() => codePayload(preRef.current!, { language: 'tsx' }))}>Copy</button>\n */\nexport function codePayload(source: CodeSource, options: CodePayloadOptions = {}): HtmlPayload | TextPayload {\n const resolved = resolveText(options, { prompt: 'auto', clean: false });\n const withHtml = options.html ?? true;\n if (typeof withHtml !== 'boolean') throw copyFailure('invalid-payload', '`html` must be a boolean.');\n const { language } = options;\n if (language !== undefined && (typeof language !== 'string' || !LANGUAGE.test(language))) {\n throw copyFailure('invalid-payload', '`language` may only hold letters, digits and _ + # . - (at most 64).');\n }\n let lines: Line[];\n let blockStyle = '';\n if (typeof source === 'string') {\n lines = toLines([{ text: source, style: '' }]);\n } else {\n assertElement(source, 'source');\n const extracted = extract(source, { ignore: options.ignore, styles: withHtml });\n lines = toLines(extracted.runs);\n blockStyle = extracted.blockStyle;\n }\n const out = transform(lines, resolved).lines;\n const text = render(out, resolved);\n if (!withHtml || text === '') return { kind: 'text', value: text };\n return { kind: 'html', text, html: toHtml(out, blockStyle, language) };\n}\n","import { copyFailure, isCopyFailure } from '../core/errors';\nimport { asTextField, insertText } from '../core/text-field';\nimport { extract } from './element';\nimport { inspectCode, positiveLimit, type CodeFinding } from './inspect';\nimport { lineText, toLines, type Line } from './lines';\nimport { render, resolveText, transform, type CodeTextOptions } from './normalize';\nimport { parseInertHtml } from '../core/inert-html';\n\nexport const DEFAULT_CODE_MAX_LENGTH = 2_000_000;\n\nexport interface PasteToCodeOptions extends Omit<CodeTextOptions, 'finalNewline'> {\n /**\n * Indentation for every line after the first, which lands where the cursor is.\n * `pasteAsCode` sets it to the cursor line's indentation.\n */\n readonly indent?: string;\n /**\n * Longest paste to process, in UTF-16 code units. Longer pastes throw a\n * `too-large` error (`pasteAsCode` leaves them to the browser): code is never cut.\n * Default {@link DEFAULT_CODE_MAX_LENGTH}.\n */\n readonly maxLength?: number;\n}\n\nexport interface PasteCode {\n readonly code: string;\n /** `text` for the plain-text flavour; `html` when only HTML was on the clipboard. */\n readonly source: 'text' | 'html';\n /** What the pasted text held, before anything was fixed (positions in the pasted text, at most 1000). */\n readonly findings: readonly CodeFinding[];\n /** How many characters `clean` replaced or removed. */\n readonly fixed: number;\n /** What is still in `code` (positions in `code`), e.g. a non-Latin letter with no lookalike. */\n readonly remaining: readonly CodeFinding[];\n /** Whether `remaining` holds a `danger` finding. */\n readonly danger: boolean;\n}\n\n/** The clipboard flavours: a `PasteResult` from `usePaste`, or anything with `text` / `html`. */\nexport interface CodePasteSource {\n readonly text?: string | null;\n readonly html?: string | null;\n}\n\nconst INDENT = /^[ \\t]*$/;\n\nfunction indentLines(lines: readonly Line[], indent: string): Line[] {\n if (indent === '') return [...lines];\n return lines.map((line, at) => (at === 0 || lineText(line) === '' ? line : [{ text: indent, style: '' }, ...line]));\n}\n\n/**\n * Code for what was pasted: the plain text (or, when only HTML was copied, the\n * text of its code), cleaned of invisible and lookalike characters, curly quotes\n * and odd spaces, dedented, and re-indented with `indent`. Every finding is\n * reported. Returns `null` when there is nothing to paste.\n *\n * @example\n * usePaste({ accept: ['text'], onPaste: (result) => {\n * const pasted = pasteToCode(result);\n * if (pasted?.danger) showWarning(pasted.remaining);\n * } });\n */\nexport function pasteToCode(source: CodePasteSource, options: PasteToCodeOptions = {}): PasteCode | null {\n const resolved = resolveText(options, { prompt: false, clean: true });\n const maxLength = positiveLimit(options.maxLength, DEFAULT_CODE_MAX_LENGTH, 'maxLength');\n const indent = options.indent ?? '';\n if (typeof indent !== 'string' || !INDENT.test(indent)) throw copyFailure('invalid-payload', '`indent` may only hold spaces and tabs.');\n let text = source.text ?? '';\n let from: PasteCode['source'] = 'text';\n if (text === '' && typeof source.html === 'string' && source.html.trim() !== '' && typeof DOMParser !== 'undefined') {\n if (source.html.length > maxLength) throw copyFailure('too-large', `The pasted HTML is longer than maxLength (${String(maxLength)}).`);\n const body = parseInertHtml(source.html).body;\n text = extract(body, { styles: false }).runs.map((run) => run.text).join('');\n from = 'html';\n }\n if (text.length > maxLength) throw copyFailure('too-large', `The pasted text is longer than maxLength (${String(maxLength)}).`);\n if (text.trim() === '') return null;\n const { lines, fixed } = transform(toLines([{ text, style: '' }]), resolved);\n const code = render(indentLines(lines, indent), { eol: resolved.eol, finalNewline: false });\n const remaining = inspectCode(code, { maxFindings: Infinity }).findings;\n return {\n code,\n source: from,\n findings: inspectCode(text).findings,\n fixed,\n remaining,\n danger: remaining.some((finding) => finding.severity === 'danger'),\n };\n}\n\n/** Structural paste event: a DOM `ClipboardEvent` and React's `onPaste` event both fit. */\nexport interface CodePasteEvent {\n readonly clipboardData: { getData(format: string): string } | null;\n readonly currentTarget: EventTarget | null;\n readonly target: EventTarget | null;\n readonly defaultPrevented: boolean;\n preventDefault(): void;\n}\n\nexport interface PasteAsCodeOptions extends Omit<PasteToCodeOptions, 'indent'> {\n /** Indent the pasted lines to the cursor line's indentation, as code editors do. Default `true`. */\n readonly indentToCursor?: boolean;\n /**\n * Called before the code is inserted. Return `false` to cancel the paste, e.g.\n * when `danger` is set and the user declines.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- the callback may return nothing\n readonly onPaste?: (result: PasteCode) => boolean | void;\n}\n\n/**\n * A paste handler for code fields (`<textarea>`, or a text `<input>` for one-line\n * commands): pastes the code from {@link pasteToCode} at the cursor with the\n * browser's undo intact. Returns whether it took over the paste: `false` leaves\n * the paste to the browser (nothing to paste, a field it can't write to, invalid\n * options, or a paste past `maxLength`).\n *\n * @example\n * <textarea onPaste={pasteAsCode} />\n * <textarea onPaste={(event) => pasteAsCode(event, { onPaste: (r) => !r.danger || confirm('Paste anyway?') })} />\n */\nexport function pasteAsCode(event: CodePasteEvent, options: PasteAsCodeOptions = {}): boolean {\n if (event.defaultPrevented || event.clipboardData === null) return false;\n const field = asTextField(event.currentTarget) ?? asTextField(event.target);\n if (field === null || field.disabled || field.readOnly) return false;\n const { indentToCursor, onPaste, ...rest } = options;\n let indent = '';\n if (indentToCursor !== false && field.nodeName === 'TEXTAREA' && field.selectionStart !== null) {\n const before = field.value.slice(0, field.selectionStart);\n indent = /^[ \\t]*/.exec(before.slice(before.lastIndexOf('\\n') + 1))?.[0] as string;\n }\n let result: PasteCode | null;\n try {\n result = pasteToCode({ text: event.clipboardData.getData('text/plain'), html: event.clipboardData.getData('text/html') }, { ...rest, indent });\n } catch (error) {\n if (isCopyFailure(error)) return false; // Invalid options or too large: the native paste still happens.\n throw error;\n }\n if (result === null) return false;\n event.preventDefault();\n if (onPaste?.(result) === false) return true;\n insertText(field, result.code);\n return true;\n}\n"],"mappings":";;;;;;AAgBA,MAAa,qBAAiD,OAAO,OAAO;CAC1E;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AA2CD,MAAa,4BAA4B;AAWzC,MAAM,QAAQ,MAAuB,UAA+B,aAA4B,UAAwB;CACtH;CACA;CACA;CACA;AACF;;AAGA,MAAM,wBAAwB,IAAI,IAAkB;CAElD,CAAC,MAAQ,KAAK,gBAAgB,UAAU,IAAI,yBAAyB,CAAC;CACtE,CAAC,MAAQ,KAAK,gBAAgB,UAAU,IAAI,yBAAyB,CAAC;CACtE,CAAC,MAAQ,KAAK,gBAAgB,UAAU,IAAI,4BAA4B,CAAC;CACzE,CAAC,MAAQ,KAAK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EACd,IAAI,cAAc,KAAK,GAAG,OAAO;EACjC,MAAM;CACR;CACA,IAAI,WAAW,MAAM,OAAO;CAC5B,MAAM,eAAe;CACrB,IAAI,UAAU,MAAM,MAAM,OAAO,OAAO;CACxC,WAAW,OAAO,OAAO,IAAI;CAC7B,OAAO;AACT"}
|
package/dist/color.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_errors = require("./chunks/errors-
|
|
3
|
+
const require_errors = require("./chunks/errors-DFmEAC4E.cjs");
|
|
4
4
|
const require_text_field = require("./chunks/text-field-BEzUVOag.cjs");
|
|
5
|
-
const require_contrast = require("./chunks/contrast-
|
|
5
|
+
const require_contrast = require("./chunks/contrast-C9d8QuaF.cjs");
|
|
6
6
|
//#region src/color/payload.ts
|
|
7
7
|
/** The sRGB hex of a colour for the swatch's inline style: always generated here, never user text. */
|
|
8
8
|
const swatchColor = (c) => require_contrast.formatColor(require_contrast.toGamut(c), "hex");
|
package/dist/color.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { f as TextPayload, o as HtmlPayload } from "./chunks/payload-
|
|
2
|
+
import { f as TextPayload, o as HtmlPayload } from "./chunks/payload-qkAWVXWA.cjs";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.cjs";
|
|
4
4
|
//#region src/color/convert.d.ts
|
|
5
5
|
/**
|
package/dist/color.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { f as TextPayload, o as HtmlPayload } from "./chunks/payload-
|
|
2
|
+
import { f as TextPayload, o as HtmlPayload } from "./chunks/payload-CcvSx_Hq.js";
|
|
3
3
|
import { t as insertText } from "./chunks/text-field-C0SGmvvR.js";
|
|
4
4
|
//#region src/color/convert.d.ts
|
|
5
5
|
/**
|
package/dist/color.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as copyFailure } from "./chunks/errors-
|
|
2
|
+
import { n as copyFailure } from "./chunks/errors-CT-FfUtU.js";
|
|
3
3
|
import { n as insertText, t as asTextField } from "./chunks/text-field-D7PF2WlX.js";
|
|
4
|
-
import { a as toColor, c as inGamut, i as formatColor, l as toGamut, n as contrastRatio, o as parseColor, r as COLOR_FORMATS, t as contrastLevel } from "./chunks/contrast-
|
|
4
|
+
import { a as toColor, c as inGamut, i as formatColor, l as toGamut, n as contrastRatio, o as parseColor, r as COLOR_FORMATS, t as contrastLevel } from "./chunks/contrast-DUaZq5SA.js";
|
|
5
5
|
//#region src/color/payload.ts
|
|
6
6
|
/** The sRGB hex of a colour for the swatch's inline style: always generated here, never user text. */
|
|
7
7
|
const swatchColor = (c) => formatColor(toGamut(c), "hex");
|
package/dist/core.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_errors = require("./chunks/errors-
|
|
4
|
-
const require_payload = require("./chunks/payload-
|
|
3
|
+
const require_errors = require("./chunks/errors-DFmEAC4E.cjs");
|
|
4
|
+
const require_payload = require("./chunks/payload-sBxkG7jH.cjs");
|
|
5
5
|
const require_mime = require("./chunks/mime--LB7kdqG.cjs");
|
|
6
|
-
const require_clipboard_adapter = require("./chunks/clipboard-adapter-
|
|
7
|
-
const require_core = require("./chunks/core-
|
|
8
|
-
const require_paste_reader = require("./chunks/paste-reader-
|
|
6
|
+
const require_clipboard_adapter = require("./chunks/clipboard-adapter-UIFc_Qso.cjs");
|
|
7
|
+
const require_core = require("./chunks/core-DmncxMt3.cjs");
|
|
8
|
+
const require_paste_reader = require("./chunks/paste-reader-BWQaYNaV.cjs");
|
|
9
9
|
exports.CopyFailure = require_errors.CopyFailure;
|
|
10
10
|
exports.DEFAULT_INTERCEPTED_EVENTS = require_core.DEFAULT_INTERCEPTED_EVENTS;
|
|
11
11
|
exports.DEFAULT_MAX_RETRIES = require_core.DEFAULT_MAX_RETRIES;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as resolveMaxRetries, C as describeCopyError, D as toCopyError, E as isRetryableError, O as DEFAULT_MAX_RETRIES, S as createCopyError, T as isCopyFailure, _ as ClipboardOperation, a as CopySource, b as CopyFailure, c as ImagePayload, d as MultiPayloadItem, f as TextPayload, g as validatePayload, h as serializeJson, i as CopyPayloadKind, k as OperationContext, l as JsonPayload, m as normalizePayload, n as CopyInput, o as HtmlPayload, p as isBlob, r as CopyPayload, s as IMAGE_MIME_TYPE, t as BlobSource, u as MultiPayload, v as CopyError, w as describePasteError, x as copyFailure, y as CopyErrorType } from "./chunks/payload-
|
|
2
|
+
import { A as resolveMaxRetries, C as describeCopyError, D as toCopyError, E as isRetryableError, O as DEFAULT_MAX_RETRIES, S as createCopyError, T as isCopyFailure, _ as ClipboardOperation, a as CopySource, b as CopyFailure, c as ImagePayload, d as MultiPayloadItem, f as TextPayload, g as validatePayload, h as serializeJson, i as CopyPayloadKind, k as OperationContext, l as JsonPayload, m as normalizePayload, n as CopyInput, o as HtmlPayload, p as isBlob, r as CopyPayload, s as IMAGE_MIME_TYPE, t as BlobSource, u as MultiPayload, v as CopyError, w as describePasteError, x as copyFailure, y as CopyErrorType } from "./chunks/payload-qkAWVXWA.cjs";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.cjs";
|
|
4
|
-
import { $ as SVG_MIME_TYPE, A as RegisterDragCopyResult, B as CopyState, C as DragCopyPayload, D as DragEffectAllowed, E as DragCopyStatus, F as CopyIgnoredReason, G as IDLE_STATE, H as CopyingState, I as CopyMachine, J as createCopyMachine, K as IdleState, L as CopyMachineOptions, M as registerDragCopy, N as CopiedState, O as DragMultiPayload, P as CopyCancelReason, Q as RasterImageMimeType, R as CopyMachineOptionsSource, S as DragCopyPassReason, T as DragCopyState, U as DEFAULT_RESET_AFTER_MS, V as CopyStatus, W as ErrorState, X as CopyCoordinatorMember, Y as CopyCoordinator, Z as createCopyCoordinator, _ as createPasteMachine, a as PasteEventLike, at as normalizeMimeType, b as DragCopyOptions, c as PasteMachine, d as PasteOutcome, et as WEB_CUSTOM_FORMAT_PREFIX, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as normalizeClipboardType, j as applyDragCopy, k as DragStartEventLike, l as PasteMachineOptions, m as PasteState, n as PasteCancelReason, nt as isWebCustomFormat, o as PasteIdleState, ot as sniffImageBytes, p as PasteReadingState, q as canRetryState, r as PasteDropEventLike, rt as matchesMimePattern, s as PasteIgnoredReason, st as sniffImageType, t as PASTE_IDLE_STATE, tt as isTextualMimeType, u as PasteMachineOptionsSource, v as DragCopyDecision, w as DragCopySource, x as DragCopyOutcome, y as DragCopyItem, z as CopyOutcome } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter
|
|
4
|
+
import { $ as SVG_MIME_TYPE, A as RegisterDragCopyResult, B as CopyState, C as DragCopyPayload, D as DragEffectAllowed, E as DragCopyStatus, F as CopyIgnoredReason, G as IDLE_STATE, H as CopyingState, I as CopyMachine, J as createCopyMachine, K as IdleState, L as CopyMachineOptions, M as registerDragCopy, N as CopiedState, O as DragMultiPayload, P as CopyCancelReason, Q as RasterImageMimeType, R as CopyMachineOptionsSource, S as DragCopyPassReason, T as DragCopyState, U as DEFAULT_RESET_AFTER_MS, V as CopyStatus, W as ErrorState, X as CopyCoordinatorMember, Y as CopyCoordinator, Z as createCopyCoordinator, _ as createPasteMachine, a as PasteEventLike, at as normalizeMimeType, b as DragCopyOptions, c as PasteMachine, d as PasteOutcome, et as WEB_CUSTOM_FORMAT_PREFIX, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as normalizeClipboardType, j as applyDragCopy, k as DragStartEventLike, l as PasteMachineOptions, m as PasteState, n as PasteCancelReason, nt as isWebCustomFormat, o as PasteIdleState, ot as sniffImageBytes, p as PasteReadingState, q as canRetryState, r as PasteDropEventLike, rt as matchesMimePattern, s as PasteIgnoredReason, st as sniffImageType, t as PASTE_IDLE_STATE, tt as isTextualMimeType, u as PasteMachineOptionsSource, v as DragCopyDecision, w as DragCopySource, x as DragCopyOutcome, y as DragCopyItem, z as CopyOutcome } from "./chunks/index-CqYzvxSN.cjs";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-CfaIbZpv.cjs";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-BClcHS_P.cjs";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-B6eucH3E.cjs";
|
|
8
8
|
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as resolveMaxRetries, C as describeCopyError, D as toCopyError, E as isRetryableError, O as DEFAULT_MAX_RETRIES, S as createCopyError, T as isCopyFailure, _ as ClipboardOperation, a as CopySource, b as CopyFailure, c as ImagePayload, d as MultiPayloadItem, f as TextPayload, g as validatePayload, h as serializeJson, i as CopyPayloadKind, k as OperationContext, l as JsonPayload, m as normalizePayload, n as CopyInput, o as HtmlPayload, p as isBlob, r as CopyPayload, s as IMAGE_MIME_TYPE, t as BlobSource, u as MultiPayload, v as CopyError, w as describePasteError, x as copyFailure, y as CopyErrorType } from "./chunks/payload-
|
|
2
|
+
import { A as resolveMaxRetries, C as describeCopyError, D as toCopyError, E as isRetryableError, O as DEFAULT_MAX_RETRIES, S as createCopyError, T as isCopyFailure, _ as ClipboardOperation, a as CopySource, b as CopyFailure, c as ImagePayload, d as MultiPayloadItem, f as TextPayload, g as validatePayload, h as serializeJson, i as CopyPayloadKind, k as OperationContext, l as JsonPayload, m as normalizePayload, n as CopyInput, o as HtmlPayload, p as isBlob, r as CopyPayload, s as IMAGE_MIME_TYPE, t as BlobSource, u as MultiPayload, v as CopyError, w as describePasteError, x as copyFailure, y as CopyErrorType } from "./chunks/payload-CcvSx_Hq.js";
|
|
3
3
|
import { _ as resolvePasteReadOptions, a as DataTransferItemLike, c as PasteAcceptShorthand, d as PasteReadOptions, f as PasteReadResult, g as canAcceptDrag, h as ResolvedPasteReadOptions, i as DEFAULT_PASTE_MAX_ITEMS, l as PasteItem, m as PasteSource, n as DEFAULT_PASTE_ACCEPT, o as DataTransferLike, p as PasteResult, r as DEFAULT_PASTE_MAX_BYTES, s as PasteAccept, t as ClipboardItemLike, u as PasteLimits } from "./chunks/paste-reader-DcXnRWQr.js";
|
|
4
|
-
import { $ as SVG_MIME_TYPE, A as RegisterDragCopyResult, B as CopyState, C as DragCopyPayload, D as DragEffectAllowed, E as DragCopyStatus, F as CopyIgnoredReason, G as IDLE_STATE, H as CopyingState, I as CopyMachine, J as createCopyMachine, K as IdleState, L as CopyMachineOptions, M as registerDragCopy, N as CopiedState, O as DragMultiPayload, P as CopyCancelReason, Q as RasterImageMimeType, R as CopyMachineOptionsSource, S as DragCopyPassReason, T as DragCopyState, U as DEFAULT_RESET_AFTER_MS, V as CopyStatus, W as ErrorState, X as CopyCoordinatorMember, Y as CopyCoordinator, Z as createCopyCoordinator, _ as createPasteMachine, a as PasteEventLike, at as normalizeMimeType, b as DragCopyOptions, c as PasteMachine, d as PasteOutcome, et as WEB_CUSTOM_FORMAT_PREFIX, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as normalizeClipboardType, j as applyDragCopy, k as DragStartEventLike, l as PasteMachineOptions, m as PasteState, n as PasteCancelReason, nt as isWebCustomFormat, o as PasteIdleState, ot as sniffImageBytes, p as PasteReadingState, q as canRetryState, r as PasteDropEventLike, rt as matchesMimePattern, s as PasteIgnoredReason, st as sniffImageType, t as PASTE_IDLE_STATE, tt as isTextualMimeType, u as PasteMachineOptionsSource, v as DragCopyDecision, w as DragCopySource, x as DragCopyOutcome, y as DragCopyItem, z as CopyOutcome } from "./chunks/index-
|
|
5
|
-
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-
|
|
7
|
-
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-
|
|
4
|
+
import { $ as SVG_MIME_TYPE, A as RegisterDragCopyResult, B as CopyState, C as DragCopyPayload, D as DragEffectAllowed, E as DragCopyStatus, F as CopyIgnoredReason, G as IDLE_STATE, H as CopyingState, I as CopyMachine, J as createCopyMachine, K as IdleState, L as CopyMachineOptions, M as registerDragCopy, N as CopiedState, O as DragMultiPayload, P as CopyCancelReason, Q as RasterImageMimeType, R as CopyMachineOptionsSource, S as DragCopyPassReason, T as DragCopyState, U as DEFAULT_RESET_AFTER_MS, V as CopyStatus, W as ErrorState, X as CopyCoordinatorMember, Y as CopyCoordinator, Z as createCopyCoordinator, _ as createPasteMachine, a as PasteEventLike, at as normalizeMimeType, b as DragCopyOptions, c as PasteMachine, d as PasteOutcome, et as WEB_CUSTOM_FORMAT_PREFIX, f as PasteReadState, g as canRetryPasteState, h as PasteStatus, i as PasteErrorState, it as normalizeClipboardType, j as applyDragCopy, k as DragStartEventLike, l as PasteMachineOptions, m as PasteState, n as PasteCancelReason, nt as isWebCustomFormat, o as PasteIdleState, ot as sniffImageBytes, p as PasteReadingState, q as canRetryState, r as PasteDropEventLike, rt as matchesMimePattern, s as PasteIgnoredReason, st as sniffImageType, t as PASTE_IDLE_STATE, tt as isTextualMimeType, u as PasteMachineOptionsSource, v as DragCopyDecision, w as DragCopySource, x as DragCopyOutcome, y as DragCopyItem, z as CopyOutcome } from "./chunks/index-Q_QeSwGr.js";
|
|
5
|
+
import { a as ClipboardItemData, i as ClipboardItemConstructorLike, n as ClipboardAdapter, o as ClipboardLike, r as ClipboardEnvironment, s as createBrowserClipboardAdapter, t as BrowserClipboardAdapterOptions } from "./chunks/clipboard-adapter-Chm6zq60.js";
|
|
6
|
+
import { _ as registerCopyInterceptor, a as CopyInterceptOptions, c as CopyInterceptTransform, d as DEFAULT_INTERCEPTED_EVENTS, f as InterceptedCopyKind, g as readCopySelection, h as interceptCopyEvent, i as CopyInterceptFailureMode, l as CopyInterceptorOptions, m as SyncMultiPayload, n as CopyEventLike, o as CopyInterceptOutcome, p as SyncCopyPayload, r as CopyInterceptDecision, s as CopyInterceptPassReason, t as ClipboardDataLike, u as CopySelection } from "./chunks/copy-interceptor-D8c9EDnO.js";
|
|
7
|
+
import { a as createBrowserPasteAdapter, i as PasteEnvironment, n as PasteAdapter, r as PasteClipboardLike, t as BrowserPasteAdapterOptions } from "./chunks/paste-adapter-CfIDT3mp.js";
|
|
8
8
|
export { BlobSource, BrowserClipboardAdapterOptions, type BrowserPasteAdapterOptions, ClipboardAdapter, ClipboardDataLike, ClipboardEnvironment, ClipboardItemConstructorLike, ClipboardItemData, type ClipboardItemLike, ClipboardLike, ClipboardOperation, CopiedState, CopyCancelReason, CopyCoordinator, CopyCoordinatorMember, CopyError, CopyErrorType, CopyEventLike, CopyFailure, CopyIgnoredReason, CopyInput, CopyInterceptDecision, CopyInterceptFailureMode, CopyInterceptOptions, CopyInterceptOutcome, CopyInterceptPassReason, CopyInterceptTransform, CopyInterceptorOptions, CopyMachine, CopyMachineOptions, CopyMachineOptionsSource, CopyOutcome, CopyPayload, CopyPayloadKind, CopySelection, CopySource, CopyState, CopyStatus, CopyingState, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, type DataTransferItemLike, DataTransferLike, DragCopyDecision, DragCopyItem, DragCopyOptions, DragCopyOutcome, DragCopyPassReason, DragCopyPayload, DragCopySource, DragCopyState, DragCopyStatus, DragEffectAllowed, DragMultiPayload, DragStartEventLike, ErrorState, HtmlPayload, IDLE_STATE, IMAGE_MIME_TYPE, IdleState, ImagePayload, InterceptedCopyKind, JsonPayload, MultiPayload, MultiPayloadItem, type OperationContext, PASTE_IDLE_STATE, type PasteAccept, type PasteAcceptShorthand, type PasteAdapter, PasteCancelReason, type PasteClipboardLike, PasteDropEventLike, type PasteEnvironment, PasteErrorState, PasteEventLike, PasteIdleState, PasteIgnoredReason, type PasteItem, type PasteLimits, PasteMachine, PasteMachineOptions, PasteMachineOptionsSource, PasteOutcome, type PasteReadOptions, type PasteReadResult, PasteReadState, PasteReadingState, type PasteResult, type PasteSource, PasteState, PasteStatus, RasterImageMimeType, RegisterDragCopyResult, type ResolvedPasteReadOptions, SVG_MIME_TYPE, SyncCopyPayload, SyncMultiPayload, TextPayload, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload };
|
package/dist/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as describePasteError, c as toCopyError, i as describeCopyError, n as copyFailure, o as isCopyFailure, r as createCopyError, s as isRetryableError, t as CopyFailure } from "./chunks/errors-
|
|
3
|
-
import { a as validatePayload, i as serializeJson, n as isBlob, r as normalizePayload, t as IMAGE_MIME_TYPE } from "./chunks/payload-
|
|
2
|
+
import { a as describePasteError, c as toCopyError, i as describeCopyError, n as copyFailure, o as isCopyFailure, r as createCopyError, s as isRetryableError, t as CopyFailure } from "./chunks/errors-CT-FfUtU.js";
|
|
3
|
+
import { a as validatePayload, i as serializeJson, n as isBlob, r as normalizePayload, t as IMAGE_MIME_TYPE } from "./chunks/payload-BrQWGwyx.js";
|
|
4
4
|
import { a as matchesMimePattern, c as sniffImageBytes, i as isWebCustomFormat, l as sniffImageType, n as WEB_CUSTOM_FORMAT_PREFIX, o as normalizeClipboardType, r as isTextualMimeType, s as normalizeMimeType, t as SVG_MIME_TYPE } from "./chunks/mime-aa-HA2dm.js";
|
|
5
|
-
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-
|
|
6
|
-
import { _ as resolveMaxRetries, a as applyDragCopy, c as interceptCopyEvent, d as DEFAULT_RESET_AFTER_MS, f as IDLE_STATE, h as DEFAULT_MAX_RETRIES, i as createBrowserPasteAdapter, l as readCopySelection, m as createCopyMachine, n as canRetryPasteState, o as registerDragCopy, p as canRetryState, r as createPasteMachine, s as DEFAULT_INTERCEPTED_EVENTS, t as PASTE_IDLE_STATE, u as registerCopyInterceptor, v as createCopyCoordinator } from "./chunks/core-
|
|
7
|
-
import { i as canAcceptDrag, l as resolvePasteReadOptions, n as DEFAULT_PASTE_MAX_BYTES, r as DEFAULT_PASTE_MAX_ITEMS, t as DEFAULT_PASTE_ACCEPT } from "./chunks/paste-reader-
|
|
5
|
+
import { t as createBrowserClipboardAdapter } from "./chunks/clipboard-adapter-CmKDTFdO.js";
|
|
6
|
+
import { _ as resolveMaxRetries, a as applyDragCopy, c as interceptCopyEvent, d as DEFAULT_RESET_AFTER_MS, f as IDLE_STATE, h as DEFAULT_MAX_RETRIES, i as createBrowserPasteAdapter, l as readCopySelection, m as createCopyMachine, n as canRetryPasteState, o as registerDragCopy, p as canRetryState, r as createPasteMachine, s as DEFAULT_INTERCEPTED_EVENTS, t as PASTE_IDLE_STATE, u as registerCopyInterceptor, v as createCopyCoordinator } from "./chunks/core-BH2uIumi.js";
|
|
7
|
+
import { i as canAcceptDrag, l as resolvePasteReadOptions, n as DEFAULT_PASTE_MAX_BYTES, r as DEFAULT_PASTE_MAX_ITEMS, t as DEFAULT_PASTE_ACCEPT } from "./chunks/paste-reader-D6uOTDBM.js";
|
|
8
8
|
export { CopyFailure, DEFAULT_INTERCEPTED_EVENTS, DEFAULT_MAX_RETRIES, DEFAULT_PASTE_ACCEPT, DEFAULT_PASTE_MAX_BYTES, DEFAULT_PASTE_MAX_ITEMS, DEFAULT_RESET_AFTER_MS, IDLE_STATE, IMAGE_MIME_TYPE, PASTE_IDLE_STATE, SVG_MIME_TYPE, WEB_CUSTOM_FORMAT_PREFIX, applyDragCopy, canAcceptDrag, canRetryPasteState, canRetryState, copyFailure, createBrowserClipboardAdapter, createBrowserPasteAdapter, createCopyCoordinator, createCopyError, createCopyMachine, createPasteMachine, describeCopyError, describePasteError, interceptCopyEvent, isBlob, isCopyFailure, isRetryableError, isTextualMimeType, isWebCustomFormat, matchesMimePattern, normalizeClipboardType, normalizeMimeType, normalizePayload, readCopySelection, registerCopyInterceptor, registerDragCopy, resolveMaxRetries, resolvePasteReadOptions, serializeJson, sniffImageBytes, sniffImageType, toCopyError, validatePayload };
|