@vkontakte/vk-qr 2.0.13 → 3.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/svg.ts","../src/qr.ts","../src/index.ts"],"sourcesContent":["import type { QrCode } from './qr.ts';\nimport type { RequiredQrOptions } from './types.ts';\n\nconst MULTI = 1;\nconst QR_BORDER = 7;\nconst TILE_SIZE = 96 * MULTI;\nexport const INC_TILE_SIZE = 96 * MULTI;\nconst SMALL_QR_SIZE = 25;\n\n/**\n * Returns the color of the module (pixel) at the given coordinates, which is false\n * for white or true for black. The top left corner has the coordinates (x=0, y=0).\n * If the given coordinates are out of bounds, then false (white) is returned.\n */\nconst getPixel = (\n x: number,\n y: number,\n size: number,\n modules: boolean[][],\n isLogoShowed: boolean,\n) => {\n if (x < QR_BORDER && y < QR_BORDER) {\n return false;\n }\n\n if (x >= size - QR_BORDER && y < QR_BORDER) {\n return false;\n }\n\n if (x < QR_BORDER && y >= size - QR_BORDER) {\n return false;\n }\n\n if (isLogoShowed) {\n let imageTiles = QR_BORDER + 2;\n if (size <= SMALL_QR_SIZE) {\n imageTiles--;\n }\n\n let paddingTiles = (size - QR_BORDER * 2 - imageTiles) / 2 - 1;\n if (size <= SMALL_QR_SIZE) {\n paddingTiles++;\n }\n\n if (\n x > QR_BORDER + paddingTiles &&\n x < size - QR_BORDER - paddingTiles - 1 &&\n y > QR_BORDER + paddingTiles &&\n y < size - QR_BORDER - paddingTiles - 1\n ) {\n return false;\n }\n\n return 0 <= x && x < size && 0 <= y && y < size && modules[y][x];\n }\n\n return modules[y]?.[x];\n};\n\nconst getNeighbors = (\n x: number,\n y: number,\n size: number,\n modules: boolean[][],\n isLogoShowed = true,\n) => ({\n l: getPixel(x - 1, y, size, modules, isLogoShowed),\n r: getPixel(x + 1, y, size, modules, isLogoShowed),\n t: getPixel(x, y - 1, size, modules, isLogoShowed),\n b: getPixel(x, y + 1, size, modules, isLogoShowed),\n current: getPixel(x, y, size, modules, isLogoShowed),\n});\n\n/**\n * Converts QrCode instance to SVG code\n * @param qrCode QrCode instance\n * @param options Convertation options\n */\nexport const convertSegmentsToSvgString = (qrCode: QrCode, options: RequiredQrOptions): string => {\n if (typeof options.qrSize !== 'number') {\n throw new Error('Size should be a number');\n }\n\n if (typeof options.className !== 'string') {\n throw new Error('Classname should be a string');\n }\n\n const _2 = 2 * MULTI;\n const _12_7 = 12.7 * MULTI;\n const _12_8 = 12.8 * MULTI;\n const _14_7 = 14.7 * MULTI;\n const _14_8 = 14.8 * MULTI;\n const _15_9 = 15.9 * MULTI;\n const _28_6 = 28.6 * MULTI;\n const _30_5 = 30.5 * MULTI;\n const _84_7 = 84.7776815 * MULTI;\n const _87_3 = 87.3 * MULTI;\n const _71_4 = 71.4 * MULTI;\n const _42_9 = 42.9 * MULTI;\n const _87_2 = 87.2 * MULTI;\n const _85_2 = 85.2 * MULTI;\n const _85_3 = 85.3 * MULTI;\n const _69_5 = 69.5 * MULTI;\n const _98 = 98 * MULTI;\n const _100 = 100 * MULTI;\n\n const parts = [];\n let leftPadding = 0;\n let topPadding = 0;\n let xCoord = 0;\n let yCoord = 0;\n\n for (let y = 0; y < qrCode.size; y++) {\n leftPadding = 0;\n for (let x = 0; x < qrCode.size; x++) {\n xCoord = x + leftPadding;\n leftPadding += TILE_SIZE;\n yCoord = y + topPadding;\n\n const neighbors = getNeighbors(x, y, qrCode.size, qrCode.modules, options.isShowLogo);\n\n let path = '';\n let selector = '';\n\n if (neighbors.current) {\n selector =\n !selector && !neighbors.l && !neighbors.r && !neighbors.t && !neighbors.b ? 'empty' : '';\n selector =\n (!selector && neighbors.l && neighbors.r) || (neighbors.t && neighbors.b) ? 'rect' : '';\n if (!selector) {\n selector += neighbors.l ? 'l' : neighbors.r ? 'r' : '';\n selector += neighbors.t ? 't' : neighbors.b ? 'b' : '';\n if (!selector) {\n selector = 'empty';\n }\n }\n } else {\n selector =\n !selector &&\n neighbors.l &&\n neighbors.t &&\n getPixel(x - 1, y - 1, qrCode.size, qrCode.modules, options.isShowLogo)\n ? 'n_lt'\n : '';\n selector =\n !selector &&\n neighbors.l &&\n neighbors.b &&\n getPixel(x - 1, y + 1, qrCode.size, qrCode.modules, options.isShowLogo)\n ? 'n_lb'\n : '';\n selector =\n !selector &&\n neighbors.r &&\n neighbors.t &&\n getPixel(x + 1, y - 1, qrCode.size, qrCode.modules, options.isShowLogo)\n ? 'n_rt'\n : '';\n selector =\n !selector &&\n neighbors.r &&\n neighbors.b &&\n getPixel(x + 1, y + 1, qrCode.size, qrCode.modules, options.isShowLogo)\n ? 'n_rb'\n : '';\n }\n\n if (!selector) {\n continue;\n }\n path = `<use xlink:href=\"#${selector}-${options.suffix}\"/>`;\n parts.push(`<g transform=\"translate(${xCoord},${yCoord})\">${path}</g>`);\n }\n topPadding += TILE_SIZE;\n }\n\n let scale = '';\n let position = ((qrCode.size - QR_BORDER * 3) / 2) * TILE_SIZE + TILE_SIZE * QR_BORDER - 10;\n if (qrCode.size <= SMALL_QR_SIZE) {\n scale = 'scale(0.85)';\n position += 50;\n }\n\n const pointPosition = (qrCode.size - QR_BORDER) * options.incTileSize;\n parts.push(\n `<use fill-rule=\"evenodd\" transform=\"translate(0,0)\" xlink:href=\"#point-${options.suffix}\"/>`,\n );\n parts.push(\n `<use fill-rule=\"evenodd\" transform=\"translate(${pointPosition},0)\" xlink:href=\"#point-${options.suffix}\"/>`,\n );\n parts.push(\n `<use fill-rule=\"evenodd\" transform=\"translate(0,${pointPosition})\" xlink:href=\"#point-${options.suffix}\"/>`,\n );\n\n if (options.isShowLogo) {\n if (!options.logoData) {\n parts.push(`\n <use style=\"width: 750px; height: 750px;\" width=\"750\" height=\"750\"\n fill=\"none\"\n fill-rule=\"evenodd\"\n transform=\"translate(${position},${position}) ${scale}\" xlink:href=\"#vk_logo-${options.suffix}\"\n />\n `);\n } else {\n parts.push(`\n <image\n preserveAspectRatio=\"xMidYMid slice\" clip-path=\"url(#logo-mask-${options.suffix})\"\n style=\"width: 750px; height: 750px;\" width=\"750\" height=\"750\"\n transform=\"translate(${position},${position}) ${scale}\"\n xlink:href=\"${options.logoData}\"\n />\n `);\n }\n }\n\n const backgroundSize = 99 * qrCode.size;\n let qrBackground = '';\n let qrTransform = 'translate(0,0)';\n\n if (options.isShowBackground) {\n const qrScale = (options.qrSize - 20 * 2) / options.qrSize; // 0.756972112\n const padding = (backgroundSize / options.qrSize) * 21;\n const radius = Math.ceil(backgroundSize / (options.qrSize / 36)); // 7.11111111 = 256px/36px radius\n\n qrBackground = `\n <rect\n x=\"0\"\n width=\"${backgroundSize}\"\n height=\"${backgroundSize}\"\n rx=\"${radius}\"\n fill=\"${options.backgroundColor}\"\n />`;\n qrTransform = `translate(${padding}, ${padding}) scale(${qrScale})`;\n }\n\n // eslint-disable-next-line\n const oneSide = `M0,0 L66,0 C${_84_7},-3.44940413e-15 ${_100},15.2223185 ${_100},34 L${_100},66 C${_100},${_84_7} \\\n${_84_7},${_100} 66,${_100} L0,${_100} L0,0 Z`;\n const twoSides = `M0,0 L${_100},0 L${_100},66 C${_100},${_84_7} ${_84_7},${_100} 66,${_100} L0,${_100} L0,0 Z`;\n\n return `\n <svg\n version=\"1.1\"\n viewBox=\"0 0 ${backgroundSize} ${backgroundSize}\"\n width=\"${options.qrSize}px\"\n height=\"${options.qrSize}px\"\n ${options.className ? `class=\"${options.className}\"` : ''}\n xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <defs>\n <rect id=\"rect-${options.suffix}\" width=\"100\" height=\"100\" fill=\"${options.foregroundColor}\"/>\n <path\n id=\"empty-${options.suffix}\"\n d=\"M0,${_28_6}v${_42_9}C0,${_87_3},${_12_8},${_100},${_28_6},${_100}h${_42_9}c${_15_9},0,${_28_6}-${_12_8},\\\n${_28_6}-${_28_6}V${_28_6}C${_100},${_12_7},${_87_2},0,${_71_4},0H${_28_6} C${_12_8},0,0,${_12_8},0,${_28_6}z\"\n fill=\"${options.foregroundColor}\"\n />\n <path id=\"b-${options.suffix}\" d=\"${oneSide}\" transform=\"rotate(-90 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"r-${options.suffix}\" d=\"${oneSide}\" transform=\"rotate(-180 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"l-${options.suffix}\" d=\"${oneSide}\" fill=\"${options.foregroundColor}\"/>\n <path id=\"t-${options.suffix}\" d=\"${oneSide}\" transform=\"rotate(90 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"l-${options.suffix}\" d=\"${twoSides}\" transform=\"rotate(-90 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"lt-${options.suffix}\" d=\"${twoSides}\" fill=\"${options.foregroundColor}\"/>\n <path id=\"lb-${options.suffix}\" d=\"${twoSides}\" transform=\"rotate(-90 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"rb-${options.suffix}\" d=\"${twoSides}\" transform=\"rotate(-180 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path id=\"rt-${options.suffix}\" d=\"${twoSides}\" transform=\"rotate(90 50 50)\" fill=\"${options.foregroundColor}\"/>\n <path\n id=\"n_lt-${options.suffix}\"\n d=\"M${_30_5},${_2}V0H0v${_30_5}h${_2}C${_2},${_14_7},${_14_8},${_2},${_30_5},${_2}z\"\n fill=\"${options.foregroundColor}\"\n />\n <path\n id=\"n_lb-${options.suffix}\"\n d=\"M${_2},${_69_5}H0V${_100}h${_30_5}v-${_2}C${_14_7},${_98},${_2},${_85_2},${_2},${_69_5}z\"\n fill=\"${options.foregroundColor}\"\n />\n <path\n id=\"n_rt-${options.suffix}\"\n d=\"M${_98},${_30_5}h${_2}V0H${_69_5}v${_2}C${_85_3},${_2},${_98},${_14_8},${_98},${_30_5}z\"\n fill=\"${options.foregroundColor}\"\n />\n <path id=\"n_rb-${options.suffix}\"\n d=\"M${_69_5},${_98}v${_2}H${_100}V${_69_5}h-${_2}C${_98},${_85_3},${_85_2},${_98},${_69_5},${_98}z\"\n fill=\"${options.foregroundColor}\"\n />\n <path\n id=\"point-${options.suffix}\"\n fill=\"${options.foregroundColor}\"\n d=\"M600.001786,457.329333 L600.001786,242.658167 C600.001786,147.372368 587.039517,124.122784 \\\n581.464617,118.535383 C575.877216,112.960483 552.627632,99.9982143 457.329333,99.9982143 \\\nL242.670667,99.9982143 C147.372368,99.9982143 124.122784,112.960483 118.547883,118.535383 \\\nC112.972983,124.122784 99.9982143,147.372368 99.9982143,242.658167 L99.9982143,457.329333 \\\nC99.9982143,552.627632 112.972983,575.877216 118.547883,581.464617 C124.122784,587.027017 \\\n147.372368,600.001786 242.670667,600.001786 L457.329333,600.001786 C552.627632,600.001786 \\\n575.877216,587.027017 581.464617,581.464617 C587.039517,575.877216 600.001786,552.627632 \\\n600.001786,457.329333 Z M457.329333,0 C653.338333,0 700,46.6616668 700,242.658167 C700,438.667167 \\\n700,261.332833 700,457.329333 C700,653.338333 653.338333,700 457.329333,700 C261.332833,700 438.667167,700 \\\n242.670667,700 C46.6616668,700 0,653.338333 0,457.329333 C0,261.332833 0,352.118712 0,242.658167 \\\nC0,46.6616668 46.6616668,0 242.670667,0 C438.667167,0 261.332833,0 457.329333,0 Z M395.996667,200 \\\nC480.004166,200 500,220.008332 500,303.990835 C500,387.998334 500,312.001666 500,395.996667 \\\nC500,479.991668 480.004166,500 395.996667,500 C312.001666,500 387.998334,500 304.003333,500 C220.008332,500 \\\n200,479.991668 200,395.996667 C200,312.001666 200,350.906061 200,303.990835 C200,220.008332 220.008332,200 \\\n304.003333,200 C387.998334,200 312.001666,200 395.996667,200 Z\"\n />\n <g id=\"vk_logo-${options.suffix}\">\n <path\n fill=\"${options.logoColor}\"\n d=\"M83.3334 363.333C83.3334 231.34 83.3334 165.343 124.338 124.338C165.343 83.3333 231.34 \\\n 83.3333 363.333 83.3333H386.667C518.66 83.3333 584.657 83.3333 625.662 124.338C666.667 165.343 \\\n 666.667 231.34 666.667 363.333V386.667C666.667 518.66 666.667 584.657 625.662 625.662C584.657 \\\n 666.667 518.66 666.667 386.667 666.667H363.333C231.34 666.667 165.343 666.667 124.338 625.662C83.3334 \\\n 584.657 83.3334 518.66 83.3334 386.667V363.333Z\"\n />\n <path\n fill=\"#FFF\"\n d=\"M394.907 508.681C263.293 508.681 183.442 417.365 180.313 265.625H246.972C249.05 377.09 \\\n 299.763 424.323 338.638 434.036V265.625H402.519V361.82C440.016 357.664 479.264 313.909 \\\n 492.456 265.625H555.333C545.27 325 502.543 368.754 472.353 386.803C502.566 401.395 551.177 \\\n 439.593 569.926 508.681H500.815C486.222 462.498 450.476 426.728 402.542 421.872V508.681H394.907Z\"\n />\n </g>\n <clipPath id=\"logo-mask-${options.suffix}\">\n <rect x=\"0\" y=\"0\" width=\"750\" height=\"750\" />\n </clipPath>\n </defs>\n\n ${qrBackground}\n\n <g transform=\"${qrTransform}\">\n ${parts.join('\\n')}\n </g>\n </svg>`;\n};\n","/*\n * QR Code generator library (TypeScript)\n *\n * Copyright (c) Project Nayuki. (MIT License)\n * https://www.nayuki.io/page/qr-code-generator-library\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n * - The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * - The Software is provided \"as is\", without warranty of any kind, express or\n * implied, including but not limited to the warranties of merchantability,\n * fitness for a particular purpose and noninfringement. In no event shall the\n * authors or copyright holders be liable for any claim, damages or other\n * liability, whether in an action of contract, tort or otherwise, arising from,\n * out of or in connection with the Software or the use or other dealings in the\n * Software.\n */\n\ntype bit = number;\ntype byte = number;\ntype int = number;\n\n/*---- QR Code symbol class ----*/\n\n/*\n * A QR Code symbol, which is a type of two-dimension barcode.\n * Invented by Denso Wave and described in the ISO/IEC 18004 standard.\n * Instances of this class represent an immutable square grid of black and white cells.\n * The class provides static factory functions to create a QR Code from text or binary data.\n * The class covers the QR Code Model 2 specification, supporting all versions (sizes)\n * from 1 to 40, all 4 error correction levels, and 4 character encoding modes.\n *\n * Ways to create a QR Code object:\n * - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary().\n * - Mid level: Custom-make the list of segments and call QrCode.encodeSegments().\n * - Low level: Custom-make the array of data codeword bytes (including\n * segment headers and final padding, excluding error correction codewords),\n * supply the appropriate version number, and call the QrCode() constructor.\n * (Note that all ways require supplying the desired error correction level.)\n */\nexport class QrCode {\n /*-- Static factory functions (high level) --*/\n\n // Returns a QR Code representing the given Unicode text string at the given error correction level.\n // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer\n // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible\n // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the\n // ecl argument if it can be done without increasing the version.\n public static encodeText(text: string, ecl: QrCodeEcc): QrCode {\n const segs: Array<QrSegment> = QrSegment.makeSegments(text);\n return QrCode.encodeSegments(segs, ecl);\n }\n\n // Returns a QR Code representing the given binary data at the given error correction level.\n // This function always encodes using the binary segment mode, not any text mode. The maximum number of\n // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.\n // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.\n public static encodeBinary(data: Array<byte>, ecl: QrCodeEcc): QrCode {\n const seg: QrSegment = QrSegment.makeBytes(data);\n return QrCode.encodeSegments([seg], ecl);\n }\n\n /*-- Static factory functions (mid level) --*/\n\n // Returns a QR Code representing the given segments with the given encoding parameters.\n // The smallest possible QR Code version within the given range is automatically\n // chosen for the output. Iff boostEcl is true, then the ECC level of the result\n // may be higher than the ecl argument if it can be done without increasing the\n // version. The mask number is either between 0 to 7 (inclusive) to force that\n // mask, or -1 to automatically choose an appropriate mask (which may be slow).\n // This function allows the user to create a custom sequence of segments that switches\n // between modes (such as alphanumeric and byte) to encode text in less space.\n // This is a mid-level API; the high-level API is encodeText() and encodeBinary().\n public static encodeSegments(\n segs: Array<QrSegment>,\n ecl: QrCodeEcc,\n minVersion: int = 1,\n maxVersion: int = 40,\n mask: int = -1,\n boostEcl: boolean = true,\n ): QrCode {\n if (\n !(\n QrCode.MIN_VERSION <= minVersion &&\n minVersion <= maxVersion &&\n maxVersion <= QrCode.MAX_VERSION\n ) ||\n mask < -1 ||\n mask > 7\n )\n throw 'Invalid value';\n\n // Find the minimal version number to use\n let version: int;\n let dataUsedBits: int;\n for (version = minVersion; ; version++) {\n const dataCapacityBits: int = QrCode.getNumDataCodewords(version, ecl) * 8; // Number of data bits available\n const usedBits: number = QrSegment.getTotalBits(segs, version);\n if (usedBits <= dataCapacityBits) {\n dataUsedBits = usedBits;\n break; // This version number is found to be suitable\n }\n if (version >= maxVersion)\n // All versions in the range could not fit the given data\n throw 'Data too long';\n }\n\n // Increase the error correction level while the data still fits in the current version number\n for (const newEcl of [QrCodeEcc.MEDIUM, QrCodeEcc.QUARTILE, QrCodeEcc.HIGH]) {\n // From low to high\n if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8) ecl = newEcl;\n }\n\n // Concatenate all segments to create the data bit string\n const bb = new BitBuffer();\n for (const seg of segs) {\n bb.appendBits(seg.mode.modeBits, 4);\n bb.appendBits(seg.numChars, seg.mode.numCharCountBits(version));\n for (const b of seg.getData()) bb.array.push(b);\n }\n if (bb.array.length !== dataUsedBits) throw 'Assertion error';\n\n // Add terminator and pad up to a byte if applicable\n const dataCapacityBits: int = QrCode.getNumDataCodewords(version, ecl) * 8;\n if (bb.array.length > dataCapacityBits) throw 'Assertion error';\n bb.appendBits(0, Math.min(4, dataCapacityBits - bb.array.length));\n bb.appendBits(0, (8 - (bb.array.length % 8)) % 8);\n if (bb.array.length % 8 !== 0) throw 'Assertion error';\n\n // Pad with alternating bytes until data capacity is reached\n for (let padByte = 0xec; bb.array.length < dataCapacityBits; padByte ^= 0xec ^ 0x11)\n bb.appendBits(padByte, 8);\n\n // Pack bits into bytes in big endian\n const dataCodewords: Array<byte> = [];\n while (dataCodewords.length * 8 < bb.array.length) dataCodewords.push(0);\n bb.array.forEach((b: bit, i: int) => {\n dataCodewords[i >>> 3] |= b << (7 - (i & 7));\n });\n\n // Create the QR Code object\n return new QrCode(version, ecl, dataCodewords, mask);\n }\n\n /*-- Fields --*/\n\n // The width and height of this QR Code, measured in modules, between\n // 21 and 177 (inclusive). This is equal to version * 4 + 17.\n public readonly size: int;\n\n // The modules of this QR Code (false = white, true = black).\n // Immutable after constructor finishes. Accessed through getModule().\n public readonly modules: Array<Array<boolean>> = [];\n\n // Indicates function modules that are not subjected to masking. Discarded when constructor finishes.\n private readonly isFunction: Array<Array<boolean>> = [];\n\n /*-- Constructor (low level) and fields --*/\n\n // The version number of this QR Code, which is between 1 and 40 (inclusive).\n // This determines the size of this barcode.\n public readonly version: int;\n\n // The error correction level used in this QR Code.\n public readonly errorCorrectionLevel: QrCodeEcc;\n\n // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).\n // Even if a QR Code is created with automatic masking requested (mask = -1),\n // the resulting object still has a mask value between 0 and 7.\n public readonly mask: int;\n\n // Creates a new QR Code with the given version number,\n // error correction level, data codeword bytes, and mask number.\n // This is a low-level API that most users should not use directly.\n // A mid-level API is the encodeSegments() function.\n public constructor(\n version: int,\n errorCorrectionLevel: QrCodeEcc,\n dataCodewords: Array<byte>,\n mask: int,\n ) {\n // Check scalar arguments\n if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)\n throw 'Version value out of range';\n if (mask < -1 || mask > 7) throw 'Mask value out of range';\n this.version = version;\n this.errorCorrectionLevel = errorCorrectionLevel;\n this.size = version * 4 + 17;\n\n // Initialize both grids to be size*size arrays of Boolean false\n const row: Array<boolean> = [];\n for (let i = 0; i < this.size; i++) row.push(false);\n for (let i = 0; i < this.size; i++) {\n this.modules.push(row.slice()); // Initially all white\n this.isFunction.push(row.slice());\n }\n\n // Compute ECC, draw modules\n this.drawFunctionPatterns();\n const allCodewords: Array<byte> = this.addEccAndInterleave(dataCodewords);\n this.drawCodewords(allCodewords);\n\n // Do masking\n if (mask === -1) {\n // Automatically choose best mask\n let minPenalty: int = 1000000000;\n for (let i = 0; i < 8; i++) {\n this.applyMask(i);\n this.drawFormatBits(i);\n const penalty: int = this.getPenaltyScore();\n if (penalty < minPenalty) {\n mask = i;\n minPenalty = penalty;\n }\n this.applyMask(i); // Undoes the mask due to XOR\n }\n }\n if (mask < 0 || mask > 7) throw 'Assertion error';\n this.mask = mask;\n this.applyMask(mask); // Apply the final choice of mask\n this.drawFormatBits(mask); // Overwrite old format bits\n\n this.isFunction = [];\n }\n\n /*-- Accessor methods --*/\n\n // Returns the color of the module (pixel) at the given coordinates, which is false\n // for white or true for black. The top left corner has the coordinates (x=0, y=0).\n // If the given coordinates are out of bounds, then false (white) is returned.\n public getModule(x: int, y: int): boolean {\n return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];\n }\n\n /*-- Public instance methods --*/\n\n // Returns a string of SVG code for an image depicting this QR Code, with the given number\n // of border modules. The string always uses Unix newlines (\\n), regardless of the platform.\n public toSvgString(border: int): string {\n if (border < 0) throw 'Border must be non-negative';\n const parts: Array<string> = [];\n for (let y = 0; y < this.size; y++) {\n for (let x = 0; x < this.size; x++) {\n if (this.getModule(x, y)) parts.push(`M${x + border},${y + border}h1v1h-1z`);\n }\n }\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 ${this.size + border * 2} ${\n this.size + border * 2\n }\" stroke=\"none\">\n\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\"/>\n\t<path d=\"${parts.join(' ')}\" fill=\"#000000\"/>\n</svg>\n`;\n }\n\n /*-- Private helper methods for constructor: Drawing function modules --*/\n\n // Reads this object's version field, and draws and marks all function modules.\n private drawFunctionPatterns(): void {\n // Draw horizontal and vertical timing patterns\n for (let i = 0; i < this.size; i++) {\n this.setFunctionModule(6, i, i % 2 === 0);\n this.setFunctionModule(i, 6, i % 2 === 0);\n }\n\n // Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)\n this.drawFinderPattern(3, 3);\n this.drawFinderPattern(this.size - 4, 3);\n this.drawFinderPattern(3, this.size - 4);\n\n // Draw numerous alignment patterns\n const alignPatPos: Array<int> = this.getAlignmentPatternPositions();\n const numAlign: int = alignPatPos.length;\n for (let i = 0; i < numAlign; i++) {\n for (let j = 0; j < numAlign; j++) {\n // Don't draw on the three finder corners\n if (\n !(\n (i === 0 && j === 0) ||\n (i === 0 && j === numAlign - 1) ||\n (i === numAlign - 1 && j === 0)\n )\n )\n this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);\n }\n }\n\n // Draw configuration data\n this.drawFormatBits(0); // Dummy mask value; overwritten later in the constructor\n this.drawVersion();\n }\n\n // Draws two copies of the format bits (with its own error correction code)\n // based on the given mask and this object's error correction level field.\n private drawFormatBits(mask: int): void {\n // Calculate error correction code and pack bits\n const data: int = (this.errorCorrectionLevel.formatBits << 3) | mask; // errCorrLvl is uint2, mask is uint3\n let rem: int = data;\n for (let i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n const bits = ((data << 10) | rem) ^ 0x5412; // uint15\n if (bits >>> 15 !== 0) throw 'Assertion error';\n\n // Draw first copy\n for (let i = 0; i <= 5; i++) this.setFunctionModule(8, i, getBit(bits, i));\n this.setFunctionModule(8, 7, getBit(bits, 6));\n this.setFunctionModule(8, 8, getBit(bits, 7));\n this.setFunctionModule(7, 8, getBit(bits, 8));\n for (let i = 9; i < 15; i++) this.setFunctionModule(14 - i, 8, getBit(bits, i));\n\n // Draw second copy\n for (let i = 0; i < 8; i++) this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));\n for (let i = 8; i < 15; i++) this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));\n this.setFunctionModule(8, this.size - 8, true); // Always black\n }\n\n // Draws two copies of the version bits (with its own error correction code),\n // based on this object's version field, iff 7 <= version <= 40.\n private drawVersion(): void {\n if (this.version < 7) return;\n\n // Calculate error correction code and pack bits\n let rem: int = this.version; // version is uint6, in the range [7, 40]\n for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n const bits: int = (this.version << 12) | rem; // uint18\n if (bits >>> 18 !== 0) throw 'Assertion error';\n\n // Draw two copies\n for (let i = 0; i < 18; i++) {\n const color: boolean = getBit(bits, i);\n const a: int = this.size - 11 + (i % 3);\n const b: int = Math.floor(i / 3);\n this.setFunctionModule(a, b, color);\n this.setFunctionModule(b, a, color);\n }\n }\n\n // Draws a 9*9 finder pattern including the border separator,\n // with the center module at (x, y). Modules can be out of bounds.\n private drawFinderPattern(x: int, y: int): void {\n for (let dy = -4; dy <= 4; dy++) {\n for (let dx = -4; dx <= 4; dx++) {\n const dist: int = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm\n const xx: int = x + dx;\n const yy: int = y + dy;\n if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)\n this.setFunctionModule(xx, yy, dist !== 2 && dist !== 4);\n }\n }\n }\n\n // Draws a 5*5 alignment pattern, with the center module\n // at (x, y). All modules must be in bounds.\n private drawAlignmentPattern(x: int, y: int): void {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++)\n this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }\n }\n\n // Sets the color of a module and marks it as a function module.\n // Only used by the constructor. Coordinates must be in bounds.\n private setFunctionModule(x: int, y: int, isBlack: boolean): void {\n this.modules[y][x] = isBlack;\n this.isFunction[y][x] = true;\n }\n\n /*-- Private helper methods for constructor: Codewords and masking --*/\n\n // Returns a new byte string representing the given data with the appropriate error correction\n // codewords appended to it, based on this object's version and error correction level.\n private addEccAndInterleave(data: Array<byte>): Array<byte> {\n const ver: int = this.version;\n const ecl: QrCodeEcc = this.errorCorrectionLevel;\n if (data.length !== QrCode.getNumDataCodewords(ver, ecl)) throw 'Invalid argument';\n\n // Calculate parameter numbers\n const numBlocks: int = QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];\n const blockEccLen: int = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];\n const rawCodewords: int = Math.floor(QrCode.getNumRawDataModules(ver) / 8);\n const numShortBlocks: int = numBlocks - (rawCodewords % numBlocks);\n const shortBlockLen: int = Math.floor(rawCodewords / numBlocks);\n\n // Split data into blocks and append ECC to each block\n const blocks: Array<Array<byte>> = [];\n const rs = new ReedSolomonGenerator(blockEccLen);\n for (let i = 0, k = 0; i < numBlocks; i++) {\n const dat: Array<byte> = data.slice(\n k,\n k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1),\n );\n k += dat.length;\n const ecc: Array<byte> = rs.getRemainder(dat);\n if (i < numShortBlocks) dat.push(0);\n blocks.push(dat.concat(ecc));\n }\n\n // Interleave (not concatenate) the bytes from every block into a single sequence\n const result: Array<byte> = [];\n for (let i = 0; i < blocks[0].length; i++) {\n for (let j = 0; j < blocks.length; j++) {\n // Skip the padding byte in short blocks\n if (i !== shortBlockLen - blockEccLen || j >= numShortBlocks) result.push(blocks[j][i]);\n }\n }\n if (result.length !== rawCodewords) throw 'Assertion error';\n return result;\n }\n\n // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire\n // data area of this QR Code. Function modules need to be marked off before this is called.\n private drawCodewords(data: Array<byte>): void {\n if (data.length !== Math.floor(QrCode.getNumRawDataModules(this.version) / 8))\n throw 'Invalid argument';\n let i: int = 0; // Bit index into the data\n // Do the funny zigzag scan\n for (let right = this.size - 1; right >= 1; right -= 2) {\n // Index of right column in each column pair\n if (right === 6) right = 5;\n for (let vert = 0; vert < this.size; vert++) {\n // Vertical counter\n for (let j = 0; j < 2; j++) {\n const x: int = right - j; // Actual x coordinate\n const upward: boolean = ((right + 1) & 2) === 0;\n const y: int = upward ? this.size - 1 - vert : vert; // Actual y coordinate\n if (!this.isFunction[y][x] && i < data.length * 8) {\n this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));\n i++;\n }\n // If this QR Code has any remainder bits (0 to 7), they were assigned as\n // 0/false/white by the constructor and are left unchanged by this method\n }\n }\n }\n if (i !== data.length * 8) throw 'Assertion error';\n }\n\n // XORs the codeword modules in this QR Code with the given mask pattern.\n // The function modules must be marked and the codeword bits must be drawn\n // before masking. Due to the arithmetic of XOR, calling applyMask() with\n // the same mask value a second time will undo the mask. A final well-formed\n // QR Code needs exactly one (not zero, two, etc.) mask applied.\n private applyMask(mask: int): void {\n if (mask < 0 || mask > 7) throw 'Mask value out of range';\n for (let y = 0; y < this.size; y++) {\n for (let x = 0; x < this.size; x++) {\n let invert: boolean;\n switch (mask) {\n case 0:\n invert = (x + y) % 2 === 0;\n break;\n case 1:\n invert = y % 2 === 0;\n break;\n case 2:\n invert = x % 3 === 0;\n break;\n case 3:\n invert = (x + y) % 3 === 0;\n break;\n case 4:\n invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n break;\n case 5:\n invert = ((x * y) % 2) + ((x * y) % 3) === 0;\n break;\n case 6:\n invert = (((x * y) % 2) + ((x * y) % 3)) % 2 === 0;\n break;\n case 7:\n invert = (((x + y) % 2) + ((x * y) % 3)) % 2 === 0;\n break;\n default:\n throw 'Assertion error';\n }\n if (!this.isFunction[y][x] && invert) this.modules[y][x] = !this.modules[y][x];\n }\n }\n }\n\n // Calculates and returns the penalty score based on state of this QR Code's current modules.\n // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.\n private getPenaltyScore(): int {\n let result: int = 0;\n\n // Adjacent modules in row having same color, and finder-like patterns\n for (let y = 0; y < this.size; y++) {\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n let color = false;\n let runX = 0;\n for (let x = 0; x < this.size; x++) {\n if (this.modules[y][x] === color) {\n runX++;\n if (runX === 5) result += QrCode.PENALTY_N1;\n else if (runX > 5) result++;\n } else {\n QrCode.addRunToHistory(runX, runHistory);\n if (!color && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3;\n color = this.modules[y][x];\n runX = 1;\n }\n }\n QrCode.addRunToHistory(runX, runHistory);\n if (color) QrCode.addRunToHistory(0, runHistory); // Dummy run of white\n if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3;\n }\n // Adjacent modules in column having same color, and finder-like patterns\n for (let x = 0; x < this.size; x++) {\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n let color = false;\n let runY = 0;\n for (let y = 0; y < this.size; y++) {\n if (this.modules[y][x] === color) {\n runY++;\n if (runY === 5) result += QrCode.PENALTY_N1;\n else if (runY > 5) result++;\n } else {\n QrCode.addRunToHistory(runY, runHistory);\n if (!color && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3;\n color = this.modules[y][x];\n runY = 1;\n }\n }\n QrCode.addRunToHistory(runY, runHistory);\n if (color) QrCode.addRunToHistory(0, runHistory); // Dummy run of white\n if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3;\n }\n\n // 2*2 blocks of modules having same color\n for (let y = 0; y < this.size - 1; y++) {\n for (let x = 0; x < this.size - 1; x++) {\n const color: boolean = this.modules[y][x];\n if (\n color === this.modules[y][x + 1] &&\n color === this.modules[y + 1][x] &&\n color === this.modules[y + 1][x + 1]\n )\n result += QrCode.PENALTY_N2;\n }\n }\n\n // Balance of black and white modules\n let black: int = 0;\n for (const row of this.modules) {\n for (const color of row) {\n if (color) black++;\n }\n }\n const total: int = this.size * this.size; // Note that size is odd, so black/total != 1/2\n // Compute the smallest integer k >= 0 such that (45-5k)% <= black/total <= (55+5k)%\n const k: int = Math.ceil(Math.abs(black * 20 - total * 10) / total) - 1;\n result += k * QrCode.PENALTY_N4;\n return result;\n }\n\n /*-- Private helper functions --*/\n\n // Returns an ascending list of positions of alignment patterns for this version number.\n // Each position is in the range [0,177), and are used on both the x and y axes.\n // This could be implemented as lookup table of 40 variable-length lists of integers.\n private getAlignmentPatternPositions(): Array<int> {\n if (this.version === 1) return [];\n else {\n const numAlign: int = Math.floor(this.version / 7) + 2;\n const step: int =\n this.version === 32 ? 26 : Math.ceil((this.size - 13) / (numAlign * 2 - 2)) * 2;\n const result: Array<int> = [6];\n for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);\n return result;\n }\n }\n\n // Returns the number of data bits that can be stored in a QR Code of the given version number, after\n // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.\n // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.\n private static getNumRawDataModules(ver: int): int {\n if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION) throw 'Version number out of range';\n let result: int = (16 * ver + 128) * ver + 64;\n if (ver >= 2) {\n const numAlign: int = Math.floor(ver / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (ver >= 7) result -= 36;\n }\n return result;\n }\n\n // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any\n // QR Code of the given version number and error correction level, with remainder bits discarded.\n // This stateless pure function could be implemented as a (40*4)-cell lookup table.\n private static getNumDataCodewords(ver: int, ecl: QrCodeEcc): int {\n return (\n Math.floor(QrCode.getNumRawDataModules(ver) / 8) -\n QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] *\n QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]\n );\n }\n\n // Inserts the given value to the front of the given array, which shifts over the\n // existing values and deletes the last value. A helper function for getPenaltyScore().\n private static addRunToHistory(run: int, history: Array<int>): void {\n history.pop();\n history.unshift(run);\n }\n\n // Tests whether the given run history has the pattern of ratio 1:1:3:1:1 in the middle, and\n // surrounded by at least 4 on either or both ends. A helper function for getPenaltyScore().\n // Must only be called immediately after a run of white modules has ended.\n private static hasFinderLikePattern(runHistory: Array<int>): boolean {\n const n: int = runHistory[1];\n return (\n n > 0 &&\n runHistory[2] === n &&\n runHistory[4] === n &&\n runHistory[5] === n &&\n runHistory[3] === n * 3 &&\n Math.max(runHistory[0], runHistory[6]) >= n * 4\n );\n }\n\n /*-- Constants and tables --*/\n\n // The minimum version number supported in the QR Code Model 2 standard.\n public static readonly MIN_VERSION: int = 1;\n // The maximum version number supported in the QR Code Model 2 standard.\n public static readonly MAX_VERSION: int = 40;\n\n // For use in getPenaltyScore(), when evaluating which mask is best.\n private static readonly PENALTY_N1: int = 3;\n private static readonly PENALTY_N2: int = 3;\n private static readonly PENALTY_N3: int = 40;\n private static readonly PENALTY_N4: int = 10;\n\n private static readonly ECC_CODEWORDS_PER_BLOCK: Array<Array<int>> = [\n /* eslint-disable */\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n // prettier-ignore\n [\n -1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30,\n 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n ], // Low\n // prettier-ignore\n [\n -1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28,\n 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n ], // Medium\n // prettier-ignore\n [\n -1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30,\n 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n ], // Quartile\n // prettier-ignore\n [\n -1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24,\n 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n ], // High\n /* eslint-enable */\n ];\n\n private static readonly NUM_ERROR_CORRECTION_BLOCKS: Array<Array<int>> = [\n /* eslint-disable */\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n // prettier-ignore\n [\n -1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13,\n 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25,\n ], // Low\n // prettier-ignore\n [\n -1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23,\n 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49,\n ], // Medium\n // prettier-ignore\n [\n -1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29,\n 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68,\n ], // Quartile\n // prettier-ignore\n [\n -1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35,\n 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81,\n ], // High\n /* eslint-enable */\n ];\n}\n\n// Returns true iff the i'th bit of x is set to 1.\nfunction getBit(x: int, i: int): boolean {\n return ((x >>> i) & 1) !== 0;\n}\n\n/*---- Data segment class ----*/\n\n/*\n * A segment of character/binary/control data in a QR Code symbol.\n * Instances of this class are immutable.\n * The mid-level way to create a segment is to take the payload data\n * and call a static factory function such as QrSegment.makeNumeric().\n * The low-level way to create a segment is to custom-make the bit buffer\n * and call the QrSegment() constructor with appropriate values.\n * This segment class imposes no length restrictions, but QR Codes have restrictions.\n * Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.\n * Any segment longer than this is meaningless for the purpose of generating QR Codes.\n */\nexport class QrSegment {\n /*-- Static factory functions (mid level) --*/\n\n // Returns a segment representing the given binary data encoded in\n // byte mode. All input byte arrays are acceptable. Any text string\n // can be converted to UTF-8 bytes and encoded as a byte mode segment.\n public static makeBytes(data: Array<byte>): QrSegment {\n const bb = new BitBuffer();\n for (const b of data) bb.appendBits(b, 8);\n return new QrSegment(QrSegmentMode.BYTE, data.length, bb.array);\n }\n\n // Returns a segment representing the given string of decimal digits encoded in numeric mode.\n public static makeNumeric(digits: string): QrSegment {\n if (!QrSegment.NUMERIC_REGEX.test(digits)) throw 'String contains non-numeric characters';\n const bb = new BitBuffer();\n for (let i = 0; i < digits.length; ) {\n // Consume up to 3 digits per iteration\n const n: int = Math.min(digits.length - i, 3);\n bb.appendBits(parseInt(digits.substr(i, n), 10), n * 3 + 1);\n i += n;\n }\n return new QrSegment(QrSegmentMode.NUMERIC, digits.length, bb.array);\n }\n\n // Returns a segment representing the given text string encoded in alphanumeric mode.\n // The characters allowed are: 0 to 9, A to Z (uppercase only), space,\n // dollar, percent, asterisk, plus, hyphen, period, slash, colon.\n public static makeAlphanumeric(text: string): QrSegment {\n if (!QrSegment.ALPHANUMERIC_REGEX.test(text))\n throw 'String contains unencodable characters in alphanumeric mode';\n const bb = new BitBuffer();\n let i: int;\n for (i = 0; i + 2 <= text.length; i += 2) {\n // Process groups of 2\n let temp: int = QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;\n temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));\n bb.appendBits(temp, 11);\n }\n if (i < text.length)\n // 1 character remaining\n bb.appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6);\n return new QrSegment(QrSegmentMode.ALPHANUMERIC, text.length, bb.array);\n }\n\n // Returns a new mutable list of zero or more segments to represent the given Unicode text string.\n // The result may use various segment modes and switch modes to optimize the length of the bit stream.\n public static makeSegments(text: string): Array<QrSegment> {\n // Select the most efficient segment encoding automatically\n if (text === '') return [];\n else if (QrSegment.NUMERIC_REGEX.test(text)) return [QrSegment.makeNumeric(text)];\n else if (QrSegment.ALPHANUMERIC_REGEX.test(text)) return [QrSegment.makeAlphanumeric(text)];\n else return [QrSegment.makeBytes(QrSegment.toUtf8ByteArray(text))];\n }\n\n // Returns a segment representing an Extended Channel Interpretation\n // (ECI) designator with the given assignment value.\n public static makeEci(assignVal: int): QrSegment {\n const bb = new BitBuffer();\n if (assignVal < 0) throw 'ECI assignment value out of range';\n else if (assignVal < 1 << 7) bb.appendBits(assignVal, 8);\n else if (assignVal < 1 << 14) {\n bb.appendBits(2, 2);\n bb.appendBits(assignVal, 14);\n } else if (assignVal < 1000000) {\n bb.appendBits(6, 3);\n bb.appendBits(assignVal, 21);\n } else throw 'ECI assignment value out of range';\n return new QrSegment(QrSegmentMode.ECI, 0, bb.array);\n }\n\n /*-- Constructor (low level) and fields --*/\n\n // The mode indicator of this segment.\n public readonly mode: QrSegmentMode;\n\n // The length of this segment's unencoded data. Measured in characters for\n // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.\n // Always zero or positive. Not the same as the data's bit length.\n public readonly numChars: int;\n\n // The data bits of this segment. Accessed through getData().\n private readonly bitData: Array<bit>;\n\n // Creates a new QR Code segment with the given attributes and data.\n // The character count (numChars) must agree with the mode and the bit buffer length,\n // but the constraint isn't checked. The given bit buffer is cloned and stored.\n public constructor(mode: QrSegmentMode, numChars: int, bitData: Array<bit>) {\n if (numChars < 0) throw 'Invalid argument';\n this.mode = mode;\n this.numChars = numChars;\n this.bitData = bitData.slice(); // Make defensive copy\n }\n\n /*-- Methods --*/\n\n // Returns a new copy of the data bits of this segment.\n public getData(): Array<bit> {\n return this.bitData.slice(); // Make defensive copy\n }\n\n // (Package-private) Calculates and returns the number of bits needed to encode the given segments at\n // the given version. The result is infinity if a segment has too many characters to fit its length field.\n public static getTotalBits(segs: Array<QrSegment>, version: int): number {\n let result: number = 0;\n for (const seg of segs) {\n const ccbits: int = seg.mode.numCharCountBits(version);\n if (seg.numChars >= 1 << ccbits) return Infinity; // The segment's length doesn't fit the field's bit width\n result += 4 + ccbits + seg.bitData.length;\n }\n return result;\n }\n\n // Returns a new array of bytes representing the given string encoded in UTF-8.\n private static toUtf8ByteArray(str: string): Array<byte> {\n str = encodeURI(str);\n const result: Array<byte> = [];\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) !== '%') result.push(str.charCodeAt(i));\n else {\n result.push(parseInt(str.substr(i + 1, 2), 16));\n i += 2;\n }\n }\n return result;\n }\n\n /*-- Constants --*/\n\n // Describes precisely all strings that are encodable in numeric mode. To test\n // whether a string s is encodable: let ok: boolean = NUMERIC_REGEX.test(s);\n // A string is encodable iff each character is in the range 0 to 9.\n public static readonly NUMERIC_REGEX: RegExp = /^[0-9]*$/;\n\n // Describes precisely all strings that are encodable in alphanumeric mode. To test\n // whether a string s is encodable: let ok: boolean = ALPHANUMERIC_REGEX.test(s);\n // A string is encodable iff each character is in the following set: 0 to 9, A to Z\n // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.\n public static readonly ALPHANUMERIC_REGEX: RegExp = /^[A-Z0-9 $%*+./:-]*$/;\n\n // The set of all legal characters in alphanumeric mode,\n // where each character value maps to the index in the string.\n private static readonly ALPHANUMERIC_CHARSET: string =\n '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';\n}\n\n/*---- Private helper classes ----*/\n\n/*\n * Computes the Reed-Solomon error correction codewords for a sequence of data codewords\n * at a given degree. Objects are immutable, and the state only depends on the degree.\n * This class exists because each data block in a QR Code shares the same the divisor polynomial.\n */\nclass ReedSolomonGenerator {\n // Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which\n // is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.\n private readonly coefficients: Array<byte> = [];\n\n // Creates a Reed-Solomon ECC generator for the given degree. This could be implemented\n // as a lookup table over all possible parameter values, instead of as an algorithm.\n public constructor(degree: int) {\n if (degree < 1 || degree > 255) throw 'Degree out of range';\n const coefs = this.coefficients;\n\n // Start with the monomial x^0\n for (let i = 0; i < degree - 1; i++) coefs.push(0);\n coefs.push(1);\n\n // Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),\n // drop the highest term, and store the rest of the coefficients in order of descending powers.\n // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).\n let root = 1;\n for (let i = 0; i < degree; i++) {\n // Multiply the current product by (x - r^i)\n for (let j = 0; j < coefs.length; j++) {\n coefs[j] = ReedSolomonGenerator.multiply(coefs[j], root);\n if (j + 1 < coefs.length) coefs[j] ^= coefs[j + 1];\n }\n root = ReedSolomonGenerator.multiply(root, 0x02);\n }\n }\n\n // Computes and returns the Reed-Solomon error correction codewords for the given\n // sequence of data codewords. The returned object is always a new byte array.\n // This method does not alter this object's state (because it is immutable).\n public getRemainder(data: Array<byte>): Array<byte> {\n // Compute the remainder by performing polynomial division\n const result: Array<byte> = this.coefficients.map((_) => 0);\n for (const b of data) {\n const factor: byte = b ^ (result.shift() as byte);\n result.push(0);\n this.coefficients.forEach((coef, i) => {\n result[i] ^= ReedSolomonGenerator.multiply(coef, factor);\n });\n }\n return result;\n }\n\n // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result\n // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.\n private static multiply(x: byte, y: byte): byte {\n if (x >>> 8 !== 0 || y >>> 8 !== 0) throw 'Byte out of range';\n // Russian peasant multiplication\n let z: int = 0;\n for (let i = 7; i >= 0; i--) {\n z = (z << 1) ^ ((z >>> 7) * 0x11d);\n z ^= ((y >>> i) & 1) * x;\n }\n if (z >>> 8 !== 0) throw 'Assertion error';\n return z as byte;\n }\n}\n\n/*\n * An appendable sequence of bits (0s and 1s). Mainly used by QrSegment.\n * The implicit constructor creates an empty bit buffer (length 0).\n */\nclass BitBuffer {\n public array: Array<bit> = [];\n\n // Appends the given number of low-order bits of the given value\n // to this buffer. Requires 0 <= len <= 31 and 0 <= val < 2^len.\n public appendBits(val: int, len: int): void {\n if (len < 0 || len > 31 || val >>> len !== 0) throw 'Value out of range';\n for (\n let i = len - 1;\n i >= 0;\n i-- // Append bit by bit\n )\n this.array.push((val >>> i) & 1);\n }\n}\n\n/*---- Public helper enumeration ----*/\n\n/*\n * The error correction level in a QR Code symbol. Immutable.\n */\nexport class QrCodeEcc {\n /*-- Constants --*/\n\n public static readonly LOW = new QrCodeEcc(0, 1); // The QR Code can tolerate about 7% erroneous codewords\n public static readonly MEDIUM = new QrCodeEcc(1, 0); // The QR Code can tolerate about 15% erroneous codewords\n public static readonly QUARTILE = new QrCodeEcc(2, 3); // The QR Code can tolerate about 25% erroneous codewords\n public static readonly HIGH = new QrCodeEcc(3, 2); // The QR Code can tolerate about 30% erroneous codewords\n\n /*-- Constructor and fields --*/\n\n // In the range 0 to 3 (unsigned 2-bit integer).\n public readonly ordinal: int;\n // (Package-private) In the range 0 to 3 (unsigned 2-bit integer).\n public readonly formatBits: int;\n\n private constructor(ordinal: int, formatBits: int) {\n this.ordinal = ordinal;\n this.formatBits = formatBits;\n }\n}\n\n/*---- Public helper enumeration ----*/\n\n/*\n * Describes how a segment's data bits are interpreted. Immutable.\n */\nexport class QrSegmentMode {\n /*-- Constants --*/\n\n public static readonly NUMERIC = new QrSegmentMode(0x1, [10, 12, 14]);\n public static readonly ALPHANUMERIC = new QrSegmentMode(0x2, [9, 11, 13]);\n public static readonly BYTE = new QrSegmentMode(0x4, [8, 16, 16]);\n public static readonly KANJI = new QrSegmentMode(0x8, [8, 10, 12]);\n public static readonly ECI = new QrSegmentMode(0x7, [0, 0, 0]);\n\n /*-- Constructor and fields --*/\n\n // The mode indicator bits, which is a uint4 value (range 0 to 15).\n public readonly modeBits: int;\n // Number of character count bits for three different version ranges.\n private readonly numBitsCharCount: [int, int, int];\n\n private constructor(modeBits: int, numBitsCharCount: [int, int, int]) {\n this.modeBits = modeBits;\n this.numBitsCharCount = numBitsCharCount;\n }\n\n /*-- Method --*/\n\n // (Package-private) Returns the bit width of the character count field for a segment in\n // this mode in a QR Code at the given version number. The result is in the range [0, 16].\n public numCharCountBits(ver: int): int {\n return this.numBitsCharCount[Math.floor((ver + 7) / 17)];\n }\n}\n","import { convertSegmentsToSvgString, INC_TILE_SIZE } from './svg.ts';\nimport { QrSegment, QrCode, QrCodeEcc } from './qr.ts';\nimport type { QrOptions, RequiredQrOptions } from './types.ts';\n\n/** Default width and height of QR code */\nconst DEFAULT_SIZE = 128;\n\n/** Default background color of QR code*/\nconst BACKGROUND_COLOR_DEFAULT = '#ffffff';\n\n/** Default foreground color */\nconst FOREGROUND_COLOR_DEFAULT = '#000000';\n\n/** Default logo color */\nconst LOGO_COLOR_DEFAULT = '#07f';\n\n/**\n * Generates SVG QR code by a text\n * @param text String to encode\n * @param options QR code options\n */\nexport function createQR(text: string, options?: QrOptions): string;\n\n/**\n * Legacy interface\n * @deprecated\n * @param text String to encode\n * @param qrSize Size of QR code\n * @param className SVG element class name\n * @param options Options of the QR code\n */\nexport function createQR(\n text: string,\n qrSize: number,\n className: string,\n options?: QrOptions,\n): string;\n\n/**\n * Implementation\n */\nexport function createQR(\n text: string,\n qrSizeOrOptions?: number | QrOptions,\n classNameLegacy?: string,\n legacyOptions?: QrOptions,\n): string {\n if (typeof text !== 'string') {\n throw new TypeError('Enter text for encoding');\n }\n\n // Legacy interface resolve\n const options: QrOptions = {\n ...(typeof qrSizeOrOptions === 'object' && qrSizeOrOptions !== null ? qrSizeOrOptions : {}),\n ...(typeof legacyOptions === 'object' && legacyOptions !== null ? legacyOptions : {}),\n qrSize:\n typeof qrSizeOrOptions === 'object' &&\n qrSizeOrOptions !== null &&\n typeof qrSizeOrOptions.qrSize === 'number'\n ? qrSizeOrOptions.qrSize\n : (qrSizeOrOptions as number),\n className:\n typeof qrSizeOrOptions === 'object' &&\n qrSizeOrOptions !== null &&\n typeof qrSizeOrOptions.className === 'string'\n ? qrSizeOrOptions.className\n : classNameLegacy,\n };\n\n // ECC levels mapping\n const eccLevels = [QrCodeEcc.LOW, QrCodeEcc.MEDIUM, QrCodeEcc.QUARTILE, QrCodeEcc.HIGH];\n\n // Fallback undefined options\n const fallbackOptions: RequiredQrOptions = {\n qrSize: typeof options.qrSize === 'number' ? options.qrSize : DEFAULT_SIZE,\n className: typeof options.className === 'string' ? options.className : classNameLegacy || '',\n isShowLogo: !!options.isShowLogo || false,\n isShowBackground: !!options.isShowBackground || false,\n foregroundColor:\n typeof options.foregroundColor === 'string'\n ? options.foregroundColor\n : FOREGROUND_COLOR_DEFAULT,\n backgroundColor:\n typeof options.backgroundColor === 'string'\n ? options.backgroundColor\n : BACKGROUND_COLOR_DEFAULT,\n logoColor: typeof options.logoColor === 'string' ? options.logoColor : LOGO_COLOR_DEFAULT,\n suffix: options.suffix ? options.suffix.toString() : '0',\n logoData: typeof options.logoData === 'string' ? options.logoData : null,\n ecc: typeof options.ecc === 'number' && eccLevels[options.ecc] ? options.ecc : 3,\n incTileSize: typeof options.incTileSize === 'number' ? options.incTileSize : INC_TILE_SIZE,\n };\n\n // Code generation\n const segments: QrSegment[] = QrSegment.makeSegments(text);\n const qrCode: QrCode = QrCode.encodeSegments(\n segments,\n eccLevels[fallbackOptions.ecc],\n 1,\n 40,\n -1,\n true,\n );\n const svgCode = convertSegmentsToSvgString(qrCode, fallbackOptions);\n\n return svgCode;\n}\n"],"names":["MULTI","QR_BORDER","TILE_SIZE","SMALL_QR_SIZE","getPixel","x","y","size","modules","isLogoShowed","imageTiles","paddingTiles","getNeighbors","convertSegmentsToSvgString","qrCode","options","Error","_2","_12_7","_12_8","_14_7","_14_8","_15_9","_28_6","_30_5","_84_7","_87_3","_71_4","_42_9","_87_2","_85_2","_85_3","_69_5","_98","_100","parts","leftPadding","topPadding","xCoord","yCoord","neighbors","path","selector","scale","position","pointPosition","backgroundSize","qrBackground","qrTransform","qrScale","padding","radius","Math","oneSide","twoSides","QrCode","text","ecl","segs","QrSegment","data","seg","minVersion","maxVersion","mask","boostEcl","version","dataUsedBits","dataCapacityBits","usedBits","newEcl","QrCodeEcc","bb","BitBuffer","b","padByte","dataCodewords","i","border","alignPatPos","numAlign","j","rem","bits","getBit","color","a","dy","dx","dist","xx","yy","isBlack","ver","numBlocks","blockEccLen","rawCodewords","numShortBlocks","shortBlockLen","blocks","rs","ReedSolomonGenerator","k","dat","ecc","result","right","vert","upward","invert","runHistory","runX","runY","black","row","total","step","pos","run","history","n","errorCorrectionLevel","allCodewords","minPenalty","penalty","QrSegmentMode","digits","parseInt","temp","assignVal","ccbits","Infinity","str","encodeURI","mode","numChars","bitData","_","factor","coef","z","degree","coefs","root","val","len","ordinal","formatBits","modeBits","numBitsCharCount","DEFAULT_SIZE","BACKGROUND_COLOR_DEFAULT","FOREGROUND_COLOR_DEFAULT","LOGO_COLOR_DEFAULT","createQR","qrSizeOrOptions","classNameLegacy","legacyOptions","TypeError","eccLevels","fallbackOptions","INC_TILE_SIZE","segments","svgCode"],"mappings":";AAGA,MAAMA,QAAQ;AACd,MAAMC,YAAY;AAClB,MAAMC,YAAY,KAAKF;AAEvB,MAAMG,gBAAgB;AAOtB,MAAMC,WAAW,CACfC,GACAC,GACAC,MACAC,SACAC;IAEA,IAAIJ,IAAIJ,aAAaK,IAAIL,WACvB,OAAO;IAGT,IAAII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,IACA,IACA;IAEF,MAAMG,UAAUtJ,2BAA2BC,QAAQkJ;IAEnD,OAAOG;AACT"}
@@ -1,87 +1,79 @@
1
- declare type bit = number;
2
- declare type byte = number;
3
- declare type int = number;
4
- export declare class QrCode {
5
- readonly version: int;
6
- readonly errorCorrectionLevel: QrCode.Ecc;
7
- readonly mask: int;
8
- static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
9
- static encodeBinary(data: Array<byte>, ecl: QrCode.Ecc): QrCode;
10
- static encodeSegments(segs: Array<QrSegment>, ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
11
- readonly size: int;
12
- readonly modules: Array<Array<boolean>>;
13
- private readonly isFunction;
14
- constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: Array<byte>, mask: int);
15
- getModule(x: int, y: int): boolean;
16
- drawCanvas(scale: int, border: int, canvas: HTMLCanvasElement): void;
17
- toSvgString(border: int): string;
18
- private drawFunctionPatterns;
19
- private drawFormatBits;
20
- private drawVersion;
21
- private drawFinderPattern;
22
- private drawAlignmentPattern;
23
- private setFunctionModule;
24
- private addEccAndInterleave;
25
- private drawCodewords;
26
- private applyMask;
27
- private getPenaltyScore;
28
- private getAlignmentPatternPositions;
29
- private static getNumRawDataModules;
30
- private static getNumDataCodewords;
31
- private static addRunToHistory;
32
- private static hasFinderLikePattern;
33
- static readonly MIN_VERSION: int;
34
- static readonly MAX_VERSION: int;
35
- private static readonly PENALTY_N1;
36
- private static readonly PENALTY_N2;
37
- private static readonly PENALTY_N3;
38
- private static readonly PENALTY_N4;
39
- private static readonly ECC_CODEWORDS_PER_BLOCK;
40
- private static readonly NUM_ERROR_CORRECTION_BLOCKS;
41
- }
42
- export declare class QrSegment {
43
- readonly mode: QrSegment.Mode;
44
- readonly numChars: int;
45
- private readonly bitData;
46
- static makeBytes(data: Array<byte>): QrSegment;
47
- static makeNumeric(digits: string): QrSegment;
48
- static makeAlphanumeric(text: string): QrSegment;
49
- static makeSegments(text: string): Array<QrSegment>;
50
- static makeEci(assignVal: int): QrSegment;
51
- constructor(mode: QrSegment.Mode, numChars: int, bitData: Array<bit>);
52
- getData(): Array<bit>;
53
- static getTotalBits(segs: Array<QrSegment>, version: int): number;
54
- private static toUtf8ByteArray;
55
- static readonly NUMERIC_REGEX: RegExp;
56
- static readonly ALPHANUMERIC_REGEX: RegExp;
57
- private static readonly ALPHANUMERIC_CHARSET;
58
- }
59
- export declare namespace QrCode {
60
- type int = number;
61
- export class Ecc {
62
- readonly ordinal: int;
63
- readonly formatBits: int;
64
- static readonly LOW: Ecc;
65
- static readonly MEDIUM: Ecc;
66
- static readonly QUARTILE: Ecc;
67
- static readonly HIGH: Ecc;
68
- private constructor();
69
- }
70
- export {};
71
- }
72
- export declare namespace QrSegment {
73
- type int = number;
74
- export class Mode {
75
- readonly modeBits: int;
76
- private readonly numBitsCharCount;
77
- static readonly NUMERIC: Mode;
78
- static readonly ALPHANUMERIC: Mode;
79
- static readonly BYTE: Mode;
80
- static readonly KANJI: Mode;
81
- static readonly ECI: Mode;
82
- private constructor();
83
- numCharCountBits(ver: int): int;
84
- }
85
- export {};
86
- }
87
- export {};
1
+ type bit = number;
2
+ type byte = number;
3
+ type int = number;
4
+ export declare class QrCode {
5
+ static encodeText(text: string, ecl: QrCodeEcc): QrCode;
6
+ static encodeBinary(data: Array<byte>, ecl: QrCodeEcc): QrCode;
7
+ static encodeSegments(segs: Array<QrSegment>, ecl: QrCodeEcc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
8
+ readonly size: int;
9
+ readonly modules: Array<Array<boolean>>;
10
+ private readonly isFunction;
11
+ readonly version: int;
12
+ readonly errorCorrectionLevel: QrCodeEcc;
13
+ readonly mask: int;
14
+ constructor(version: int, errorCorrectionLevel: QrCodeEcc, dataCodewords: Array<byte>, mask: int);
15
+ getModule(x: int, y: int): boolean;
16
+ toSvgString(border: int): string;
17
+ private drawFunctionPatterns;
18
+ private drawFormatBits;
19
+ private drawVersion;
20
+ private drawFinderPattern;
21
+ private drawAlignmentPattern;
22
+ private setFunctionModule;
23
+ private addEccAndInterleave;
24
+ private drawCodewords;
25
+ private applyMask;
26
+ private getPenaltyScore;
27
+ private getAlignmentPatternPositions;
28
+ private static getNumRawDataModules;
29
+ private static getNumDataCodewords;
30
+ private static addRunToHistory;
31
+ private static hasFinderLikePattern;
32
+ static readonly MIN_VERSION: int;
33
+ static readonly MAX_VERSION: int;
34
+ private static readonly PENALTY_N1;
35
+ private static readonly PENALTY_N2;
36
+ private static readonly PENALTY_N3;
37
+ private static readonly PENALTY_N4;
38
+ private static readonly ECC_CODEWORDS_PER_BLOCK;
39
+ private static readonly NUM_ERROR_CORRECTION_BLOCKS;
40
+ }
41
+ export declare class QrSegment {
42
+ static makeBytes(data: Array<byte>): QrSegment;
43
+ static makeNumeric(digits: string): QrSegment;
44
+ static makeAlphanumeric(text: string): QrSegment;
45
+ static makeSegments(text: string): Array<QrSegment>;
46
+ static makeEci(assignVal: int): QrSegment;
47
+ readonly mode: QrSegmentMode;
48
+ readonly numChars: int;
49
+ private readonly bitData;
50
+ constructor(mode: QrSegmentMode, numChars: int, bitData: Array<bit>);
51
+ getData(): Array<bit>;
52
+ static getTotalBits(segs: Array<QrSegment>, version: int): number;
53
+ private static toUtf8ByteArray;
54
+ static readonly NUMERIC_REGEX: RegExp;
55
+ static readonly ALPHANUMERIC_REGEX: RegExp;
56
+ private static readonly ALPHANUMERIC_CHARSET;
57
+ }
58
+ export declare class QrCodeEcc {
59
+ static readonly LOW: QrCodeEcc;
60
+ static readonly MEDIUM: QrCodeEcc;
61
+ static readonly QUARTILE: QrCodeEcc;
62
+ static readonly HIGH: QrCodeEcc;
63
+ readonly ordinal: int;
64
+ readonly formatBits: int;
65
+ private constructor();
66
+ }
67
+ export declare class QrSegmentMode {
68
+ static readonly NUMERIC: QrSegmentMode;
69
+ static readonly ALPHANUMERIC: QrSegmentMode;
70
+ static readonly BYTE: QrSegmentMode;
71
+ static readonly KANJI: QrSegmentMode;
72
+ static readonly ECI: QrSegmentMode;
73
+ readonly modeBits: int;
74
+ private readonly numBitsCharCount;
75
+ private constructor();
76
+ numCharCountBits(ver: int): int;
77
+ }
78
+ export {};
79
+ //# sourceMappingURL=qr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../src/qr.ts"],"names":[],"mappings":"AAuBA,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAoBlB,qBAAa,MAAM;WAQH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM;WAShD,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM;WAgBvD,cAAc,CAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,EACtB,GAAG,EAAE,SAAS,EACd,UAAU,GAAE,GAAO,EACnB,UAAU,GAAE,GAAQ,EACpB,IAAI,GAAE,GAAQ,EACd,QAAQ,GAAE,OAAc,GACvB,MAAM;IAoET,SAAgB,IAAI,EAAE,GAAG,CAAC;IAI1B,SAAgB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAM;IAGpD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAMxD,SAAgB,OAAO,EAAE,GAAG,CAAC;IAG7B,SAAgB,oBAAoB,EAAE,SAAS,CAAC;IAKhD,SAAgB,IAAI,EAAE,GAAG,CAAC;gBAOxB,OAAO,EAAE,GAAG,EACZ,oBAAoB,EAAE,SAAS,EAC/B,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,EAC1B,IAAI,EAAE,GAAG;IAmDJ,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO;IAQlC,WAAW,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ode instance to SVG code
6
+ * @param qrCode QrCode instance
7
+ * @param options Convertation options
8
+ */
9
+ export declare const convertSegmentsToSvgString: (qrCode: QrCode, options: RequiredQrOptions) => string;
10
+ //# sourceMappingURL=svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKpD,eAAO,MAAM,aAAa,QAAa,CAAC;AAmExC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,EAAE,SAAS,iBAAiB,KAAG,MA8PvF,CAAC"}
@@ -0,0 +1,57 @@
1
+ export type QrOptions = {
2
+ /**
3
+ * Size of QR code
4
+ * @default 128
5
+ */
6
+ qrSize?: number | undefined;
7
+ /**
8
+ * Class name of root SVG element
9
+ */
10
+ className?: string | undefined;
11
+ /**
12
+ * Show VK logo in center of QR code
13
+ * @default false
14
+ */
15
+ isShowLogo?: boolean | undefined;
16
+ /**
17
+ * Show QR background
18
+ * @default false
19
+ */
20
+ isShowBackground?: boolean | undefined;
21
+ /**
22
+ * QR code background HEX color. Works if `isShowBackground` is enabled.
23
+ * @default "#ffffff"
24
+ */
25
+ backgroundColor?: string | undefined;
26
+ /**
27
+ * QR code HEX color
28
+ */
29
+ foregroundColor?: string | undefined;
30
+ /**
31
+ * Color of logo
32
+ * @default "#000000"
33
+ */
34
+ logoColor?: string | undefined;
35
+ /**
36
+ * Reference to logo as a reference IRI
37
+ */
38
+ logoData?: string | null | undefined;
39
+ /**
40
+ * SVG elements id postfix
41
+ */
42
+ suffix?: string | undefined;
43
+ /**
44
+ * ECC Level
45
+ */
46
+ ecc?: number | undefined;
47
+ /**
48
+ * Custom INC_TILE_SIZE
49
+ */
50
+ incTileSize?: number | undefined;
51
+ };
52
+ type NotUndefined<T> = {
53
+ [k in keyof T]-?: Exclude<T[k], undefined>;
54
+ };
55
+ export type RequiredQrOptions = NotUndefined<QrOptions>;
56
+ export {};
57
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;CAAE,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,79 +1,57 @@
1
1
  {
2
- "name": "@vkontakte/vk-qr",
3
- "version": "2.0.13",
4
- "description": "QR Code generator",
5
- "main": "dist/cjs/index.js",
6
- "browser": "dist/umd/qrCodeGenerator.js",
7
- "module": "dist/es/index.js",
8
- "jsxnext:main": "dist/es/index.js",
9
- "umdName": "qrCodeGenerator",
10
- "types": "dist/types/index.d.ts",
11
- "files": [
12
- "dist",
13
- "src"
14
- ],
15
- "scripts": {
16
- "test": "jest",
17
- "watch": "rollup -c -w",
18
- "build": "rimraf dist && NODE_ENV=production rollup -c",
19
- "build:types": "rimraf dist/types && tsc src/index.ts",
20
- "lint": "eslint src/*.ts",
21
- "size": "size-limit",
22
- "prepublish": "yarn build"
23
- },
24
- "keywords": [],
25
- "author": "VK.com",
26
- "license": "MIT",
27
- "repository": "VKCOM/vk-qr",
28
- "jest": {
29
- "testMatch": [
30
- "<rootDir>/tests/**/*.js"
31
- ]
32
- },
33
- "devDependencies": {
34
- "@babel/cli": "^7.5.0",
35
- "@babel/core": "^7.5.4",
36
- "@babel/preset-env": "^7.5.5",
37
- "@babel/preset-typescript": "^7.3.3",
38
- "@size-limit/preset-small-lib": "^4.12.0",
39
- "@types/jest": "^24.0.15",
40
- "@types/prettier": "^1.16.4",
41
- "@typescript-eslint/eslint-plugin": "^2.0.0",
42
- "@typescript-eslint/parser": "^2.0.0",
43
- "babel-plugin-add-module-exports": "^0.2.1",
44
- "convert-svg-to-png": "^0.5.0",
45
- "cross-env": "^5.2.0",
46
- "eslint": "^6.0.1",
47
- "eslint-plugin-babel": "^4.1.2",
48
- "eslint-plugin-import": "^2.18.0",
49
- "eslint-plugin-prettier": "^3.1.0",
50
- "fast-xml-parser": "^3.12.17",
51
- "jest": "^24.9.0",
52
- "jest-image-snapshot": "^2.9.0",
53
- "js-beautify": "^1.10.0",
54
- "prettier": "^1.18.2",
55
- "rimraf": "^2.6.1",
56
- "rollup": "^1.16.7",
57
- "rollup-plugin-babel": "^4.3.3",
58
- "rollup-plugin-bundle-size": "^1.0.3",
59
- "rollup-plugin-commonjs": "^10.0.1",
60
- "rollup-plugin-node-resolve": "^5.2.0",
61
- "rollup-plugin-typescript2": "^0.22.0",
62
- "rollup-plugin-uglify": "^6.0.2",
63
- "size-limit": "^4.12.0",
64
- "ts-node": "^8.3.0",
65
- "typescript": "^3.5.3",
66
- "xml-js": "^1.6.11"
67
- },
68
- "size-limit": [
69
- {
70
- "path": "dist/cjs/index.js"
71
- },
72
- {
73
- "path": "dist/es/index.js"
74
- },
75
- {
76
- "path": "dist/umd/qrCodeGenerator.js"
77
- }
78
- ]
2
+ "name": "@vkontakte/vk-qr",
3
+ "version": "3.0.0",
4
+ "description": "QR Code generator",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "main": "dist/index.js",
15
+ "module": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "files": [
18
+ "dist",
19
+ "src"
20
+ ],
21
+ "scripts": {
22
+ "test": "node --test tests/**/*.test.ts",
23
+ "test:update": "UPDATE_SNAPSHOTS=1 node --import tsx --test tests/**/*.test.ts",
24
+ "watch": "rslib --watch",
25
+ "build": "rslib",
26
+ "lint": "yarn lint:biome && yarn lint:types",
27
+ "size": "size-limit",
28
+ "lint:biome": "biome check",
29
+ "lint:biome:fix": "biome check --write",
30
+ "lint:types": "tsc -b",
31
+ "prepack": "yarn build"
32
+ },
33
+ "keywords": [],
34
+ "author": "vk.ru",
35
+ "license": "MIT",
36
+ "repository": "VKCOM/vk-qr",
37
+ "dependencies": {
38
+ "@swc/helpers": "^0.5.21"
39
+ },
40
+ "devDependencies": {
41
+ "@biomejs/biome": "^2.4.12",
42
+ "@rslib/core": "^0.21.2",
43
+ "@size-limit/preset-small-lib": "^12.1.0",
44
+ "@types/node": "^25.6.0",
45
+ "size-limit": "^12.1.0",
46
+ "typescript": "^6.0.3"
47
+ },
48
+ "size-limit": [
49
+ {
50
+ "path": "dist/index.js"
51
+ }
52
+ ],
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
79
57
  }