{"version":3,"sources":["../../src/utils/Helper.ts","../../src/utils/DCS.ts","../../src/utils/Data/Header.ts","../../src/utils/Data/Part.ts","../../src/utils/Data/Data.ts","../../src/utils/PID.ts","../../src/utils/SCA/SCAType.ts","../../src/utils/SCA/SCA.ts","../../src/utils/PDU.ts","../../src/utils/SCTS.ts","../../src/utils/Type/PDUType.ts","../../src/utils/Type/DeliverType.ts","../../src/Deliver.ts","../../src/utils/Type/ReportType.ts","../../src/Report.ts","../../src/utils/Type/SubmitType.ts","../../src/utils/VP.ts","../../src/Submit.ts","../../src/parse/parseUtils/parseData.ts","../../src/parse/parseUtils/parseDCS.ts","../../src/parse/parseUtils/parsePID.ts","../../src/parse/parseUtils/parseSCA.ts","../../src/parse/parseUtils/parseSCTS.ts","../../src/parse/parseUtils/parseType.ts","../../src/parse/parseUtils/parseVP.ts","../../src/parse/index.ts","../../src/utils/index.ts"],"names":["Helper","_Helper","hex","bytes","i","ascii","hexStr","str","char","order","text","buffer","inLen","alignBits","ret","data","dataPos","buf","bufLen","inDone","inExt","digit","c","low","result","length","symb","code","pdu","byte","number","fill","DCS","_DCS","options","indication","type","compressed","alphabet","cls","use","Header","_Header","params","ie","dataHex","udhl","head","Part","size","header","Data","_Data","headerSize","max","parts","haveHeader","uniqID","index","tmp","part","p","p1","p2","PID","_PID","pid","indicates","SCAType","value","plan","SCA","_SCA","isAddress","phone","detectType","SC","clear","s","phoneSpaceless","l","b1","b2","letter","PDU","address","dcs","SCTS","date","tzOff","tzAbs","x","datetime","offset","PDUType","_PDUType","userDataHeader","srr","validityPeriodFormat","DeliverType","Deliver","time","ReportType","Report","reference","dateTime","discharge","status","SubmitType","VP","interval","minutes","hours","days","weeks","Submit","messageReference","parseData","dataCodingScheme","userDataLength","getPduSubstr","dataOptions","parsePart","hdrSz","parseHeader","ies","ieType","ieLen","parseDCS","dcsOptions","parsePID","parseSCA","sca","octets","adjustedSize","typeValue","septets","b","parseSCTS","isoTime","parseType","parseVP","vpf","vp","scts","parse","pduParse","getSubstr","parseDeliver","parseReport","parseSubmit","serviceCenterAddress","protocolIdentifier","serviceCenterTimeStamp","userData","referencedBytes","timestamp","validityPeriod","utils_exports","__export"],"mappings":";;;;;;;;;;;AAOO,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAMA,CAAAA,CAAN,MAAMC,CAAO,CACnB,OAAgB,aAAA,CACf,CAAA;AAAA,wOAAA,CAAA,CACD,OAAgB,cAAA,CACf,wIAAA,CAED,OAAgB,WAAA,CAAc,IAC9B,OAAgB,aAAA,CAAgB,GAAA,CAChC,OAAgB,YAAA,CAAe,EAAA,CAE/B,OAAwB,YAAA,CAAe,IAAI,WAAA,CAS3C,OAAO,eAAA,CAAgBC,CAAAA,CAAyB,CAC/C,GAAIA,CAAAA,CAAI,MAAA,CAAS,CAAA,GAAM,CAAA,CACtB,MAAM,IAAI,MAAM,mDAAmD,CAAA,CAGpE,IAAMC,CAAAA,CAAQ,IAAI,UAAA,CAAWD,CAAAA,CAAI,MAAA,CAAS,CAAC,CAAA,CAE3C,IAAA,IAASE,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,EAAI,MAAA,CAAQE,CAAAA,EAAK,CAAA,CACpCD,CAAAA,CAAMC,CAAAA,CAAI,CAAC,CAAA,CAAI,QAAA,CAASF,CAAAA,CAAI,SAAA,CAAUE,CAAAA,CAAGA,CAAAA,CAAI,CAAC,CAAA,CAAG,EAAE,CAAA,CAGpD,OAAOD,CACR,CAQA,OAAO,iBAAA,CAAkBE,EAA2B,CACnD,OAAO,IAAA,CAAK,YAAA,CAAa,MAAA,CAAOA,CAAK,CACtC,CAQA,OA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AAA,CAASqE,CAAAA,CAAU,CACpC,oBAAA,CAAAH,CAAAA,CACA,KAAAnH,CAAAA,CACA,gBAAA,CAAAgF,CAAAA,CACA,kBAAA,CAAAoC,CAAAA,CACA,gBAAA,CAAAlC,CAAAA,CACA,cAAA,CAAAuC,CACD,CAAC,CACF,CC1IA,IAAAC,CAAAA,CAAA,GAAAC,CAAAA,CAAAD,CAAAA,CAAA,SAAA9H,CAAAA,CAAA,IAAA,CAAA,IAAAmB,CAAAA,CAAA,WAAA,CAAA,IAAAgD,CAAAA,CAAA,MAAA,CAAA,IAAA1D,CAAAA,CAAA,MAAA,CAAA,IAAAzC,EAAA,GAAA,CAAA,IAAAoF,CAAAA,CAAA,OAAA,CAAA,IAAAU,CAAAA,CAAA,GAAA,CAAA,IAAA9B,CAAAA,CAAA,IAAA,CAAA,IAAAhB,CAAAA,CAAA,eAAAsD,CAAAA,CAAA,GAAA,CAAA,IAAA/B,CAAAA,CAAA,OAAA,CAAA,IAAAH,CAAAA,CAAA,IAAA,CAAA,IAAAmB,CAAAA,CAAA,UAAA,CAAA,IAAAqB,EAAA,EAAA,CAAA,IAAAC,CAAAA,CAAAA,CAAAA","file":"index.cjs","sourcesContent":["/**\n * A utility class providing static methods for encoding and decoding SMS messages.\n *\n * This class contains methods for converting text into various encoding formats used in SMS,\n * such as GSM 7-bit, 8-bit, and UCS-2 (16-bit). It also includes utility methods\n * for handling characters and converting values to hexadecimal strings.\n */\nexport class Helper {\n\tstatic readonly ALPHABET_7BIT =\n\t\t'@£$¥èéùìòÇ\\nØø\\rÅåΔ_ΦΓΛΩΠΨΣΘΞ\\x1bÆæßÉ !\"#¤%&\\'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑÜ`¿abcdefghijklmnopqrstuvwxyzäöñüà';\n\tstatic readonly EXTENDED_TABLE =\n\t\t'````````````````````^```````````````````{}`````\\\\````````````[~]`|````````````````````````````````````€``````````````````````````';\n\n\tstatic readonly limitNormal = 140;\n\tstatic readonly limitCompress = 160;\n\tstatic readonly limitUnicode = 70;\n\n\tprivate static readonly TEXT_ENCODER = new TextEncoder();\n\t// private static readonly TEXT_DECODER = new TextDecoder();\n\n\t/**\n\t * Converts a hex string to a Uint8Array.\n\t *\n\t * @param hex The hex string to convert\n\t * @returns A Uint8Array representing the hex string\n\t */\n\tstatic hexToUint8Array(hex: string): Uint8Array {\n\t\tif (hex.length % 2 !== 0) {\n\t\t\tthrow new Error('Hex string must have an even number of characters');\n\t\t}\n\n\t\tconst bytes = new Uint8Array(hex.length / 2);\n\n\t\tfor (let i = 0; i < hex.length; i += 2) {\n\t\t\tbytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);\n\t\t}\n\n\t\treturn bytes;\n\t}\n\n\t/**\n\t * Converts an ASCII string to a Uint8Array.\n\t *\n\t * @param ascii The ASCII string to convert\n\t * @returns A Uint8Array representing the ASCII string\n\t */\n\tstatic asciiToUint8Array(ascii: string): Uint8Array {\n\t\treturn this.TEXT_ENCODER.encode(ascii);\n\t}\n\n\t/**\n\t * Converts the first two characters of a hexadecimal string to a number.\n\t *\n\t * @param hexStr The hexadecimal string to convert\n\t * @returns The number represented by the first two characters of the hexadecimal string\n\t */\n\tstatic getByteFromHex(hexStr: string): number {\n\t\treturn parseInt(hexStr.substring(0, 2), 16);\n\t}\n\n\t/**\n\t * Capitalizes the first character of the input string.\n\t *\n\t * @param str The string to capitalize\n\t * @returns The input string with its first character capitalized\n\t */\n\tstatic ucfirst(str: string) {\n\t\treturn str.substring(0, 1).toUpperCase() + str.substring(1);\n\t}\n\n\t/**\n\t * Returns the Unicode code point of the first character of the input string.\n\t *\n\t * @param char A single character string\n\t * @returns The Unicode code point of the character\n\t */\n\tstatic order(char: string) {\n\t\treturn char.charCodeAt(0);\n\t}\n\n\t/**\n\t * Returns the character represented by the specified Unicode code point.\n\t *\n\t * @param order The Unicode code point\n\t * @returns A string containing the character represented by the code point\n\t */\n\tstatic char(order: number) {\n\t\treturn String.fromCharCode(order);\n\t}\n\n\t/**\n\t * Decodes a 16-bit encoded string into a human-readable text.\n\t *\n\t * @param text The 16-bit encoded hexadecimal string\n\t * @returns The decoded text\n\t */\n\tstatic decode16Bit(text: string) {\n\t\treturn (text.match(/.{1,4}/g) || [])\n\t\t\t.map((hex) => {\n\t\t\t\tconst buffer = Helper.hexToUint8Array(hex);\n\t\t\t\treturn Helper.char((buffer[0] << 8) | buffer[1]);\n\t\t\t})\n\t\t\t.join('');\n\t}\n\n\t/**\n\t * Decodes an 8-bit encoded string into a human-readable text.\n\t *\n\t * @param text The 8-bit encoded hexadecimal string\n\t * @returns The decoded text\n\t */\n\tstatic decode8Bit(text: string) {\n\t\treturn (text.match(/.{1,2}/g) || []).map((hex) => Helper.char(Helper.getByteFromHex(hex))).join('');\n\t}\n\n\t/**\n\t * Decodes a 7-bit encoded string into a human-readable text.\n\t *\n\t * @param text The 7-bit encoded hexadecimal string\n\t * @param inLen The length of the input data in septets\n\t * @param alignBits The number of bits for alignment\n\t *\n\t * @returns The decoded text\n\t */\n\tstatic decode7Bit(text: string, inLen?: number, alignBits?: number) {\n\t\tconst ret: number[] = [];\n\t\tconst data = Helper.hexToUint8Array(text);\n\n\t\tlet dataPos = 0; // Position in the input octets stream\n\t\tlet buf = 0; // Bit buffer, used in FIFO manner\n\t\tlet bufLen = 0; // Amount of buffered bits\n\t\tlet inDone = 0;\n\t\tlet inExt = false;\n\n\t\t// If we have some leading alignment bits then skip them\n\t\tif (alignBits && data.length) {\n\t\t\talignBits = alignBits % 7;\n\t\t\tbuf = data[dataPos++];\n\t\t\tbuf >>= alignBits;\n\t\t\tbufLen = 8 - alignBits;\n\t\t}\n\n\t\twhile (!(bufLen < 7 && dataPos === data.length)) {\n\t\t\tif (bufLen < 7) {\n\t\t\t\tif (dataPos === data.length) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Move next input octet to the FIFO buffer\n\t\t\t\tbuf |= data[dataPos++] << bufLen;\n\t\t\t\tbufLen += 8;\n\t\t\t}\n\n\t\t\t// Fetch next septet from the FIFO buffer\n\t\t\tconst digit = buf & 0x7f;\n\n\t\t\tbuf >>= 7;\n\t\t\tbufLen -= 7;\n\t\t\tinDone++;\n\n\t\t\tif (digit % 128 === 27) {\n\t\t\t\t// Escape character\n\t\t\t\tinExt = true;\n\t\t\t} else {\n\t\t\t\t// Determine Unicode code point for this septet\n\t\t\t\tlet c = inExt ? Helper.EXTENDED_TABLE.charCodeAt(digit) || 63 : Helper.ALPHABET_7BIT.charCodeAt(digit);\n\t\t\t\tinExt = false;\n\n\t\t\t\t// If we encountered a high surrogate in the extended table, and next is a low\n\t\t\t\t// surrogate, combine into a single code point.\n\t\t\t\tif ((c & 0xfc00) === 0xd800 && inExt === false && digit + 1 < Helper.EXTENDED_TABLE.length) {\n\t\t\t\t\tconst low = Helper.EXTENDED_TABLE.charCodeAt(digit + 1);\n\t\t\t\t\tif ((low & 0xfc00) === 0xdc00) {\n\t\t\t\t\t\tc = 0x10000 + ((c & 0x03ff) << 10) + (low & 0x03ff);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tret.push(c);\n\t\t\t}\n\n\t\t\t// Do we process all input data\n\t\t\tif (inLen === undefined) {\n\t\t\t\t// If we have only the final (possibly padding) septet and it's empty\n\t\t\t\tif (dataPos === data.length && bufLen === 7 && !buf) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (inDone >= inLen) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Convert collected Unicode code points to string\n\t\t// Use String.fromCodePoint to correctly handle supplementary planes\n\t\treturn String.fromCodePoint(...ret);\n\t}\n\n\t/**\n\t * Encodes a text string into 8-bit hexadecimal PDU format.\n\t *\n\t * @param text The text to encode\n\t * @returns An object containing the length of the encoded text and the result as a hexadecimal string\n\t */\n\tstatic encode8Bit(text: string) {\n\t\tconst buffer = Helper.asciiToUint8Array(text);\n\t\tlet result = '';\n\n\t\tfor (let i = 0; i < buffer.length; i++) {\n\t\t\tresult += Helper.toStringHex(buffer[i]);\n\t\t}\n\n\t\treturn { length: buffer.length, result };\n\t}\n\n\t/**\n\t * Encodes a text string into 7-bit hexadecimal PDU format.\n\t *\n\t * @param text The text to encode\n\t * @param alignBits The number of bits for alignment, if needed\n\t *\n\t * @returns An object containing the length of the encoded text in septets and the result as a hexadecimal string\n\t */\n\tstatic encode7Bit(text: string, alignBits = 0) {\n\t\tlet result = '';\n\t\tlet buf = 0; // Bit buffer, used in FIFO manner\n\t\tlet bufLen = 0; // Amount of buffered bits\n\t\tlet length = 0; // Amount of produced septets\n\n\t\t// Adjust for initial padding if alignBits is specified\n\t\tbufLen = alignBits;\n\n\t\tfor (const symb of text) {\n\t\t\tlet code: number;\n\n\t\t\tif ((code = Helper.ALPHABET_7BIT.indexOf(symb)) !== -1) {\n\t\t\t\t// Normal character\n\t\t\t\tbuf |= code << bufLen;\n\t\t\t\tbufLen += 7;\n\t\t\t\tlength++;\n\t\t\t} else if ((code = Helper.EXTENDED_TABLE.indexOf(symb)) !== -1) {\n\t\t\t\t// ESC character (27), then the actual extended character\n\t\t\t\tbuf |= 27 << bufLen;\n\t\t\t\tbufLen += 7;\n\t\t\t\tlength++;\n\n\t\t\t\t// Then add extended character\n\t\t\t\tbuf |= code << bufLen;\n\t\t\t\tbufLen += 7;\n\t\t\t\tlength++;\n\t\t\t} else {\n\t\t\t\t// Replace unknown with space (' '- code 0x20)\n\t\t\t\tbuf |= 32 << bufLen;\n\t\t\t\tbufLen += 7;\n\t\t\t\tlength++;\n\t\t\t}\n\n\t\t\twhile (bufLen >= 8) {\n\t\t\t\tresult += Helper.toStringHex(buf & 0xff);\n\t\t\t\tbuf >>= 8;\n\t\t\t\tbufLen -= 8;\n\t\t\t}\n\t\t}\n\n\t\t// Write out remaining bits if needed\n\t\tif (bufLen > 0) {\n\t\t\tresult += Helper.toStringHex(buf & 0xff);\n\t\t}\n\n\t\tif (alignBits) {\n\t\t\tlength++; // Add 1 to length to account for the padding septet\n\t\t}\n\n\t\treturn { length, result };\n\t}\n\n\t/**\n\t * Encodes a text string into 16-bit hexadecimal PDU format.\n\t *\n\t * @param text The text to encode\n\t * @returns An object containing the length of the encoded text in septets and the result as a hexadecimal string\n\t */\n\tstatic encode16Bit(text: string) {\n\t\tlet pdu = '';\n\n\t\tfor (let i = 0; i < text.length; i++) {\n\t\t\tconst byte = Helper.order(text.substring(i, i + 1));\n\t\t\tpdu += Helper.toStringHex(byte, 4);\n\t\t}\n\n\t\treturn { length: text.length * 2, result: pdu };\n\t}\n\n\t/**\n\t * Converts a number to a hexadecimal string with optional zero padding.\n\t *\n\t * @param number The number to convert\n\t * @param fill The minimum length of the resulting string, padded with zeros if necessary\n\t * @returns The number as a hexadecimal string\n\t */\n\tstatic toStringHex(number: number, fill = 2) {\n\t\treturn number.toString(16).padStart(fill, '0').toUpperCase();\n\t}\n}\n","import { Helper } from './Helper';\n\n/**\n * Represents the Data Coding Scheme (DCS) of an SMS message.\n *\n * Defines how the message content is encoded, affecting character set selection and special message features.\n * It plays a key role in ensuring that the message content is correctly displayed on the receiving device.\n */\nexport class DCS {\n\t/*\n\t * GSM 03.38 V7.0.0 (1998-07).\n\t */\n\n\tstatic readonly CLASS_NONE = 0x00;\n\tstatic readonly CLASS_MOBILE_EQUIPMENT = 0x01;\n\tstatic readonly CLASS_SIM_SPECIFIC_MESSAGE = 0x02;\n\tstatic readonly CLASS_TERMINAL_EQUIPMENT = 0x03;\n\n\tstatic readonly INDICATION_TYPE_VOICEMAIL = 0x00;\n\tstatic readonly INDICATION_TYPE_FAX = 0x01;\n\tstatic readonly INDICATION_TYPE_EMAIL = 0x02;\n\tstatic readonly INDICATION_TYPE_OTHER = 0x03;\n\n\tstatic readonly ALPHABET_DEFAULT = 0x00;\n\tstatic readonly ALPHABET_8BIT = 0x01;\n\tstatic readonly ALPHABET_UCS2 = 0x02; // 16 bit unicode\n\tstatic readonly ALPHABET_RESERVED = 0x03;\n\n\tprivate _encodeGroup: number;\n\tprivate _dataEncoding: number;\n\tprivate _compressedText: boolean;\n\tprivate _textAlphabet: number;\n\tprivate _useMessageClass: boolean;\n\tprivate _classMessage: number;\n\tprivate _discardMessage: boolean;\n\tprivate _storeMessage: boolean;\n\tprivate _storeMessageUCS2: boolean;\n\tprivate _dataCodingAndMessageClass: boolean;\n\tprivate _messageIndication: number;\n\tprivate _messageIndicationType: number;\n\n\tconstructor(options: DCSOptions = {}) {\n\t\tthis._encodeGroup = options.encodeGroup || 0x00;\n\t\tthis._dataEncoding = options.dataEncoding || 0x00;\n\t\tthis._compressedText = options.compressedText || false;\n\t\tthis._textAlphabet = options.textAlphabet || DCS.ALPHABET_DEFAULT;\n\t\tthis._useMessageClass = options.useMessageClass || false;\n\t\tthis._classMessage = options.classMessage || DCS.CLASS_NONE;\n\t\tthis._discardMessage = options.discardMessage || false;\n\t\tthis._storeMessage = options.storeMessage || false;\n\t\tthis._storeMessageUCS2 = options.storeMessageUCS2 || false;\n\t\tthis._dataCodingAndMessageClass = options.dataCodingAndMessageClass || false;\n\t\tthis._messageIndication = options.messageIndication || 0;\n\t\tthis._messageIndicationType = options.messageIndicationType || 0;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\tget encodeGroup() {\n\t\treturn this._encodeGroup;\n\t}\n\n\tget dataEncoding() {\n\t\treturn this._dataEncoding;\n\t}\n\n\tget compressedText() {\n\t\treturn this._compressedText;\n\t}\n\n\tget dataCodingAndMessageClass() {\n\t\treturn this._dataCodingAndMessageClass;\n\t}\n\n\tget discardMessage() {\n\t\treturn this._discardMessage;\n\t}\n\n\tsetDiscardMessage() {\n\t\tthis._discardMessage = true;\n\t\treturn this;\n\t}\n\n\tget storeMessage() {\n\t\treturn this._storeMessage;\n\t}\n\n\tsetStoreMessage() {\n\t\tthis._storeMessage = true;\n\t\treturn this;\n\t}\n\n\tget storeMessageUCS2() {\n\t\treturn this._storeMessageUCS2;\n\t}\n\n\tsetStoreMessageUCS2() {\n\t\tthis._storeMessageUCS2 = true;\n\t\treturn this;\n\t}\n\n\tget messageIndication() {\n\t\treturn this._messageIndication;\n\t}\n\n\tsetMessageIndication(indication: number) {\n\t\tthis._messageIndication = 1 & indication;\n\t\treturn this;\n\t}\n\n\tget messageIndicationType() {\n\t\treturn this._messageIndicationType;\n\t}\n\n\tsetMessageIndicationType(type: number) {\n\t\tthis._messageIndicationType = 0x03 & type;\n\n\t\tswitch (this._messageIndicationType) {\n\t\t\tcase DCS.INDICATION_TYPE_VOICEMAIL:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.INDICATION_TYPE_FAX:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.INDICATION_TYPE_EMAIL:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.INDICATION_TYPE_OTHER:\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error('node-pdu: Wrong indication type!');\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tget textTextCompressed() {\n\t\treturn this._compressedText;\n\t}\n\n\tsetTextCompressed(compressed = true) {\n\t\tthis._compressedText = compressed;\n\t\treturn this;\n\t}\n\n\tget textAlphabet() {\n\t\treturn this._textAlphabet;\n\t}\n\n\tsetTextAlphabet(alphabet: number) {\n\t\tthis._textAlphabet = 0x03 & alphabet;\n\n\t\tswitch (this._textAlphabet) {\n\t\t\tcase DCS.ALPHABET_DEFAULT:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.ALPHABET_8BIT:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.ALPHABET_UCS2:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.ALPHABET_RESERVED:\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error('node-pdu: Wrong alphabet!');\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tget classMessage() {\n\t\treturn this._classMessage;\n\t}\n\n\tsetClass(cls: number) {\n\t\tthis.setUseMessageClass();\n\t\tthis._classMessage = 0x03 & cls;\n\n\t\tswitch (this._classMessage) {\n\t\t\tcase DCS.CLASS_NONE:\n\t\t\t\tthis.setUseMessageClass(false);\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.CLASS_MOBILE_EQUIPMENT:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.CLASS_SIM_SPECIFIC_MESSAGE:\n\t\t\t\tbreak;\n\n\t\t\tcase DCS.CLASS_TERMINAL_EQUIPMENT:\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error('node-pdu: Wrong class type!');\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tget useMessageClass() {\n\t\treturn this._useMessageClass;\n\t}\n\n\tsetUseMessageClass(use = true) {\n\t\tthis._useMessageClass = use;\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\tgetValue() {\n\t\tthis._encodeGroup = 0x00;\n\n\t\t// set data encoding, from alphabet and message class\n\t\tthis._dataEncoding = (this._textAlphabet << 2) | this._classMessage;\n\n\t\t// set message class bit\n\t\tif (this._useMessageClass) {\n\t\t\tthis._encodeGroup |= 1 << 0;\n\t\t}\n\n\t\t// set is compressed bit\n\t\tif (this._compressedText) {\n\t\t\tthis._encodeGroup |= 1 << 1;\n\t\t}\n\n\t\t// change encoding format\n\t\tif (this._discardMessage || this._storeMessage || this._storeMessageUCS2) {\n\t\t\tthis._dataEncoding = 0x00;\n\n\t\t\t// set indication\n\t\t\tif (this._messageIndication) {\n\t\t\t\tthis._dataEncoding |= 1 << 3;\n\n\t\t\t\t// set message indication type\n\t\t\t\tthis._dataEncoding |= this._messageIndicationType;\n\t\t\t}\n\t\t}\n\n\t\t// Discard Message\n\t\tif (this._discardMessage) {\n\t\t\tthis._encodeGroup = 0x0c;\n\t\t}\n\n\t\t// Store Message\n\t\tif (this._storeMessage) {\n\t\t\tthis._encodeGroup = 0x0d;\n\t\t}\n\n\t\t// Store Message UCS2\n\t\tif (this._storeMessageUCS2) {\n\t\t\tthis._encodeGroup = 0x0e;\n\t\t}\n\n\t\t// Data Coding and Message Class\n\t\tif (this._dataCodingAndMessageClass) {\n\t\t\t// set bits to 1\n\t\t\tthis._encodeGroup = 0x0f;\n\n\t\t\t// only class message\n\t\t\tthis._dataEncoding = 0x03 & this._classMessage;\n\n\t\t\t// check encoding\n\t\t\tswitch (this._textAlphabet) {\n\t\t\t\tcase DCS.ALPHABET_8BIT:\n\t\t\t\t\tthis._dataEncoding |= 1 << 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DCS.ALPHABET_DEFAULT:\n\t\t\t\t\t// bit is set to 0\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// return byte value\n\t\treturn ((0x0f & this._encodeGroup) << 4) | (0x0f & this._dataEncoding);\n\t}\n\n\ttoString() {\n\t\treturn Helper.toStringHex(this.getValue());\n\t}\n}\n\nexport type DCSOptions = {\n\tencodeGroup?: number;\n\tdataEncoding?: number;\n\tcompressedText?: boolean;\n\ttextAlphabet?: number;\n\tuseMessageClass?: boolean;\n\tclassMessage?: number;\n\tdiscardMessage?: boolean;\n\tstoreMessage?: boolean;\n\tstoreMessageUCS2?: boolean;\n\tdataCodingAndMessageClass?: boolean;\n\tmessageIndication?: number;\n\tmessageIndicationType?: number;\n};\n","import { Helper } from '../Helper';\n\n/**\n * Represents the header information in a segmented SMS message part.\n *\n * Contains metadata essential for the reassembly of segmented SMS messages, such as part numbering and\n * reference identifiers. It ensures that multipart messages are correctly reconstructed upon receipt.\n */\nexport class Header {\n\tstatic readonly IE_CONCAT_8BIT_REF = 0x00;\n\tstatic readonly IE_CONCAT_16BIT_REF = 0x08;\n\n\tprivate ies: IES[] = [];\n\tprivate concatIeIdx?: number;\n\n\t/**\n\t * Constructs a Header instance.\n\t * @param params The parameters for constructing the Header instance\n\t */\n\tconstructor(params: HeaderParams) {\n\t\tif (Array.isArray(params)) {\n\t\t\t/*\n\t\t\t * NB: This code can be factored out into a separate method if we have\n\t\t\t * a usecase for it.\n\t\t\t */\n\n\t\t\tfor (const ie of params) {\n\t\t\t\tconst buf = Helper.hexToUint8Array(ie.dataHex);\n\n\t\t\t\t// Parse known IEs (e.g. concatenetion)\n\t\t\t\tif (ie.type === Header.IE_CONCAT_8BIT_REF) {\n\t\t\t\t\t// Preserve IE index\n\t\t\t\t\tthis.concatIeIdx = this.ies.length;\n\n\t\t\t\t\tthis.ies.push({\n\t\t\t\t\t\ttype: ie.type,\n\t\t\t\t\t\tdataHex: ie.dataHex,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tmsgRef: buf[0],\n\t\t\t\t\t\t\tmaxMsgNum: buf[1],\n\t\t\t\t\t\t\tmsgSeqNo: buf[2]\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (ie.type === Header.IE_CONCAT_16BIT_REF) {\n\t\t\t\t\t// Preserve IE index\n\t\t\t\t\tthis.concatIeIdx = this.ies.length;\n\n\t\t\t\t\tthis.ies.push({\n\t\t\t\t\t\ttype: ie.type,\n\t\t\t\t\t\tdataHex: ie.dataHex,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tmsgRef: (buf[0] << 8) | buf[1],\n\t\t\t\t\t\t\tmaxMsgNum: buf[2],\n\t\t\t\t\t\t\tmsgSeqNo: buf[3]\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthis.ies.push({\n\t\t\t\t\ttype: ie.type,\n\t\t\t\t\tdataHex: ie.dataHex\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst dataHex = Helper.toStringHex(params.POINTER, 4) + Helper.toStringHex(params.SEGMENTS) + Helper.toStringHex(params.CURRENT);\n\n\t\tthis.ies.push({\n\t\t\ttype: Header.IE_CONCAT_16BIT_REF,\n\t\t\tdataHex: dataHex,\n\t\t\tdata: {\n\t\t\t\tmsgRef: params.POINTER,\n\t\t\t\tmaxMsgNum: params.SEGMENTS,\n\t\t\t\tmsgSeqNo: params.CURRENT\n\t\t\t}\n\t\t});\n\n\t\tthis.concatIeIdx = this.ies.length - 1;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Converts the header information to an object.\n\t *\n\t * This function is useful for serializing the header information, including the message reference number,\n\t * total number of segments, and current segment number. It's particularly useful for diagnostics or\n\t * interfacing with systems that require these details in a structured format.\n\t *\n\t * @returns An object containing the pointer\n\t */\n\ttoJSON() {\n\t\treturn {\n\t\t\tPOINTER: this.getPointer(),\n\t\t\tSEGMENTS: this.getSegments(),\n\t\t\tCURRENT: this.getCurrent()\n\t\t};\n\t}\n\n\t/**\n\t * Calculates the total size of the User Data Header Length (UDHL).\n\t *\n\t * The size is calculated based on the length of all Information Elements (IEs) included in the header.\n\t * This is crucial for correctly encoding and decoding segmented SMS messages.\n\t *\n\t * @returns The total size of the UDHL\n\t */\n\tgetSize() {\n\t\tlet udhl = 0;\n\n\t\tthis.ies.forEach((ie) => {\n\t\t\tudhl += 2 + ie.dataHex.length / 2;\n\t\t});\n\n\t\treturn udhl;\n\t}\n\n\t/**\n\t * Retrieves the type of the concatenation Information Element (IE).\n\t *\n\t * This method checks if there's a known concatenation IE present and returns its type.\n\t * It distinguishes between 8-bit and 16-bit reference numbers for concatenated messages.\n\t *\n\t * @returns The type of the concatenation IE, or undefined if not present\n\t */\n\tgetType() {\n\t\tif (this.concatIeIdx !== undefined) {\n\t\t\treturn this.ies[this.concatIeIdx].type;\n\t\t}\n\n\t\treturn;\n\t}\n\n\t/**\n\t * Gets the size of the pointer (message reference number) in bytes.\n\t *\n\t * The size is determined based on the type of concatenation IE present, reflecting the\n\t * length of the message reference number field.\n\t *\n\t * @returns The size of the pointer in bytes, or 0 if no concatenation IE is present\n\t */\n\tgetPointerSize() {\n\t\tif (this.concatIeIdx !== undefined) {\n\t\t\treturn this.ies[this.concatIeIdx].dataHex.length / 2;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Retrieves the message reference number for the segmented SMS message.\n\t *\n\t * This number is used to correlate all segments of a multi-part SMS message, ensuring\n\t * they can be correctly reassembled upon receipt.\n\t *\n\t * @returns The message reference number, or 0 if no concatenation IE is present\n\t */\n\tgetPointer() {\n\t\tif (this.concatIeIdx !== undefined) {\n\t\t\treturn this.ies[this.concatIeIdx].data?.msgRef;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Gets the total number of segments in the segmented SMS message.\n\t *\n\t * This information is critical for understanding how many parts the message has been\n\t * divided into, enabling correct reassembly.\n\t *\n\t * @returns The total number of segments, or 1 if no concatenation IE is present\n\t */\n\tgetSegments() {\n\t\tif (this.concatIeIdx !== undefined) {\n\t\t\treturn this.ies[this.concatIeIdx].data?.maxMsgNum;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\t/**\n\t * Retrieves the current segment number of this part of the segmented SMS message.\n\t *\n\t * This number indicates the order of the current segment in the sequence of the total\n\t * message parts, aiding in proper reconstruction.\n\t *\n\t * @returns The current segment number, or 1 if no concatenation IE is present\n\t */\n\tgetCurrent() {\n\t\tif (this.concatIeIdx !== undefined) {\n\t\t\treturn this.ies[this.concatIeIdx].data?.msgSeqNo;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\t/**\n\t * Generates a string representation of the User Data Header (UDH).\n\t *\n\t * This method constructs the UDH string by concatenating the encoded lengths and data of all\n\t * Information Elements (IEs), prefixed with the overall UDH length. It's essential for\n\t * encoding the header part of segmented SMS messages.\n\t *\n\t * @returns A string representing the encoded User Data Header\n\t */\n\ttoString() {\n\t\tlet udhl = 0;\n\t\tlet head = '';\n\n\t\tthis.ies.forEach((ie) => {\n\t\t\tudhl += 2 + ie.dataHex.length / 2;\n\t\t\thead += Helper.toStringHex(ie.type) + Helper.toStringHex(ie.dataHex.length / 2) + ie.dataHex;\n\t\t});\n\n\t\treturn Helper.toStringHex(udhl) + head;\n\t}\n}\n\nexport type HeaderParams =\n\t| {\n\t\t\tPOINTER: number;\n\t\t\tSEGMENTS: number;\n\t\t\tCURRENT: number;\n\t  }\n\t| {\n\t\t\ttype: number;\n\t\t\tdataHex: string;\n\t  }[];\n\nexport type IES = {\n\ttype: number;\n\tdataHex: string;\n\tdata?: {\n\t\tmsgRef: number;\n\t\tmaxMsgNum: number;\n\t\tmsgSeqNo: number;\n\t};\n};\n","import type { Deliver } from '../../Deliver';\nimport type { Submit } from '../../Submit';\nimport { Helper } from '../Helper';\nimport type { Header } from './Header';\n\n/**\n * Represents a part of a segmented SMS message.\n *\n * Used for messages that exceed the size limit for a single SMS and must be split. Each part contains\n * a segment of the full message, facilitating the reassembly of the complete message by the recipient.\n */\nexport class Part {\n\treadonly data: string;\n\treadonly size: number;\n\treadonly text: string;\n\treadonly header: Header | null;\n\n\t/**\n\t * Constructs a new Part instance for a segmented SMS message.\n\t *\n\t * @param data The raw data of this message part\n\t * @param size The size of this part, including headers and content\n\t * @param text The decoded text content of this part\n\t * @param header An optional header for concatenated message support\n\t */\n\tconstructor(data: string, size: number, text: string, header?: Header) {\n\t\tthis.data = data;\n\t\tthis.size = size;\n\t\tthis.text = text;\n\t\tthis.header = header || null;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate getPduString(pdu: Deliver | Submit) {\n\t\treturn pdu.getStart();\n\t}\n\n\tprivate getPartSize() {\n\t\treturn Helper.toStringHex(this.size);\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Generates a string representation of this SMS part, suitable for transmission.\n\t *\n\t * This method constructs the PDU string for this part by concatenating the PDU start,\n\t * the size of the part, any headers, and the data content.\n\t *\n\t * @param pdu The PDU (either Deliver or Submit) that this part belongs to.\n\t * @returns A string representing the PDU for this part of the message.\n\t */\n\ttoString(pdu: Deliver | Submit) {\n\t\t// concate pdu, size of part, headers, data\n\t\treturn this.getPduString(pdu) + this.getPartSize() + (this.header ? this.header.toString() : '') + this.data;\n\t}\n}\n","import type { Deliver } from '../../Deliver';\nimport type { Submit } from '../../Submit';\nimport { DCS } from '../DCS';\nimport { Helper } from '../Helper';\nimport { Header } from './Header';\nimport { Part } from './Part';\n\n/**\n * Represents the data content of an SMS message.\n *\n * Holds the actual message content, whether text or binary data. It is central to the purpose of SMS,\n * conveying the intended information from sender to recipient.\n */\nexport class Data {\n\tstatic readonly HEADER_SIZE = 7; // UDHL + UDH\n\n\tprivate _data: string;\n\tprivate _size: number;\n\tprivate _parts: Part[];\n\tprivate _isUnicode: boolean;\n\n\t/**\n\t * Constructs a Data instance.\n\t * @param options An object containing optional parameters for the Data instance\n\t */\n\tconstructor(options: DataOptions = {}) {\n\t\tthis._size = options.size || 0;\n\t\tthis._data = options.data || '';\n\t\tthis._parts = options.parts || [];\n\t\tthis._isUnicode = options.isUnicode || false;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Gets the raw data of the SMS message.\n\t *\n\t * This property holds the actual content of the message, which could be text or binary data,\n\t * depending on how the message was encoded.\n\t *\n\t * @returns The raw data as a string\n\t */\n\tget data() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Retrieves the size of the message data.\n\t *\n\t * The size is determined based on the encoding and content of the message. It reflects the\n\t * number of characters or bytes.\n\t *\n\t * @returns The size of the data\n\t */\n\tget size() {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Provides access to the individual parts of the message.\n\t *\n\t * For longer messages that are split into multiple parts (segments), this getter allows access\n\t * to each part. Each part contains a portion of the message data along with metadata.\n\t *\n\t * @returns An array of Part instances, each representing a segment of the message\n\t */\n\tget parts() {\n\t\treturn this._parts;\n\t}\n\n\t/**\n\t * Indicates whether the message data is encoded using Unicode.\n\t *\n\t * This property is true if the message content includes characters that require Unicode encoding\n\t * (e.g., non-Latin characters). Otherwise, it's false.\n\t *\n\t * @returns A boolean indicating if the message data is Unicode.\n\t */\n\tget isUnicode() {\n\t\treturn this._isUnicode;\n\t}\n\n\t/**\n\t * Sets the data for the SMS message.\n\t *\n\t * This method encodes the provided data string according to the specified PDU type (Deliver or Submit)\n\t * and updates the message parts accordingly. It handles encoding, part splitting, and header preparation.\n\t *\n\t * @param data The new message data as a string\n\t * @param pdu The PDU instance (Deliver or Submit) associated with this data\n\t * @returns The instance of this Data, allowing for method chaining\n\t */\n\tsetData(data: string, pdu: Deliver | Submit) {\n\t\tthis._data = data;\n\n\t\t// encode message\n\t\tthis.checkData();\n\n\t\t// preapre parts\n\t\tthis.prepareParts(pdu);\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate checkData() {\n\t\t// set is unicode to false\n\t\tthis._isUnicode = false;\n\t\t// set zero size\n\t\tthis._size = 0;\n\n\t\t// check message\n\t\tfor (let i = 0; i < this._data.length; i++) {\n\t\t\t// get byte\n\t\t\tconst byte = Helper.order(this._data.substring(i, i + 1));\n\n\t\t\tif (byte > 0xc0) {\n\t\t\t\tthis._isUnicode = true;\n\t\t\t}\n\n\t\t\tthis._size++;\n\t\t}\n\t}\n\n\tprivate prepareParts(pdu: Deliver | Submit) {\n\t\tlet headerSize = Data.HEADER_SIZE;\n\t\tlet max = Helper.limitNormal;\n\n\t\tif (this._isUnicode) {\n\t\t\t// max length sms to unicode\n\t\t\tmax = Helper.limitUnicode;\n\n\t\t\t// can't compress message\n\t\t\tpdu.dataCodingScheme\n\t\t\t\t.setTextCompressed(false) // no compress\n\t\t\t\t.setTextAlphabet(DCS.ALPHABET_UCS2); // type alphabet is UCS2\n\t\t}\n\n\t\t// if message is compressed\n\t\tif (pdu.dataCodingScheme.compressedText) {\n\t\t\tmax = Helper.limitCompress;\n\t\t\theaderSize++;\n\t\t}\n\n\t\tconst parts = this.splitMessage(max - headerSize);\n\t\tconst haveHeader = parts.length > 1;\n\t\tconst uniqID = (Math.random() * 0x10000) | 0;\n\n\t\t// message will be splited, need headers\n\t\tif (haveHeader) {\n\t\t\tpdu.type.setUserDataHeader(1);\n\t\t}\n\n\t\tparts.forEach((text, index) => {\n\t\t\tconst header = haveHeader ? new Header({ SEGMENTS: parts.length, CURRENT: index + 1, POINTER: uniqID }) : undefined;\n\n\t\t\tconst tmp = (() => {\n\t\t\t\tswitch (pdu.dataCodingScheme.textAlphabet) {\n\t\t\t\t\tcase DCS.ALPHABET_DEFAULT:\n\t\t\t\t\t\treturn Helper.encode7Bit(text);\n\n\t\t\t\t\tcase DCS.ALPHABET_8BIT:\n\t\t\t\t\t\treturn Helper.encode8Bit(text);\n\n\t\t\t\t\tcase DCS.ALPHABET_UCS2:\n\t\t\t\t\t\treturn Helper.encode16Bit(text);\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error('node-pdu: Unknown alphabet!');\n\t\t\t\t}\n\t\t\t})();\n\n\t\t\tlet size = tmp.length;\n\t\t\tconst data = tmp.result;\n\n\t\t\tif (haveHeader) {\n\t\t\t\tif (pdu.dataCodingScheme.textAlphabet === DCS.ALPHABET_DEFAULT) {\n\t\t\t\t\t// When using 7bit encoding (ALPHABET_DEFAULT), the UDH must be padded into septets.\n\t\t\t\t\t// 1 byte = 8 bits, so we calculate the UDH size in septets: ceil(bytes * 8 / 7)\n\t\t\t\t\t// This ensures the user data length is correct and no character is lost.\n\t\t\t\t\tsize += Math.ceil((headerSize * 8) / 7);\n\t\t\t\t} else {\n\t\t\t\t\t// For 8bit and UCS2, header size is already in bytes and can be added directly.\n\t\t\t\t\tsize += headerSize;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._parts.push(new Part(data, size, text, header));\n\t\t});\n\t}\n\n\tprivate partExists(part: Part) {\n\t\tfor (const p of this._parts) {\n\t\t\tif (part.header === null || p.header === null) {\n\t\t\t\tthrow new Error('node-pdu: Part is missing a header!');\n\t\t\t}\n\n\t\t\tif (part.header.getPointer() !== p.header.getPointer() || part.header.getSegments() !== p.header.getSegments()) {\n\t\t\t\tthrow new Error('node-pdu: Part from different message!');\n\t\t\t}\n\n\t\t\tif (p.header.getCurrent() === part.header.getCurrent()) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate sortParts() {\n\t\tthis._data = this._parts\n\t\t\t.sort((p1, p2) => (p1.header?.getCurrent() || 1) - (p2.header?.getCurrent() || 1))\n\t\t\t.map((part) => part.text)\n\t\t\t.join('');\n\t}\n\n\tprivate splitMessage(size: number) {\n\t\tconst data = [];\n\n\t\tfor (let i = 0; i < this._data.length; i += size) {\n\t\t\tdata.push(this._data.substring(i, i + size));\n\t\t}\n\n\t\treturn data;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the textual content of the SMS message.\n\t *\n\t * This method decodes the raw data into a readable text format, considering the encoding scheme\n\t * (e.g., GSM 7-bit, UCS-2) used for the message.\n\t *\n\t * @returns The decoded text of the message\n\t */\n\tgetText() {\n\t\treturn this.data;\n\t}\n\n\t/**\n\t * Appends the parts from another PDU to this data instance.\n\t *\n\t * This method is used to combine the parts of another message (Deliver or Submit) into this one,\n\t * effectively concatenating the messages. It ensures parts are added only once and sorts them.\n\t *\n\t * @param pdu The PDU instance (Deliver or Submit) whose parts are to be appended\n\t */\n\tappend(pdu: Deliver | Submit) {\n\t\tpdu.getParts().forEach((part) => {\n\t\t\tif (!this.partExists(part)) {\n\t\t\t\tthis._parts.push(part);\n\t\t\t}\n\t\t});\n\n\t\tthis.sortParts();\n\t}\n}\n\nexport type DataOptions = {\n\tdata?: string;\n\tsize?: number;\n\tparts?: Part[];\n\tisUnicode?: boolean;\n};\n","/**\n * Represents the Protocol Identifier (PID) of an SMS message.\n *\n * Specifies the type or nature of the message, allowing the system to handle it appropriately. It can\n * indicate special types of messages such as voicemail notifications or system messages, among others.\n */\nexport class PID {\n\tstatic readonly PID_ASSIGNED = 0x00; // Assigns bits 0..5 as defined below\n\tstatic readonly PID_GSM_03_40 = 0x01; // See GSM 03.40 TP-PID complete definition\n\tstatic readonly PID_RESERVED = 0x02; // Reserved\n\tstatic readonly PID_SPECIFIC = 0x03; // Assigns bits 0-5 for SC specific use\n\n\tstatic readonly TYPE_IMPLICIT = 0x00; // Implicit\n\tstatic readonly TYPE_TELEX = 0x01; // Telex (or teletex reduced to telex format)\n\tstatic readonly TYPE_TELEFAX = 0x02; // Group 3 telefax\n\tstatic readonly TYPE_VOICE = 0x04; // Voice telephone (i.e. conversion to speech)\n\tstatic readonly TYPE_ERMES = 0x05; // ERMES (European Radio Messaging System)\n\tstatic readonly TYPE_NPS = 0x06; // National Paging system (known to the SC\n\tstatic readonly TYPE_X_400 = 0x11; // Any public X.400-based message handling system\n\tstatic readonly TYPE_IEM = 0x12; // Internet Electronic Mail\n\n\tprivate _pid: number;\n\tprivate _indicates: number;\n\tprivate _type: number;\n\n\t/**\n\t * Constructs a Protocol Identifier (PID) instance.\n\t * @param options An object containing optional parameters for the PID instance\n\t */\n\tconstructor(options: PIDOptions = {}) {\n\t\tthis._pid = options.pid || PID.PID_ASSIGNED;\n\t\tthis._indicates = options.indicates || 0x00;\n\t\tthis._type = options.type || PID.TYPE_IMPLICIT;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the Protocol Identifier (PID) value.\n\t *\n\t * The PID value is crucial for identifying the nature and handling of the SMS message within\n\t * the network. It determines if the message is of a specific type, such as voicemail\n\t * notifications or system messages.\n\t *\n\t * @returns The current PID value\n\t */\n\tget pid() {\n\t\treturn this._pid;\n\t}\n\n\t/**\n\t * Sets the Protocol Identifier (PID) value.\n\t *\n\t * Allows specifying the nature of the SMS message by setting an appropriate PID value. The\n\t * value is masked to ensure it fits the allowed range defined by the protocol.\n\t *\n\t * @param pid The new PID value, which is masked to fit into the allowed range\n\t * @returns The instance of this PID, allowing for method chaining\n\t */\n\tsetPid(pid: number) {\n\t\tthis._pid = 0x03 & pid;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the indicates value.\n\t *\n\t * This value is part of determining how the message should be handled or processed by the\n\t * receiving entity, contributing to the overall interpretation of the PID.\n\t *\n\t * @returns The current indicates value\n\t */\n\tget indicates() {\n\t\treturn this._indicates;\n\t}\n\n\t/**\n\t * Sets the indicates value.\n\t *\n\t * Modifies part of the PID to influence how the SMS message is processed by the network or\n\t * receiving device. The value is masked to ensure it adheres to the expected range.\n\t *\n\t * @param indicates The new indicates value, which is masked to the allowed range\n\t * @returns The instance of this PID, allowing for method chaining\n\t */\n\tsetIndicates(indicates: number) {\n\t\tthis._indicates = 0x01 & indicates;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the type of the SMS message.\n\t *\n\t * The type provides further specification within the PID, defining the exact nature or\n\t * handling instructions for the message, such as whether it's a voice message or an email.\n\t *\n\t * @returns The current type value\n\t */\n\tget type() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Sets the type of the SMS message.\n\t *\n\t * This method allows for detailed specification of the message's nature, affecting how it is\n\t * processed. The type is masked to ensure it complies with the defined protocol specifications.\n\t *\n\t * @param type The new type value, masked to fit the allowed protocol range\n\t * @returns The instance of this PID, allowing for method chaining\n\t */\n\tsetType(type: number) {\n\t\tthis._type = 0x1f & type;\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Computes and returns the combined value of the PID, including its indicates and type parts.\n\t *\n\t * This value is used for encoding the PID field in the SMS message, combining the general PID\n\t * with specific flags for message handling.\n\t *\n\t * @returns The combined PID value as a number\n\t */\n\tgetValue() {\n\t\treturn (this._pid << 6) | (this._indicates << 5) | this._type;\n\t}\n\n\t/**\n\t * Provides a string representation of the PID's combined value.\n\t *\n\t * Useful for logging or debugging, this method returns a string that represents the encoded\n\t * value of the PID, including its general identifier, indicates, and type components.\n\t *\n\t * @returns The PID's combined value as a string\n\t */\n\ttoString() {\n\t\treturn this.getValue().toString();\n\t}\n}\n\nexport type PIDOptions = {\n\tpid?: number;\n\tindicates?: number;\n\ttype?: number;\n};\n","import { Helper } from '../Helper';\n\n/**\n * Defines the Service Centre Address (SCA) format in SMS messages.\n *\n * Specifies the SCA format, crucial for SMS routing and delivery. Types may include international,\n * national, and others, ensuring compatibility across networks.\n */\nexport class SCAType {\n\tstatic readonly TYPE_UNKNOWN = 0x00;\n\tstatic readonly TYPE_INTERNATIONAL = 0x01;\n\tstatic readonly TYPE_NATIONAL = 0x02;\n\tstatic readonly TYPE_ACCEPTER_INTO_NET = 0x03;\n\tstatic readonly TYPE_SUBSCRIBER_NET = 0x04;\n\tstatic readonly TYPE_ALPHANUMERICAL = 0x05;\n\tstatic readonly TYPE_TRIMMED = 0x06;\n\tstatic readonly TYPE_RESERVED = 0x07;\n\n\tstatic readonly PLAN_UNKNOWN = 0x00;\n\tstatic readonly PLAN_ISDN = 0x01;\n\tstatic readonly PLAN_X_121 = 0x02;\n\tstatic readonly PLAN_TELEX = 0x03;\n\tstatic readonly PLAN_NATIONAL = 0x08;\n\tstatic readonly PLAN_INDIVIDUAL = 0x09;\n\tstatic readonly PLAN_ERMES = 0x0a;\n\tstatic readonly PLAN_RESERVED = 0x0f;\n\n\tprivate _type: number;\n\tprivate _plan: number;\n\n\tconstructor(value = 0x91) {\n\t\tthis._type = 0x07 & (value >> 4);\n\t\tthis._plan = 0x0f & value;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the type of the Service Centre Address (SCA).\n\t * The type indicates the format or category of the SCA, such as international, national, or alphanumeric.\n\t *\n\t * @returns The type of the SCA\n\t */\n\tget type() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Sets the type of the Service Centre Address (SCA).\n\t * This method allows updating the type of the SCA, ensuring compatibility and proper routing.\n\t *\n\t * @param type The new type of the SCA\n\t * @returns The instance of this SCAType, allowing for method chaining\n\t */\n\tsetType(type: number) {\n\t\tthis._type = 0x07 & type;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the numbering plan identification of the Service Centre Address (SCA).\n\t * The plan indicates the numbering plan used for the SCA, such as ISDN, national, or individual.\n\t *\n\t * @returns The numbering plan identification of the SCA\n\t */\n\tget plan() {\n\t\treturn this._plan;\n\t}\n\n\t/**\n\t * Sets the numbering plan identification of the Service Centre Address (SCA).\n\t * This method allows updating the numbering plan used for the SCA, ensuring compatibility and proper routing.\n\t *\n\t * @param plan The new numbering plan identification for the SCA\n\t * @returns The instance of this SCAType, allowing for method chaining\n\t */\n\tsetPlan(plan: number) {\n\t\tthis._plan = 0x0f & plan;\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the numerical value representing the SCAType.\n\t * This value is used internally and for PDU encoding.\n\t *\n\t * @returns The numerical value representing the SCAType\n\t */\n\tgetValue() {\n\t\treturn (1 << 7) | (this._type << 4) | this._plan;\n\t}\n\n\t/**\n\t * Converts the SCAType instance to its hexadecimal string representation.\n\t *\n\t * This method converts the SCAType instance to its hexadecimal string representation suitable for\n\t * inclusion in PDUs.\n\t *\n\t * @returns The hexadecimal string representation of the SCAType\n\t */\n\ttoString() {\n\t\treturn Helper.toStringHex(this.getValue());\n\t}\n}\n","import { Helper } from '../Helper';\nimport { SCAType } from './SCAType';\n\n/**\n * Represents the Service Centre Address (SCA) of an SMS message.\n *\n * The address of the SMSC responsible for the delivery of the message. It is crucial for routing the SMS\n * through the correct service center to reach the intended recipient.\n */\nexport class SCA {\n\ttype: SCAType;\n\n\tprivate _isAddress: boolean;\n\tprivate _size = 0x00;\n\tprivate _encoded = '';\n\tprivate _phone: string | null = null;\n\n\tconstructor(isAddress = false, options: SCAOptions = {}) {\n\t\tthis.type = options.type || new SCAType();\n\t\tthis._isAddress = isAddress;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Indicates whether the current instance represents an address.\n\t * @returns True if the instance represents an address; otherwise, false\n\t */\n\tget isAddress() {\n\t\treturn this._isAddress;\n\t}\n\n\t/**\n\t * Retrieves the size of the encoded address.\n\t * The size is calculated based on the encoding scheme used.\n\t *\n\t * @returns The size of the encoded address\n\t */\n\tget size() {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Retrieves the encoded representation of the address.\n\t * The encoding scheme depends on the type of address.\n\t *\n\t * @returns The encoded address as a hexadecimal string\n\t */\n\tget encoded() {\n\t\treturn this._encoded;\n\t}\n\n\t/**\n\t * Retrieves the phone number associated with the address.\n\t * @returns The phone number associated with the address\n\t */\n\tget phone() {\n\t\treturn this._phone;\n\t}\n\n\t/**\n\t * Sets the phone number associated with the address.\n\t *\n\t * This method allows setting the phone number for the address. It also performs\n\t * encoding based on the address type and detects the type of address if requested.\n\t *\n\t * @param phone The phone number to set\n\t * @param detectType Flag indicating whether to detect the address type\n\t * @param SC Flag indicating whether the address is a service center address\n\t *\n\t * @returns The instance of this SCA, allowing for method chaining\n\t */\n\tsetPhone(phone: string, detectType = true, SC = false) {\n\t\tthis._phone = phone.trim();\n\t\tthis._isAddress = !SC;\n\n\t\tif (this._isAddress && detectType) {\n\t\t\tthis.detectScaType(this._phone);\n\t\t}\n\n\t\tif (this.type.type === SCAType.TYPE_ALPHANUMERICAL) {\n\t\t\tconst tmp = Helper.encode7Bit(phone);\n\n\t\t\tthis._size = Math.ceil((tmp.length * 7) / 4); // septets to semi-octets\n\t\t\tthis._encoded = tmp.result;\n\n\t\t\treturn this;\n\t\t}\n\n\t\tconst clear = this._phone.replace(/[^a-c0-9*#]/gi, '');\n\n\t\t// get size\n\t\t// service center address counting by octets OA or DA as length numbers\n\t\tthis._size = SC ? 1 + Math.ceil(clear.length / 2) : clear.length;\n\n\t\tthis._encoded = clear\n\t\t\t.split('')\n\t\t\t.map((s) => SCA.mapFilterEncode(s))\n\t\t\t.join('');\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate detectScaType(phone: string) {\n\t\tconst phoneSpaceless = phone.replace(/^\\s+|\\s+$/g, '');\n\n\t\tif (/\\+\\d+$/.test(phoneSpaceless)) {\n\t\t\tthis._phone = phoneSpaceless.substring(1);\n\t\t\tthis.type.setType(SCAType.TYPE_INTERNATIONAL);\n\t\t\treturn;\n\t\t}\n\n\t\tif (/00\\d+$/.test(phoneSpaceless)) {\n\t\t\tthis._phone = phoneSpaceless.substring(2);\n\t\t\tthis.type.setType(SCAType.TYPE_INTERNATIONAL);\n\t\t\treturn;\n\t\t}\n\n\t\tif (/\\d+$/.test(phoneSpaceless)) {\n\t\t\tthis._phone = phoneSpaceless;\n\t\t\tthis.type.setType(SCAType.TYPE_UNKNOWN);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.type.setType(SCAType.TYPE_ALPHANUMERICAL);\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the offset for the SCA in the PDU.\n\t * The offset indicates the position of the SCA within the PDU.\n\t *\n\t * @returns The offset for the SCA in the PDU\n\t */\n\tgetOffset() {\n\t\treturn !this._size ? 2 : this._size + 4;\n\t}\n\n\t/**\n\t * Converts the SCA instance to a string representation.\n\t *\n\t * This method converts the SCA instance to its string representation suitable for\n\t * inclusion in the PDU.\n\t *\n\t * @returns The string representation of the SCA\n\t */\n\ttoString() {\n\t\tlet str = Helper.toStringHex(this.size);\n\n\t\tif (this.size !== 0) {\n\t\t\tstr += this.type.toString();\n\n\t\t\tif (this.type.type !== SCAType.TYPE_ALPHANUMERICAL) {\n\t\t\t\t// reverse octets\n\t\t\t\tconst l = this.encoded.length;\n\n\t\t\t\tfor (let i = 0; i < l; i += 2) {\n\t\t\t\t\tconst b1 = this.encoded.substring(i, i + 1);\n\t\t\t\t\tconst b2 = i + 1 >= l ? 'F' : this.encoded.substring(i + 1, i + 2);\n\n\t\t\t\t\t// add to pdu\n\t\t\t\t\tstr += b2 + b1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr += this.encoded;\n\t\t\t}\n\t\t}\n\n\t\treturn str;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Static functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Maps and decodes a hexadecimal letter to its corresponding character.\n\t * This method decodes a hexadecimal letter back to its original character value.\n\t *\n\t * @param letter The hexadecimal letter to decode\n\t * @returns The decoded character\n\t */\n\tstatic mapFilterDecode(letter: string) {\n\t\tconst byte = Helper.getByteFromHex(letter);\n\n\t\tswitch (byte) {\n\t\t\tcase 0x0a:\n\t\t\t\treturn '*';\n\t\t\tcase 0x0b:\n\t\t\t\treturn '#';\n\t\t\tcase 0x0c:\n\t\t\t\treturn 'a';\n\t\t\tcase 0x0d:\n\t\t\t\treturn 'b';\n\t\t\tcase 0x0e:\n\t\t\t\treturn 'c';\n\t\t\tdefault:\n\t\t\t\treturn letter;\n\t\t}\n\t}\n\n\t/**\n\t * Maps and encodes a character to its corresponding hexadecimal representation.\n\t * This method encodes a character to its hexadecimal representation.\n\t *\n\t * @param letter The character to encode\n\t * @returns The encoded hexadecimal representation\n\t */\n\tstatic mapFilterEncode(letter: string) {\n\t\tswitch (letter) {\n\t\t\tcase '*':\n\t\t\t\treturn 'A';\n\t\t\tcase '#':\n\t\t\t\treturn 'B';\n\t\t\tcase 'a':\n\t\t\t\treturn 'C';\n\t\t\tcase 'b':\n\t\t\t\treturn 'D';\n\t\t\tcase 'c':\n\t\t\t\treturn 'E';\n\t\t\tdefault:\n\t\t\t\treturn letter;\n\t\t}\n\t}\n}\n\nexport type SCAOptions = {\n\ttype?: SCAType;\n};\n","import { DCS } from './DCS';\nimport { PID } from './PID';\nimport { SCA } from './SCA/SCA';\nimport type { DeliverType } from './Type/DeliverType';\nimport type { ReportType } from './Type/ReportType';\nimport type { SubmitType } from './Type/SubmitType';\n\n/**\n * An abstract base class for Protocol Data Units (PDU) in SMS messaging.\n *\n * Defines the basic structure and functionalities common to all types of PDUs used in the GSM SMS system.\n * This class serves as a foundation for more specific PDU classes like Submit, Deliver, and Report.\n */\nexport abstract class PDU {\n\tabstract type: DeliverType | ReportType | SubmitType;\n\n\tprivate _address: SCA;\n\tprivate _serviceCenterAddress: SCA;\n\tprivate _protocolIdentifier: PID;\n\tprivate _dataCodingScheme: DCS;\n\n\t/**\n\t * Constructs a Protocol Description Unit (PDU) instance.\n\t *\n\t * @param address The address as a string or SCA instance\n\t * @param options An object containing optional parameters for the PDU instance\n\t */\n\tconstructor(address: string | SCA, options: PDUOptions = {}) {\n\t\tthis._address = this.findAddress(address);\n\n\t\tthis._serviceCenterAddress = options.serviceCenterAddress || new SCA(false);\n\t\tthis._protocolIdentifier = options.protocolIdentifier || new PID();\n\t\tthis._dataCodingScheme = options.dataCodingScheme || new DCS();\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Represents the address of the recipient.\n\t * @returns The current address as an SCA instance\n\t */\n\tget address() {\n\t\treturn this._address;\n\t}\n\n\t/**\n\t * Sets the address of the recipient.\n\t *\n\t * This method updates the address for the PDU. It accepts either a string or an SCA instance.\n\t * If a string is provided, it converts it to an SCA instance.\n\t *\n\t * @param address The new address, either as a string or an SCA instance\n\t * @returns The instance of this PDU, allowing for method chaining\n\t */\n\tsetAddress(address: string | SCA) {\n\t\tthis._address = this.findAddress(address);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the Service Center Address (SCA) of the SMS message.\n\t *\n\t * The Service Center Address is used by the GSM network to know where to send the SMS.\n\t *\n\t * @returns The current service center address as an SCA instance\n\t */\n\tget serviceCenterAddress() {\n\t\treturn this._serviceCenterAddress;\n\t}\n\n\t/**\n\t * Sets the Service Center Address (SCA) for the SMS message.\n\t *\n\t * This address is crucial for routing the message through the GSM network. The method accepts\n\t * either an SCA instance directly or a string that will be converted into an SCA.\n\t *\n\t * @param address The new service center address, either as a string or an SCA instance\n\t * @returns The instance of this PDU, allowing for method chaining\n\t */\n\tsetServiceCenterAddress(address: SCA | string) {\n\t\tif (address instanceof SCA) {\n\t\t\tthis._serviceCenterAddress = address;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._serviceCenterAddress.setPhone(address, false, true);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the Protocol Identifier (PID) of the SMS message.\n\t *\n\t * The PID is used to indicate interworking and teleservices. It determines how the message\n\t * should be processed by the receiving entity.\n\t *\n\t * @returns The current protocol identifier as a PID instance\n\t */\n\tget protocolIdentifier() {\n\t\treturn this._protocolIdentifier;\n\t}\n\n\t/**\n\t * Sets the Protocol Identifier (PID) for the SMS message.\n\t *\n\t * This method allows customization of the message's PID, which can affect delivery and processing.\n\t * Only PID instances are accepted to ensure correct format and compatibility.\n\t *\n\t * @param pid The new protocol identifier as a PID instance\n\t * @returns The instance of this PDU, allowing for method chaining\n\t */\n\tsetProtocolIdentifier(pid: PID) {\n\t\tthis._protocolIdentifier = pid;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the Data Coding Scheme (DCS) of the SMS message.\n\t *\n\t * The DCS indicates the data type of the message content (e.g., text, UCS2, etc.) and may\n\t * influence how the message is displayed on the recipient's device.\n\t *\n\t * @returns The current data coding scheme as a DCS instance\n\t */\n\tget dataCodingScheme() {\n\t\treturn this._dataCodingScheme;\n\t}\n\n\t/**\n\t * Sets the Data Coding Scheme (DCS) for the SMS message.\n\t *\n\t * Adjusting the DCS can change how the message content is interpreted and displayed by the\n\t * recipient's device. This method accepts only DCS instances to ensure proper format.\n\t *\n\t * @param dcs The new data coding scheme as a DCS instance\n\t * @returns The instance of this PDU, allowing for method chaining\n\t */\n\tsetDataCodingScheme(dcs: DCS) {\n\t\tthis._dataCodingScheme = dcs;\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate findAddress(address: string | SCA) {\n\t\tif (address instanceof SCA) {\n\t\t\treturn address;\n\t\t}\n\n\t\treturn new SCA().setPhone(address);\n\t}\n}\n\nexport type PDUOptions = {\n\tserviceCenterAddress?: SCA;\n\tprotocolIdentifier?: PID;\n\tdataCodingScheme?: DCS;\n};\n","import { Helper } from './Helper';\n\n/**\n * Represents the Service Centre Time Stamp (SCTS) of an SMS message.\n *\n * Marks the time and date the SMSC received the message, used in delivery reports and incoming\n * messages for timing analysis and record-keeping, providing a temporal reference for the message's handling.\n */\nexport class SCTS {\n\treadonly time: number;\n\treadonly tzOff: number;\n\n\t/**\n\t * Constructs a Service Centre Time Stamp (SCTS) instance.\n\t *\n\t * @param date The date object representing the time and date the message was received\n\t * @param tzOff The time zone offset in minutes, defaults to the local time zone offset if not provided\n\t */\n\tconstructor(date: Date, tzOff?: number) {\n\t\tthis.time = date.getTime() / 1000;\n\t\tthis.tzOff = tzOff || -1 * date.getTimezoneOffset();\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate getDateTime() {\n\t\tconst tzAbs = Math.floor(Math.abs(this.tzOff) / 15); // To quarters of an hour\n\t\tconst x = Math.floor(tzAbs / 10) * 16 + (tzAbs % 10) + (this.tzOff < 0 ? 0x80 : 0x00);\n\n\t\treturn this.getDateWithOffset().toISOString().replace(/[-T:]/g, '').slice(2, 14) + Helper.toStringHex(x);\n\t}\n\n\tprivate getDateWithOffset() {\n\t\treturn new Date(this.time * 1000 + this.tzOff * 60 * 1000);\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Converts the SCTS to an ISO 8601 string format with a custom time zone offset.\n\t *\n\t * This method formats the date and time into an easily readable ISO 8601 format,\n\t * adjusting for the stored time zone offset to reflect the local time at the service centre.\n\t *\n\t * @returns The SCTS as an ISO 8601 formatted string with a custom time zone offset.\n\t */\n\tgetIsoString() {\n\t\tconst datetime = this.getDateWithOffset()\n\t\t\t.toISOString()\n\t\t\t.replace(/.\\d{3}Z$/, '');\n\n\t\tconst offset = Math.abs(this.tzOff / 60)\n\t\t\t.toString()\n\t\t\t.padStart(2, '0');\n\n\t\treturn datetime + (this.tzOff > 0 ? '+' : '-') + offset + ':00';\n\t}\n\n\t/**\n\t * Converts the SCTS to a string representation based on the SMS PDU specifications.\n\t *\n\t * This method formats the service centre time stamp into a semi-octet representation suitable\n\t * for inclusion in a PDU message, converting the date and time components and including the\n\t * time zone in a standardized format.\n\t *\n\t * @returns The SCTS as a string formatted according to the SMS PDU specifications\n\t */\n\ttoString() {\n\t\treturn (this.getDateTime().match(/.{1,2}/g) || []).map((s) => s.split('').reverse().join('')).join('');\n\t}\n}\n","import { Helper } from '../Helper';\n\n/**\n * Represents the abstract base for different types of Protocol Data Units (PDU) in SMS messaging.\n *\n * This abstract class defines the core structure for various SMS PDU types and\n * ensuring standardized handling and processing across different messaging operations.\n */\nexport abstract class PDUType {\n\tabstract messageTypeIndicator: number;\n\n\tstatic readonly SMS_SUBMIT = 0x01;\n\tstatic readonly SMS_DELIVER = 0x00;\n\tstatic readonly SMS_REPORT = 0x02;\n\n\tstatic readonly VPF_NONE = 0x00;\n\tstatic readonly VPF_SIEMENS = 0x01;\n\tstatic readonly VPF_RELATIVE = 0x02;\n\tstatic readonly VPF_ABSOLUTE = 0x03;\n\n\tprivate readonly replyPath: number;\n\tprivate readonly rejectDuplicates: number;\n\tprivate _userDataHeader: number;\n\tprivate _statusReportRequest: number;\n\tprivate _validityPeriodFormat: number;\n\n\t/**\n\t * Constructs a PDUType instance.\n\t * @param params Parameters for configuring the PDUType instance\n\t */\n\tconstructor(params: TypeParams) {\n\t\tthis.replyPath = params.replyPath;\n\t\tthis._userDataHeader = params.userDataHeader;\n\t\tthis._statusReportRequest = params.statusReportRequest;\n\t\tthis._validityPeriodFormat = params.validityPeriodFormat;\n\t\tthis.rejectDuplicates = params.rejectDuplicates;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the User Data Header (UDH) indicator status.\n\t *\n\t * The User Data Header is part of the SMS payload and can contain various control\n\t * information such as concatenated message reference numbers, port numbers for WAP\n\t * Push, and other service indications. This indicator specifies whether UDH is present.\n\t *\n\t * @returns The current status of the User Data Header indicator\n\t */\n\tget userDataHeader() {\n\t\treturn this._userDataHeader;\n\t}\n\n\t/**\n\t * Sets the User Data Header (UDH) indicator.\n\t *\n\t * This method configures the presence of a User Data Header in the SMS message. It is\n\t * primarily used for advanced messaging features such as concatenated SMS or application\n\t * port addressing. The value is masked to ensure it is within valid range.\n\t *\n\t * @param userDataHeader The desired status for the UDH indicator (0 or 1)\n\t * @returns The instance of this PDUType, allowing for method chaining\n\t */\n\tsetUserDataHeader(userDataHeader: number) {\n\t\tthis._userDataHeader = 0x01 & userDataHeader;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the Status Report Request (SRR) status.\n\t *\n\t * The SRR is a feature in SMS that requests the network to send a delivery report\n\t * for the sent message. This indicator specifies whether such a report is requested.\n\t *\n\t * @returns The current status of the Status Report Request indicator\n\t */\n\tget statusReportRequest() {\n\t\treturn this._statusReportRequest;\n\t}\n\n\t/**\n\t * Sets the Status Report Request (SRR) indicator.\n\t *\n\t * This method enables or disables the request for a delivery report for the SMS message.\n\t * It ensures the delivery status can be tracked. The value is masked to ensure it is\n\t * within valid range.\n\t *\n\t * @param srr The desired status for the SRR indicator (0 or 1)\n\t * @returns The instance of this PDUType, allowing for method chaining\n\t */\n\tsetStatusReportRequest(srr: number) {\n\t\tthis._statusReportRequest = 0x01 & srr;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the Validity Period Format (VPF).\n\t *\n\t * The VPF specifies the format of the validity period of the SMS message, dictating how\n\t * long the message should be stored in the network before delivery is attempted. It supports\n\t * several formats including none, relative, and absolute.\n\t *\n\t * @returns The current format of the validity period\n\t */\n\tget validityPeriodFormat() {\n\t\treturn this._validityPeriodFormat;\n\t}\n\n\t/**\n\t * Sets the Validity Period Format (VPF) for the SMS message.\n\t *\n\t * This method configures the time frame in which the SMS should be delivered. It is crucial\n\t * for time-sensitive messages. The value is masked and validated to ensure it corresponds to\n\t * one of the predefined formats. An error is thrown for invalid formats.\n\t *\n\t * @param validityPeriodFormat The desired format for the message validity period\n\t * @returns The instance of this PDUType, allowing for method chaining\n\t */\n\tsetValidityPeriodFormat(validityPeriodFormat: number) {\n\t\tthis._validityPeriodFormat = 0x03 & validityPeriodFormat;\n\n\t\tswitch (this._validityPeriodFormat) {\n\t\t\tcase PDUType.VPF_NONE:\n\t\t\t\tbreak;\n\t\t\tcase PDUType.VPF_SIEMENS:\n\t\t\t\tbreak;\n\t\t\tcase PDUType.VPF_RELATIVE:\n\t\t\t\tbreak;\n\t\t\tcase PDUType.VPF_ABSOLUTE:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('node-pdu: Wrong validity period format!');\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Calculates and returns the overall value of the PDU type based on its components.\n\t *\n\t * This method aggregates the various indicators and settings into a single value, which\n\t * represents the configuration of the PDU type. It is used for generating the final PDU\n\t * string representation.\n\t *\n\t * @returns The aggregated value of the PDU type settings\n\t */\n\tgetValue() {\n\t\treturn (\n\t\t\t((1 & this.replyPath) << 7) |\n\t\t\t((1 & this._userDataHeader) << 6) |\n\t\t\t((1 & this._statusReportRequest) << 5) |\n\t\t\t((3 & this._validityPeriodFormat) << 3) |\n\t\t\t((1 & this.rejectDuplicates) << 2) |\n\t\t\t(3 & this.messageTypeIndicator)\n\t\t);\n\t}\n\n\t/**\n\t * Generates a string representation of the PDU type value.\n\t *\n\t * This method utilizes a helper function to convert the aggregated PDU type value into\n\t * a hexadecimal string. It is useful for logging and debugging purposes to see the\n\t * encoded PDU type.\n\t *\n\t * @returns A hexadecimal string representation of the PDU type value\n\t */\n\ttoString() {\n\t\treturn Helper.toStringHex(this.getValue());\n\t}\n}\n\nexport type TypeParams = {\n\treplyPath: number;\n\tuserDataHeader: number;\n\tstatusReportRequest: number;\n\tvalidityPeriodFormat: number;\n\trejectDuplicates: number;\n};\n","import { PDUType } from './PDUType';\n\n/**\n * Represents the PDU type for an SMS-DELIVER message in GSM SMS messaging.\n */\nexport class DeliverType extends PDUType {\n\treadonly messageTypeIndicator = PDUType.SMS_DELIVER;\n\n\t/**\n\t * Constructs a DeliverType instance.\n\t * @param params Parameters for configuring the DeliverType instance\n\t */\n\tconstructor(params: DeliverParams = {}) {\n\t\tsuper({\n\t\t\treplyPath: params.replyPath ? 1 & params.replyPath : 0,\n\t\t\tuserDataHeader: params.userDataHeader ? 1 & params.userDataHeader : 0,\n\t\t\tstatusReportRequest: params.statusReportRequest ? 1 & params.statusReportRequest : 0,\n\t\t\trejectDuplicates: params.mms ? 1 & params.mms : 0,\n\t\t\tvalidityPeriodFormat: 0x00 // not used\n\t\t});\n\t}\n}\n\nexport type DeliverParams = {\n\treplyPath?: number;\n\tuserDataHeader?: number;\n\tstatusReportRequest?: number;\n\tmms?: number;\n};\n","import { Data } from './utils/Data/Data';\nimport { Helper } from './utils/Helper';\nimport { PDU, type PDUOptions } from './utils/PDU';\nimport type { SCA } from './utils/SCA/SCA';\nimport { SCTS } from './utils/SCTS';\nimport { DeliverType } from './utils/Type/DeliverType';\n\n/**\n * Represents a GSM SMS Deliver PDU.\n *\n * Used for receiving SMS messages. It includes information like the sender's address and the message content,\n * essential for any application or service that needs to process or display incoming text messages to users.\n */\nexport class Deliver extends PDU {\n\tprivate _type: DeliverType;\n\tprivate _data: Data;\n\tprivate _serviceCenterTimeStamp: SCTS;\n\n\t/**\n\t * Constructs a SMS Deliver PDU instance.\n\t *\n\t * @param address The sender's address as a string or an instance of SCA\n\t * @param data The message content as a string or an instance of Data\n\t * @param options An object containing optional parameters for the Deliver instance\n\t */\n\tconstructor(address: string | SCA, data: string | Data, options: DeliverOptions = {}) {\n\t\tsuper(address, options);\n\n\t\tthis._type = options.type || new DeliverType();\n\t\tthis._data = this.findData(data);\n\t\tthis._serviceCenterTimeStamp = options.serviceCenterTimeStamp || new SCTS(this.getDateTime());\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the message type for this Deliver PDU.\n\t *\n\t * This property represents the specific characteristics and parameters related to the delivery of the SMS message,\n\t * such as whether it's a standard message, a status report request, etc.\n\t *\n\t * @returns The current DeliverType instance, defining the message type\n\t */\n\tget type() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Sets the message type for this Deliver PDU.\n\t *\n\t * Allows for specifying the type of SMS deliver message, adjusting its parameters like whether it requests\n\t * a status report, among other options.\n\t *\n\t * @param type The new DeliverType instance to set as the message type\n\t * @returns The instance of this Deliver, allowing for method chaining\n\t */\n\tsetType(type: DeliverType) {\n\t\tthis._type = type;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the data/content of the SMS message.\n\t *\n\t * This property holds the actual message content that was sent, which can be in various formats\n\t * (e.g., plain text, binary data) depending on the data coding scheme.\n\t *\n\t * @returns The current Data instance containing the message content\n\t */\n\tget data() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Sets the data/content of the SMS message.\n\t *\n\t * This method allows the message content to be updated, accepting either a string (which will be\n\t * converted to a Data instance internally) or a Data instance directly.\n\t *\n\t * @param data The new message content, either as a string or a Data instance\n\t * @returns The instance of this Deliver, allowing for method chaining\n\t */\n\tsetData(data: string | Data) {\n\t\tthis._data = this.findData(data);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the timestamp from the service center.\n\t *\n\t * This timestamp represents when the SMS message was received by the service center, providing\n\t * information about the message's delivery time.\n\t *\n\t * @returns The current SCTS (Service Center Time Stamp) instance\n\t */\n\tget serviceCenterTimeStamp() {\n\t\treturn this._serviceCenterTimeStamp;\n\t}\n\n\t/**\n\t * Sets the service center timestamp for the SMS message.\n\t *\n\t * This method updates the timestamp indicating when the message was received by the service center.\n\t * It accepts either a Date object or an SCTS instance. If a Date is provided, it is converted to an SCTS.\n\t *\n\t * @param time The new timestamp, either as a Date or an SCTS instance\n\t * @returns The instance of this Deliver, allowing for method chaining\n\t */\n\tsetServiceCenterTimeStamp(time: Date | SCTS = this.getDateTime()) {\n\t\tif (time instanceof SCTS) {\n\t\t\tthis._serviceCenterTimeStamp = time;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._serviceCenterTimeStamp = new SCTS(time);\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate getDateTime() {\n\t\t// Create Date in the increment of 10 days\n\t\treturn new Date(Date.now() + 864000000);\n\t}\n\n\tprivate findData(data: string | Data) {\n\t\tif (data instanceof Data) {\n\t\t\treturn data;\n\t\t}\n\n\t\treturn new Data().setData(data, this);\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves all parts of the message data.\n\t *\n\t * For messages that are split into multiple parts (e.g., concatenated SMS), this method returns\n\t * all parts as an array.\n\t *\n\t * @returns An array of Data parts representing the message content\n\t */\n\tgetParts() {\n\t\treturn this._data.parts;\n\t}\n\n\t/**\n\t * Retrieves all parts of the message as strings.\n\t *\n\t * This method is useful for concatenated messages, converting each part of the message data\n\t * into a string format based on the current data coding scheme.\n\t *\n\t * @returns An array of strings, each representing a part of the message content\n\t */\n\tgetPartStrings() {\n\t\treturn this._data.parts.map((part) => part.toString(this));\n\t}\n\n\t/**\n\t * Generates a string representation of the start of the PDU.\n\t *\n\t * This method constructs the initial part of the PDU string, including information like the\n\t * service center address, message type, sender's address, protocol identifier, data coding scheme,\n\t * and service center timestamp.\n\t *\n\t * @returns A string representing the start of the PDU\n\t */\n\tgetStart() {\n\t\tlet str = '';\n\n\t\tstr += this.serviceCenterAddress.toString();\n\t\tstr += this._type.toString();\n\t\tstr += this.address.toString();\n\t\tstr += Helper.toStringHex(this.protocolIdentifier.getValue());\n\t\tstr += this.dataCodingScheme.toString();\n\t\tstr += this._serviceCenterTimeStamp.toString();\n\n\t\treturn str;\n\t}\n\n\t/**\n\t * Converts the entire Deliver PDU into a string representation.\n\t *\n\t * This method is intended to provide a complete textual representation of the Deliver PDU,\n\t * including all headers and the message content, formatted according to the PDU protocol.\n\t *\n\t * @returns A string representation of the Deliver PDU\n\t */\n\ttoString() {\n\t\treturn this.getStart();\n\t}\n}\n\nexport type DeliverOptions = PDUOptions & {\n\ttype?: DeliverType;\n\tserviceCenterTimeStamp?: SCTS;\n};\n","import { PDUType } from './PDUType';\n\n/**\n * Represents the PDU type for an SMS-REPORT message in GSM SMS messaging.\n */\nexport class ReportType extends PDUType {\n\treadonly messageTypeIndicator = PDUType.SMS_REPORT;\n\n\t/**\n\t * Constructs a ReportType instance.\n\t * @param params Parameters for configuring the ReportType instance\n\t */\n\tconstructor(params: ReportParams = {}) {\n\t\tsuper({\n\t\t\treplyPath: params.replyPath ? 1 & params.replyPath : 0,\n\t\t\tuserDataHeader: params.userDataHeader ? 1 & params.userDataHeader : 0,\n\t\t\tstatusReportRequest: params.statusReportRequest ? 1 & params.statusReportRequest : 0,\n\t\t\trejectDuplicates: params.mms ? 1 & params.mms : 0,\n\t\t\tvalidityPeriodFormat: 0x00 // not used\n\t\t});\n\t}\n}\n\nexport type ReportParams = {\n\treplyPath?: number;\n\tuserDataHeader?: number;\n\tstatusReportRequest?: number;\n\tmms?: number;\n};\n","import { PDU, type PDUOptions } from './utils/PDU';\nimport type { SCA } from './utils/SCA/SCA';\nimport type { SCTS } from './utils/SCTS';\nimport { ReportType } from './utils/Type/ReportType';\n\n/**\n * Represents a GSM SMS delivery Report PDU.\n *\n * Provides feedback on the delivery status of sent SMS messages, indicating success, failure, or delay.\n * This is crucial for ensuring message reliability in services that require confirmation of message delivery,\n * such as transaction alerts and critical notifications.\n */\nexport class Report extends PDU {\n\tprivate _type: ReportType;\n\tprivate _reference: number;\n\tprivate _dateTime: SCTS;\n\tprivate _discharge: SCTS;\n\n\t/*\n\t * report status\n\t * 0x00 Short message received succesfully\n\t * 0x01 Short message forwarded to the mobile phone, but unable to confirm delivery\n\t * 0x02 Short message replaced by the service center\n\t * 0x20 Congestion\n\t * 0x21 SME busy\n\t * 0x22 No response from SME\n\t * 0x23 Service rejected\n\t * 0x24 Quality of service not available\n\t * 0x25 Error in SME\n\t * 0x40 Remote procedure error\n\t * 0x41 Incompatible destination\n\t * 0x42 Connection rejected by SME\n\t * 0x43 Not obtainable\n\t * 0x44 Quality of service not available\n\t * 0x45 No interworking available\n\t * 0x46 SM validity period expired\n\t * 0x47 SM deleted by originating SME\n\t * 0x48 SM deleted by service center administration\n\t * 0x49 SM does not exist\n\t * 0x60 Congestion\n\t * 0x61 SME busy\n\t * 0x62 No response from SME\n\t * 0x63 Service rejected\n\t * 0x64 Quality of service not available\n\t * 0x65 Error in SME\n\t */\n\tprivate _status: number;\n\n\t/**\n\t * Constructs a Report PDU instance.\n\t *\n\t * @param address The sender's address as a string or an instance of SCA\n\t * @param reference The reference number of the SMS message for which this report is generated\n\t * @param dateTime The original message submission timestamp represented by an SCTS instance\n\t * @param discharge The discharge time indicating the completion of the delivery process, as an SCTS instance\n\t * @param status The status code indicating the outcome of the delivery attempt\n\t * @param options An object containing optional parameters for the Report instance\n\t */\n\tconstructor(address: string | SCA, reference: number, dateTime: SCTS, discharge: SCTS, status: number, options: ReportOptions = {}) {\n\t\tsuper(address, options);\n\n\t\tthis._type = options.type || new ReportType();\n\t\tthis._reference = reference;\n\t\tthis._dateTime = dateTime;\n\t\tthis._discharge = discharge;\n\t\tthis._status = status;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the message type for this Report PDU.\n\t *\n\t * This property indicates the specific type of delivery report, such as whether it's a delivery\n\t * acknowledgment or a failure report, providing context for the reported delivery status.\n\t *\n\t * @returns The current ReportType instance, defining the report type\n\t */\n\tget type() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Sets the message type for this Report PDU.\n\t *\n\t * Allows for specifying the type of delivery report, which impacts the interpretation of the\n\t * report's content and the delivery status it conveys.\n\t *\n\t * @param type The new ReportType instance to set as the report type\n\t * @returns The instance of this Report, allowing for method chaining\n\t */\n\tsetType(type: ReportType) {\n\t\tthis._type = type;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the message reference number.\n\t *\n\t * This number uniquely identifies the SMS message for which this delivery report is generated,\n\t * allowing for correlation between sent messages and their respective delivery reports.\n\t *\n\t * @returns The reference number of the SMS message\n\t */\n\tget reference() {\n\t\treturn this._reference;\n\t}\n\n\t/**\n\t * Sets the message reference number.\n\t *\n\t * Updates the reference number to match the SMS message this delivery report pertains to,\n\t * ensuring accurate identification and tracking of message delivery status.\n\t *\n\t * @param reference The new reference number for the SMS message\n\t * @returns The instance of this Report, allowing for method chaining\n\t */\n\tsetReference(reference: number) {\n\t\tthis._reference = reference;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the original message submission timestamp.\n\t *\n\t * This timestamp represents when the SMS message was originally submitted for delivery,\n\t * providing context for the delivery process and timing.\n\t *\n\t * @returns The SCTS (Service Center Time Stamp) instance representing the submission timestamp\n\t */\n\tget dateTime() {\n\t\treturn this._dateTime;\n\t}\n\n\t/**\n\t * Sets the original message submission timestamp.\n\t *\n\t * Updates the timestamp indicating when the SMS message was submitted, which is useful for\n\t * tracking the duration between message submission and its final delivery status.\n\t *\n\t * @param dateTime The new SCTS instance representing the submission timestamp\n\t * @returns The instance of this Report, allowing for method chaining\n\t */\n\tsetDateTime(dateTime: SCTS) {\n\t\tthis._dateTime = dateTime;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the discharge time of the SMS message.\n\t *\n\t * The discharge time indicates when the message delivery process was completed, whether successfully\n\t * or not, providing precise timing information about the delivery status.\n\t *\n\t * @returns The SCTS (Service Center Time Stamp) instance representing the discharge time\n\t */\n\tget discharge() {\n\t\treturn this._discharge;\n\t}\n\n\t/**\n\t * Sets the discharge time of the SMS message.\n\t *\n\t * Updates the discharge time to accurately reflect when the message delivery process concluded,\n\t * essential for detailed delivery reporting.\n\t *\n\t * @param discharge The new SCTS instance representing the discharge time\n\t * @returns The instance of this Report, allowing for method chaining\n\t */\n\tsetDischarge(discharge: SCTS) {\n\t\tthis._discharge = discharge;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the status of the SMS message delivery.\n\t *\n\t * This status provides detailed information about the outcome of the delivery attempt,\n\t * such as success, failure, or specific error conditions.\n\t *\n\t * @returns The status code representing the delivery outcome\n\t */\n\tget status() {\n\t\treturn this._status;\n\t}\n\n\t/**\n\t * Sets the status of the SMS message delivery.\n\t *\n\t * Updates the delivery status to accurately represent the outcome of the delivery attempt,\n\t * critical for applications requiring confirmation of message delivery.\n\t *\n\t * @param status The new status code indicating the delivery outcome\n\t * @returns The instance of this Report, allowing for method chaining\n\t */\n\tsetStatus(status: number) {\n\t\tthis._status = status;\n\t\treturn this;\n\t}\n}\n\nexport type ReportOptions = PDUOptions & {\n\ttype?: ReportType;\n};\n","import { PDUType } from './PDUType';\n\n/**\n * Represents the PDU type for an SMS-SUBMIT message in GSM SMS messaging.\n */\nexport class SubmitType extends PDUType {\n\treadonly messageTypeIndicator = PDUType.SMS_SUBMIT;\n\n\t/**\n\t * Constructs a SubmitType instance.\n\t * @param params Parameters for configuring the SubmitType instance\n\t */\n\tconstructor(params: SubmitParams = {}) {\n\t\tsuper({\n\t\t\treplyPath: params.replyPath ? 1 & params.replyPath : 0,\n\t\t\tuserDataHeader: params.userDataHeader ? 1 & params.userDataHeader : 0,\n\t\t\tstatusReportRequest: params.statusReportRequest ? 1 & params.statusReportRequest : 0,\n\t\t\tvalidityPeriodFormat: params.validityPeriodFormat ? 3 & params.validityPeriodFormat : 0,\n\t\t\trejectDuplicates: params.rejectDuplicates ? 1 & params.rejectDuplicates : 0\n\t\t});\n\t}\n}\n\nexport type SubmitParams = {\n\treplyPath?: number;\n\tuserDataHeader?: number;\n\tstatusReportRequest?: number;\n\tvalidityPeriodFormat?: number;\n\trejectDuplicates?: number;\n};\n","import { Helper } from './Helper';\nimport type { PDU } from './PDU';\nimport { SCTS } from './SCTS';\nimport { PDUType } from './Type/PDUType';\n\n/**\n * Represents the Validity Period (VP) of an SMS message.\n *\n * Defines how long an SMS is stored at the SMSC before delivery attempts cease. This duration\n * ensures messages remain relevant and can vary from minutes to days based on the sender's preference.\n */\nexport class VP {\n\tstatic readonly PID_ASSIGNED = 0x00;\n\n\tprivate _datetime: Date | null;\n\tprivate _interval: number | null;\n\n\t/**\n\t * Constructs a Validity Period (VP) instance.\n\t * @param options An object containing optional parameters for the VP instance\n\t */\n\tconstructor(options: VPOptions = {}) {\n\t\tthis._datetime = options.datetime || null;\n\t\tthis._interval = options.interval || null;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the datetime set for the Validity Period.\n\t *\n\t * This property represents the exact date and time the SMS should be considered valid.\n\t * If null, it implies that a specific datetime has not been set for this validity period.\n\t *\n\t * @returns The datetime as a Date object or null if not set\n\t */\n\tget dateTime() {\n\t\treturn this._datetime;\n\t}\n\n\t/**\n\t * Sets the datetime for the SMS Validity Period.\n\t *\n\t * This method allows setting a specific date and time until which the SMS is considered valid.\n\t * Can be set using a Date object or a string that can be parsed into a Date.\n\t *\n\t * @param datetime The datetime to set as a Date object or a string representation\n\t * @returns The instance of this VP, allowing for method chaining\n\t */\n\tsetDateTime(datetime: string | Date) {\n\t\tif (datetime instanceof Date) {\n\t\t\tthis._datetime = datetime;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._datetime = new Date(Date.parse(datetime));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the interval set for the Validity Period.\n\t *\n\t * This property represents the duration in seconds for which the SMS should be considered valid.\n\t * If null, it implies that a specific interval has not been set for this validity period.\n\t *\n\t * @returns The interval in seconds or null if not set\n\t */\n\tget interval() {\n\t\treturn this._interval;\n\t}\n\n\t/**\n\t * Sets the interval for the SMS Validity Period.\n\t *\n\t * This method allows setting a specific duration in seconds until which the SMS is considered valid.\n\t * It's an alternative to setting a specific datetime.\n\t *\n\t * @param interval The interval in seconds to set for the validity period\n\t * @returns The instance of this VP, allowing for method chaining\n\t */\n\tsetInterval(interval: number) {\n\t\tthis._interval = interval;\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Converts the Validity Period to a PDU string representation.\n\t *\n\t * This method generates a string suitable for inclusion in a PDU, based on the validity period's format.\n\t * It can handle both absolute and relative formats and adjusts the PDU's validity period format accordingly.\n\t * This is critical for ensuring that the SMS's validity period is correctly interpreted by the SMSC.\n\t *\n\t * @param pdu The PDU instance to which this validity period belongs\n\t * @returns A string representation of the validity period for inclusion in the PDU\n\t */\n\ttoString(pdu: PDU): string {\n\t\tconst type = pdu.type;\n\n\t\t// absolute value\n\t\tif (this._datetime !== null) {\n\t\t\ttype.setValidityPeriodFormat(PDUType.VPF_ABSOLUTE);\n\n\t\t\treturn new SCTS(this._datetime).toString();\n\t\t}\n\n\t\t// relative value in seconds\n\t\tif (this._interval) {\n\t\t\ttype.setValidityPeriodFormat(PDUType.VPF_RELATIVE);\n\n\t\t\tconst minutes = Math.ceil(this._interval / 60);\n\t\t\tconst hours = Math.ceil(this._interval / 60 / 60);\n\t\t\tconst days = Math.ceil(this._interval / 60 / 60 / 24);\n\t\t\tconst weeks = Math.ceil(this._interval / 60 / 60 / 24 / 7);\n\n\t\t\tif (hours <= 12) {\n\t\t\t\treturn Helper.toStringHex(Math.ceil(minutes / 5) - 1);\n\t\t\t}\n\n\t\t\tif (hours <= 24) {\n\t\t\t\treturn Helper.toStringHex(Math.ceil((minutes - 720) / 30) + 143);\n\t\t\t}\n\n\t\t\tif (hours <= 30 * 24 * 3600) {\n\t\t\t\treturn Helper.toStringHex(days + 166);\n\t\t\t}\n\n\t\t\treturn Helper.toStringHex((weeks > 63 ? 63 : weeks) + 192);\n\t\t}\n\n\t\t// vpf not used\n\t\ttype.setValidityPeriodFormat(PDUType.VPF_NONE);\n\n\t\treturn '';\n\t}\n}\n\nexport type VPOptions = {\n\tdatetime?: Date;\n\tinterval?: number;\n};\n","import { Data } from './utils/Data/Data';\nimport { Helper } from './utils/Helper';\nimport { PDU, type PDUOptions } from './utils/PDU';\nimport type { SCA } from './utils/SCA/SCA';\nimport { SubmitType } from './utils/Type/SubmitType';\nimport { VP } from './utils/VP';\n\n/**\n * Represents a GSM SMS Submit PDU.\n *\n * Facilitates sending SMS messages from devices to the SMSC. It's critical for any application or service\n * that needs to initiate outbound text messages.\n */\nexport class Submit extends PDU {\n\tprivate _type: SubmitType;\n\tprivate _data: Data;\n\tprivate _messageReference: number;\n\tprivate _validityPeriod: VP;\n\n\t/**\n\t * Constructs a SMS Submit PDU instance.\n\t *\n\t * @param address The recipents address as a string or an instance of SCA\n\t * @param data The message content as a string or an instance of Data\n\t * @param options An object containing optional parameters for the Submit instance\n\t */\n\tconstructor(address: string | SCA, data: string | Data, options: SubmitOptions = {}) {\n\t\tsuper(address, options);\n\n\t\tthis._type = options.type || new SubmitType();\n\t\tthis._data = this.findData(data);\n\t\tthis._messageReference = options.messageReference || 0x00;\n\t\tthis._validityPeriod = options.validityPeriod || new VP();\n\t}\n\n\t/*\n\t * ================================================\n\t *                Getter & Setter\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves the message type for this Submit PDU.\n\t *\n\t * This property represents the specific characteristics and parameters related to the submission of the SMS message,\n\t * such as whether it's a standard message, a status report request, etc.\n\t *\n\t * @returns The current SubmitType instance, defining the message type\n\t */\n\tget type() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Sets the message type for this Submit PDU.\n\t *\n\t * Allows for specifying the type of SMS submit message, adjusting its parameters like whether it requests\n\t * a status report, among other options.\n\t *\n\t * @param type The new SubmitType instance to set as the message type\n\t * @returns The instance of this Submit, allowing for method chaining\n\t */\n\tsetType(type: SubmitType) {\n\t\tthis._type = type;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the data/content of the SMS message.\n\t *\n\t * This property holds the actual message content that will be sent, which can be in various formats\n\t * (e.g., plain text, binary data) depending on the data coding scheme.\n\t *\n\t * @returns The current Data instance containing the message content\n\t */\n\tget data() {\n\t\treturn this._data;\n\t}\n\n\t/**\n\t * Sets the data/content of the SMS message.\n\t *\n\t * This method allows the message content to be updated, accepting either a string (which will be\n\t * converted to a Data instance internally) or a Data instance directly.\n\t *\n\t * @param data The new message content, either as a string or a Data instance\n\t * @returns The instance of this Submit, allowing for method chaining\n\t */\n\tsetData(data: string | Data) {\n\t\tthis._data = this.findData(data);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the message reference number for this Submit PDU.\n\t *\n\t * The message reference is a unique identifier for the message, used for tracking purposes and\n\t * to correlate delivery reports with the original messages.\n\t *\n\t * @returns The current message reference number\n\t */\n\tget messageReference() {\n\t\treturn this._messageReference;\n\t}\n\n\t/**\n\t * Sets the message reference number for this Submit PDU.\n\t *\n\t * This method allows setting a custom message reference number for tracking and correlation purposes.\n\t *\n\t * @param messageReference The new message reference number\n\t * @returns The instance of this Submit, allowing for method chaining\n\t */\n\tsetMessageReference(messageReference: number) {\n\t\tthis._messageReference = messageReference;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Retrieves the Validity Period (VP) for the SMS message.\n\t *\n\t * The validity period indicates how long the message is valid for delivery before it expires.\n\t * This can be specified as an absolute date/time or as a time interval from the submission.\n\t *\n\t * @returns The current validity period as a VP instance\n\t */\n\tget validityPeriod() {\n\t\treturn this._validityPeriod;\n\t}\n\n\t/**\n\t * Sets the Validity Period (VP) for the SMS message.\n\t *\n\t * This method allows specifying how long the message is valid for delivery before it expires.\n\t * The validity period can be set as an absolute date/time or as a time interval from the submission.\n\t *\n\t * @param value The new validity period, either as a VP instance, a string (for absolute date/time), or a number (for time interval)\n\t * @returns The instance of this Submit, allowing for method chaining\n\t */\n\tsetValidityPeriod(value: VP | string | number) {\n\t\tif (value instanceof VP) {\n\t\t\tthis._validityPeriod = value;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._validityPeriod = new VP();\n\n\t\tif (typeof value === 'string') {\n\t\t\tthis._validityPeriod.setDateTime(value);\n\t\t} else {\n\t\t\tthis._validityPeriod.setInterval(value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * ================================================\n\t *                Private functions\n\t * ================================================\n\t */\n\n\tprivate findData(data: string | Data) {\n\t\tif (data instanceof Data) {\n\t\t\treturn data;\n\t\t}\n\n\t\treturn new Data().setData(data, this);\n\t}\n\n\t/*\n\t * ================================================\n\t *                 Public functions\n\t * ================================================\n\t */\n\n\t/**\n\t * Retrieves all parts of the message data.\n\t *\n\t * For messages that are split into multiple parts (e.g., concatenated SMS), this method returns\n\t * all parts as an array.\n\t *\n\t * @returns An array of Data parts representing the message content\n\t */\n\tgetParts() {\n\t\treturn this._data.parts;\n\t}\n\n\t/**\n\t * Retrieves all parts of the message as strings.\n\t *\n\t * This method is useful for concatenated messages, converting each part of the message data\n\t * into a string format based on the current data coding scheme.\n\t *\n\t * @returns An array of strings, each representing a part of the message content\n\t */\n\tgetPartStrings() {\n\t\treturn this._data.parts.map((part) => part.toString(this));\n\t}\n\n\t/**\n\t * Generates a string representation of the start of the PDU.\n\t *\n\t * This method constructs the initial part of the PDU string, including information like the\n\t * service center address, message type, message reference number, sender's address, protocol identifier,\n\t * data coding scheme, and validity period.\n\t *\n\t * @returns A string representing the start of the PDU\n\t */\n\tgetStart() {\n\t\tlet str = '';\n\n\t\tstr += this.serviceCenterAddress.toString();\n\t\tstr += this._type.toString();\n\t\tstr += Helper.toStringHex(this._messageReference);\n\t\tstr += this.address.toString();\n\t\tstr += Helper.toStringHex(this.protocolIdentifier.getValue());\n\t\tstr += this.dataCodingScheme.toString();\n\t\tstr += this._validityPeriod.toString(this);\n\n\t\treturn str;\n\t}\n\n\t/**\n\t * Converts the entire Submit PDU into a string representation.\n\t *\n\t * This method is intended to provide a complete textual representation of the Submit PDU,\n\t * including all headers and the message content, formatted according to the PDU protocol.\n\t *\n\t * @returns A string representation of the Submit PDU\n\t */\n\ttoString() {\n\t\treturn this.getParts()\n\t\t\t.map((part) => part.toString(this))\n\t\t\t.join('\\n');\n\t}\n}\n\nexport type SubmitOptions = PDUOptions & {\n\ttype?: SubmitType;\n\tmessageReference?: number;\n\tvalidityPeriod?: VP;\n};\n","import { Data, type DataOptions } from '../../utils/Data/Data';\nimport { Header } from '../../utils/Data/Header';\nimport { Part } from '../../utils/Data/Part';\nimport { DCS } from '../../utils/DCS';\nimport { Helper } from '../../utils/Helper';\nimport type { PDUType } from '../../utils/Type/PDUType';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses the user data portion of a PDU string into a Data object.\n *\n * This function extracts the user data from the PDU string, including any headers, decodes it according to the specified data coding scheme,\n * and constructs a Data object representing the parsed user data.\n *\n * @param type The type of the PDU, determining how the user data is parsed\n * @param dataCodingScheme The data coding scheme used to encode the user data\n * @param userDataLength The length of the user data in octets\n * @param getPduSubstr A function to extract substrings from the PDU string\n *\n * @returns A Data object containing the parsed user data\n */\nexport default function parseData(type: PDUType, dataCodingScheme: DCS, userDataLength: number, getPduSubstr: GetSubstr) {\n\tconst dataOptions: DataOptions = {};\n\n\tif (dataCodingScheme.textAlphabet === DCS.ALPHABET_UCS2) {\n\t\tdataOptions.isUnicode = true;\n\t}\n\n\tconst tmp = parsePart(type, dataCodingScheme, userDataLength, getPduSubstr);\n\n\tdataOptions.data = tmp.text;\n\tdataOptions.size = tmp.size;\n\tdataOptions.parts = [tmp.part];\n\n\treturn new Data(dataOptions);\n}\n\n/**\n * Parses a single part of the user data from a PDU string.\n *\n * This function extracts a part of the user data from the PDU string, including any headers if present,\n * decodes it according to the specified data coding scheme, and constructs a Part object representing the parsed part.\n *\n * @param type The type of the PDU, determining how the user data is parsed\n * @param dataCodingScheme The data coding scheme used to encode the user data\n * @param userDataLength The length of the user data in octets\n * @param getPduSubstr A function to extract substrings from the PDU string\n *\n * @returns An object containing the parsed text, size, and Part object representing the parsed part\n */\nfunction parsePart(type: PDUType, dataCodingScheme: DCS, userDataLength: number, getPduSubstr: GetSubstr) {\n\tlet length = 0;\n\n\tif (dataCodingScheme.textAlphabet === DCS.ALPHABET_DEFAULT) {\n\t\tlength = Math.ceil((userDataLength * 7) / 8); // Convert septets to octets\n\t} else {\n\t\tlength = userDataLength; // Length already in octets\n\t}\n\n\tlet header: Header | undefined;\n\tlet hdrSz = 0; // Header full size: UDHL + UDH\n\n\tif (type.userDataHeader === 1) {\n\t\theader = parseHeader(getPduSubstr);\n\t\thdrSz = 1 + header.getSize(); // UDHL field length + UDH length\n\t\tlength -= hdrSz;\n\t}\n\n\tconst hex = getPduSubstr(length * 2); // Extract Octets x2 chars\n\n\tconst text = (() => {\n\t\tif (dataCodingScheme.textAlphabet === DCS.ALPHABET_DEFAULT) {\n\t\t\tconst inLen = userDataLength - Math.ceil((hdrSz * 8) / 7); // Convert octets to septets\n\t\t\tconst alignBits = Math.ceil((hdrSz * 8) / 7) * 7 - hdrSz * 8;\n\n\t\t\treturn Helper.decode7Bit(hex, inLen, alignBits);\n\t\t}\n\n\t\tif (dataCodingScheme.textAlphabet === DCS.ALPHABET_8BIT) {\n\t\t\treturn Helper.decode8Bit(hex);\n\t\t}\n\n\t\tif (dataCodingScheme.textAlphabet === DCS.ALPHABET_UCS2) {\n\t\t\treturn Helper.decode16Bit(hex);\n\t\t}\n\n\t\tthrow new Error('node-pdu: Unknown alpabet!');\n\t})();\n\n\tconst part = new Part(hex, userDataLength, text, header);\n\n\treturn { text, size: userDataLength, part };\n}\n\n/**\n * Parses the user data header from a PDU string.\n *\n * This function extracts and parses the user data header (if present) from the PDU string,\n * constructing a Header object representing the parsed header information.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n * @returns A Header object representing the parsed user data header\n */\nfunction parseHeader(getPduSubstr: GetSubstr) {\n\tlet udhl = Helper.getByteFromHex(getPduSubstr(2));\n\tconst ies: { type: number; dataHex: string }[] = [];\n\n\t/*\n\t * NB: this parser does not perform the IE data parsing, it only\n\t * splits the header onto separate IE(s) and then create a new Header\n\t * object using the extracted IE(s) as an initializer. IE data parsing\n\t * (if any) will beb performed later by the Header class constructor.\n\t */\n\n\t// Parse IE(s) as TLV\n\twhile (udhl > 0) {\n\t\tconst ieType = Helper.getByteFromHex(getPduSubstr(2));\n\t\tconst ieLen = Helper.getByteFromHex(getPduSubstr(2));\n\n\t\ties.push({ type: ieType, dataHex: getPduSubstr(ieLen * 2) });\n\t\tudhl -= 2 + ieLen;\n\t}\n\n\treturn new Header(ies);\n}\n","import { DCS, type DCSOptions } from '../../utils/DCS';\nimport { Helper } from '../../utils/Helper';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses Data Coding Scheme (DCS) information from a PDU substring extractor.\n * This function extracts and constructs a DCS object from the provided PDU substring.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n * @returns A DCS object representing the parsed Data Coding Scheme information\n */\nexport default function parseDCS(getPduSubstr: GetSubstr) {\n\tconst byte = Helper.getByteFromHex(getPduSubstr(2));\n\tconst dcsOptions: DCSOptions = {};\n\n\tdcsOptions.encodeGroup = 0x0f & (byte >> 4);\n\tdcsOptions.dataEncoding = 0x0f & byte;\n\n\tdcsOptions.textAlphabet = 3 & (dcsOptions.dataEncoding >> 2);\n\tdcsOptions.classMessage = 3 & dcsOptions.dataEncoding;\n\n\tswitch (dcsOptions.encodeGroup) {\n\t\tcase 0x0c:\n\t\t\tdcsOptions.discardMessage = true;\n\t\t\tdcsOptions.textAlphabet = DCS.ALPHABET_DEFAULT;\n\t\t\tbreak;\n\n\t\tcase 0x0d:\n\t\t\tdcsOptions.storeMessage = true;\n\t\t\tbreak;\n\n\t\tcase 0x0e:\n\t\t\tdcsOptions.storeMessageUCS2 = true;\n\t\t\tbreak;\n\n\t\tcase 0x0f:\n\t\t\tdcsOptions.dataCodingAndMessageClass = true;\n\n\t\t\tif (dcsOptions.dataEncoding & (1 << 2)) {\n\t\t\t\tdcsOptions.textAlphabet = DCS.ALPHABET_8BIT;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tdcsOptions.useMessageClass = !!(dcsOptions.encodeGroup & (1 << 0));\n\t\t\tdcsOptions.compressedText = !!(dcsOptions.encodeGroup & (1 << 1));\n\t}\n\n\tif (dcsOptions.discardMessage || dcsOptions.storeMessage || dcsOptions.storeMessageUCS2) {\n\t\tif (dcsOptions.dataEncoding & (1 << 3)) {\n\t\t\tdcsOptions.messageIndication = 1;\n\t\t\tdcsOptions.messageIndicationType = 3 & dcsOptions.dataEncoding;\n\t\t}\n\t}\n\n\treturn new DCS(dcsOptions);\n}\n","import { Helper } from '../../utils/Helper';\nimport { PID } from '../../utils/PID';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses Protocol Identifier (PID) from a PDU string.\n *\n * This function extracts Protocol Identifier information from the provided PDU string\n * and constructs a PID object to represent it.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n * @returns An instance of PID containing parsed information\n */\nexport default function parsePID(getPduSubstr: GetSubstr) {\n\tconst byte = Helper.getByteFromHex(getPduSubstr(2));\n\tconst pid = new PID();\n\n\tpid.setPid(byte >> 6);\n\tpid.setIndicates(byte >> 5);\n\tpid.setType(byte);\n\n\treturn pid;\n}\n","import { Helper } from '../../utils/Helper';\nimport { SCA } from '../../utils/SCA/SCA';\nimport { SCAType } from '../../utils/SCA/SCAType';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses the Service Center Address (SCA) from a given substring extractor.\n * This function extracts and constructs an SCA object from the provided PDU string parts.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n * @param isAddress Indicates whether the SCA represents an address (OA or DA)\n *\n * @returns An instance of SCA containing the parsed SCA information\n */\nexport default function parseSCA(getPduSubstr: GetSubstr, isAddress: boolean) {\n\tconst size = Helper.getByteFromHex(getPduSubstr(2));\n\tconst sca = new SCA(isAddress);\n\tlet octets;\n\n\tif (!size) {\n\t\treturn sca;\n\t}\n\n\t// if is OA or DA then the size in semi-octets\n\tlet adjustedSize = size;\n\tif (isAddress) {\n\t\toctets = Math.ceil(adjustedSize / 2); // to full octets\n\t\t// else size in octets\n\t} else {\n\t\tadjustedSize--;\n\t\toctets = adjustedSize;\n\t\tadjustedSize *= 2; // to semi-octets for future usage\n\t}\n\n\tconst typeValue = Helper.getByteFromHex(getPduSubstr(2));\n\tconst type = new SCAType(typeValue);\n\tconst hex = getPduSubstr(octets * 2);\n\n\tsca.type.setType(type.type);\n\tsca.type.setPlan(type.plan);\n\n\tif (sca.type.type === SCAType.TYPE_ALPHANUMERICAL) {\n\t\tconst septets = Math.floor((adjustedSize * 4) / 7); // semi-octets to septets\n\t\treturn sca.setPhone(Helper.decode7Bit(hex, septets), false, !isAddress);\n\t}\n\n\t// Detect padding char\n\tif (!isAddress && hex.charAt(adjustedSize - 2) === 'F') {\n\t\tadjustedSize--;\n\t}\n\n\tconst phone = (hex.match(/.{1,2}/g) || [])\n\t\t.map((b) => SCA.mapFilterDecode(b).split('').reverse().join(''))\n\t\t.join('')\n\t\t.slice(0, adjustedSize);\n\n\treturn sca.setPhone(phone, false, !isAddress);\n}\n","import { SCTS } from '../../utils/SCTS';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses the Service Center Time Stamp (SCTS) from a given substring extractor.\n * This function extracts and constructs an SCTS object representing the date and time provided in the PDU string.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of SCTS containing the parsed date and time information\n * @throws Throws an error if there are not enough bytes to parse or if parsing fails\n */\nexport default function parseSCTS(getPduSubstr: GetSubstr) {\n\tconst hex = getPduSubstr(14);\n\tconst params: number[] = [];\n\n\tif (!hex) {\n\t\tthrow new Error('node-pdu: Not enough bytes!');\n\t}\n\n\t(hex.match(/.{1,2}/g) || []).map((s) => {\n\t\t// NB: 7'th element (index = 6) is TimeZone and it can be a HEX\n\t\tif ((params.length < 6 && /\\D+/.test(s)) || (params.length === 6 && /[^0-9A-Fa-f]/.test(s))) {\n\t\t\tparams.push(0);\n\t\t\treturn;\n\t\t}\n\n\t\tparams.push(parseInt(s.split('').reverse().join(''), params.length < 6 ? 10 : 16));\n\t});\n\n\tif (params.length < 6) {\n\t\tthrow new Error('node-pdu: Parsing failed!');\n\t}\n\n\t// Parse TimeZone field (see 3GPP TS 23.040 section 9.2.3.11)\n\tlet tzOff = params[6] & 0x7f;\n\ttzOff = (tzOff >> 4) * 10 + (tzOff & 0x0f); // Semi-octet to int\n\ttzOff = tzOff * 15; // Quarters of an hour to minutes\n\n\t// Check sign\n\tif (params[6] & 0x80) {\n\t\ttzOff *= -1;\n\t}\n\n\t// Build ISO8601 datetime\n\tconst isoTime = new Date(\n\t\tDate.UTC(\n\t\t\t// Year\n\t\t\tparams[0] > 70 ? 1900 + params[0] : 2000 + params[0],\n\t\t\t// Month\n\t\t\tparams[1] - 1,\n\t\t\t// Day\n\t\t\tparams[2],\n\t\t\t// Hour\n\t\t\tparams[3],\n\t\t\t// Minute\n\t\t\tparams[4],\n\t\t\t// Secound\n\t\t\tparams[5]\n\t\t)\n\t);\n\n\tisoTime.setUTCMinutes(isoTime.getUTCMinutes() - tzOff);\n\n\treturn new SCTS(isoTime, tzOff);\n}\n","import { Helper } from '../../utils/Helper';\nimport { DeliverType } from '../../utils/Type/DeliverType';\nimport { PDUType } from '../../utils/Type/PDUType';\nimport { ReportType } from '../../utils/Type/ReportType';\nimport { SubmitType } from '../../utils/Type/SubmitType';\nimport type { GetSubstr } from '../index';\n\n/**\n * Parses the PDU type from the provided PDU string.\n * This function extracts and constructs an appropriate PDU type object based on the type indicator byte in the PDU string.\n *\n * @param getPduSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of DeliverType, SubmitType, or ReportType representing the parsed PDU type\n * @throws Throws an error if an unknown SMS type is encountered\n */\nexport default function parseType(getPduSubstr: GetSubstr) {\n\tconst byte = Helper.getByteFromHex(getPduSubstr(2));\n\n\tconst params = {\n\t\treplyPath: 1 & (byte >> 7),\n\t\tuserDataHeader: 1 & (byte >> 6),\n\t\tstatusReportRequest: 1 & (byte >> 5),\n\t\tvalidityPeriodFormat: 3 & (byte >> 3),\n\t\trejectDuplicates: 1 & (byte >> 2),\n\t\tmessageTypeIndicator: 3 & byte\n\t};\n\n\tswitch (3 & byte) {\n\t\tcase PDUType.SMS_DELIVER:\n\t\t\treturn new DeliverType(params);\n\t\tcase PDUType.SMS_SUBMIT:\n\t\t\treturn new SubmitType(params);\n\t\tcase PDUType.SMS_REPORT:\n\t\t\treturn new ReportType(params);\n\t\tdefault:\n\t\t\tthrow new Error('node-pdu: Unknown SMS type!');\n\t}\n}\n","import { Helper } from '../../utils/Helper';\nimport { PDUType } from '../../utils/Type/PDUType';\nimport type { SubmitType } from '../../utils/Type/SubmitType';\nimport { VP } from '../../utils/VP';\nimport type { GetSubstr } from '../index';\nimport parseSCTS from './parseSCTS';\n\n/**\n * Parses the validity period (VP) from a PDU string based on the specified validity period format (VPF).\n * This function is used specifically for parsing the validity period of a Submit type PDU.\n *\n * @param type The SubmitType instance specifying the validity period format (VPF)\n * @param getPduSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of VP representing the parsed validity period\n * @throws Throws an error if an unknown validity period format (VPF) is encountered\n */\nexport default function parseVP(type: SubmitType, getPduSubstr: GetSubstr) {\n\tconst vpf = type.validityPeriodFormat;\n\tconst vp = new VP();\n\n\tif (vpf === PDUType.VPF_NONE) {\n\t\treturn vp;\n\t}\n\n\tif (vpf === PDUType.VPF_ABSOLUTE) {\n\t\tconst scts = parseSCTS(getPduSubstr);\n\t\tvp.setDateTime(scts.getIsoString());\n\n\t\treturn vp;\n\t}\n\n\tif (vpf === PDUType.VPF_RELATIVE) {\n\t\tconst byte = Helper.getByteFromHex(getPduSubstr(2));\n\n\t\tif (byte <= 0x8f) {\n\t\t\tvp.setInterval((byte + 1) * (5 * 60));\n\t\t\treturn vp;\n\t\t}\n\n\t\tif (byte <= 0xa7) {\n\t\t\tvp.setInterval(3600 * 24 * 12 + (byte - 0x8f) * (30 * 60));\n\t\t\treturn vp;\n\t\t}\n\n\t\tif (byte <= 0xc4) {\n\t\t\tvp.setInterval((byte - 0xa7) * (3600 * 24));\n\t\t\treturn vp;\n\t\t}\n\n\t\tvp.setInterval((byte - 0xc4) * (3600 * 24 * 7));\n\t\treturn vp;\n\t}\n\n\tthrow new Error('node-pdu: Unknown validity period format!');\n}\n","import { Deliver } from '../Deliver';\nimport { Report } from '../Report';\nimport { Submit } from '../Submit';\nimport { Helper } from '../utils/Helper';\nimport type { SCA } from '../utils/SCA/SCA';\nimport { DeliverType } from '../utils/Type/DeliverType';\nimport { ReportType } from '../utils/Type/ReportType';\nimport { SubmitType } from '../utils/Type/SubmitType';\n\n// import the parser for the utils\n\nimport parseData from './parseUtils/parseData';\nimport parseDCS from './parseUtils/parseDCS';\nimport parsePID from './parseUtils/parsePID';\nimport parseSCA from './parseUtils/parseSCA';\nimport parseSCTS from './parseUtils/parseSCTS';\nimport parseType from './parseUtils/parseType';\nimport parseVP from './parseUtils/parseVP';\n\nexport type GetSubstr = (length: number) => string;\n\n/**\n * Parses a PDU string into an instance of a PDU object (Deliver, Submit, or Report).\n *\n * This function is a high-level entry point for parsing PDU strings into their corresponding PDU object types\n * based on the detected PDU type within the provided string. It handles the initial parsing steps common to all PDU types,\n * such as the Service Center Address (SCA) and PDU type determination, and then delegates to specific parsing functions\n * based on the PDU type.\n *\n * @param str The PDU string to be parsed\n *\n * @returns An instance of a PDU object (Deliver, Submit, or Report) depending on the PDU type detected in the input string\n * @throws Throws an error if an unknown SMS type is encountered\n */\nexport function parse(str: string) {\n\tlet pduParse = str.toUpperCase();\n\n\tconst getSubstr: GetSubstr = (length: number) => {\n\t\tconst str = pduParse.substring(0, length);\n\t\tpduParse = pduParse.substring(length);\n\n\t\treturn str;\n\t};\n\n\t// The correct order of parsing is important!!!\n\n\tconst sca = parseSCA(getSubstr, false);\n\tconst type = parseType(getSubstr);\n\n\tif (type instanceof DeliverType) {\n\t\treturn parseDeliver(sca, type, getSubstr);\n\t}\n\n\tif (type instanceof ReportType) {\n\t\treturn parseReport(sca, type, getSubstr);\n\t}\n\n\tif (type instanceof SubmitType) {\n\t\treturn parseSubmit(sca, type, getSubstr);\n\t}\n\n\tthrow new Error('node-pdu: Unknown SMS type!');\n}\n\n/**\n * Parses the \"Deliver\" type PDU from a given substring extractor.\n * This function extracts and constructs a Deliver PDU object from the provided PDU string parts.\n *\n * @param serviceCenterAddress The service center address extracted from the PDU string\n * @param type The detected DeliverType instance\n * @param getSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of Deliver containing parsed data\n */\nfunction parseDeliver(serviceCenterAddress: SCA, type: DeliverType, getSubstr: GetSubstr) {\n\t// The correct order of parsing is important!\n\n\tconst address = parseSCA(getSubstr, true);\n\tconst protocolIdentifier = parsePID(getSubstr);\n\tconst dataCodingScheme = parseDCS(getSubstr);\n\tconst serviceCenterTimeStamp = parseSCTS(getSubstr);\n\tconst userDataLength = Helper.getByteFromHex(getSubstr(2));\n\tconst userData = parseData(type, dataCodingScheme, userDataLength, getSubstr);\n\n\treturn new Deliver(address, userData, { serviceCenterAddress, type, protocolIdentifier, dataCodingScheme, serviceCenterTimeStamp });\n}\n\n/**\n * Parses the \"Report\" type PDU from a given substring extractor.\n * This function extracts and constructs a Report PDU object from the provided PDU string parts.\n *\n * @param serviceCenterAddress The service center address extracted from the PDU string\n * @param type The detected ReportType instance\n * @param getSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of Report containing parsed data\n */\nfunction parseReport(serviceCenterAddress: SCA, type: ReportType, getSubstr: GetSubstr) {\n\t// The correct order of parsing is important!\n\n\tconst referencedBytes = Helper.getByteFromHex(getSubstr(2));\n\tconst address = parseSCA(getSubstr, true);\n\tconst timestamp = parseSCTS(getSubstr);\n\tconst discharge = parseSCTS(getSubstr);\n\tconst status = Helper.getByteFromHex(getSubstr(2));\n\n\treturn new Report(address, referencedBytes, timestamp, discharge, status, { serviceCenterAddress, type });\n}\n\n/**\n * Parses the \"Submit\" type PDU from a given substring extractor.\n * This function extracts and constructs a Submit PDU object from the provided PDU string parts.\n *\n * @param serviceCenterAddress The service center address extracted from the PDU string\n * @param type The detected SubmitType instance\n * @param getSubstr A function to extract substrings from the PDU string\n *\n * @returns An instance of Submit containing parsed data\n */\nfunction parseSubmit(serviceCenterAddress: SCA, type: SubmitType, getSubstr: GetSubstr) {\n\t// The correct order of parsing is important!\n\n\tconst messageReference = Helper.getByteFromHex(getSubstr(2));\n\tconst address = parseSCA(getSubstr, true);\n\tconst protocolIdentifier = parsePID(getSubstr);\n\tconst dataCodingScheme = parseDCS(getSubstr);\n\tconst validityPeriod = parseVP(type, getSubstr);\n\tconst userDataLength = Helper.getByteFromHex(getSubstr(2));\n\tconst userData = parseData(type, dataCodingScheme, userDataLength, getSubstr);\n\n\treturn new Submit(address, userData, {\n\t\tserviceCenterAddress,\n\t\ttype,\n\t\tmessageReference,\n\t\tprotocolIdentifier,\n\t\tdataCodingScheme,\n\t\tvalidityPeriod\n\t});\n}\n","export * from './Data/Data';\nexport * from './Data/Header';\nexport * from './Data/Part';\nexport * from './DCS';\nexport * from './Helper';\nexport * from './PDU';\nexport * from './PID';\nexport * from './SCA/SCA';\nexport * from './SCA/SCAType';\nexport * from './SCTS';\nexport * from './Type/DeliverType';\nexport * from './Type/PDUType';\nexport * from './Type/ReportType';\nexport * from './Type/SubmitType';\nexport * from './VP';\n"]}