UNPKG

@d3plus/text

Version:

A smart SVG text box with line wrapping and automatic font size scaling.

1,185 lines (1,148 loc) 111 kB
/* @d3plus/text v3.0.5 A smart SVG text box with line wrapping and automatic font size scaling. Copyright (c) 2025 D3plus - https://d3plus.org @license MIT */ (function (factory) { typeof define === 'function' && define.amd ? define(factory) : factory(); })((function () { 'use strict'; if (typeof window !== "undefined") { (function () { try { if (typeof SVGElement === 'undefined' || Boolean(SVGElement.prototype.innerHTML)) { return; } } catch (e) { return; } function serializeNode (node) { switch (node.nodeType) { case 1: return serializeElementNode(node); case 3: return serializeTextNode(node); case 8: return serializeCommentNode(node); } } function serializeTextNode (node) { return node.textContent.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); } function serializeCommentNode (node) { return '<!--' + node.nodeValue + '-->' } function serializeElementNode (node) { var output = ''; output += '<' + node.tagName; if (node.hasAttributes()) { [].forEach.call(node.attributes, function(attrNode) { output += ' ' + attrNode.name + '="' + attrNode.value + '"'; }); } output += '>'; if (node.hasChildNodes()) { [].forEach.call(node.childNodes, function(childNode) { output += serializeNode(childNode); }); } output += '</' + node.tagName + '>'; return output; } Object.defineProperty(SVGElement.prototype, 'innerHTML', { get: function () { var output = ''; [].forEach.call(this.childNodes, function(childNode) { output += serializeNode(childNode); }); return output; }, set: function (markup) { while (this.firstChild) { this.removeChild(this.firstChild); } try { var dXML = new DOMParser(); dXML.async = false; var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markup + '</svg>'; var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement; [].forEach.call(svgDocElement.childNodes, function(childNode) { this.appendChild(this.ownerDocument.importNode(childNode, true)); }.bind(this)); } catch (e) { throw new Error('Error parsing markup string'); } } }); Object.defineProperty(SVGElement.prototype, 'innerSVG', { get: function () { return this.innerHTML; }, set: function (markup) { this.innerHTML = markup; } }); })(); } })); (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define('@d3plus/text', ['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3plus = {})); })(this, (function (exports) { /** @const fontFamily @desc The default fallback font list used for all text labels as an Array of Strings. @returns {Array<string>} */ const fontFamily = [ "Inter", "Helvetica Neue", "HelveticaNeue", "Helvetica", "Arial", "sans-serif" ]; /** @const fontFamilyStringify @desc Converts an Array of font-family names into a CSS font-family string. @param {String|Array<string>} *family* @returns {String} */ const fontFamilyStringify = (family)=>(typeof family === "string" ? [ family ] : family).map((d)=>d.match(/^[a-z-_]{1,}$/) ? d : `'${d}'`).join(", "); /** @function stringify @desc Coerces value into a String. @param {String} value */ function stringify(value) { if (value === void 0) value = "undefined"; else if (!(typeof value === "string" || value instanceof String)) value = JSON.stringify(value); return value; } // great unicode list: http://asecuritysite.com/coding/asc2 const diacritics = [ [ /[\300-\305]/g, "A" ], [ /[\340-\345]/g, "a" ], [ /[\306]/g, "AE" ], [ /[\346]/g, "ae" ], [ /[\337]/g, "B" ], [ /[\307]/g, "C" ], [ /[\347]/g, "c" ], [ /[\320\336\376]/g, "D" ], [ /[\360]/g, "d" ], [ /[\310-\313]/g, "E" ], [ /[\350-\353]/g, "e" ], [ /[\314-\317]/g, "I" ], [ /[\354-\357]/g, "i" ], [ /[\321]/g, "N" ], [ /[\361]/g, "n" ], [ /[\u014c\322-\326\330]/g, "O" ], [ /[\u014d\362-\366\370]/g, "o" ], [ /[\u016a\331-\334]/g, "U" ], [ /[\u016b\371-\374]/g, "u" ], [ /[\327]/g, "x" ], [ /[\335]/g, "Y" ], [ /[\375\377]/g, "y" ] ]; /** @function strip @desc Removes all non ASCII characters from a string. @param {String} value @param {String} [spacer = "-"] */ function strip(value, spacer = "-") { return `${value}`.replace(/[^A-Za-z0-9\-_\u0621-\u064A]/g, (char)=>{ if (char === " ") return spacer; let ret = false; for(let d = 0; d < diacritics.length; d++){ if (new RegExp(diacritics[d][0]).test(char)) { ret = diacritics[d][1]; break; } } return ret || ""; }); } function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var tinyInflate; var hasRequiredTinyInflate; function requireTinyInflate () { if (hasRequiredTinyInflate) return tinyInflate; hasRequiredTinyInflate = 1; var TINF_OK = 0; var TINF_DATA_ERROR = -3; function Tree() { this.table = new Uint16Array(16); /* table of code length counts */ this.trans = new Uint16Array(288); /* code -> symbol translation table */ } function Data(source, dest) { this.source = source; this.sourceIndex = 0; this.tag = 0; this.bitcount = 0; this.dest = dest; this.destLen = 0; this.ltree = new Tree(); /* dynamic length/symbol tree */ this.dtree = new Tree(); /* dynamic distance tree */ } /* --------------------------------------------------- * * -- uninitialized global data (static structures) -- * * --------------------------------------------------- */ var sltree = new Tree(); var sdtree = new Tree(); /* extra bits and base tables for length codes */ var length_bits = new Uint8Array(30); var length_base = new Uint16Array(30); /* extra bits and base tables for distance codes */ var dist_bits = new Uint8Array(30); var dist_base = new Uint16Array(30); /* special ordering of code length codes */ var clcidx = new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]); /* used by tinf_decode_trees, avoids allocations every call */ var code_tree = new Tree(); var lengths = new Uint8Array(288 + 32); /* ----------------------- * * -- utility functions -- * * ----------------------- */ /* build extra bits and base tables */ function tinf_build_bits_base(bits, base, delta, first) { var i, sum; /* build bits table */ for(i = 0; i < delta; ++i)bits[i] = 0; for(i = 0; i < 30 - delta; ++i)bits[i + delta] = i / delta | 0; /* build base table */ for(sum = first, i = 0; i < 30; ++i){ base[i] = sum; sum += 1 << bits[i]; } } /* build the fixed huffman trees */ function tinf_build_fixed_trees(lt, dt) { var i; /* build fixed length tree */ for(i = 0; i < 7; ++i)lt.table[i] = 0; lt.table[7] = 24; lt.table[8] = 152; lt.table[9] = 112; for(i = 0; i < 24; ++i)lt.trans[i] = 256 + i; for(i = 0; i < 144; ++i)lt.trans[24 + i] = i; for(i = 0; i < 8; ++i)lt.trans[24 + 144 + i] = 280 + i; for(i = 0; i < 112; ++i)lt.trans[24 + 144 + 8 + i] = 144 + i; /* build fixed distance tree */ for(i = 0; i < 5; ++i)dt.table[i] = 0; dt.table[5] = 32; for(i = 0; i < 32; ++i)dt.trans[i] = i; } /* given an array of code lengths, build a tree */ var offs = new Uint16Array(16); function tinf_build_tree(t, lengths, off, num) { var i, sum; /* clear code length count table */ for(i = 0; i < 16; ++i)t.table[i] = 0; /* scan symbol lengths, and sum code length counts */ for(i = 0; i < num; ++i)t.table[lengths[off + i]]++; t.table[0] = 0; /* compute offset table for distribution sort */ for(sum = 0, i = 0; i < 16; ++i){ offs[i] = sum; sum += t.table[i]; } /* create code->symbol translation table (symbols sorted by code) */ for(i = 0; i < num; ++i){ if (lengths[off + i]) t.trans[offs[lengths[off + i]]++] = i; } } /* ---------------------- * * -- decode functions -- * * ---------------------- */ /* get one bit from source stream */ function tinf_getbit(d) { /* check if tag is empty */ if (!d.bitcount--) { /* load next tag */ d.tag = d.source[d.sourceIndex++]; d.bitcount = 7; } /* shift bit out of tag */ var bit = d.tag & 1; d.tag >>>= 1; return bit; } /* read a num bit value from a stream and add base */ function tinf_read_bits(d, num, base) { if (!num) return base; while(d.bitcount < 24){ d.tag |= d.source[d.sourceIndex++] << d.bitcount; d.bitcount += 8; } var val = d.tag & 0xffff >>> 16 - num; d.tag >>>= num; d.bitcount -= num; return val + base; } /* given a data stream and a tree, decode a symbol */ function tinf_decode_symbol(d, t) { while(d.bitcount < 24){ d.tag |= d.source[d.sourceIndex++] << d.bitcount; d.bitcount += 8; } var sum = 0, cur = 0, len = 0; var tag = d.tag; /* get more bits while code value is above sum */ do { cur = 2 * cur + (tag & 1); tag >>>= 1; ++len; sum += t.table[len]; cur -= t.table[len]; }while (cur >= 0) d.tag = tag; d.bitcount -= len; return t.trans[sum + cur]; } /* given a data stream, decode dynamic trees from it */ function tinf_decode_trees(d, lt, dt) { var hlit, hdist, hclen; var i, num, length; /* get 5 bits HLIT (257-286) */ hlit = tinf_read_bits(d, 5, 257); /* get 5 bits HDIST (1-32) */ hdist = tinf_read_bits(d, 5, 1); /* get 4 bits HCLEN (4-19) */ hclen = tinf_read_bits(d, 4, 4); for(i = 0; i < 19; ++i)lengths[i] = 0; /* read code lengths for code length alphabet */ for(i = 0; i < hclen; ++i){ /* get 3 bits code length (0-7) */ var clen = tinf_read_bits(d, 3, 0); lengths[clcidx[i]] = clen; } /* build code length tree */ tinf_build_tree(code_tree, lengths, 0, 19); /* decode code lengths for the dynamic trees */ for(num = 0; num < hlit + hdist;){ var sym = tinf_decode_symbol(d, code_tree); switch(sym){ case 16: /* copy previous code length 3-6 times (read 2 bits) */ var prev = lengths[num - 1]; for(length = tinf_read_bits(d, 2, 3); length; --length){ lengths[num++] = prev; } break; case 17: /* repeat code length 0 for 3-10 times (read 3 bits) */ for(length = tinf_read_bits(d, 3, 3); length; --length){ lengths[num++] = 0; } break; case 18: /* repeat code length 0 for 11-138 times (read 7 bits) */ for(length = tinf_read_bits(d, 7, 11); length; --length){ lengths[num++] = 0; } break; default: /* values 0-15 represent the actual code lengths */ lengths[num++] = sym; break; } } /* build dynamic trees */ tinf_build_tree(lt, lengths, 0, hlit); tinf_build_tree(dt, lengths, hlit, hdist); } /* ----------------------------- * * -- block inflate functions -- * * ----------------------------- */ /* given a stream and two trees, inflate a block of data */ function tinf_inflate_block_data(d, lt, dt) { while(1){ var sym = tinf_decode_symbol(d, lt); /* check for end of block */ if (sym === 256) { return TINF_OK; } if (sym < 256) { d.dest[d.destLen++] = sym; } else { var length, dist, offs; var i; sym -= 257; /* possibly get more bits from length code */ length = tinf_read_bits(d, length_bits[sym], length_base[sym]); dist = tinf_decode_symbol(d, dt); /* possibly get more bits from distance code */ offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist]); /* copy match */ for(i = offs; i < offs + length; ++i){ d.dest[d.destLen++] = d.dest[i]; } } } } /* inflate an uncompressed block of data */ function tinf_inflate_uncompressed_block(d) { var length, invlength; var i; /* unread from bitbuffer */ while(d.bitcount > 8){ d.sourceIndex--; d.bitcount -= 8; } /* get length */ length = d.source[d.sourceIndex + 1]; length = 256 * length + d.source[d.sourceIndex]; /* get one's complement of length */ invlength = d.source[d.sourceIndex + 3]; invlength = 256 * invlength + d.source[d.sourceIndex + 2]; /* check length */ if (length !== (~invlength & 0x0000ffff)) return TINF_DATA_ERROR; d.sourceIndex += 4; /* copy block */ for(i = length; i; --i)d.dest[d.destLen++] = d.source[d.sourceIndex++]; /* make sure we start next block on a byte boundary */ d.bitcount = 0; return TINF_OK; } /* inflate stream from source to dest */ function tinf_uncompress(source, dest) { var d = new Data(source, dest); var bfinal, btype, res; do { /* read final block flag */ bfinal = tinf_getbit(d); /* read block type (2 bits) */ btype = tinf_read_bits(d, 2, 0); /* decompress block */ switch(btype){ case 0: /* decompress uncompressed block */ res = tinf_inflate_uncompressed_block(d); break; case 1: /* decompress block with fixed huffman trees */ res = tinf_inflate_block_data(d, sltree, sdtree); break; case 2: /* decompress block with dynamic huffman trees */ tinf_decode_trees(d, d.ltree, d.dtree); res = tinf_inflate_block_data(d, d.ltree, d.dtree); break; default: res = TINF_DATA_ERROR; } if (res !== TINF_OK) throw new Error('Data error'); }while (!bfinal) if (d.destLen < d.dest.length) { if (typeof d.dest.slice === 'function') return d.dest.slice(0, d.destLen); else return d.dest.subarray(0, d.destLen); } return d.dest; } /* -------------------- * * -- initialization -- * * -------------------- */ /* build fixed huffman trees */ tinf_build_fixed_trees(sltree, sdtree); /* build extra bits and base tables */ tinf_build_bits_base(length_bits, length_base, 4, 3); tinf_build_bits_base(dist_bits, dist_base, 2, 1); /* fix a special case */ length_bits[28] = 0; length_base[28] = 258; tinyInflate = tinf_uncompress; return tinyInflate; } var swap_1; var hasRequiredSwap; function requireSwap () { if (hasRequiredSwap) return swap_1; hasRequiredSwap = 1; const isBigEndian = new Uint8Array(new Uint32Array([ 0x12345678 ]).buffer)[0] === 0x12; const swap = (b, n, m)=>{ let i = b[n]; b[n] = b[m]; b[m] = i; }; const swap32 = (array)=>{ const len = array.length; for(let i = 0; i < len; i += 4){ swap(array, i, i + 3); swap(array, i + 1, i + 2); } }; const swap32LE = (array)=>{ if (isBigEndian) { swap32(array); } }; swap_1 = { swap32LE: swap32LE }; return swap_1; } var unicodeTrie; var hasRequiredUnicodeTrie; function requireUnicodeTrie () { if (hasRequiredUnicodeTrie) return unicodeTrie; hasRequiredUnicodeTrie = 1; const inflate = requireTinyInflate(); const { swap32LE } = requireSwap(); // Shift size for getting the index-1 table offset. const SHIFT_1 = 6 + 5; // Shift size for getting the index-2 table offset. const SHIFT_2 = 5; // Difference between the two shift sizes, // for getting an index-1 offset from an index-2 offset. 6=11-5 const SHIFT_1_2 = SHIFT_1 - SHIFT_2; // Number of index-1 entries for the BMP. 32=0x20 // This part of the index-1 table is omitted from the serialized form. const OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> SHIFT_1; // Number of entries in an index-2 block. 64=0x40 const INDEX_2_BLOCK_LENGTH = 1 << SHIFT_1_2; // Mask for getting the lower bits for the in-index-2-block offset. */ const INDEX_2_MASK = INDEX_2_BLOCK_LENGTH - 1; // Shift size for shifting left the index array values. // Increases possible data size with 16-bit index values at the cost // of compactability. // This requires data blocks to be aligned by DATA_GRANULARITY. const INDEX_SHIFT = 2; // Number of entries in a data block. 32=0x20 const DATA_BLOCK_LENGTH = 1 << SHIFT_2; // Mask for getting the lower bits for the in-data-block offset. const DATA_MASK = DATA_BLOCK_LENGTH - 1; // The part of the index-2 table for U+D800..U+DBFF stores values for // lead surrogate code _units_ not code _points_. // Values for lead surrogate code _points_ are indexed with this portion of the table. // Length=32=0x20=0x400>>SHIFT_2. (There are 1024=0x400 lead surrogates.) const LSCP_INDEX_2_OFFSET = 0x10000 >> SHIFT_2; const LSCP_INDEX_2_LENGTH = 0x400 >> SHIFT_2; // Count the lengths of both BMP pieces. 2080=0x820 const INDEX_2_BMP_LENGTH = LSCP_INDEX_2_OFFSET + LSCP_INDEX_2_LENGTH; // The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. // Length 32=0x20 for lead bytes C0..DF, regardless of SHIFT_2. const UTF8_2B_INDEX_2_OFFSET = INDEX_2_BMP_LENGTH; const UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; // U+0800 is the first code point after 2-byte UTF-8 // The index-1 table, only used for supplementary code points, at offset 2112=0x840. // Variable length, for code points up to highStart, where the last single-value range starts. // Maximum length 512=0x200=0x100000>>SHIFT_1. // (For 0x100000 supplementary code points U+10000..U+10ffff.) // // The part of the index-2 table for supplementary code points starts // after this index-1 table. // // Both the index-1 table and the following part of the index-2 table // are omitted completely if there is only BMP data. const INDEX_1_OFFSET = UTF8_2B_INDEX_2_OFFSET + UTF8_2B_INDEX_2_LENGTH; // The alignment size of a data block. Also the granularity for compaction. const DATA_GRANULARITY = 1 << INDEX_SHIFT; class UnicodeTrie { get(codePoint) { let index; if (codePoint < 0 || codePoint > 0x10ffff) { return this.errorValue; } if (codePoint < 0xd800 || codePoint > 0xdbff && codePoint <= 0xffff) { // Ordinary BMP code point, excluding leading surrogates. // BMP uses a single level lookup. BMP index starts at offset 0 in the index. // data is stored in the index array itself. index = (this.data[codePoint >> SHIFT_2] << INDEX_SHIFT) + (codePoint & DATA_MASK); return this.data[index]; } if (codePoint <= 0xffff) { // Lead Surrogate Code Point. A Separate index section is stored for // lead surrogate code units and code points. // The main index has the code unit data. // For this function, we need the code point data. index = (this.data[LSCP_INDEX_2_OFFSET + (codePoint - 0xd800 >> SHIFT_2)] << INDEX_SHIFT) + (codePoint & DATA_MASK); return this.data[index]; } if (codePoint < this.highStart) { // Supplemental code point, use two-level lookup. index = this.data[INDEX_1_OFFSET - OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> SHIFT_1)]; index = this.data[index + (codePoint >> SHIFT_2 & INDEX_2_MASK)]; index = (index << INDEX_SHIFT) + (codePoint & DATA_MASK); return this.data[index]; } return this.data[this.data.length - DATA_GRANULARITY]; } constructor(data){ const isBuffer = typeof data.readUInt32BE === 'function' && typeof data.slice === 'function'; if (isBuffer || data instanceof Uint8Array) { // read binary format let uncompressedLength; if (isBuffer) { this.highStart = data.readUInt32LE(0); this.errorValue = data.readUInt32LE(4); uncompressedLength = data.readUInt32LE(8); data = data.slice(12); } else { const view = new DataView(data.buffer); this.highStart = view.getUint32(0, true); this.errorValue = view.getUint32(4, true); uncompressedLength = view.getUint32(8, true); data = data.subarray(12); } // double inflate the actual trie data data = inflate(data, new Uint8Array(uncompressedLength)); data = inflate(data, new Uint8Array(uncompressedLength)); // swap bytes from little-endian swap32LE(data); this.data = new Uint32Array(data.buffer); } else { // pre-parsed data ({ data: this.data, highStart: this.highStart, errorValue: this.errorValue } = data); } } } unicodeTrie = UnicodeTrie; return unicodeTrie; } var unicodeTrieExports = requireUnicodeTrie(); var $hJqJp$unicodetrie = /*@__PURE__*/getDefaultExportFromCjs(unicodeTrieExports); var b64 = {}; var hasRequiredB64; function requireB64 () { if (hasRequiredB64) return b64; hasRequiredB64 = 1; (function (exports) { var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; (function(exports1) { var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; var PLUS = '+'.charCodeAt(0); var SLASH = '/'.charCodeAt(0); var NUMBER = '0'.charCodeAt(0); var LOWER = 'a'.charCodeAt(0); var UPPER = 'A'.charCodeAt(0); var PLUS_URL_SAFE = '-'.charCodeAt(0); var SLASH_URL_SAFE = '_'.charCodeAt(0); function decode(elt) { var code = elt.charCodeAt(0); if (code === PLUS || code === PLUS_URL_SAFE) return 62 // '+' ; if (code === SLASH || code === SLASH_URL_SAFE) return 63 // '/' ; if (code < NUMBER) return -1 //no match ; if (code < NUMBER + 10) return code - NUMBER + 26 + 26; if (code < UPPER + 26) return code - UPPER; if (code < LOWER + 26) return code - LOWER + 26; } function b64ToByteArray(b64) { var i, j, l, tmp, placeHolders, arr; if (b64.length % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4'); } // the number of equal signs (place holders) // if there are two placeholders, than the two characters before it // represent one byte // if there is only one, then the three characters before it represent 2 bytes // this is just a cheap hack to not do indexOf twice var len = b64.length; placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0; // base64 is 4/3 + up to two characters of the original data arr = new Arr(b64.length * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars l = placeHolders > 0 ? b64.length - 4 : b64.length; var L = 0; function push(v) { arr[L++] = v; } for(i = 0, j = 0; i < l; i += 4, j += 3){ tmp = decode(b64.charAt(i)) << 18 | decode(b64.charAt(i + 1)) << 12 | decode(b64.charAt(i + 2)) << 6 | decode(b64.charAt(i + 3)); push((tmp & 0xFF0000) >> 16); push((tmp & 0xFF00) >> 8); push(tmp & 0xFF); } if (placeHolders === 2) { tmp = decode(b64.charAt(i)) << 2 | decode(b64.charAt(i + 1)) >> 4; push(tmp & 0xFF); } else if (placeHolders === 1) { tmp = decode(b64.charAt(i)) << 10 | decode(b64.charAt(i + 1)) << 4 | decode(b64.charAt(i + 2)) >> 2; push(tmp >> 8 & 0xFF); push(tmp & 0xFF); } return arr; } function uint8ToBase64(uint8) { var i, extraBytes = uint8.length % 3, output = "", temp, length; function encode(num) { return lookup.charAt(num); } function tripletToBase64(num) { return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F); } // go through the array every three bytes, we'll deal with trailing stuff later for(i = 0, length = uint8.length - extraBytes; i < length; i += 3){ temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; output += tripletToBase64(temp); } // pad the end with zeros, but make sure to not forget the extra bytes switch(extraBytes){ case 1: temp = uint8[uint8.length - 1]; output += encode(temp >> 2); output += encode(temp << 4 & 0x3F); output += '=='; break; case 2: temp = (uint8[uint8.length - 2] << 8) + uint8[uint8.length - 1]; output += encode(temp >> 10); output += encode(temp >> 4 & 0x3F); output += encode(temp << 2 & 0x3F); output += '='; break; } return output; } exports1.toByteArray = b64ToByteArray; exports1.fromByteArray = uint8ToBase64; })(exports); } (b64)); return b64; } var b64Exports = requireB64(); var $hJqJp$base64js = /*@__PURE__*/getDefaultExportFromCjs(b64Exports); var $557adaaeb0c7885f$exports = {}; const $1627905f8be2ef3f$export$fb4028874a74450 = 5; // Non-starters const $1627905f8be2ef3f$export$1bb1140fe1358b00 = 12; // Alphabetic const $1627905f8be2ef3f$export$f3e416a182673355 = 13; // Hebrew Letter const $1627905f8be2ef3f$export$24aa617c849a894a = 16; // Hyphen const $1627905f8be2ef3f$export$a73c4d14459b698d = 17; // Break after const $1627905f8be2ef3f$export$9e5d732f3676a9ba = 22; // Word joiner const $1627905f8be2ef3f$export$1dff41d5c0caca01 = 28; // Regional Indicator const $1627905f8be2ef3f$export$30a74a373318dec6 = 31; // Zero Width Joiner const $1627905f8be2ef3f$export$d710c5f50fc7496a = 33; // Ambiguous (Alphabetic or Ideograph) const $1627905f8be2ef3f$export$66498d28055820a9 = 34; // Break (mandatory) const $1627905f8be2ef3f$export$eb6c6d0b7c8826f2 = 35; // Conditional Japanese Starter const $1627905f8be2ef3f$export$de92be486109a1df = 36; // Carriage return const $1627905f8be2ef3f$export$606cfc2a8896c91f = 37; // Line feed const $1627905f8be2ef3f$export$e51d3c675bb0140d = 38; // Next line const $1627905f8be2ef3f$export$da51c6332ad11d7b = 39; // South-East Asian const $1627905f8be2ef3f$export$bea437c40441867d = 40; // Surrogates const $1627905f8be2ef3f$export$c4c7eecbfed13dc9 = 41; // Space const $1627905f8be2ef3f$export$98e1f8a379849661 = 42; // Unknown const $32627af916ac1b00$export$98f50d781a474745 = 0; // Direct break opportunity const $32627af916ac1b00$export$12ee1f8f5315ca7e = 1; // Indirect break opportunity const $32627af916ac1b00$export$e4965ce242860454 = 2; // Indirect break opportunity for combining marks const $32627af916ac1b00$export$8f14048969dcd45e = 3; // Prohibited break for combining marks const $32627af916ac1b00$export$133eb141bf58aff4 = 4; // Prohibited break const $32627af916ac1b00$export$5bdb8ccbf5c57afc = [ //OP , CL , CP , QU , GL , NS , EX , SY , IS , PR , PO , NU , AL , HL , ID , IN , HY , BA , BB , B2 , ZW , CM , WJ , H2 , H3 , JL , JV , JT , RI , EB , EM , ZWJ , CB [ $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$8f14048969dcd45e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4 ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e ], [ $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$e4965ce242860454, $32627af916ac1b00$export$133eb141bf58aff4, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$98f50d781a474745, $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1b00$export$98f50d781a474745 ], [ $32627af916ac1b00$export$12ee1f8f5315ca7e, $32627af916ac1