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AAK8M,IAEhB3G,EAAWnG,KAAKmN,GAOpB,OAFIpQ,EAAMmE,EAAMpI,QAAQqN,EAAWnG,KAAK8M,GAEjC1T,OAAOgN,cAAa,MAApBhN,OAAwB+M,IAS3BkH,EAAkB,SAAC7Q,GACvB,OAAAA,GAAa,OAAUA,GAAa,OAQhC+Q,EAAiB,SAAC/Q,GACtB,OAAAA,GAAa,OAAUA,GAAa,OAUhC4Q,EAAe,SAACD,EAAeG,EAAgBN,GAInD,GAAIA,IAAcV,EAAUkB,aAAc,OAAQF,GAAU,EAAKH,EACjE,GAAIH,IAAcV,EAAUY,UAAW,OAAQC,GAAS,EAAKG,EAC7D,MAAM,IAAInQ,MAAM,sBAAsB6P,IAYlCC,EAAU,SAAClT,GAAiC,OAC9C0T,EAAqB1T,GAASuS,EAAUY,UACxCQ,EAAwB3T,GAASuS,EAAUkB,aAC3ClB,EAAUY,WAGRO,EAAuB,SAAC1T,GAC5B,OAAa,MAAbA,EAAM,IAA4B,MAAbA,EAAM,IAEvB2T,EAA0B,SAAC3T,GAC/B,OAAa,MAAbA,EAAM,IAA4B,MAAbA,EAAM,IAEhB4T,EAAc,SAAC5T,GAC1B,OAAA0T,EAAqB1T,IAAU2T,EAAwB3T","sources":["webpack://Msdyn365.Commerce.Online/./node_modules/@pdf-lib/standard-fonts/es/utils.js?a5c9","webpack://Msdyn365.Commerce.Online/./node_modules/@pdf-lib/standard-fonts/es/Font.js?92a8","webpack://Msdyn365.Commerce.Online/./node_modules/@pdf-lib/standard-fonts/es/Encoding.js?571b","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/base64.ts?a13b","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/pdfDocEncoding.ts?422c","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/arrays.ts?db2a","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/async.ts?512e","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/numbers.ts?22bd","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/errors.ts?ebe3","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/objects.ts?9e87","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/validators.ts?577f","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/Cache.ts?09a0","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/png.ts?215a","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/rng.ts?a22c","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/strings.ts?4375","webpack://Msdyn365.Commerce.Online/./node_modules/pdf-lib/src/utils/unicode.ts?c8c1"],"sourcesContent":["/*\n * The `chars`, `lookup`, and `decodeFromBase64` members of this file are\n * licensed under the following:\n *\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n *\n */\nimport pako from 'pako';\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nexport var decodeFromBase64 = function (base64) {\n var bufferLength = base64.length * 0.75;\n var len = base64.length;\n var i;\n var p = 0;\n var encoded1;\n var encoded2;\n var encoded3;\n var encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var bytes = new Uint8Array(bufferLength);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return bytes;\n};\nvar arrayToString = function (array) {\n var str = '';\n for (var i = 0; i < array.length; i++) {\n str += String.fromCharCode(array[i]);\n }\n return str;\n};\nexport var decompressJson = function (compressedJson) {\n return arrayToString(pako.inflate(decodeFromBase64(compressedJson)));\n};\nexport var padStart = function (value, length, padChar) {\n var padding = '';\n for (var idx = 0, len = length - value.length; idx < len; idx++) {\n padding += padChar;\n }\n return padding + value;\n};\n","import { decompressJson } from './utils';\nimport CourierBoldCompressed from './Courier-Bold.compressed.json';\nimport CourierBoldObliqueCompressed from './Courier-BoldOblique.compressed.json';\nimport CourierObliqueCompressed from './Courier-Oblique.compressed.json';\nimport CourierCompressed from './Courier.compressed.json';\nimport HelveticaBoldCompressed from './Helvetica-Bold.compressed.json';\nimport HelveticaBoldObliqueCompressed from './Helvetica-BoldOblique.compressed.json';\nimport HelveticaObliqueCompressed from './Helvetica-Oblique.compressed.json';\nimport HelveticaCompressed from './Helvetica.compressed.json';\nimport TimesBoldCompressed from './Times-Bold.compressed.json';\nimport TimesBoldItalicCompressed from './Times-BoldItalic.compressed.json';\nimport TimesItalicCompressed from './Times-Italic.compressed.json';\nimport TimesRomanCompressed from './Times-Roman.compressed.json';\nimport SymbolCompressed from './Symbol.compressed.json';\nimport ZapfDingbatsCompressed from './ZapfDingbats.compressed.json';\n// prettier-ignore\nvar compressedJsonForFontName = {\n 'Courier': CourierCompressed,\n 'Courier-Bold': CourierBoldCompressed,\n 'Courier-Oblique': CourierObliqueCompressed,\n 'Courier-BoldOblique': CourierBoldObliqueCompressed,\n 'Helvetica': HelveticaCompressed,\n 'Helvetica-Bold': HelveticaBoldCompressed,\n 'Helvetica-Oblique': HelveticaObliqueCompressed,\n 'Helvetica-BoldOblique': HelveticaBoldObliqueCompressed,\n 'Times-Roman': TimesRomanCompressed,\n 'Times-Bold': TimesBoldCompressed,\n 'Times-Italic': TimesItalicCompressed,\n 'Times-BoldItalic': TimesBoldItalicCompressed,\n 'Symbol': SymbolCompressed,\n 'ZapfDingbats': ZapfDingbatsCompressed,\n};\nexport var FontNames;\n(function (FontNames) {\n FontNames[\"Courier\"] = \"Courier\";\n FontNames[\"CourierBold\"] = \"Courier-Bold\";\n FontNames[\"CourierOblique\"] = \"Courier-Oblique\";\n FontNames[\"CourierBoldOblique\"] = \"Courier-BoldOblique\";\n FontNames[\"Helvetica\"] = \"Helvetica\";\n FontNames[\"HelveticaBold\"] = \"Helvetica-Bold\";\n FontNames[\"HelveticaOblique\"] = \"Helvetica-Oblique\";\n FontNames[\"HelveticaBoldOblique\"] = \"Helvetica-BoldOblique\";\n FontNames[\"TimesRoman\"] = \"Times-Roman\";\n FontNames[\"TimesRomanBold\"] = \"Times-Bold\";\n FontNames[\"TimesRomanItalic\"] = \"Times-Italic\";\n FontNames[\"TimesRomanBoldItalic\"] = \"Times-BoldItalic\";\n FontNames[\"Symbol\"] = \"Symbol\";\n FontNames[\"ZapfDingbats\"] = \"ZapfDingbats\";\n})(FontNames || (FontNames = {}));\nvar fontCache = {};\nvar Font = /** @class */ (function () {\n function Font() {\n var _this = this;\n this.getWidthOfGlyph = function (glyphName) {\n return _this.CharWidths[glyphName];\n };\n this.getXAxisKerningForPair = function (leftGlyphName, rightGlyphName) {\n return (_this.KernPairXAmounts[leftGlyphName] || {})[rightGlyphName];\n };\n }\n Font.load = function (fontName) {\n var cachedFont = fontCache[fontName];\n if (cachedFont)\n return cachedFont;\n var json = decompressJson(compressedJsonForFontName[fontName]);\n var font = Object.assign(new Font(), JSON.parse(json));\n font.CharWidths = font.CharMetrics.reduce(function (acc, metric) {\n acc[metric.N] = metric.WX;\n return acc;\n }, {});\n font.KernPairXAmounts = font.KernPairs.reduce(function (acc, _a) {\n var name1 = _a[0], name2 = _a[1], width = _a[2];\n if (!acc[name1])\n acc[name1] = {};\n acc[name1][name2] = width;\n return acc;\n }, {});\n fontCache[fontName] = font;\n return font;\n };\n return Font;\n}());\nexport { Font };\n","/* tslint:disable max-classes-per-file */\nimport { decompressJson, padStart } from './utils';\nimport AllEncodingsCompressed from './all-encodings.compressed.json';\nvar decompressedEncodings = decompressJson(AllEncodingsCompressed);\nvar allUnicodeMappings = JSON.parse(decompressedEncodings);\nvar Encoding = /** @class */ (function () {\n function Encoding(name, unicodeMappings) {\n var _this = this;\n this.canEncodeUnicodeCodePoint = function (codePoint) {\n return codePoint in _this.unicodeMappings;\n };\n this.encodeUnicodeCodePoint = function (codePoint) {\n var mapped = _this.unicodeMappings[codePoint];\n if (!mapped) {\n var str = String.fromCharCode(codePoint);\n var hexCode = \"0x\" + padStart(codePoint.toString(16), 4, '0');\n var msg = _this.name + \" cannot encode \\\"\" + str + \"\\\" (\" + hexCode + \")\";\n throw new Error(msg);\n }\n return { code: mapped[0], name: mapped[1] };\n };\n this.name = name;\n this.supportedCodePoints = Object.keys(unicodeMappings)\n .map(Number)\n .sort(function (a, b) { return a - b; });\n this.unicodeMappings = unicodeMappings;\n }\n return Encoding;\n}());\nexport var Encodings = {\n Symbol: new Encoding('Symbol', allUnicodeMappings.symbol),\n ZapfDingbats: new Encoding('ZapfDingbats', allUnicodeMappings.zapfdingbats),\n WinAnsi: new Encoding('WinAnsi', allUnicodeMappings.win1252),\n};\n","/*\n * The `chars`, `lookup`, `encode`, and `decode` members of this file are\n * licensed under the following:\n *\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n *\n */\n\nconst chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n// Use a lookup table to find the index.\nconst lookup = new Uint8Array(256);\nfor (let i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\n\nexport const encodeToBase64 = (bytes: Uint8Array): string => {\n let base64 = '';\n const len = bytes.length;\n for (let i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n\n return base64;\n};\n\nexport const decodeFromBase64 = (base64: string): Uint8Array => {\n let bufferLength = base64.length * 0.75;\n const len = base64.length;\n let i;\n let p = 0;\n let encoded1;\n let encoded2;\n let encoded3;\n let encoded4;\n\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n\n const bytes = new Uint8Array(bufferLength);\n\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return bytes;\n};\n\n// This regex is designed to be as flexible as possible. It will parse certain\n// invalid data URIs.\nconst DATA_URI_PREFIX_REGEX = /^(data)?:?([\\w\\/\\+]+)?;?(charset=[\\w-]+|base64)?.*,/i;\n\n/**\n * If the `dataUri` input is a data URI, then the data URI prefix must not be\n * longer than 100 characters, or this function will fail to decode it.\n *\n * @param dataUri a base64 data URI or plain base64 string\n * @returns a Uint8Array containing the decoded input\n */\nexport const decodeFromBase64DataUri = (dataUri: string): Uint8Array => {\n const trimmedUri = dataUri.trim();\n\n const prefix = trimmedUri.substring(0, 100);\n const res = prefix.match(DATA_URI_PREFIX_REGEX);\n\n // Assume it's not a data URI - just a plain base64 string\n if (!res) return decodeFromBase64(trimmedUri);\n\n // Remove the data URI prefix and parse the remainder as a base64 string\n const [fullMatch] = res;\n const data = trimmedUri.substring(fullMatch.length);\n\n return decodeFromBase64(data);\n};\n","import { toCharCode } from 'src/utils/strings';\n\n// Mapping from PDFDocEncoding to Unicode code point\nconst pdfDocEncodingToUnicode = new Uint16Array(256);\n\n// Initialize the code points which are the same\nfor (let idx = 0; idx < 256; idx++) {\n pdfDocEncodingToUnicode[idx] = idx;\n}\n\n// Set differences (see \"Table D.2 – PDFDocEncoding Character Set\" of the PDF spec)\npdfDocEncodingToUnicode[0x16] = toCharCode('\\u0017'); // SYNCRONOUS IDLE\npdfDocEncodingToUnicode[0x18] = toCharCode('\\u02D8'); // BREVE\npdfDocEncodingToUnicode[0x19] = toCharCode('\\u02C7'); // CARON\npdfDocEncodingToUnicode[0x1a] = toCharCode('\\u02C6'); // MODIFIER LETTER CIRCUMFLEX ACCENT\npdfDocEncodingToUnicode[0x1b] = toCharCode('\\u02D9'); // DOT ABOVE\npdfDocEncodingToUnicode[0x1c] = toCharCode('\\u02DD'); // DOUBLE ACUTE ACCENT\npdfDocEncodingToUnicode[0x1d] = toCharCode('\\u02DB'); // OGONEK\npdfDocEncodingToUnicode[0x1e] = toCharCode('\\u02DA'); // RING ABOVE\npdfDocEncodingToUnicode[0x1f] = toCharCode('\\u02DC'); // SMALL TILDE\npdfDocEncodingToUnicode[0x7f] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\npdfDocEncodingToUnicode[0x80] = toCharCode('\\u2022'); // BULLET\npdfDocEncodingToUnicode[0x81] = toCharCode('\\u2020'); // DAGGER\npdfDocEncodingToUnicode[0x82] = toCharCode('\\u2021'); // DOUBLE DAGGER\npdfDocEncodingToUnicode[0x83] = toCharCode('\\u2026'); // HORIZONTAL ELLIPSIS\npdfDocEncodingToUnicode[0x84] = toCharCode('\\u2014'); // EM DASH\npdfDocEncodingToUnicode[0x85] = toCharCode('\\u2013'); // EN DASH\npdfDocEncodingToUnicode[0x86] = toCharCode('\\u0192'); // LATIN SMALL LETTER SCRIPT F\npdfDocEncodingToUnicode[0x87] = toCharCode('\\u2044'); // FRACTION SLASH (solidus)\npdfDocEncodingToUnicode[0x88] = toCharCode('\\u2039'); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK\npdfDocEncodingToUnicode[0x89] = toCharCode('\\u203A'); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\npdfDocEncodingToUnicode[0x8a] = toCharCode('\\u2212'); // MINUS SIGN\npdfDocEncodingToUnicode[0x8b] = toCharCode('\\u2030'); // PER MILLE SIGN\npdfDocEncodingToUnicode[0x8c] = toCharCode('\\u201E'); // DOUBLE LOW-9 QUOTATION MARK (quotedblbase)\npdfDocEncodingToUnicode[0x8d] = toCharCode('\\u201C'); // LEFT DOUBLE QUOTATION MARK (quotedblleft)\npdfDocEncodingToUnicode[0x8e] = toCharCode('\\u201D'); // RIGHT DOUBLE QUOTATION MARK (quotedblright)\npdfDocEncodingToUnicode[0x8f] = toCharCode('\\u2018'); // LEFT SINGLE QUOTATION MARK (quoteleft)\npdfDocEncodingToUnicode[0x90] = toCharCode('\\u2019'); // RIGHT SINGLE QUOTATION MARK (quoteright)\npdfDocEncodingToUnicode[0x91] = toCharCode('\\u201A'); // SINGLE LOW-9 QUOTATION MARK (quotesinglbase)\npdfDocEncodingToUnicode[0x92] = toCharCode('\\u2122'); // TRADE MARK SIGN\npdfDocEncodingToUnicode[0x93] = toCharCode('\\uFB01'); // LATIN SMALL LIGATURE FI\npdfDocEncodingToUnicode[0x94] = toCharCode('\\uFB02'); // LATIN SMALL LIGATURE FL\npdfDocEncodingToUnicode[0x95] = toCharCode('\\u0141'); // LATIN CAPITAL LETTER L WITH STROKE\npdfDocEncodingToUnicode[0x96] = toCharCode('\\u0152'); // LATIN CAPITAL LIGATURE OE\npdfDocEncodingToUnicode[0x97] = toCharCode('\\u0160'); // LATIN CAPITAL LETTER S WITH CARON\npdfDocEncodingToUnicode[0x98] = toCharCode('\\u0178'); // LATIN CAPITAL LETTER Y WITH DIAERESIS\npdfDocEncodingToUnicode[0x99] = toCharCode('\\u017D'); // LATIN CAPITAL LETTER Z WITH CARON\npdfDocEncodingToUnicode[0x9a] = toCharCode('\\u0131'); // LATIN SMALL LETTER DOTLESS I\npdfDocEncodingToUnicode[0x9b] = toCharCode('\\u0142'); // LATIN SMALL LETTER L WITH STROKE\npdfDocEncodingToUnicode[0x9c] = toCharCode('\\u0153'); // LATIN SMALL LIGATURE OE\npdfDocEncodingToUnicode[0x9d] = toCharCode('\\u0161'); // LATIN SMALL LETTER S WITH CARON\npdfDocEncodingToUnicode[0x9e] = toCharCode('\\u017E'); // LATIN SMALL LETTER Z WITH CARON\npdfDocEncodingToUnicode[0x9f] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\npdfDocEncodingToUnicode[0xa0] = toCharCode('\\u20AC'); // EURO SIGN\npdfDocEncodingToUnicode[0xad] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\n\n/**\n * Decode a byte array into a string using PDFDocEncoding.\n *\n * @param bytes a byte array (decimal representation) containing a string\n * encoded with PDFDocEncoding.\n */\nexport const pdfDocEncodingDecode = (bytes: Uint8Array): string => {\n const codePoints = new Array(bytes.length);\n for (let idx = 0, len = bytes.length; idx < len; idx++) {\n codePoints[idx] = pdfDocEncodingToUnicode[bytes[idx]];\n }\n return String.fromCodePoint(...codePoints);\n};\n","import { decodeFromBase64DataUri } from 'src/utils/base64';\nimport { charFromCode } from 'src/utils/strings';\n\nexport const last = (array: T[]): T => array[array.length - 1];\n\n// export const dropLast = (array: T[]): T[] =>\n// array.slice(0, array.length - 1);\n\nexport const typedArrayFor = (value: string | Uint8Array): Uint8Array => {\n if (value instanceof Uint8Array) return value;\n const length = value.length;\n const typedArray = new Uint8Array(length);\n for (let idx = 0; idx < length; idx++) {\n typedArray[idx] = value.charCodeAt(idx);\n }\n return typedArray;\n};\n\nexport const mergeIntoTypedArray = (...arrays: (string | Uint8Array)[]) => {\n const arrayCount = arrays.length;\n\n const typedArrays: Uint8Array[] = [];\n for (let idx = 0; idx < arrayCount; idx++) {\n const element = arrays[idx];\n typedArrays[idx] =\n element instanceof Uint8Array ? element : typedArrayFor(element);\n }\n\n let totalSize = 0;\n for (let idx = 0; idx < arrayCount; idx++) {\n totalSize += arrays[idx].length;\n }\n\n const merged = new Uint8Array(totalSize);\n let offset = 0;\n for (let arrIdx = 0; arrIdx < arrayCount; arrIdx++) {\n const arr = typedArrays[arrIdx];\n for (let byteIdx = 0, arrLen = arr.length; byteIdx < arrLen; byteIdx++) {\n merged[offset++] = arr[byteIdx];\n }\n }\n\n return merged;\n};\n\nexport const mergeUint8Arrays = (arrays: Uint8Array[]): Uint8Array => {\n let totalSize = 0;\n for (let idx = 0, len = arrays.length; idx < len; idx++) {\n totalSize += arrays[idx].length;\n }\n\n const mergedBuffer = new Uint8Array(totalSize);\n let offset = 0;\n for (let idx = 0, len = arrays.length; idx < len; idx++) {\n const array = arrays[idx];\n mergedBuffer.set(array, offset);\n offset += array.length;\n }\n\n return mergedBuffer;\n};\n\nexport const arrayAsString = (array: Uint8Array | number[]): string => {\n let str = '';\n for (let idx = 0, len = array.length; idx < len; idx++) {\n str += charFromCode(array[idx]);\n }\n return str;\n};\n\nexport const byAscendingId = (a: T, b: T) => a.id - b.id;\n\nexport const sortedUniq = (array: T[], indexer: (elem: T) => any): T[] => {\n const uniq: T[] = [];\n\n for (let idx = 0, len = array.length; idx < len; idx++) {\n const curr = array[idx];\n const prev = array[idx - 1];\n if (idx === 0 || indexer(curr) !== indexer(prev)) {\n uniq.push(curr);\n }\n }\n\n return uniq;\n};\n\n// Arrays and TypedArrays in JS both have .reverse() methods, which would seem\n// to negate the need for this function. However, not all runtimes support this\n// method (e.g. React Native). This function compensates for that fact.\nexport const reverseArray = (array: Uint8Array) => {\n const arrayLen = array.length;\n for (let idx = 0, len = Math.floor(arrayLen / 2); idx < len; idx++) {\n const leftIdx = idx;\n const rightIdx = arrayLen - idx - 1;\n const temp = array[idx];\n\n array[leftIdx] = array[rightIdx];\n array[rightIdx] = temp;\n }\n return array;\n};\n\nexport const sum = (array: number[] | Uint8Array): number => {\n let total = 0;\n for (let idx = 0, len = array.length; idx < len; idx++) {\n total += array[idx];\n }\n return total;\n};\n\nexport const range = (start: number, end: number): number[] => {\n const arr = new Array(end - start);\n for (let idx = 0, len = arr.length; idx < len; idx++) {\n arr[idx] = start + idx;\n }\n return arr;\n};\n\nexport const pluckIndices = (arr: T[], indices: number[]) => {\n const plucked = new Array(indices.length);\n for (let idx = 0, len = indices.length; idx < len; idx++) {\n plucked[idx] = arr[indices[idx]];\n }\n return plucked;\n};\n\nexport const canBeConvertedToUint8Array = (\n input: any,\n): input is string | ArrayBuffer | Uint8Array =>\n input instanceof Uint8Array ||\n input instanceof ArrayBuffer ||\n typeof input === 'string';\n\nexport const toUint8Array = (input: string | ArrayBuffer | Uint8Array) => {\n if (typeof input === 'string') {\n return decodeFromBase64DataUri(input);\n } else if (input instanceof ArrayBuffer) {\n return new Uint8Array(input);\n } else if (input instanceof Uint8Array) {\n return input;\n } else {\n throw new TypeError(\n '`input` must be one of `string | ArrayBuffer | Uint8Array`',\n );\n }\n};\n","/**\n * Returns a Promise that resolves after at least one tick of the\n * Macro Task Queue occurs.\n */\nexport const waitForTick = (): Promise =>\n new Promise((resolve) => {\n setTimeout(() => resolve(), 0);\n });\n","// tslint:disable radix\n\n/**\n * Converts a number to its string representation in decimal. This function\n * differs from simply converting a number to a string with `.toString()`\n * because this function's output string will **not** contain exponential\n * notation.\n *\n * Credit: https://stackoverflow.com/a/46545519\n */\nexport const numberToString = (num: number) => {\n let numStr = String(num);\n\n if (Math.abs(num) < 1.0) {\n const e = parseInt(num.toString().split('e-')[1]);\n if (e) {\n const negative = num < 0;\n if (negative) num *= -1;\n num *= Math.pow(10, e - 1);\n numStr = '0.' + new Array(e).join('0') + num.toString().substring(2);\n if (negative) numStr = '-' + numStr;\n }\n } else {\n let e = parseInt(num.toString().split('+')[1]);\n if (e > 20) {\n e -= 20;\n num /= Math.pow(10, e);\n numStr = num.toString() + new Array(e + 1).join('0');\n }\n }\n\n return numStr;\n};\n\nexport const sizeInBytes = (n: number) => Math.ceil(n.toString(2).length / 8);\n\n/**\n * Converts a number into its constituent bytes and returns them as\n * a number[].\n *\n * Returns most significant byte as first element in array. It may be necessary\n * to call .reverse() to get the bits in the desired order.\n *\n * Example:\n * bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ]\n *\n * Credit for algorithm: https://stackoverflow.com/a/1936865\n */\nexport const bytesFor = (n: number) => {\n const bytes = new Uint8Array(sizeInBytes(n));\n for (let i = 1; i <= bytes.length; i++) {\n bytes[i - 1] = n >> ((bytes.length - i) * 8);\n }\n return bytes;\n};\n","export const error = (msg: string) => {\n throw new Error(msg);\n};\n","import { FontNames } from '@pdf-lib/standard-fonts';\n\nexport const values = (obj: any) => Object.keys(obj).map((k) => obj[k]);\n\nexport const StandardFontValues = values(FontNames);\n\nexport const isStandardFont = (input: any): input is FontNames =>\n StandardFontValues.includes(input);\n\nexport const rectanglesAreEqual = (\n a: { x: number; y: number; width: number; height: number },\n b: { x: number; y: number; width: number; height: number },\n) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n","/* tslint:disable:ban-types */\n\nimport { values as objectValues } from 'src/utils/objects';\n\nexport const backtick = (val: any) => `\\`${val}\\``;\nexport const singleQuote = (val: any) => `'${val}'`;\n\ntype Primitive = string | number | boolean | undefined | null;\n\n// prettier-ignore\nconst formatValue = (value: any) => {\n const type = typeof value;\n if (type ==='string') return singleQuote(value);\n else if (type ==='undefined') return backtick(value);\n else return value;\n};\n\nexport const createValueErrorMsg = (\n value: any,\n valueName: string,\n values: Primitive[],\n) => {\n const allowedValues = new Array(values.length);\n\n for (let idx = 0, len = values.length; idx < len; idx++) {\n const v = values[idx];\n allowedValues[idx] = formatValue(v);\n }\n\n const joinedValues = allowedValues.join(' or ');\n\n // prettier-ignore\n return `${backtick(valueName)} must be one of ${joinedValues}, but was actually ${formatValue(value)}`;\n};\n\nexport const assertIsOneOf = (\n value: any,\n valueName: string,\n allowedValues: Primitive[] | { [key: string]: Primitive },\n) => {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n for (let idx = 0, len = allowedValues.length; idx < len; idx++) {\n if (value === allowedValues[idx]) return;\n }\n throw new TypeError(createValueErrorMsg(value, valueName, allowedValues));\n};\n\nexport const assertIsOneOfOrUndefined = (\n value: any,\n valueName: string,\n allowedValues: Primitive[] | { [key: string]: Primitive },\n) => {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n assertIsOneOf(value, valueName, allowedValues.concat(undefined));\n};\n\nexport const assertIsSubset = (\n values: any[],\n valueName: string,\n allowedValues: Primitive[] | { [key: string]: Primitive },\n) => {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n for (let idx = 0, len = values.length; idx < len; idx++) {\n assertIsOneOf(values[idx], valueName, allowedValues);\n }\n};\n\nexport const getType = (val: any) => {\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (typeof val === 'string') return 'string';\n if (isNaN(val)) return 'NaN';\n if (typeof val === 'number') return 'number';\n if (typeof val === 'boolean') return 'boolean';\n if (typeof val === 'symbol') return 'symbol';\n if (typeof val === 'bigint') return 'bigint';\n if (val.constructor && val.constructor.name) return val.constructor.name;\n if (val.name) return val.name;\n if (val.constructor) return String(val.constructor);\n return String(val);\n};\n\nexport type TypeDescriptor =\n | 'null'\n | 'undefined'\n | 'string'\n | 'number'\n | 'boolean'\n | 'symbol'\n | 'bigint'\n | DateConstructor\n | ArrayConstructor\n | Uint8ArrayConstructor\n | ArrayBufferConstructor\n | FunctionConstructor\n | [Function, string];\n\nexport const isType = (value: any, type: TypeDescriptor) => {\n if (type === 'null') return value === null;\n if (type === 'undefined') return value === undefined;\n if (type === 'string') return typeof value === 'string';\n if (type === 'number') return typeof value === 'number' && !isNaN(value);\n if (type === 'boolean') return typeof value === 'boolean';\n if (type === 'symbol') return typeof value === 'symbol';\n if (type === 'bigint') return typeof value === 'bigint';\n if (type === Date) return value instanceof Date;\n if (type === Array) return value instanceof Array;\n if (type === Uint8Array) return value instanceof Uint8Array;\n if (type === ArrayBuffer) return value instanceof ArrayBuffer;\n if (type === Function) return value instanceof Function;\n return value instanceof (type as [Function, string])[0];\n};\n\nexport const createTypeErrorMsg = (\n value: any,\n valueName: string,\n types: TypeDescriptor[],\n) => {\n const allowedTypes = new Array(types.length);\n\n for (let idx = 0, len = types.length; idx < len; idx++) {\n const type = types[idx];\n if (type === 'null') allowedTypes[idx] = backtick('null');\n if (type === 'undefined') allowedTypes[idx] = backtick('undefined');\n if (type === 'string') allowedTypes[idx] = backtick('string');\n else if (type === 'number') allowedTypes[idx] = backtick('number');\n else if (type === 'boolean') allowedTypes[idx] = backtick('boolean');\n else if (type === 'symbol') allowedTypes[idx] = backtick('symbol');\n else if (type === 'bigint') allowedTypes[idx] = backtick('bigint');\n else if (type === Array) allowedTypes[idx] = backtick('Array');\n else if (type === Uint8Array) allowedTypes[idx] = backtick('Uint8Array');\n else if (type === ArrayBuffer) allowedTypes[idx] = backtick('ArrayBuffer');\n else allowedTypes[idx] = backtick((type as [Function, string])[1]);\n }\n\n const joinedTypes = allowedTypes.join(' or ');\n\n // prettier-ignore\n return `${backtick(valueName)} must be of type ${joinedTypes}, but was actually of type ${backtick(getType(value))}`;\n};\n\nexport const assertIs = (\n value: any,\n valueName: string,\n types: TypeDescriptor[],\n) => {\n for (let idx = 0, len = types.length; idx < len; idx++) {\n if (isType(value, types[idx])) return;\n }\n throw new TypeError(createTypeErrorMsg(value, valueName, types));\n};\n\nexport const assertOrUndefined = (\n value: any,\n valueName: string,\n types: TypeDescriptor[],\n) => {\n assertIs(value, valueName, types.concat('undefined'));\n};\n\nexport const assertEachIs = (\n values: any[],\n valueName: string,\n types: TypeDescriptor[],\n) => {\n for (let idx = 0, len = values.length; idx < len; idx++) {\n assertIs(values[idx], valueName, types);\n }\n};\n\nexport const assertRange = (\n value: any,\n valueName: string,\n min: number,\n max: number,\n) => {\n assertIs(value, valueName, ['number']);\n assertIs(min, 'min', ['number']);\n assertIs(max, 'max', ['number']);\n max = Math.max(min, max);\n if (value < min || value > max) {\n // prettier-ignore\n throw new Error(`${backtick(valueName)} must be at least ${min} and at most ${max}, but was actually ${value}`);\n }\n};\n\nexport const assertRangeOrUndefined = (\n value: any,\n valueName: string,\n min: number,\n max: number,\n) => {\n assertIs(value, valueName, ['number', 'undefined']);\n if (typeof value === 'number') assertRange(value, valueName, min, max);\n};\n\nexport const assertMultiple = (\n value: any,\n valueName: string,\n multiplier: number,\n) => {\n assertIs(value, valueName, ['number']);\n if (value % multiplier !== 0) {\n // prettier-ignore\n throw new Error(`${backtick(valueName)} must be a multiple of ${multiplier}, but was actually ${value}`);\n }\n};\n\nexport const assertInteger = (value: any, valueName: string) => {\n if (!Number.isInteger(value)) {\n throw new Error(\n `${backtick(valueName)} must be an integer, but was actually ${value}`,\n );\n }\n};\n\nexport const assertPositive = (value: number, valueName: string) => {\n if (![1, 0].includes(Math.sign(value))) {\n // prettier-ignore\n throw new Error(`${backtick(valueName)} must be a positive number or 0, but was actually ${value}`);\n }\n};\n","class Cache {\n static readonly populatedBy = (populate: () => T) => new Cache(populate);\n\n private readonly populate: () => T;\n private value: T | undefined;\n\n private constructor(populate: () => T) {\n this.populate = populate;\n this.value = undefined;\n }\n\n getValue(): T | undefined {\n return this.value;\n }\n\n access(): T {\n if (!this.value) this.value = this.populate();\n return this.value;\n }\n\n invalidate(): void {\n this.value = undefined;\n }\n}\n\nexport default Cache;\n","import UPNG from '@pdf-lib/upng';\n\nconst getImageType = (ctype: number) => {\n if (ctype === 0) return PngType.Greyscale;\n if (ctype === 2) return PngType.Truecolour;\n if (ctype === 3) return PngType.IndexedColour;\n if (ctype === 4) return PngType.GreyscaleWithAlpha;\n if (ctype === 6) return PngType.TruecolourWithAlpha;\n throw new Error(`Unknown color type: ${ctype}`);\n};\n\nconst splitAlphaChannel = (rgbaChannel: Uint8Array) => {\n const pixelCount = Math.floor(rgbaChannel.length / 4);\n\n const rgbChannel = new Uint8Array(pixelCount * 3);\n const alphaChannel = new Uint8Array(pixelCount * 1);\n\n let rgbaOffset = 0;\n let rgbOffset = 0;\n let alphaOffset = 0;\n\n while (rgbaOffset < rgbaChannel.length) {\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n alphaChannel[alphaOffset++] = rgbaChannel[rgbaOffset++];\n }\n\n return { rgbChannel, alphaChannel };\n};\n\nexport enum PngType {\n Greyscale = 'Greyscale',\n Truecolour = 'Truecolour',\n IndexedColour = 'IndexedColour',\n GreyscaleWithAlpha = 'GreyscaleWithAlpha',\n TruecolourWithAlpha = 'TruecolourWithAlpha',\n}\n\nexport class PNG {\n static load = (pngData: Uint8Array) => new PNG(pngData);\n\n readonly rgbChannel: Uint8Array;\n readonly alphaChannel?: Uint8Array;\n readonly type: PngType;\n readonly width: number;\n readonly height: number;\n readonly bitsPerComponent: number;\n\n private constructor(pngData: Uint8Array) {\n const upng = UPNG.decode(pngData);\n const frames = UPNG.toRGBA8(upng);\n\n if (frames.length > 1) throw new Error(`Animated PNGs are not supported`);\n\n const frame = new Uint8Array(frames[0]);\n const { rgbChannel, alphaChannel } = splitAlphaChannel(frame);\n\n this.rgbChannel = rgbChannel;\n\n const hasAlphaValues = alphaChannel.some((a) => a < 255);\n if (hasAlphaValues) this.alphaChannel = alphaChannel;\n\n this.type = getImageType(upng.ctype);\n\n this.width = upng.width;\n this.height = upng.height;\n this.bitsPerComponent = 8;\n }\n}\n","/**\n * Generates a pseudo random number. Although it is not cryptographically secure\n * and uniformly distributed, it is not a concern for the intended use-case,\n * which is to generate distinct numbers.\n *\n * Credit: https://stackoverflow.com/a/19303725/10254049\n */\nexport class SimpleRNG {\n static withSeed = (seed: number) => new SimpleRNG(seed);\n\n private seed: number;\n\n private constructor(seed: number) {\n this.seed = seed;\n }\n\n nextInt(): number {\n const x = Math.sin(this.seed++) * 10000;\n return x - Math.floor(x);\n }\n}\n","export const toCharCode = (character: string) => character.charCodeAt(0);\n\nexport const toCodePoint = (character: string) => character.codePointAt(0);\n\nexport const toHexStringOfMinLength = (num: number, minLength: number) =>\n padStart(num.toString(16), minLength, '0').toUpperCase();\n\nexport const toHexString = (num: number) => toHexStringOfMinLength(num, 2);\n\nexport const charFromCode = (code: number) => String.fromCharCode(code);\n\nexport const charFromHexCode = (hex: string) => charFromCode(parseInt(hex, 16));\n\nexport const padStart = (value: string, length: number, padChar: string) => {\n let padding = '';\n for (let idx = 0, len = length - value.length; idx < len; idx++) {\n padding += padChar;\n }\n return padding + value;\n};\n\nexport const copyStringIntoBuffer = (\n str: string,\n buffer: Uint8Array,\n offset: number,\n): number => {\n const length = str.length;\n for (let idx = 0; idx < length; idx++) {\n buffer[offset++] = str.charCodeAt(idx);\n }\n return length;\n};\n\nexport const addRandomSuffix = (prefix: string, suffixLength = 4) =>\n `${prefix}-${Math.floor(Math.random() * 10 ** suffixLength)}`;\n\nexport const escapeRegExp = (str: string) =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\nexport const cleanText = (text: string) =>\n text.replace(/\\t|\\u0085|\\u2028|\\u2029/g, ' ').replace(/[\\b\\v]/g, '');\n\nexport const escapedNewlineChars = ['\\\\n', '\\\\f', '\\\\r', '\\\\u000B'];\n\nexport const newlineChars = ['\\n', '\\f', '\\r', '\\u000B'];\n\nexport const isNewlineChar = (text: string) => /^[\\n\\f\\r\\u000B]$/.test(text);\n\nexport const lineSplit = (text: string) => text.split(/[\\n\\f\\r\\u000B]/);\n\nexport const mergeLines = (text: string) =>\n text.replace(/[\\n\\f\\r\\u000B]/g, ' ');\n\n// JavaScript's String.charAt() method doesn work on strings containing UTF-16\n// characters (with high and low surrogate pairs), such as 💩 (poo emoji). This\n// `charAtIndex()` function does.\n//\n// Credit: https://github.com/mathiasbynens/String.prototype.at/blob/master/at.js#L14-L48\nexport const charAtIndex = (text: string, index: number): [string, number] => {\n // Get the first code unit and code unit value\n const cuFirst = text.charCodeAt(index);\n let cuSecond: number;\n const nextIndex = index + 1;\n let length = 1;\n if (\n // Check if it's the start of a surrogate pair.\n cuFirst >= 0xd800 &&\n cuFirst <= 0xdbff && // high surrogate\n text.length > nextIndex // there is a next code unit\n ) {\n cuSecond = text.charCodeAt(nextIndex);\n if (cuSecond >= 0xdc00 && cuSecond <= 0xdfff) length = 2; // low surrogate\n }\n return [text.slice(index, index + length), length];\n};\n\nexport const charSplit = (text: string) => {\n const chars: string[] = [];\n\n for (let idx = 0, len = text.length; idx < len; ) {\n const [c, cLen] = charAtIndex(text, idx);\n chars.push(c);\n idx += cLen;\n }\n\n return chars;\n};\n\nconst buildWordBreakRegex = (wordBreaks: string[]) => {\n const newlineCharUnion = escapedNewlineChars.join('|');\n\n const escapedRules: string[] = ['$'];\n for (let idx = 0, len = wordBreaks.length; idx < len; idx++) {\n const wordBreak = wordBreaks[idx];\n if (isNewlineChar(wordBreak)) {\n throw new TypeError(`\\`wordBreak\\` must not include ${newlineCharUnion}`);\n }\n escapedRules.push(wordBreak === '' ? '.' : escapeRegExp(wordBreak));\n }\n\n const breakRules = escapedRules.join('|');\n return new RegExp(`(${newlineCharUnion})|((.*?)(${breakRules}))`, 'gm');\n};\n\nexport const breakTextIntoLines = (\n text: string,\n wordBreaks: string[],\n maxWidth: number,\n computeWidthOfText: (t: string) => number,\n): string[] => {\n const regex = buildWordBreakRegex(wordBreaks);\n\n const words = cleanText(text).match(regex)!;\n\n let currLine = '';\n let currWidth = 0;\n const lines: string[] = [];\n\n const pushCurrLine = () => {\n if (currLine !== '') lines.push(currLine);\n currLine = '';\n currWidth = 0;\n };\n\n for (let idx = 0, len = words.length; idx < len; idx++) {\n const word = words[idx];\n if (isNewlineChar(word)) {\n pushCurrLine();\n } else {\n const width = computeWidthOfText(word);\n if (currWidth + width > maxWidth) pushCurrLine();\n currLine += word;\n currWidth += width;\n }\n }\n pushCurrLine();\n\n return lines;\n};\n\n// See section \"7.9.4 Dates\" of the PDF specification\nconst dateRegex = /^D:(\\d\\d\\d\\d)(\\d\\d)?(\\d\\d)?(\\d\\d)?(\\d\\d)?(\\d\\d)?([+\\-Z])?(\\d\\d)?'?(\\d\\d)?'?$/;\n\nexport const parseDate = (dateStr: string): Date | undefined => {\n const match = dateStr.match(dateRegex);\n\n if (!match) return undefined;\n\n const [\n ,\n year,\n month = '01',\n day = '01',\n hours = '00',\n mins = '00',\n secs = '00',\n offsetSign = 'Z',\n offsetHours = '00',\n offsetMins = '00',\n ] = match;\n\n // http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15\n const tzOffset =\n offsetSign === 'Z' ? 'Z' : `${offsetSign}${offsetHours}:${offsetMins}`;\n const date = new Date(\n `${year}-${month}-${day}T${hours}:${mins}:${secs}${tzOffset}`,\n );\n\n return date;\n};\n\nexport const findLastMatch = (value: string, regex: RegExp) => {\n let position = 0;\n let lastMatch: RegExpMatchArray | undefined;\n while (position < value.length) {\n const match = value.substring(position).match(regex);\n if (!match) return { match: lastMatch, pos: position };\n lastMatch = match;\n position += (match.index ?? 0) + match[0].length;\n }\n return { match: lastMatch, pos: position };\n};\n","import { toHexString } from 'src/utils/strings';\n\n/**\n * Encodes a string to UTF-8.\n *\n * @param input The string to be encoded.\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be added\n * to the start of the encoding. (default `true`)\n * @returns A Uint8Array containing the UTF-8 encoding of the input string.\n *\n * -----------------------------------------------------------------------------\n *\n * JavaScript strings are composed of Unicode code points. Code points are\n * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,\n * it must be encoded as a sequence of words. A word is typically 8, 16, or 32\n * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,\n * and UTF-32. These encoding forms are described in the Unicode standard [1].\n * This function implements the UTF-8 encoding form.\n *\n * -----------------------------------------------------------------------------\n *\n * In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes.\n * Note that the logic which defines this mapping is slightly convoluted, and\n * not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8\n * mapping logic is as follows [2]:\n *\n * • If a code point is in the range U+0000..U+007F, then view it as a 7-bit\n * integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order\n * bit set to 0:\n *\n * b1=0b0xxxxxxx\n *\n * • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit\n * integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits\n * of the code point stored in the first byte, and the last 6 bits stored in\n * the second byte:\n *\n * b1=0b110yyyyy b2=0b10xxxxxx\n *\n * • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit\n * integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first\n * 4 bits stored in the first byte, the next 6 bits stored in the second byte,\n * and the last 6 bits in the third byte:\n *\n * b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx\n *\n * • If a code point is in the range U+10000...U+10FFFF, then view it as a\n * 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with\n * the first 3 bits stored in the first byte, the next 6 bits stored in the\n * second byte, the next 6 bits stored in the third byte, and the last 6 bits\n * stored in the fourth byte:\n *\n * b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx\n *\n * -----------------------------------------------------------------------------\n *\n * It is important to note, when iterating through the code points of a string\n * in JavaScript, that if a character is encoded as a surrogate pair it will\n * increase the string's length by 2 instead of 1 [4]. For example:\n *\n * ```\n * > 'a'.length\n * 1\n * > '💩'.length\n * 2\n * > '語'.length\n * 1\n * > 'a💩語'.length\n * 4\n * ```\n *\n * The results of the above example are explained by the fact that the\n * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.\n *\n * Because of this idiosyncrasy in JavaScript's string implementation and APIs,\n * we must \"jump\" an extra index after encoding a character as a surrogate\n * pair. In practice, this means we must increment the index of our for loop by\n * 2 if we encode a surrogate pair, and 1 in all other cases.\n *\n * -----------------------------------------------------------------------------\n *\n * References:\n * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf\n * 3.9 Unicode Encoding Forms - UTF-8\n * - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html\n * - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html\n * - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description\n *\n */\nexport const utf8Encode = (input: string, byteOrderMark = true): Uint8Array => {\n const encoded = [];\n\n if (byteOrderMark) encoded.push(0xef, 0xbb, 0xbf);\n\n for (let idx = 0, len = input.length; idx < len; ) {\n const codePoint = input.codePointAt(idx)!;\n\n // One byte encoding\n if (codePoint < 0x80) {\n const byte1 = codePoint & 0x7f;\n encoded.push(byte1);\n idx += 1;\n }\n\n // Two byte encoding\n else if (codePoint < 0x0800) {\n const byte1 = ((codePoint >> 6) & 0x1f) | 0xc0;\n const byte2 = (codePoint & 0x3f) | 0x80;\n encoded.push(byte1, byte2);\n idx += 1;\n }\n\n // Three byte encoding\n else if (codePoint < 0x010000) {\n const byte1 = ((codePoint >> 12) & 0x0f) | 0xe0;\n const byte2 = ((codePoint >> 6) & 0x3f) | 0x80;\n const byte3 = (codePoint & 0x3f) | 0x80;\n encoded.push(byte1, byte2, byte3);\n idx += 1;\n }\n\n // Four byte encoding (surrogate pair)\n else if (codePoint < 0x110000) {\n const byte1 = ((codePoint >> 18) & 0x07) | 0xf0;\n const byte2 = ((codePoint >> 12) & 0x3f) | 0x80;\n const byte3 = ((codePoint >> 6) & 0x3f) | 0x80;\n const byte4 = ((codePoint >> 0) & 0x3f) | 0x80;\n encoded.push(byte1, byte2, byte3, byte4);\n idx += 2;\n }\n\n // Should never reach this case\n else throw new Error(`Invalid code point: 0x${toHexString(codePoint)}`);\n }\n\n return new Uint8Array(encoded);\n};\n\n/**\n * Encodes a string to UTF-16.\n *\n * @param input The string to be encoded.\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be added\n * to the start of the encoding. (default `true`)\n * @returns A Uint16Array containing the UTF-16 encoding of the input string.\n *\n * -----------------------------------------------------------------------------\n *\n * JavaScript strings are composed of Unicode code points. Code points are\n * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,\n * it must be encoded as a sequence of words. A word is typically 8, 16, or 32\n * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,\n * and UTF-32. These encoding forms are described in the Unicode standard [1].\n * This function implements the UTF-16 encoding form.\n *\n * -----------------------------------------------------------------------------\n *\n * In UTF-16, each code point is mapped to one or two 16-bit integers. The\n * UTF-16 mapping logic is as follows [2]:\n *\n * • If a code point is in the range U+0000..U+FFFF, then map the code point to\n * a 16-bit integer with the most significant byte first.\n *\n * • If a code point is in the range U+10000..U+10000, then map the code point\n * to two 16-bit integers. The first integer should contain the high surrogate\n * and the second integer should contain the low surrogate. Both surrogates\n * should be written with the most significant byte first.\n *\n * -----------------------------------------------------------------------------\n *\n * It is important to note, when iterating through the code points of a string\n * in JavaScript, that if a character is encoded as a surrogate pair it will\n * increase the string's length by 2 instead of 1 [4]. For example:\n *\n * ```\n * > 'a'.length\n * 1\n * > '💩'.length\n * 2\n * > '語'.length\n * 1\n * > 'a💩語'.length\n * 4\n * ```\n *\n * The results of the above example are explained by the fact that the\n * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.\n *\n * Because of this idiosyncrasy in JavaScript's string implementation and APIs,\n * we must \"jump\" an extra index after encoding a character as a surrogate\n * pair. In practice, this means we must increment the index of our for loop by\n * 2 if we encode a surrogate pair, and 1 in all other cases.\n *\n * -----------------------------------------------------------------------------\n *\n * References:\n * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf\n * 3.9 Unicode Encoding Forms - UTF-8\n * - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html\n * - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description\n *\n */\nexport const utf16Encode = (\n input: string,\n byteOrderMark = true,\n): Uint16Array => {\n const encoded = [];\n\n if (byteOrderMark) encoded.push(0xfeff);\n\n for (let idx = 0, len = input.length; idx < len; ) {\n const codePoint = input.codePointAt(idx)!;\n\n // Two byte encoding\n if (codePoint < 0x010000) {\n encoded.push(codePoint);\n idx += 1;\n }\n\n // Four byte encoding (surrogate pair)\n else if (codePoint < 0x110000) {\n encoded.push(highSurrogate(codePoint), lowSurrogate(codePoint));\n idx += 2;\n }\n\n // Should never reach this case\n else throw new Error(`Invalid code point: 0x${toHexString(codePoint)}`);\n }\n\n return new Uint16Array(encoded);\n};\n\n/**\n * Returns `true` if the `codePoint` is within the\n * Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded\n * with surrogate pairs.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nexport const isWithinBMP = (codePoint: number) =>\n codePoint >= 0 && codePoint <= 0xffff;\n\n/**\n * Returns `true` if the given `codePoint` is valid and must be represented\n * with a surrogate pair when encoded.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nexport const hasSurrogates = (codePoint: number) =>\n codePoint >= 0x010000 && codePoint <= 0x10ffff;\n\n// From Unicode 3.0 spec, section 3.7:\n// http://unicode.org/versions/Unicode3.0.0/ch03.pdf\nexport const highSurrogate = (codePoint: number) =>\n Math.floor((codePoint - 0x10000) / 0x400) + 0xd800;\n\n// From Unicode 3.0 spec, section 3.7:\n// http://unicode.org/versions/Unicode3.0.0/ch03.pdf\nexport const lowSurrogate = (codePoint: number) =>\n ((codePoint - 0x10000) % 0x400) + 0xdc00;\n\nenum ByteOrder {\n BigEndian = 'BigEndian',\n LittleEndian = 'LittleEndian',\n}\n\nconst REPLACEMENT = '�'.codePointAt(0)!;\n\n/**\n * Decodes a Uint8Array of data to a string using UTF-16.\n *\n * Note that this function attempts to recover from erronous input by\n * inserting the replacement character (�) to mark invalid code points\n * and surrogate pairs.\n *\n * @param input A Uint8Array containing UTF-16 encoded data\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be read\n * at the start of the encoding. (default `true`)\n * @returns The decoded string.\n */\nexport const utf16Decode = (\n input: Uint8Array,\n byteOrderMark = true,\n): string => {\n // Need at least 2 bytes of data in UTF-16 encodings\n if (input.length <= 1) return String.fromCodePoint(REPLACEMENT);\n\n const byteOrder = byteOrderMark ? readBOM(input) : ByteOrder.BigEndian;\n\n // Skip byte order mark if needed\n let idx = byteOrderMark ? 2 : 0;\n\n const codePoints: number[] = [];\n\n while (input.length - idx >= 2) {\n const first = decodeValues(input[idx++], input[idx++], byteOrder);\n\n if (isHighSurrogate(first)) {\n if (input.length - idx < 2) {\n // Need at least 2 bytes left for the low surrogate that is required\n codePoints.push(REPLACEMENT);\n } else {\n const second = decodeValues(input[idx++], input[idx++], byteOrder);\n if (isLowSurrogate(second)) {\n codePoints.push(first, second);\n } else {\n // Low surrogates should always follow high surrogates\n codePoints.push(REPLACEMENT);\n }\n }\n } else if (isLowSurrogate(first)) {\n // High surrogates should always come first since `decodeValues()`\n // accounts for the byte ordering\n idx += 2;\n codePoints.push(REPLACEMENT);\n } else {\n codePoints.push(first);\n }\n }\n\n // There shouldn't be extra byte(s) left over\n if (idx < input.length) codePoints.push(REPLACEMENT);\n\n return String.fromCodePoint(...codePoints);\n};\n\n/**\n * Returns `true` if the given `codePoint` is a high surrogate.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nconst isHighSurrogate = (codePoint: number) =>\n codePoint >= 0xd800 && codePoint <= 0xdbff;\n\n/**\n * Returns `true` if the given `codePoint` is a low surrogate.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nconst isLowSurrogate = (codePoint: number) =>\n codePoint >= 0xdc00 && codePoint <= 0xdfff;\n\n/**\n * Decodes the given utf-16 values first and second using the specified\n * byte order.\n * @param first The first byte of the encoding.\n * @param second The second byte of the encoding.\n * @param byteOrder The byte order of the encoding.\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Examples\n */\nconst decodeValues = (first: number, second: number, byteOrder: ByteOrder) => {\n // Append the binary representation of the preceding byte by shifting the\n // first one 8 to the left and than applying a bitwise or-operator to append\n // the second one.\n if (byteOrder === ByteOrder.LittleEndian) return (second << 8) | first;\n if (byteOrder === ByteOrder.BigEndian) return (first << 8) | second;\n throw new Error(`Invalid byteOrder: ${byteOrder}`);\n};\n\n/**\n * Returns whether the given array contains a byte order mark for the\n * UTF-16BE or UTF-16LE encoding. If it has neither, BigEndian is assumed.\n *\n * Reference: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-16\n *\n * @param bytes The byte array to be evaluated.\n */\n// prettier-ignore\nconst readBOM = (bytes: Uint8Array): ByteOrder => (\n hasUtf16BigEndianBOM(bytes) ? ByteOrder.BigEndian\n : hasUtf16LittleEndianBOM(bytes) ? ByteOrder.LittleEndian\n : ByteOrder.BigEndian\n);\n\nconst hasUtf16BigEndianBOM = (bytes: Uint8Array) =>\n bytes[0] === 0xfe && bytes[1] === 0xff;\n\nconst hasUtf16LittleEndianBOM = (bytes: Uint8Array) =>\n bytes[0] === 0xff && bytes[1] === 0xfe;\n\nexport const hasUtf16BOM = (bytes: Uint8Array) =>\n hasUtf16BigEndianBOM(bytes) || hasUtf16LittleEndianBOM(bytes);\n"],"names":["chars","lookup","Uint8Array","i","length","charCodeAt","decompressJson","compressedJson","array","str","String","fromCharCode","arrayToString","base64","encoded1","encoded2","encoded3","encoded4","bufferLength","len","p","bytes","decodeFromBase64","FontNames","compressedJsonForFontName","fontCache","Font","_this","this","getWidthOfGlyph","glyphName","CharWidths","getXAxisKerningForPair","leftGlyphName","rightGlyphName","KernPairXAmounts","load","fontName","cachedFont","json","font","Object","assign","JSON","parse","CharMetrics","reduce","acc","metric","N","WX","KernPairs","_a","name1","name2","width","decompressedEncodings","allUnicodeMappings","Encoding","name","unicodeMappings","canEncodeUnicodeCodePoint","codePoint","encodeUnicodeCodePoint","mapped","hexCode","value","padChar","padding","idx","padStart","toString","msg","Error","code","supportedCodePoints","keys","map","Number","sort","a","b","Encodings","Symbol","symbol","ZapfDingbats","zapfdingbats","WinAnsi","win1252","encodeToBase64","substring","DATA_URI_PREFIX_REGEX","last","typedArrayFor","typedArray","mergeIntoTypedArray","arrayCount","arrays","typedArrays","element","totalSize","merged","offset","arrIdx","arr","byteIdx","arrLen","mergeUint8Arrays","mergedBuffer","set","arrayAsString","byAscendingId","id","sortedUniq","indexer","uniq","curr","prev","push","reverseArray","arrayLen","Math","floor","leftIdx","rightIdx","temp","sum","total","range","start","end","Array","pluckIndices","indices","plucked","canBeConvertedToUint8Array","input","ArrayBuffer","toUint8Array","dataUri","trimmedUri","trim","res","match","fullMatch","data","decodeFromBase64DataUri","TypeError","waitForTick","Promise","resolve","setTimeout","numberToString","num","e","numStr","abs","parseInt","split","negative","pow","join","sizeInBytes","n","ceil","bytesFor","error","obj","k","StandardFontValues","isStandardFont","includes","rectanglesAreEqual","x","y","height","backtick","val","formatValue","type","assertIsOneOf","valueName","allowedValues","isArray","values","v","joinedValues","createValueErrorMsg","assertIsOneOfOrUndefined","concat","undefined","assertIsSubset","isType","isNaN","Date","Function","createTypeErrorMsg","types","allowedTypes","joinedTypes","constructor","assertIs","assertOrUndefined","assertEachIs","assertRange","min","max","assertRangeOrUndefined","assertMultiple","multiplier","assertInteger","isInteger","assertPositive","sign","pdfDocEncodingToUnicode","Uint16Array","pdfDocEncodingDecode","codePoints","fromCodePoint","populate","getValue","access","invalidate","populatedBy","Cache","PngType","pngData","upng","decode","frames","toRGBA8","rgbaChannel","pixelCount","rgbChannel","alphaChannel","rgbaOffset","rgbOffset","alphaOffset","splitAlphaChannel","some","ctype","Greyscale","Truecolour","IndexedColour","GreyscaleWithAlpha","TruecolourWithAlpha","getImageType","bitsPerComponent","PNG","seed","nextInt","sin","withSeed","SimpleRNG","toCharCode","character","toCodePoint","codePointAt","toHexStringOfMinLength","minLength","toUpperCase","toHexString","charFromCode","charFromHexCode","hex","copyStringIntoBuffer","buffer","cleanText","text","replace","escapedNewlineChars","isNewlineChar","test","lineSplit","mergeLines","charAtIndex","index","cuSecond","cuFirst","nextIndex","slice","charSplit","c","cLen","breakTextIntoLines","wordBreaks","maxWidth","computeWidthOfText","regex","newlineCharUnion","escapedRules","wordBreak","breakRules","RegExp","buildWordBreakRegex","words","currLine","currWidth","lines","pushCurrLine","word","dateRegex","parseDate","dateStr","year","month","day","hours","mins","secs","offsetSign","offsetHours","findLastMatch","lastMatch","position","pos","ByteOrder","utf16Encode","byteOrderMark","encoded","highSurrogate","lowSurrogate","isWithinBMP","hasSurrogates","REPLACEMENT","utf16Decode","byteOrder","readBOM","BigEndian","first","decodeValues","isHighSurrogate","second","isLowSurrogate","LittleEndian","hasUtf16BigEndianBOM","hasUtf16LittleEndianBOM","hasUtf16BOM"],"sourceRoot":""}