UNPKG

next

Version:

The React Framework

1 lines • 297 kB
module.exports = "\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/primitives/crypto.js\nvar crypto_exports = {};\n__export(crypto_exports, {\n Crypto: () => Crypto2,\n CryptoKey: () => CryptoKey,\n SubtleCrypto: () => SubtleCrypto3,\n crypto: () => crypto2\n});\nmodule.exports = __toCommonJS(crypto_exports);\n\n// ../../node_modules/.pnpm/pvtsutils@1.3.2/node_modules/pvtsutils/build/index.es.js\nvar ARRAY_BUFFER_NAME = \"[object ArrayBuffer]\";\nvar BufferSourceConverter = class {\n static isArrayBuffer(data) {\n return Object.prototype.toString.call(data) === ARRAY_BUFFER_NAME;\n }\n static toArrayBuffer(data) {\n if (this.isArrayBuffer(data)) {\n return data;\n }\n if (data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return this.toUint8Array(data).slice().buffer;\n }\n static toUint8Array(data) {\n return this.toView(data, Uint8Array);\n }\n static toView(data, type) {\n if (data.constructor === type) {\n return data;\n }\n if (this.isArrayBuffer(data)) {\n return new type(data);\n }\n if (this.isArrayBufferView(data)) {\n return new type(data.buffer, data.byteOffset, data.byteLength);\n }\n throw new TypeError(\"The provided value is not of type '(ArrayBuffer or ArrayBufferView)'\");\n }\n static isBufferSource(data) {\n return this.isArrayBufferView(data) || this.isArrayBuffer(data);\n }\n static isArrayBufferView(data) {\n return ArrayBuffer.isView(data) || data && this.isArrayBuffer(data.buffer);\n }\n static isEqual(a, b) {\n const aView = BufferSourceConverter.toUint8Array(a);\n const bView = BufferSourceConverter.toUint8Array(b);\n if (aView.length !== bView.byteLength) {\n return false;\n }\n for (let i = 0; i < aView.length; i++) {\n if (aView[i] !== bView[i]) {\n return false;\n }\n }\n return true;\n }\n static concat(...args) {\n if (Array.isArray(args[0])) {\n const buffers = args[0];\n let size = 0;\n for (const buffer of buffers) {\n size += buffer.byteLength;\n }\n const res = new Uint8Array(size);\n let offset = 0;\n for (const buffer of buffers) {\n const view = this.toUint8Array(buffer);\n res.set(view, offset);\n offset += view.length;\n }\n if (args[1]) {\n return this.toView(res, args[1]);\n }\n return res.buffer;\n } else {\n return this.concat(args);\n }\n }\n};\n__name(BufferSourceConverter, \"BufferSourceConverter\");\nvar Utf8Converter = class {\n static fromString(text) {\n const s = unescape(encodeURIComponent(text));\n const uintArray = new Uint8Array(s.length);\n for (let i = 0; i < s.length; i++) {\n uintArray[i] = s.charCodeAt(i);\n }\n return uintArray.buffer;\n }\n static toString(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let encodedString = \"\";\n for (let i = 0; i < buf.length; i++) {\n encodedString += String.fromCharCode(buf[i]);\n }\n const decodedString = decodeURIComponent(escape(encodedString));\n return decodedString;\n }\n};\n__name(Utf8Converter, \"Utf8Converter\");\nvar Utf16Converter = class {\n static toString(buffer, littleEndian = false) {\n const arrayBuffer = BufferSourceConverter.toArrayBuffer(buffer);\n const dataView = new DataView(arrayBuffer);\n let res = \"\";\n for (let i = 0; i < arrayBuffer.byteLength; i += 2) {\n const code = dataView.getUint16(i, littleEndian);\n res += String.fromCharCode(code);\n }\n return res;\n }\n static fromString(text, littleEndian = false) {\n const res = new ArrayBuffer(text.length * 2);\n const dataView = new DataView(res);\n for (let i = 0; i < text.length; i++) {\n dataView.setUint16(i * 2, text.charCodeAt(i), littleEndian);\n }\n return res;\n }\n};\n__name(Utf16Converter, \"Utf16Converter\");\nvar Convert = class {\n static isHex(data) {\n return typeof data === \"string\" && /^[a-z0-9]+$/i.test(data);\n }\n static isBase64(data) {\n return typeof data === \"string\" && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data);\n }\n static isBase64Url(data) {\n return typeof data === \"string\" && /^[a-zA-Z0-9-_]+$/i.test(data);\n }\n static ToString(buffer, enc = \"utf8\") {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.ToUtf8String(buf);\n case \"binary\":\n return this.ToBinary(buf);\n case \"hex\":\n return this.ToHex(buf);\n case \"base64\":\n return this.ToBase64(buf);\n case \"base64url\":\n return this.ToBase64Url(buf);\n case \"utf16le\":\n return Utf16Converter.toString(buf, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buf);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static FromString(str, enc = \"utf8\") {\n if (!str) {\n return new ArrayBuffer(0);\n }\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.FromUtf8String(str);\n case \"binary\":\n return this.FromBinary(str);\n case \"hex\":\n return this.FromHex(str);\n case \"base64\":\n return this.FromBase64(str);\n case \"base64url\":\n return this.FromBase64Url(str);\n case \"utf16le\":\n return Utf16Converter.fromString(str, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(str);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static ToBase64(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n if (typeof btoa !== \"undefined\") {\n const binary = this.ToString(buf, \"binary\");\n return btoa(binary);\n } else {\n return Buffer.from(buf).toString(\"base64\");\n }\n }\n static FromBase64(base64) {\n const formatted = this.formatString(base64);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64(formatted)) {\n throw new TypeError(\"Argument 'base64Text' is not Base64 encoded\");\n }\n if (typeof atob !== \"undefined\") {\n return this.FromBinary(atob(formatted));\n } else {\n return new Uint8Array(Buffer.from(formatted, \"base64\")).buffer;\n }\n }\n static FromBase64Url(base64url) {\n const formatted = this.formatString(base64url);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64Url(formatted)) {\n throw new TypeError(\"Argument 'base64url' is not Base64Url encoded\");\n }\n return this.FromBase64(this.Base64Padding(formatted.replace(/\\-/g, \"+\").replace(/\\_/g, \"/\")));\n }\n static ToBase64Url(data) {\n return this.ToBase64(data).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/\\=/g, \"\");\n }\n static FromUtf8String(text, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.FromBinary(text);\n case \"utf8\":\n return Utf8Converter.fromString(text);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(text);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.fromString(text, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static ToUtf8String(buffer, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.ToBinary(buffer);\n case \"utf8\":\n return Utf8Converter.toString(buffer);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buffer);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.toString(buffer, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static FromBinary(text) {\n const stringLength = text.length;\n const resultView = new Uint8Array(stringLength);\n for (let i = 0; i < stringLength; i++) {\n resultView[i] = text.charCodeAt(i);\n }\n return resultView.buffer;\n }\n static ToBinary(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let res = \"\";\n for (let i = 0; i < buf.length; i++) {\n res += String.fromCharCode(buf[i]);\n }\n return res;\n }\n static ToHex(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n const splitter = \"\";\n const res = [];\n const len = buf.length;\n for (let i = 0; i < len; i++) {\n const char = buf[i].toString(16).padStart(2, \"0\");\n res.push(char);\n }\n return res.join(splitter);\n }\n static FromHex(hexString) {\n let formatted = this.formatString(hexString);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isHex(formatted)) {\n throw new TypeError(\"Argument 'hexString' is not HEX encoded\");\n }\n if (formatted.length % 2) {\n formatted = `0${formatted}`;\n }\n const res = new Uint8Array(formatted.length / 2);\n for (let i = 0; i < formatted.length; i = i + 2) {\n const c = formatted.slice(i, i + 2);\n res[i / 2] = parseInt(c, 16);\n }\n return res.buffer;\n }\n static ToUtf16String(buffer, littleEndian = false) {\n return Utf16Converter.toString(buffer, littleEndian);\n }\n static FromUtf16String(text, littleEndian = false) {\n return Utf16Converter.fromString(text, littleEndian);\n }\n static Base64Padding(base64) {\n const padCount = 4 - base64.length % 4;\n if (padCount < 4) {\n for (let i = 0; i < padCount; i++) {\n base64 += \"=\";\n }\n }\n return base64;\n }\n static formatString(data) {\n return (data === null || data === void 0 ? void 0 : data.replace(/[\\n\\r\\t ]/g, \"\")) || \"\";\n }\n};\n__name(Convert, \"Convert\");\nConvert.DEFAULT_UTF8_ENCODING = \"utf8\";\nfunction combine(...buf) {\n const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur);\n const res = new Uint8Array(totalByteLength);\n let currentPos = 0;\n buf.map((item) => new Uint8Array(item)).forEach((arr) => {\n for (const item2 of arr) {\n res[currentPos++] = item2;\n }\n });\n return res.buffer;\n}\n__name(combine, \"combine\");\n\n// ../../node_modules/.pnpm/asn1js@3.0.5/node_modules/asn1js/build/index.es.js\nvar index_es_exports = {};\n__export(index_es_exports, {\n Any: () => Any,\n BaseBlock: () => BaseBlock,\n BaseStringBlock: () => BaseStringBlock,\n BitString: () => BitString,\n BmpString: () => BmpString,\n Boolean: () => Boolean,\n CharacterString: () => CharacterString,\n Choice: () => Choice,\n Constructed: () => Constructed,\n DATE: () => DATE,\n DateTime: () => DateTime,\n Duration: () => Duration,\n EndOfContent: () => EndOfContent,\n Enumerated: () => Enumerated,\n GeneralString: () => GeneralString,\n GeneralizedTime: () => GeneralizedTime,\n GraphicString: () => GraphicString,\n HexBlock: () => HexBlock,\n IA5String: () => IA5String,\n Integer: () => Integer,\n Null: () => Null,\n NumericString: () => NumericString,\n ObjectIdentifier: () => ObjectIdentifier,\n OctetString: () => OctetString,\n Primitive: () => Primitive,\n PrintableString: () => PrintableString,\n RawData: () => RawData,\n RelativeObjectIdentifier: () => RelativeObjectIdentifier,\n Repeated: () => Repeated,\n Sequence: () => Sequence,\n Set: () => Set,\n TIME: () => TIME,\n TeletexString: () => TeletexString,\n TimeOfDay: () => TimeOfDay,\n UTCTime: () => UTCTime,\n UniversalString: () => UniversalString,\n Utf8String: () => Utf8String,\n ValueBlock: () => ValueBlock,\n VideotexString: () => VideotexString,\n ViewWriter: () => ViewWriter,\n VisibleString: () => VisibleString,\n compareSchema: () => compareSchema,\n fromBER: () => fromBER,\n verifySchema: () => verifySchema\n});\n\n// ../../node_modules/.pnpm/pvutils@1.1.3/node_modules/pvutils/build/utils.es.js\nfunction utilFromBase(inputBuffer, inputBase) {\n let result = 0;\n if (inputBuffer.length === 1) {\n return inputBuffer[0];\n }\n for (let i = inputBuffer.length - 1; i >= 0; i--) {\n result += inputBuffer[inputBuffer.length - 1 - i] * Math.pow(2, inputBase * i);\n }\n return result;\n}\n__name(utilFromBase, \"utilFromBase\");\nfunction utilToBase(value, base, reserved = -1) {\n const internalReserved = reserved;\n let internalValue = value;\n let result = 0;\n let biggest = Math.pow(2, base);\n for (let i = 1; i < 8; i++) {\n if (value < biggest) {\n let retBuf;\n if (internalReserved < 0) {\n retBuf = new ArrayBuffer(i);\n result = i;\n } else {\n if (internalReserved < i) {\n return new ArrayBuffer(0);\n }\n retBuf = new ArrayBuffer(internalReserved);\n result = internalReserved;\n }\n const retView = new Uint8Array(retBuf);\n for (let j = i - 1; j >= 0; j--) {\n const basis = Math.pow(2, j * base);\n retView[result - j - 1] = Math.floor(internalValue / basis);\n internalValue -= retView[result - j - 1] * basis;\n }\n return retBuf;\n }\n biggest *= Math.pow(2, base);\n }\n return new ArrayBuffer(0);\n}\n__name(utilToBase, \"utilToBase\");\nfunction utilConcatView(...views) {\n let outputLength = 0;\n let prevLength = 0;\n for (const view of views) {\n outputLength += view.length;\n }\n const retBuf = new ArrayBuffer(outputLength);\n const retView = new Uint8Array(retBuf);\n for (const view of views) {\n retView.set(view, prevLength);\n prevLength += view.length;\n }\n return retView;\n}\n__name(utilConcatView, \"utilConcatView\");\nfunction utilDecodeTC() {\n const buf = new Uint8Array(this.valueHex);\n if (this.valueHex.byteLength >= 2) {\n const condition1 = buf[0] === 255 && buf[1] & 128;\n const condition2 = buf[0] === 0 && (buf[1] & 128) === 0;\n if (condition1 || condition2) {\n this.warnings.push(\"Needlessly long format\");\n }\n }\n const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\n const bigIntView = new Uint8Array(bigIntBuffer);\n for (let i = 0; i < this.valueHex.byteLength; i++) {\n bigIntView[i] = 0;\n }\n bigIntView[0] = buf[0] & 128;\n const bigInt = utilFromBase(bigIntView, 8);\n const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\n const smallIntView = new Uint8Array(smallIntBuffer);\n for (let j = 0; j < this.valueHex.byteLength; j++) {\n smallIntView[j] = buf[j];\n }\n smallIntView[0] &= 127;\n const smallInt = utilFromBase(smallIntView, 8);\n return smallInt - bigInt;\n}\n__name(utilDecodeTC, \"utilDecodeTC\");\nfunction utilEncodeTC(value) {\n const modValue = value < 0 ? value * -1 : value;\n let bigInt = 128;\n for (let i = 1; i < 8; i++) {\n if (modValue <= bigInt) {\n if (value < 0) {\n const smallInt = bigInt - modValue;\n const retBuf2 = utilToBase(smallInt, 8, i);\n const retView2 = new Uint8Array(retBuf2);\n retView2[0] |= 128;\n return retBuf2;\n }\n let retBuf = utilToBase(modValue, 8, i);\n let retView = new Uint8Array(retBuf);\n if (retView[0] & 128) {\n const tempBuf = retBuf.slice(0);\n const tempView = new Uint8Array(tempBuf);\n retBuf = new ArrayBuffer(retBuf.byteLength + 1);\n retView = new Uint8Array(retBuf);\n for (let k = 0; k < tempBuf.byteLength; k++) {\n retView[k + 1] = tempView[k];\n }\n retView[0] = 0;\n }\n return retBuf;\n }\n bigInt *= Math.pow(2, 8);\n }\n return new ArrayBuffer(0);\n}\n__name(utilEncodeTC, \"utilEncodeTC\");\nfunction isEqualBuffer(inputBuffer1, inputBuffer2) {\n if (inputBuffer1.byteLength !== inputBuffer2.byteLength) {\n return false;\n }\n const view1 = new Uint8Array(inputBuffer1);\n const view2 = new Uint8Array(inputBuffer2);\n for (let i = 0; i < view1.length; i++) {\n if (view1[i] !== view2[i]) {\n return false;\n }\n }\n return true;\n}\n__name(isEqualBuffer, \"isEqualBuffer\");\nfunction padNumber(inputNumber, fullLength) {\n const str = inputNumber.toString(10);\n if (fullLength < str.length) {\n return \"\";\n }\n const dif = fullLength - str.length;\n const padding = new Array(dif);\n for (let i = 0; i < dif; i++) {\n padding[i] = \"0\";\n }\n const paddingString = padding.join(\"\");\n return paddingString.concat(str);\n}\n__name(padNumber, \"padNumber\");\nvar log2 = Math.log(2);\n\n// ../../node_modules/.pnpm/asn1js@3.0.5/node_modules/asn1js/build/index.es.js\nfunction assertBigInt() {\n if (typeof BigInt === \"undefined\") {\n throw new Error(\"BigInt is not defined. Your environment doesn't implement BigInt.\");\n }\n}\n__name(assertBigInt, \"assertBigInt\");\nfunction concat(buffers) {\n let outputLength = 0;\n let prevLength = 0;\n for (let i = 0; i < buffers.length; i++) {\n const buffer = buffers[i];\n outputLength += buffer.byteLength;\n }\n const retView = new Uint8Array(outputLength);\n for (let i = 0; i < buffers.length; i++) {\n const buffer = buffers[i];\n retView.set(new Uint8Array(buffer), prevLength);\n prevLength += buffer.byteLength;\n }\n return retView.buffer;\n}\n__name(concat, \"concat\");\nfunction checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) {\n if (!(inputBuffer instanceof Uint8Array)) {\n baseBlock.error = \"Wrong parameter: inputBuffer must be 'Uint8Array'\";\n return false;\n }\n if (!inputBuffer.byteLength) {\n baseBlock.error = \"Wrong parameter: inputBuffer has zero length\";\n return false;\n }\n if (inputOffset < 0) {\n baseBlock.error = \"Wrong parameter: inputOffset less than zero\";\n return false;\n }\n if (inputLength < 0) {\n baseBlock.error = \"Wrong parameter: inputLength less than zero\";\n return false;\n }\n if (inputBuffer.byteLength - inputOffset - inputLength < 0) {\n baseBlock.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\n return false;\n }\n return true;\n}\n__name(checkBufferParams, \"checkBufferParams\");\nvar ViewWriter = class {\n constructor() {\n this.items = [];\n }\n write(buf) {\n this.items.push(buf);\n }\n final() {\n return concat(this.items);\n }\n};\n__name(ViewWriter, \"ViewWriter\");\nvar powers2 = [new Uint8Array([1])];\nvar digitsString = \"0123456789\";\nvar NAME = \"name\";\nvar VALUE_HEX_VIEW = \"valueHexView\";\nvar IS_HEX_ONLY = \"isHexOnly\";\nvar ID_BLOCK = \"idBlock\";\nvar TAG_CLASS = \"tagClass\";\nvar TAG_NUMBER = \"tagNumber\";\nvar IS_CONSTRUCTED = \"isConstructed\";\nvar FROM_BER = \"fromBER\";\nvar TO_BER = \"toBER\";\nvar LOCAL = \"local\";\nvar EMPTY_STRING = \"\";\nvar EMPTY_BUFFER = new ArrayBuffer(0);\nvar EMPTY_VIEW = new Uint8Array(0);\nvar END_OF_CONTENT_NAME = \"EndOfContent\";\nvar OCTET_STRING_NAME = \"OCTET STRING\";\nvar BIT_STRING_NAME = \"BIT STRING\";\nfunction HexBlock(BaseClass) {\n var _a2;\n return _a2 = /* @__PURE__ */ __name(class Some extends BaseClass {\n constructor(...args) {\n var _a3;\n super(...args);\n const params = args[0] || {};\n this.isHexOnly = (_a3 = params.isHexOnly) !== null && _a3 !== void 0 ? _a3 : false;\n this.valueHexView = params.valueHex ? BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;\n }\n get valueHex() {\n return this.valueHexView.slice().buffer;\n }\n set valueHex(value) {\n this.valueHexView = new Uint8Array(value);\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n const endLength = inputOffset + inputLength;\n this.valueHexView = view.subarray(inputOffset, endLength);\n if (!this.valueHexView.length) {\n this.warnings.push(\"Zero buffer length\");\n return inputOffset;\n }\n this.blockLength = inputLength;\n return endLength;\n }\n toBER(sizeOnly = false) {\n if (!this.isHexOnly) {\n this.error = \"Flag 'isHexOnly' is not set, abort\";\n return EMPTY_BUFFER;\n }\n if (sizeOnly) {\n return new ArrayBuffer(this.valueHexView.byteLength);\n }\n return this.valueHexView.byteLength === this.valueHexView.buffer.byteLength ? this.valueHexView.buffer : this.valueHexView.slice().buffer;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n isHexOnly: this.isHexOnly,\n valueHex: Convert.ToHex(this.valueHexView)\n };\n }\n }, \"Some\"), _a2.NAME = \"hexBlock\", _a2;\n}\n__name(HexBlock, \"HexBlock\");\nvar LocalBaseBlock = class {\n constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW } = {}) {\n this.blockLength = blockLength;\n this.error = error;\n this.warnings = warnings;\n this.valueBeforeDecodeView = BufferSourceConverter.toUint8Array(valueBeforeDecode);\n }\n static blockName() {\n return this.NAME;\n }\n get valueBeforeDecode() {\n return this.valueBeforeDecodeView.slice().buffer;\n }\n set valueBeforeDecode(value) {\n this.valueBeforeDecodeView = new Uint8Array(value);\n }\n toJSON() {\n return {\n blockName: this.constructor.NAME,\n blockLength: this.blockLength,\n error: this.error,\n warnings: this.warnings,\n valueBeforeDecode: Convert.ToHex(this.valueBeforeDecodeView)\n };\n }\n};\n__name(LocalBaseBlock, \"LocalBaseBlock\");\nLocalBaseBlock.NAME = \"baseBlock\";\nvar ValueBlock = class extends LocalBaseBlock {\n fromBER(inputBuffer, inputOffset, inputLength) {\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\n }\n toBER(sizeOnly, writer) {\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\n }\n};\n__name(ValueBlock, \"ValueBlock\");\nValueBlock.NAME = \"valueBlock\";\nvar LocalIdentificationBlock = class extends HexBlock(LocalBaseBlock) {\n constructor({ idBlock = {} } = {}) {\n var _a2, _b, _c, _d;\n super();\n if (idBlock) {\n this.isHexOnly = (_a2 = idBlock.isHexOnly) !== null && _a2 !== void 0 ? _a2 : false;\n this.valueHexView = idBlock.valueHex ? BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;\n this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1;\n this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1;\n this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false;\n } else {\n this.tagClass = -1;\n this.tagNumber = -1;\n this.isConstructed = false;\n }\n }\n toBER(sizeOnly = false) {\n let firstOctet = 0;\n switch (this.tagClass) {\n case 1:\n firstOctet |= 0;\n break;\n case 2:\n firstOctet |= 64;\n break;\n case 3:\n firstOctet |= 128;\n break;\n case 4:\n firstOctet |= 192;\n break;\n default:\n this.error = \"Unknown tag class\";\n return EMPTY_BUFFER;\n }\n if (this.isConstructed)\n firstOctet |= 32;\n if (this.tagNumber < 31 && !this.isHexOnly) {\n const retView2 = new Uint8Array(1);\n if (!sizeOnly) {\n let number = this.tagNumber;\n number &= 31;\n firstOctet |= number;\n retView2[0] = firstOctet;\n }\n return retView2.buffer;\n }\n if (!this.isHexOnly) {\n const encodedBuf = utilToBase(this.tagNumber, 7);\n const encodedView = new Uint8Array(encodedBuf);\n const size = encodedBuf.byteLength;\n const retView2 = new Uint8Array(size + 1);\n retView2[0] = firstOctet | 31;\n if (!sizeOnly) {\n for (let i = 0; i < size - 1; i++)\n retView2[i + 1] = encodedView[i] | 128;\n retView2[size] = encodedView[size - 1];\n }\n return retView2.buffer;\n }\n const retView = new Uint8Array(this.valueHexView.byteLength + 1);\n retView[0] = firstOctet | 31;\n if (!sizeOnly) {\n const curView = this.valueHexView;\n for (let i = 0; i < curView.length - 1; i++)\n retView[i + 1] = curView[i] | 128;\n retView[this.valueHexView.byteLength] = curView[curView.length - 1];\n }\n return retView.buffer;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const inputView = BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\n if (intBuffer.length === 0) {\n this.error = \"Zero buffer length\";\n return -1;\n }\n const tagClassMask = intBuffer[0] & 192;\n switch (tagClassMask) {\n case 0:\n this.tagClass = 1;\n break;\n case 64:\n this.tagClass = 2;\n break;\n case 128:\n this.tagClass = 3;\n break;\n case 192:\n this.tagClass = 4;\n break;\n default:\n this.error = \"Unknown tag class\";\n return -1;\n }\n this.isConstructed = (intBuffer[0] & 32) === 32;\n this.isHexOnly = false;\n const tagNumberMask = intBuffer[0] & 31;\n if (tagNumberMask !== 31) {\n this.tagNumber = tagNumberMask;\n this.blockLength = 1;\n } else {\n let count = 1;\n let intTagNumberBuffer = this.valueHexView = new Uint8Array(255);\n let tagNumberBufferMaxLength = 255;\n while (intBuffer[count] & 128) {\n intTagNumberBuffer[count - 1] = intBuffer[count] & 127;\n count++;\n if (count >= intBuffer.length) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n if (count === tagNumberBufferMaxLength) {\n tagNumberBufferMaxLength += 255;\n const tempBufferView2 = new Uint8Array(tagNumberBufferMaxLength);\n for (let i = 0; i < intTagNumberBuffer.length; i++)\n tempBufferView2[i] = intTagNumberBuffer[i];\n intTagNumberBuffer = this.valueHexView = new Uint8Array(tagNumberBufferMaxLength);\n }\n }\n this.blockLength = count + 1;\n intTagNumberBuffer[count - 1] = intBuffer[count] & 127;\n const tempBufferView = new Uint8Array(count);\n for (let i = 0; i < count; i++)\n tempBufferView[i] = intTagNumberBuffer[i];\n intTagNumberBuffer = this.valueHexView = new Uint8Array(count);\n intTagNumberBuffer.set(tempBufferView);\n if (this.blockLength <= 9)\n this.tagNumber = utilFromBase(intTagNumberBuffer, 7);\n else {\n this.isHexOnly = true;\n this.warnings.push(\"Tag too long, represented as hex-coded\");\n }\n }\n if (this.tagClass === 1 && this.isConstructed) {\n switch (this.tagNumber) {\n case 1:\n case 2:\n case 5:\n case 6:\n case 9:\n case 13:\n case 14:\n case 23:\n case 24:\n case 31:\n case 32:\n case 33:\n case 34:\n this.error = \"Constructed encoding used for primitive type\";\n return -1;\n }\n }\n return inputOffset + this.blockLength;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n tagClass: this.tagClass,\n tagNumber: this.tagNumber,\n isConstructed: this.isConstructed\n };\n }\n};\n__name(LocalIdentificationBlock, \"LocalIdentificationBlock\");\nLocalIdentificationBlock.NAME = \"identificationBlock\";\nvar LocalLengthBlock = class extends LocalBaseBlock {\n constructor({ lenBlock = {} } = {}) {\n var _a2, _b, _c;\n super();\n this.isIndefiniteForm = (_a2 = lenBlock.isIndefiniteForm) !== null && _a2 !== void 0 ? _a2 : false;\n this.longFormUsed = (_b = lenBlock.longFormUsed) !== null && _b !== void 0 ? _b : false;\n this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = view.subarray(inputOffset, inputOffset + inputLength);\n if (intBuffer.length === 0) {\n this.error = \"Zero buffer length\";\n return -1;\n }\n if (intBuffer[0] === 255) {\n this.error = \"Length block 0xFF is reserved by standard\";\n return -1;\n }\n this.isIndefiniteForm = intBuffer[0] === 128;\n if (this.isIndefiniteForm) {\n this.blockLength = 1;\n return inputOffset + this.blockLength;\n }\n this.longFormUsed = !!(intBuffer[0] & 128);\n if (this.longFormUsed === false) {\n this.length = intBuffer[0];\n this.blockLength = 1;\n return inputOffset + this.blockLength;\n }\n const count = intBuffer[0] & 127;\n if (count > 8) {\n this.error = \"Too big integer\";\n return -1;\n }\n if (count + 1 > intBuffer.length) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n const lenOffset = inputOffset + 1;\n const lengthBufferView = view.subarray(lenOffset, lenOffset + count);\n if (lengthBufferView[count - 1] === 0)\n this.warnings.push(\"Needlessly long encoded length\");\n this.length = utilFromBase(lengthBufferView, 8);\n if (this.longFormUsed && this.length <= 127)\n this.warnings.push(\"Unnecessary usage of long length form\");\n this.blockLength = count + 1;\n return inputOffset + this.blockLength;\n }\n toBER(sizeOnly = false) {\n let retBuf;\n let retView;\n if (this.length > 127)\n this.longFormUsed = true;\n if (this.isIndefiniteForm) {\n retBuf = new ArrayBuffer(1);\n if (sizeOnly === false) {\n retView = new Uint8Array(retBuf);\n retView[0] = 128;\n }\n return retBuf;\n }\n if (this.longFormUsed) {\n const encodedBuf = utilToBase(this.length, 8);\n if (encodedBuf.byteLength > 127) {\n this.error = \"Too big length\";\n return EMPTY_BUFFER;\n }\n retBuf = new ArrayBuffer(encodedBuf.byteLength + 1);\n if (sizeOnly)\n return retBuf;\n const encodedView = new Uint8Array(encodedBuf);\n retView = new Uint8Array(retBuf);\n retView[0] = encodedBuf.byteLength | 128;\n for (let i = 0; i < encodedBuf.byteLength; i++)\n retView[i + 1] = encodedView[i];\n return retBuf;\n }\n retBuf = new ArrayBuffer(1);\n if (sizeOnly === false) {\n retView = new Uint8Array(retBuf);\n retView[0] = this.length;\n }\n return retBuf;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n isIndefiniteForm: this.isIndefiniteForm,\n longFormUsed: this.longFormUsed,\n length: this.length\n };\n }\n};\n__name(LocalLengthBlock, \"LocalLengthBlock\");\nLocalLengthBlock.NAME = \"lengthBlock\";\nvar typeStore = {};\nvar BaseBlock = class extends LocalBaseBlock {\n constructor({ name = EMPTY_STRING, optional = false, primitiveSchema, ...parameters } = {}, valueBlockType) {\n super(parameters);\n this.name = name;\n this.optional = optional;\n if (primitiveSchema) {\n this.primitiveSchema = primitiveSchema;\n }\n this.idBlock = new LocalIdentificationBlock(parameters);\n this.lenBlock = new LocalLengthBlock(parameters);\n this.valueBlock = valueBlockType ? new valueBlockType(parameters) : new ValueBlock(parameters);\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, this.lenBlock.isIndefiniteForm ? inputLength : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n toBER(sizeOnly, writer) {\n const _writer = writer || new ViewWriter();\n if (!writer) {\n prepareIndefiniteForm(this);\n }\n const idBlockBuf = this.idBlock.toBER(sizeOnly);\n _writer.write(idBlockBuf);\n if (this.lenBlock.isIndefiniteForm) {\n _writer.write(new Uint8Array([128]).buffer);\n this.valueBlock.toBER(sizeOnly, _writer);\n _writer.write(new ArrayBuffer(2));\n } else {\n const valueBlockBuf = this.valueBlock.toBER(sizeOnly);\n this.lenBlock.length = valueBlockBuf.byteLength;\n const lenBlockBuf = this.lenBlock.toBER(sizeOnly);\n _writer.write(lenBlockBuf);\n _writer.write(valueBlockBuf);\n }\n if (!writer) {\n return _writer.final();\n }\n return EMPTY_BUFFER;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n idBlock: this.idBlock.toJSON(),\n lenBlock: this.lenBlock.toJSON(),\n valueBlock: this.valueBlock.toJSON(),\n name: this.name,\n optional: this.optional\n };\n if (this.primitiveSchema)\n object.primitiveSchema = this.primitiveSchema.toJSON();\n return object;\n }\n toString(encoding = \"ascii\") {\n if (encoding === \"ascii\") {\n return this.onAsciiEncoding();\n }\n return Convert.ToHex(this.toBER());\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;\n }\n isEqual(other) {\n if (this === other) {\n return true;\n }\n if (!(other instanceof this.constructor)) {\n return false;\n }\n const thisRaw = this.toBER();\n const otherRaw = other.toBER();\n return isEqualBuffer(thisRaw, otherRaw);\n }\n};\n__name(BaseBlock, \"BaseBlock\");\nBaseBlock.NAME = \"BaseBlock\";\nfunction prepareIndefiniteForm(baseBlock) {\n if (baseBlock instanceof typeStore.Constructed) {\n for (const value of baseBlock.valueBlock.value) {\n if (prepareIndefiniteForm(value)) {\n baseBlock.lenBlock.isIndefiniteForm = true;\n }\n }\n }\n return !!baseBlock.lenBlock.isIndefiniteForm;\n}\n__name(prepareIndefiniteForm, \"prepareIndefiniteForm\");\nvar BaseStringBlock = class extends BaseBlock {\n constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) {\n super(parameters, stringValueBlockType);\n if (value) {\n this.fromString(value);\n }\n }\n getValue() {\n return this.valueBlock.value;\n }\n setValue(value) {\n this.valueBlock.value = value;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, this.lenBlock.isIndefiniteForm ? inputLength : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n this.fromBuffer(this.valueBlock.valueHexView);\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : '${this.valueBlock.value}'`;\n }\n};\n__name(BaseStringBlock, \"BaseStringBlock\");\nBaseStringBlock.NAME = \"BaseStringBlock\";\nvar LocalPrimitiveValueBlock = class extends HexBlock(ValueBlock) {\n constructor({ isHexOnly = true, ...parameters } = {}) {\n super(parameters);\n this.isHexOnly = isHexOnly;\n }\n};\n__name(LocalPrimitiveValueBlock, \"LocalPrimitiveValueBlock\");\nLocalPrimitiveValueBlock.NAME = \"PrimitiveValueBlock\";\nvar _a$w;\nvar Primitive = class extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalPrimitiveValueBlock);\n this.idBlock.isConstructed = false;\n }\n};\n__name(Primitive, \"Primitive\");\n_a$w = Primitive;\n(() => {\n typeStore.Primitive = _a$w;\n})();\nPrimitive.NAME = \"PRIMITIVE\";\nfunction localChangeType(inputObject, newType) {\n if (inputObject instanceof newType) {\n return inputObject;\n }\n const newObject = new newType();\n newObject.idBlock = inputObject.idBlock;\n newObject.lenBlock = inputObject.lenBlock;\n newObject.warnings = inputObject.warnings;\n newObject.valueBeforeDecodeView = inputObject.valueBeforeDecodeView;\n return newObject;\n}\n__name(localChangeType, \"localChangeType\");\nfunction localFromBER(inputBuffer, inputOffset = 0, inputLength = inputBuffer.length) {\n const incomingOffset = inputOffset;\n let returnObject = new BaseBlock({}, ValueBlock);\n const baseBlock = new LocalBaseBlock();\n if (!checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength)) {\n returnObject.error = baseBlock.error;\n return {\n offset: -1,\n result: returnObject\n };\n }\n const intBuffer = inputBuffer.subarray(inputOffset, inputOffset + inputLength);\n if (!intBuffer.length) {\n returnObject.error = \"Zero buffer length\";\n return {\n offset: -1,\n result: returnObject\n };\n }\n let resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength);\n if (returnObject.idBlock.warnings.length) {\n returnObject.warnings.concat(returnObject.idBlock.warnings);\n }\n if (resultOffset === -1) {\n returnObject.error = returnObject.idBlock.error;\n return {\n offset: -1,\n result: returnObject\n };\n }\n inputOffset = resultOffset;\n inputLength -= returnObject.idBlock.blockLength;\n resultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength);\n if (returnObject.lenBlock.warnings.length) {\n returnObject.warnings.concat(returnObject.lenBlock.warnings);\n }\n if (resultOffset === -1) {\n returnObject.error = returnObject.lenBlock.error;\n return {\n offset: -1,\n result: returnObject\n };\n }\n inputOffset = resultOffset;\n inputLength -= returnObject.lenBlock.blockLength;\n if (!returnObject.idBlock.isConstructed && returnObject.lenBlock.isIndefiniteForm) {\n returnObject.error = \"Indefinite length form used for primitive encoding form\";\n return {\n offset: -1,\n result: returnObject\n };\n }\n let newASN1Type = BaseBlock;\n switch (returnObject.idBlock.tagClass) {\n case 1:\n if (returnObject.idBlock.tagNumber >= 37 && returnObject.idBlock.isHexOnly === false) {\n returnObject.error = \"UNIVERSAL 37 and upper tags are reserved by ASN.1 standard\";\n return {\n offset: -1,\n result: returnObject\n };\n }\n switch (returnObject.idBlock.tagNumber) {\n case 0:\n if (returnObject.idBlock.isConstructed && returnObject.lenBlock.length > 0) {\n returnObject.error = \"Type [UNIVERSAL 0] is reserved\";\n return {\n offset: -1,\n result: returnObject\n };\n }\n newASN1Type = typeStore.EndOfContent;\n break;\n case 1:\n newASN1Type = typeStore.Boolean;\n break;\n case 2:\n newASN1Type = typeStore.Integer;\n break;\n case 3:\n newASN1Type = typeStore.BitString;\n break;\n case 4:\n newASN1Type = typeStore.OctetString;\n break;\n case 5:\n newASN1Type = typeStore.Null;\n break;\n case 6:\n newASN1Type = typeStore.ObjectIdentifier;\n break;\n case 10:\n newASN1Type = typeStore.Enumerated;\n break;\n case 12:\n newASN1Type = typeStore.Utf8String;\n break;\n case 13:\n newASN1Type = typeStore.RelativeObjectIdentifier;\n break;\n case 14:\n newASN1Type = typeStore.TIME;\n break;\n case 15:\n returnObject.error = \"[UNIVERSAL 15] is reserved by ASN.1 standard\";\n return {\n offset: -1,\n result: returnObject\n };\n case 16:\n newASN1Type = typeStore.Sequence;\n break;\n case 17:\n newASN1Type = typeStore.Set;\n break;\n case 18:\n newASN1Type = typeStore.NumericString;\n break;\n case 19:\n newASN1Type = typeStore.PrintableString;\n break;\n case 20:\n newASN1Type = typeStore.TeletexString;\n break;\n case 21:\n newASN1Type = typeStore.VideotexString;\n break;\n case 22:\n newASN1Type = typeStore.IA5String;\n break;\n case 23:\n newASN1Type = typeStore.UTCTime;\n break;\n case 24:\n newASN1Type = typeStore.GeneralizedTime;\n break;\n case 25:\n newASN1Type = typeStore.GraphicString;\n break;\n case 26:\n newASN1Type = typeStore.VisibleString;\n break;\n case 27:\n newASN1Type = typeStore.GeneralString;\n break;\n case 28:\n newASN1Type = typeStore.UniversalString;\n break;\n case 29:\n newASN1Type = typeStore.CharacterString;\n break;\n case 30:\n newASN1Type = typeStore.BmpString;\n break;\n case 31:\n newASN1Type = typeStore.DATE;\n break;\n case 32:\n newASN1Type = typeStore.TimeOfDay;\n break;\n case 33:\n newASN1Type = typeStore.DateTime;\n break;\n case 34:\n newASN1Type = typeStore.Duration;\n break;\n default: {\n const newObject = returnObject.idBlock.isConstructed ? new typeStore.Constructed() : new typeStore.Primitive();\n newObject.idBlock = returnObject.idBlock;\n newObject.lenBlock = returnObject.lenBlock;\n newObject.warnings = returnObject.warnings;\n returnObject = newObject;\n }\n }\n break;\n case 2:\n case 3:\n case 4:\n default: {\n newASN1Type = returnObject.idBlock.isConstructed ? typeStore.Constructed : typeStore.Primitive;\n }\n }\n returnObject = localChangeType(returnObject, newASN1Type);\n resultOffset = returnObject.fromBER(inputBuffer, inputOffset, returnObject.lenBlock.isIndefiniteForm ? inputLength : returnObject.lenBlock.length);\n returnObject.valueBeforeDecodeView = inputBuffer.subarray(incomingOffset, incomingOffset + returnObject.blockLength);\n return {\n offset: resultOffset,\n result: returnObject\n };\n}\n__name(localFromBER, \"localFromBER\");\nfunction fromBER(inputBuffer) {\n if (!inputBuffer.byteLength) {\n const result = new BaseBlock({}, ValueBlock);\n result.error = \"Input buffer has zero length\";\n return {\n offset: -1,\n result\n };\n }\n return localFromBER(BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);\n}\n__name(fromBER, \"fromBER\");\nfunction checkLen(indefiniteLength, length) {\n if (indefiniteLength) {\n return 1;\n }\n return length;\n}\n__name(checkLen, \"checkLen\");\nvar LocalConstructedValueBlock = class extends ValueBlock {\n constructor({ value = [], isIndefiniteForm = false, ...parameters } = {}) {\n super(parameters);\n this.value = value;\n this.isIndefiniteForm = isIndefiniteForm;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n this.valueBeforeDecodeView = view.subarray(inputOffset, inputOffset + inputLength);\n if (this.valueBeforeDecodeView.length === 0) {\n this.warnings.push(\"Zero buffer length\");\n return inputOffset;\n }\n let currentOffset = inputOffset;\n while (checkLen(this.isIndefiniteForm, inputLength) > 0) {\n const returnObject = localFromBER(view, currentOffset, inputLength);\n if (returnObject.offset === -1) {\n this.error = returnObject.result.error;\n this.warnings.concat(returnObject.result.warnings);\n return -1;\n }\n currentOffset = returnObject.offset;\n this.blockLength += returnObject.result.blockLength;\n inputLength -= returnObject.result.blockLength;\n this.value.push(returnObject.result);\n if (this.isIndefiniteForm && returnObject.result.constructor.NAME === END_OF_CONTENT_NAME) {\n break;\n }\n }\n if (this.isIndefiniteForm) {\n if (this.value[this.value.length - 1].constructor.NAME === END_OF_CONTENT_NAME) {\n this.value.pop();\n } else {\n this.warnings.push(\"No EndOfContent block encoded\");\n }\n }\n return currentOffset;\n }\n toBER(sizeOnly, writer) {\n const _writer = writer || new ViewWriter();\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].toBER(sizeOnly, _writer);\n }\n if (!writer) {\n return _writer.final();\n }\n return EMPTY_BUFFER;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n isIndefiniteForm: this.isIndefiniteForm,\n value: []\n };\n for (const value of this.value) {\n object.value.push(value.toJSON());\n }\n return object;\n }\n};\n__name(LocalConstructedValueBlock, \"LocalConstructedValueBlock\");\nLocalConstructedValueBlock.NAME = \"ConstructedValueBlock\";\nvar _a$v;\nvar Constructed = class extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalConstructedValueBlock);\n this.idBlock.isConstructed = true;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, this.lenBlock.isIndefiniteForm ? inputLength : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n onAsciiEncoding() {\n const values = [];\n for (const value of this.valueBlock.value) {\n values.push(value.toString(\"ascii\").split(\"\\n\").map((o) => ` ${o}`).join(\"\\n\"));\n }\n const blockName = this.idBlock.tagClass === 3 ? `[${this.idBlock.tagNumber}]` : this.constructor.NAME;\n return values.length ? `${blockName} :\n${values.join(\"\\n\")}` : `${blockName} :`;\n }\n};\n__name(Constructed, \"Constructed\");\n_a$v = Constructed;\n(() => {\n typeStore.Constructed = _a$v;\n})();\nConstructed.NAME = \"CONSTRUCTED\";\nvar LocalEndOfContentValueBlock = class extends ValueBlock {\n fromBER(inputBuffer, inputOffset, inputLength) {\n return inputOffset;\n }\n toBER(sizeOnly) {\n return EMPTY_BUFFER;\n }\n};\n__name(LocalEndOfContentValueBlock, \"LocalEndOfContentValueBlock\");\nLocalEndOfContentValueBlock.override = \"EndOfContentValueBlock\";\nvar _a$u;\nvar EndOfContent = class extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalEndOfContentValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 0;\n }\n};\n__name(EndOfContent, \"EndOfContent\");\n_a$u = EndOfContent;\n(() => {\n typeStore.EndOfContent = _a$u;\n})();\nEndOfContent.NAME = END_OF_CONTENT_NAME;\nvar _a$t;\nvar Null = class extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, ValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 5;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n