@json-to-office/shared 1.6.0 → 2.5.0
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/dist/chunk-4MJFAJFW.js +507 -0
- package/dist/chunk-4MJFAJFW.js.map +1 -0
- package/dist/{chunk-MCUIFSUN.js → chunk-OM2IOZMT.js} +74 -6
- package/dist/chunk-OM2IOZMT.js.map +1 -0
- package/dist/fonts/node.js +1 -1
- package/dist/index.d.ts +1048 -31
- package/dist/index.js +152 -36
- package/dist/index.js.map +1 -1
- package/dist/schemas/slide-content.d.ts +10 -10
- package/dist/schemas/slide-content.js +5 -3
- package/dist/schemas/slide-content.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6KUQYVPT.js +0 -177
- package/dist/chunk-6KUQYVPT.js.map +0 -1
- package/dist/chunk-MCUIFSUN.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fonts/sources/ttf-name.ts","../src/fonts/sources/url-allowlist.ts","../src/fonts/sources/format.ts"],"sourcesContent":["/**\n * Name-table reading and rewriting for TTF/OTF sfnt fonts. Two public\n * transforms share the rebuild machinery, plus one reader:\n *\n * - `rewriteFontFamilyName` — rewrite `nameID` 1 / 4 / 6 / 16 to a\n * synthetic family name. Used by `FontRegistry` (so resolved bytes\n * declare the family they were resolved as) and by the preview-side\n * font stagers (so running-text references like `\"Inter Light\"` resolve\n * to the correct face). Core Text / fontconfig / GDI all index by the\n * font's internal `name` table rather than the filename.\n *\n * - `rewriteFontSubfamilyNames` — rewrite `nameID` 2 / 17 to the standard\n * subfamily strings for a (weight, italic) pair. Used by the variable-\n * font instancer: harfbuzz preserves the source font's name records\n * verbatim, so an instanced Bold would otherwise keep the variable\n * font's default-instance \"Regular\" subfamily and trip\n * `validateFontMetadata`.\n *\n * - `readNameRecords` / `readFontFamilyNames` — the reading half, shared\n * with `validateFontMetadata` so the checker and the writer cannot\n * drift on how a name record is located or decoded.\n *\n * Each transform rebuilds the whole font: new `name` table bytes, new\n * table directory with shifted offsets, recomputed per-table checksums,\n * and the magic `head.checkSumAdjustment` recomputed against the whole\n * output buffer. Nothing else is touched.\n *\n * OTF (CFF-flavoured) and TTF (glyf-flavoured) share the sfnt outer\n * structure, so the same code handles both.\n */\n\nconst FAMILY_NAME_IDS = new Set<number>([\n 1, // Font Family\n 4, // Full Font Name\n 6, // PostScript Name\n 16, // Typographic/Preferred Family\n]);\n\nconst MAGIC_HEAD_CHECKSUM = 0xb1b0afba;\n\ninterface NameRecord {\n platformID: number;\n encodingID: number;\n languageID: number;\n nameID: number;\n bytes: Buffer;\n}\n\ninterface TableEntry {\n tag: string;\n checksum: number;\n /** Assigned when rebuilding. */\n offset: number;\n data: Buffer;\n originalOffset: number;\n}\n\n/**\n * Compute the 32-bit big-endian uint sum of `buf`, treating it as a\n * stream of uint32s zero-padded to a 4-byte boundary. Used for per-table\n * checksums and the whole-font `head.checkSumAdjustment`.\n */\nfunction sfntChecksum(buf: Buffer): number {\n let sum = 0;\n const end = buf.length;\n const aligned = end - (end % 4);\n for (let i = 0; i < aligned; i += 4) {\n sum = (sum + buf.readUInt32BE(i)) >>> 0;\n }\n if (aligned < end) {\n let chunk = 0;\n const remaining = end - aligned;\n if (remaining >= 1) chunk |= buf[aligned] << 24;\n if (remaining >= 2) chunk |= buf[aligned + 1] << 16;\n if (remaining >= 3) chunk |= buf[aligned + 2] << 8;\n sum = (sum + chunk) >>> 0;\n }\n return sum >>> 0;\n}\n\nfunction encodeString(record: NameRecord, value: string): Buffer {\n // Platform 3 (Microsoft) and 0 (Unicode) use UTF-16 BE. Platform 1\n // (Macintosh) uses a legacy Roman encoding we approximate with ASCII —\n // non-ASCII family names are rare in this code path.\n if (record.platformID === 1) {\n return Buffer.from(value, 'ascii');\n }\n const out = Buffer.alloc(value.length * 2);\n for (let i = 0; i < value.length; i += 1) {\n out.writeUInt16BE(value.charCodeAt(i), i * 2);\n }\n return out;\n}\n\nfunction buildNameTable(records: NameRecord[]): Buffer {\n const count = records.length;\n const headerSize = 6 + count * 12;\n let heapSize = 0;\n for (const r of records) heapSize += r.bytes.length;\n const raw = Buffer.alloc(headerSize + heapSize);\n raw.writeUInt16BE(0, 0); // format 0\n raw.writeUInt16BE(count, 2);\n raw.writeUInt16BE(headerSize, 4); // stringOffset\n let heapCursor = 0;\n for (let i = 0; i < count; i += 1) {\n const r = records[i];\n const ro = 6 + i * 12;\n raw.writeUInt16BE(r.platformID, ro);\n raw.writeUInt16BE(r.encodingID, ro + 2);\n raw.writeUInt16BE(r.languageID, ro + 4);\n raw.writeUInt16BE(r.nameID, ro + 6);\n raw.writeUInt16BE(r.bytes.length, ro + 8);\n raw.writeUInt16BE(heapCursor, ro + 10);\n r.bytes.copy(raw, headerSize + heapCursor);\n heapCursor += r.bytes.length;\n }\n return raw;\n}\n\n/** Per-record decision for `rewriteNameTable`. */\ntype NameRewrite =\n | { action: 'keep' }\n | { action: 'drop' }\n | { action: 'set'; value: string };\n\n/**\n * Return a copy of `input` whose name records have been mapped through\n * `decide`. Returns the original buffer unchanged if the font has no\n * `name` table or the sfnt header is invalid.\n */\nfunction rewriteNameTable(\n input: Buffer,\n decide: (record: NameRecord) => NameRewrite\n): Buffer {\n if (input.length < 12) return input;\n const version = input.readUInt32BE(0);\n // Accept sfnt (0x00010000), OTTO (OpenType CFF), true, typ1.\n const isSfnt =\n version === 0x00010000 ||\n version === 0x4f54544f /* OTTO */ ||\n version === 0x74727565 /* true */ ||\n version === 0x74797031; /* typ1 */\n if (!isSfnt) return input;\n\n const numTables = input.readUInt16BE(4);\n if (numTables === 0 || input.length < 12 + numTables * 16) return input;\n\n // Read every table's directory entry, slurp its data.\n const tables: TableEntry[] = [];\n for (let i = 0; i < numTables; i += 1) {\n const eo = 12 + i * 16;\n const tag = input.toString('ascii', eo, eo + 4);\n const checksum = input.readUInt32BE(eo + 4);\n const offset = input.readUInt32BE(eo + 8);\n const length = input.readUInt32BE(eo + 12);\n if (offset + length > input.length) return input;\n tables.push({\n tag,\n checksum,\n offset: 0,\n originalOffset: offset,\n data: input.slice(offset, offset + length),\n });\n }\n\n const nameIdx = tables.findIndex((t) => t.tag === 'name');\n if (nameIdx === -1) return input;\n\n // Parse existing name records so we preserve all non-family entries.\n const nameBuf = tables[nameIdx].data;\n if (nameBuf.length < 6) return input;\n // `buildNameTable` emits format 0, which has no language-tag section. A\n // format-1 table keeps its tags after the name records, and any record with\n // languageID >= 0x8000 is an index into them — rewriting it as format 0\n // would strip the tags and leave those records pointing at nothing. Leaving\n // the font unstamped is the lesser loss, so hand it back untouched.\n // Preserving the tag section (and re-homing its string offsets) is the\n // follow-up if a real font ever needs the rewrite.\n if (nameBuf.readUInt16BE(0) !== 0) return input;\n const recordCount = nameBuf.readUInt16BE(2);\n const stringOffset = nameBuf.readUInt16BE(4);\n if (nameBuf.length < 6 + recordCount * 12) return input;\n\n const records: NameRecord[] = [];\n for (let i = 0; i < recordCount; i += 1) {\n const ro = 6 + i * 12;\n const platformID = nameBuf.readUInt16BE(ro);\n const encodingID = nameBuf.readUInt16BE(ro + 2);\n const languageID = nameBuf.readUInt16BE(ro + 4);\n const nameID = nameBuf.readUInt16BE(ro + 6);\n const length = nameBuf.readUInt16BE(ro + 8);\n const offset = nameBuf.readUInt16BE(ro + 10);\n const bytes = nameBuf.slice(\n stringOffset + offset,\n stringOffset + offset + length\n );\n records.push({ platformID, encodingID, languageID, nameID, bytes });\n }\n\n const survivors: NameRecord[] = [];\n for (const r of records) {\n const verdict = decide(r);\n if (verdict.action === 'drop') continue;\n if (verdict.action === 'set') {\n r.bytes = encodeString(r, verdict.value);\n }\n survivors.push(r);\n }\n records.length = 0;\n records.push(...survivors);\n\n const rebuiltName = buildNameTable(records);\n tables[nameIdx] = {\n ...tables[nameIdx],\n data: rebuiltName,\n checksum: sfntChecksum(rebuiltName),\n };\n\n // Preserve original physical order so tables whose offsets follow each\n // other stay contiguous (some consumers skim by offset rather than\n // directory). Offsets get reassigned either way — this is purely\n // aesthetic. Sort is stable.\n tables.sort((a, b) => a.originalOffset - b.originalOffset);\n\n // Assign new offsets, 4-byte aligned.\n let cursor = 12 + tables.length * 16;\n for (const t of tables) {\n cursor = (cursor + 3) & ~3;\n t.offset = cursor;\n cursor += t.data.length;\n }\n const totalSize = (cursor + 3) & ~3;\n\n const out = Buffer.alloc(totalSize);\n // Header — copy sfnt version, entrySelector, etc. verbatim; we preserve\n // numTables since we're not adding/removing entries.\n input.copy(out, 0, 0, 12);\n out.writeUInt16BE(tables.length, 4);\n\n // Directory entries go in alphabetical tag order per the sfnt spec.\n const dirTables = [...tables].sort((a, b) =>\n a.tag < b.tag ? -1 : a.tag > b.tag ? 1 : 0\n );\n for (let i = 0; i < dirTables.length; i += 1) {\n const t = dirTables[i];\n const eo = 12 + i * 16;\n out.write(t.tag, eo, 4, 'ascii');\n out.writeUInt32BE(t.checksum, eo + 4);\n out.writeUInt32BE(t.offset, eo + 8);\n out.writeUInt32BE(t.data.length, eo + 12);\n }\n\n // Write each table's bytes at its new offset. `out` is zero-filled, so\n // the 0–3 byte alignment padding after each table is already correct.\n for (const t of tables) {\n t.data.copy(out, t.offset);\n }\n\n // Recompute head.checkSumAdjustment. The algorithm: zero the field,\n // sum the whole font, then set the field to MAGIC - sum.\n const headTable = tables.find((t) => t.tag === 'head');\n if (headTable && headTable.data.length >= 12) {\n out.writeUInt32BE(0, headTable.offset + 8);\n const fontSum = sfntChecksum(out);\n const adjustment = (MAGIC_HEAD_CHECKSUM - fontSum) >>> 0;\n out.writeUInt32BE(adjustment, headTable.offset + 8);\n }\n\n return out;\n}\n\n/** One decoded `name` record: where it came from and what it says. */\nexport interface DecodedNameRecord {\n platformID: number;\n nameID: number;\n value: string;\n}\n\n/** Byte range of `tag`'s table within `input`, or null. */\nfunction findTable(\n input: Buffer,\n tag: string\n): { offset: number; length: number } | null {\n if (input.length < 12) return null;\n const numTables = input.readUInt16BE(4);\n for (let i = 0; i < numTables; i += 1) {\n const eo = 12 + i * 16;\n if (eo + 16 > input.length) return null;\n if (input.toString('ascii', eo, eo + 4) === tag) {\n return {\n offset: input.readUInt32BE(eo + 8),\n length: input.readUInt32BE(eo + 12),\n };\n }\n }\n return null;\n}\n\n/**\n * Read the `name` records a font carries, optionally narrowed to `wanted`\n * nameIDs. Tolerant of malformed tables, because these bytes come off the\n * network: everything is bounded by the `name` table's own extent, not by\n * the buffer. `Buffer.slice` clamps an out-of-range window silently rather\n * than throwing, so without that bound a table claiming more records than it\n * holds decodes the bytes of whatever table follows it, and a record with a\n * bogus string offset returns a truncated or foreign name.\n *\n * A header that would run past the table ends the scan; a single record\n * whose string does is skipped, since the other records are still readable\n * and each one stands alone. Either way the name is not reported, which is\n * the safe direction — a caller asking \"do these bytes answer to family X?\"\n * gets no for an unreadable record instead of a coincidental yes.\n *\n * Shared with `validateFontMetadata` so the checker and the rewriters above\n * cannot disagree about what a font declares.\n */\nexport function readNameRecords(\n input: Buffer,\n wanted?: Set<number>\n): DecodedNameRecord[] {\n const nt = findTable(input, 'name');\n if (!nt) return [];\n const tableOff = nt.offset;\n if (tableOff + 6 > input.length) return [];\n // The directory may claim a length past the end of a truncated download.\n const tableEnd = Math.min(tableOff + nt.length, input.length);\n const count = input.readUInt16BE(tableOff + 2);\n const storage = tableOff + input.readUInt16BE(tableOff + 4);\n // Records occupy exactly the span between the 6-byte header and the string\n // storage. Bounding them by the table alone is not enough: an inflated\n // `count` would keep reading 12-byte \"records\" out of the string heap,\n // which is inside the table and decodes to plausible-looking garbage.\n const recordsEnd = Math.min(storage, tableEnd);\n const out: DecodedNameRecord[] = [];\n for (let i = 0; i < count; i += 1) {\n const ro = tableOff + 6 + i * 12;\n if (ro + 12 > recordsEnd) break;\n const platformID = input.readUInt16BE(ro);\n const nameID = input.readUInt16BE(ro + 6);\n if (wanted && !wanted.has(nameID)) continue;\n const length = input.readUInt16BE(ro + 8);\n const offset = input.readUInt16BE(ro + 10);\n const start = storage + offset;\n if (start + length > tableEnd) continue;\n const raw = input.slice(start, start + length);\n let value: string;\n if (platformID === 1) {\n value = raw.toString('ascii');\n } else {\n // UTF-16BE. Buffer has no utf16be decoder — swap to LE and decode.\n const swapped = Buffer.from(raw);\n if (swapped.length % 2 === 0) swapped.swap16();\n value = swapped.toString('utf16le');\n }\n out.push({ platformID, nameID, value });\n }\n return out;\n}\n\n/**\n * Every distinct family name a font declares — `nameID` 1 (family) and 16\n * (typographic/preferred family), deduped, in record order.\n *\n * Both count: a weight shipped as its own family names itself \"Life Sans\n * Medium\" in nameID 1 while nameID 16 still says \"Life Sans\", and either\n * is a legitimate way for a consumer to find it. Callers asking \"do these\n * bytes answer to family X?\" must therefore accept a match on either.\n */\nexport function readFontFamilyNames(input: Buffer): string[] {\n const out: string[] = [];\n for (const r of readNameRecords(input, FAMILY_LOOKUP_IDS)) {\n const value = r.value.trim();\n if (value.length > 0 && !out.includes(value)) out.push(value);\n }\n return out;\n}\n\nconst FAMILY_LOOKUP_IDS = new Set<number>([1, 16]);\n\n/**\n * The RIBBI style label a face carries alongside its family name — the\n * four-style vocabulary `nameID` 2 is restricted to. Used to build the\n * full (`nameID` 4) and PostScript (`nameID` 6) names, which must stay\n * distinct across the faces of one family.\n */\nexport function legacySubfamilyName(\n bold: boolean,\n italic: boolean\n): 'Regular' | 'Italic' | 'Bold' | 'Bold Italic' {\n if (bold) return italic ? 'Bold Italic' : 'Bold';\n return italic ? 'Italic' : 'Regular';\n}\n\n/**\n * Return a copy of `input` whose name table has `nameID` 1/4/6/16 rewritten\n * to `newFamily`. Returns the original buffer unchanged if the font has no\n * `name` table or the sfnt header is invalid.\n *\n * `subfamily` is the RIBBI style this face occupies *within* `newFamily`.\n * The family IDs (1/16) always become `newFamily` alone, but the full name\n * (4) and PostScript name (6) take the style as a suffix, so the four faces\n * of one family stay individually addressable — \"Inter\" / \"Inter Italic\" /\n * \"Inter Bold\" / \"Inter Bold Italic\", PostScript \"Inter\" / \"Inter-Italic\" /\n * … Two faces sharing a PostScript name is malformed, and Core Text may\n * refuse the second registration outright.\n *\n * Omitted (or \"Regular\") reproduces the historical behaviour — every\n * targeted ID becomes `newFamily` — which is correct for a face staged\n * under a weight-synthesized family of its own (\"Inter Medium\"), where the\n * face IS that family's Regular member.\n */\nexport function rewriteFontFamilyName(\n input: Buffer,\n newFamily: string,\n subfamily?: string\n): Buffer {\n // \"Regular\" is the absence of a style suffix, not a suffix reading\n // \"Regular\" — a family's default face is named after the family alone.\n const style = subfamily && subfamily !== 'Regular' ? subfamily : '';\n const fullName = style ? `${newFamily} ${style}` : newFamily;\n // PostScript names (nameID 6) are restricted to printable ASCII 33-126\n // minus `[](){}<>/%` per the OpenType spec — fold spaces out and strip\n // any forbidden chars so Word doesn't silently reject the font. The\n // style rides as a hyphenated suffix, the convention every shipped\n // family uses (\"Inter-BoldItalic\").\n const psForbidden = /[[\\](){}<>/%]/g;\n // eslint-disable-next-line no-control-regex\n const isAscii = /^[\\x00-\\x7f]*$/.test(fullName);\n const psSafe = (s: string): string =>\n s\n .replace(/\\s+/g, '')\n .replace(psForbidden, '')\n // eslint-disable-next-line no-control-regex\n .replace(/[^\\x21-\\x7e]/g, '');\n const psName = style\n ? `${psSafe(newFamily)}-${psSafe(style)}`\n : psSafe(newFamily);\n return rewriteNameTable(input, (r) => {\n if (!FAMILY_NAME_IDS.has(r.nameID)) return { action: 'keep' };\n // Platform 1 (Macintosh Roman) only round-trips ASCII. For non-ASCII\n // family names (e.g. CJK), `Buffer.from(value, 'ascii')` silently\n // drops the high bytes and produces garbled Roman-encoded strings\n // that Core Text may still index. Drop those records instead —\n // platforms 0 (Unicode) and 3 (Microsoft) carry the UTF-16 form and\n // are what modern consumers prefer anyway.\n if (r.platformID === 1 && !isAscii) return { action: 'drop' };\n if (r.nameID === 6) return { action: 'set', value: psName };\n if (r.nameID === 4) return { action: 'set', value: fullName };\n return { action: 'set', value: newFamily };\n });\n}\n\nconst STANDARD_SUBFAMILY: Record<number, string> = {\n 100: 'Thin',\n 200: 'ExtraLight',\n 300: 'Light',\n 400: 'Regular',\n 500: 'Medium',\n 600: 'SemiBold',\n 700: 'Bold',\n 800: 'ExtraBold',\n 900: 'Black',\n};\n\n/**\n * Standard OpenType subfamily strings for a (weight, italic) pair, or null\n * for a non-standard weight. `typographic` is the nameID 17 form (full\n * weight vocabulary); `legacy` is the nameID 2 form, restricted to the\n * four-style RIBBI model (Regular/Italic/Bold/Bold Italic) that GDI-era\n * consumers expect. Single source of truth shared with\n * `validateFontMetadata` so writer and checker cannot diverge.\n */\nexport function standardSubfamilyNames(\n weight: number,\n italic: boolean\n): { typographic: string; legacy: string } | null {\n const base = STANDARD_SUBFAMILY[weight];\n if (!base) return null;\n return {\n typographic: italic ? `${base} Italic` : base,\n legacy: legacySubfamilyName(weight >= 600, italic),\n };\n}\n\n/**\n * Return a copy of `input` whose existing `nameID` 2/17 records carry the\n * standard subfamily strings for (weight, italic). Missing records are not\n * added. Returns the original buffer unchanged for non-standard weights,\n * or if the font has no `name` table or the sfnt header is invalid.\n */\nexport function rewriteFontSubfamilyNames(\n input: Buffer,\n weight: number,\n italic: boolean\n): Buffer {\n const std = standardSubfamilyNames(weight, italic);\n if (!std) return input;\n return rewriteNameTable(input, (r) => {\n if (r.nameID === 2) return { action: 'set', value: std.legacy };\n if (r.nameID === 17) return { action: 'set', value: std.typographic };\n return { action: 'keep' };\n });\n}\n","/**\n * Hostname allowlist for font fetchers.\n *\n * `url-fetcher` and `variable-fetcher` can be handed arbitrary URLs via\n * `FontRegistryEntry.sources`, which may originate from document JSON. Without\n * a guard, a malicious doc could point fetchers at internal hosts (SSRF), the\n * filesystem (`file://`), or the IMDS endpoint. Limit downloads to the hosts\n * our catalog + UPSTREAM_OVERRIDES actually target.\n *\n * Keep the list small and HTTPS-only. Expansions should be deliberate code\n * reviews, not config-driven — the cost of a new domain is the code change.\n */\n\nexport const FONT_URL_ALLOWLIST: readonly string[] = [\n 'fonts.gstatic.com',\n 'fonts.googleapis.com',\n 'cdn.jsdelivr.net',\n];\n\nexport function isAllowedFontUrl(url: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return false;\n }\n if (parsed.protocol !== 'https:') return false;\n return FONT_URL_ALLOWLIST.includes(parsed.hostname.toLowerCase());\n}\n","/**\n * Font format detection from magic bytes.\n * Source: OpenType spec + WOFF1/WOFF2 W3C specs.\n */\n\nimport type { ResolvedFontSource } from '../types';\n\nexport function detectFontFormat(buf: Buffer): ResolvedFontSource['format'] {\n if (buf.length < 4) return 'unknown';\n\n const b0 = buf[0],\n b1 = buf[1],\n b2 = buf[2],\n b3 = buf[3];\n\n // TTF: 0x00010000 (SFNT) or 'true' (0x74727565) or 'typ1' (0x74797031)\n if (\n (b0 === 0x00 && b1 === 0x01 && b2 === 0x00 && b3 === 0x00) ||\n (b0 === 0x74 && b1 === 0x72 && b2 === 0x75 && b3 === 0x65) ||\n (b0 === 0x74 && b1 === 0x79 && b2 === 0x70 && b3 === 0x31)\n ) {\n return 'ttf';\n }\n // OTF: 'OTTO'\n if (b0 === 0x4f && b1 === 0x54 && b2 === 0x54 && b3 === 0x4f) return 'otf';\n // WOFF: 'wOFF'\n if (b0 === 0x77 && b1 === 0x4f && b2 === 0x46 && b3 === 0x46) return 'woff';\n // WOFF2: 'wOF2'\n if (b0 === 0x77 && b1 === 0x4f && b2 === 0x46 && b3 === 0x32) return 'woff2';\n // EOT: version bytes at offset 8-11 — rougher signature\n if (buf.length >= 36 && buf[34] === 0x4c && buf[35] === 0x50) return 'eot';\n // PostScript Type 1 (.pfb) — binary container marker byte 0x80 followed by\n // segment type 0x01 (ASCII). Also match the text-form ASCII header\n // \"%!PS-AdobeFont\". Note: .pfm (metric files) have no reliable magic and\n // stay in 'unknown' — same treatment (rejection at the loader).\n if (b0 === 0x80 && b1 === 0x01) return 'pfb';\n if (\n buf.length >= 14 &&\n buf.slice(0, 14).toString('ascii') === '%!PS-AdobeFont'\n ) {\n return 'pfb';\n }\n\n return 'unknown';\n}\n\n/**\n * Formats we detect but cannot legally embed in an OOXML document:\n * WOFF/WOFF2 are web-only containers; PostScript (.pfb) is explicitly\n * disallowed by Microsoft's embedding guidance.\n */\nexport const UNEMBEDDABLE_FORMATS = new Set<ResolvedFontSource['format']>([\n 'woff',\n 'woff2',\n 'pfb',\n]);\n"],"mappings":";AA+BA,IAAM,kBAAkB,oBAAI,IAAY;AAAA,EACtC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAED,IAAM,sBAAsB;AAwB5B,SAAS,aAAa,KAAqB;AACzC,MAAI,MAAM;AACV,QAAM,MAAM,IAAI;AAChB,QAAM,UAAU,MAAO,MAAM;AAC7B,WAAS,IAAI,GAAG,IAAI,SAAS,KAAK,GAAG;AACnC,UAAO,MAAM,IAAI,aAAa,CAAC,MAAO;AAAA,EACxC;AACA,MAAI,UAAU,KAAK;AACjB,QAAI,QAAQ;AACZ,UAAM,YAAY,MAAM;AACxB,QAAI,aAAa,EAAG,UAAS,IAAI,OAAO,KAAK;AAC7C,QAAI,aAAa,EAAG,UAAS,IAAI,UAAU,CAAC,KAAK;AACjD,QAAI,aAAa,EAAG,UAAS,IAAI,UAAU,CAAC,KAAK;AACjD,UAAO,MAAM,UAAW;AAAA,EAC1B;AACA,SAAO,QAAQ;AACjB;AAEA,SAAS,aAAa,QAAoB,OAAuB;AAI/D,MAAI,OAAO,eAAe,GAAG;AAC3B,WAAO,OAAO,KAAK,OAAO,OAAO;AAAA,EACnC;AACA,QAAM,MAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACzC,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;AACxC,QAAI,cAAc,MAAM,WAAW,CAAC,GAAG,IAAI,CAAC;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,SAAS,eAAe,SAA+B;AACrD,QAAM,QAAQ,QAAQ;AACtB,QAAM,aAAa,IAAI,QAAQ;AAC/B,MAAI,WAAW;AACf,aAAW,KAAK,QAAS,aAAY,EAAE,MAAM;AAC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