@mlightcad/mtext-renderer 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10080,8 +10080,8 @@ class Ih {
10080
10080
  return r.trim();
10081
10081
  }
10082
10082
  }
10083
- const be = 10;
10084
- class Dh {
10083
+ const be = 10, Dh = [13, 10, 0];
10084
+ class _h {
10085
10085
  parse(e) {
10086
10086
  try {
10087
10087
  e.readBytes(4);
@@ -10097,11 +10097,7 @@ class Dh {
10097
10097
  for (const s of n)
10098
10098
  try {
10099
10099
  const o = e.readBytes(s.length);
10100
- if (o.length === s.length) {
10101
- const c = o.indexOf(0);
10102
- let u = 0;
10103
- c >= 0 && c < o.length && (u = c + 1), u < o.length && (a[s.code] = o.subarray(u));
10104
- }
10100
+ o.length === s.length && (a[s.code] = o);
10105
10101
  } catch {
10106
10102
  console.warn(`Failed to read shape data for code ${s.code}`);
10107
10103
  }
@@ -10119,7 +10115,7 @@ class Dh {
10119
10115
  const s = a[0];
10120
10116
  try {
10121
10117
  const o = new TextDecoder().decode(s);
10122
- let c = o.indexOf("\0");
10118
+ let c = s.findIndex((u) => Dh.includes(u));
10123
10119
  c >= 0 && (i.info = o.substring(0, c), c + 3 < s.length && (i.baseUp = s[c + 1], i.baseDown = s[c + 2], i.height = i.baseDown + i.baseUp, i.width = i.height, i.orientation = s[c + 3] === 0 ? "horizontal" : "vertical"));
10124
10120
  } catch {
10125
10121
  console.warn("Failed to parse font info block");
@@ -10140,7 +10136,7 @@ class Dh {
10140
10136
  }
10141
10137
  }
10142
10138
  }
10143
- class _h {
10139
+ class Ph {
10144
10140
  parse(e) {
10145
10141
  try {
10146
10142
  e.readInt16();
@@ -10231,7 +10227,7 @@ class _h {
10231
10227
  return { text: r, pos: n };
10232
10228
  }
10233
10229
  }
10234
- class Ph {
10230
+ let Nh = class {
10235
10231
  parse(e) {
10236
10232
  try {
10237
10233
  const r = e.readInt32();
@@ -10284,16 +10280,15 @@ class Ph {
10284
10280
  };
10285
10281
  }
10286
10282
  }
10287
- }
10288
- let Nh = class {
10283
+ }, Gh = class {
10289
10284
  static createParser(e) {
10290
10285
  switch (e) {
10291
10286
  case fe.SHAPES:
10292
- return new Dh();
10293
- case fe.BIGFONT:
10294
10287
  return new _h();
10295
- case fe.UNIFONT:
10288
+ case fe.BIGFONT:
10296
10289
  return new Ph();
10290
+ case fe.UNIFONT:
10291
+ return new Nh();
10297
10292
  default:
10298
10293
  throw new Error(`Unsupported font type: ${e}`);
10299
10294
  }
@@ -10552,8 +10547,8 @@ class vt {
10552
10547
  return `<svg width="100%" height="100%" viewBox="${i}" preserveAspectRatio="xMidYMid meet">${s}</svg>`;
10553
10548
  }
10554
10549
  }
10555
- const Gh = Math.PI / 18;
10556
- class Hh {
10550
+ const Hh = Math.PI / 18;
10551
+ class zh {
10557
10552
  constructor(e) {
10558
10553
  this.shapeCache = /* @__PURE__ */ new Map(), this.shapeData = /* @__PURE__ */ new Map(), this.fontData = e;
10559
10554
  }
@@ -10829,7 +10824,7 @@ class Hh {
10829
10824
  let p = h & 7;
10830
10825
  p === 0 && (p = 8), s !== 0 && p--;
10831
10826
  const g = Math.PI / 4;
10832
- let x = g * p, v = Gh, F = 1;
10827
+ let x = g * p, v = Hh, F = 1;
10833
10828
  h < 0 && (v = -v, x = -x, F = -1);
10834
10829
  let m = g * d, S = m + x;
10835
10830
  m += g * i / 256 * F, S += g * s / 256 * F;
@@ -10978,7 +10973,7 @@ class Hh {
10978
10973
  return o.add(r), o;
10979
10974
  }
10980
10975
  }
10981
- class zh {
10976
+ let Wh = class {
10982
10977
  /**
10983
10978
  * Creates a new ShxFont instance.
10984
10979
  * @param data - Either raw binary data of the SHX font file (ArrayBuffer) or pre-parsed font data (ShxFontData)
@@ -10986,14 +10981,14 @@ class zh {
10986
10981
  */
10987
10982
  constructor(e) {
10988
10983
  if (e instanceof ArrayBuffer) {
10989
- const r = new le(e), n = new Ih().parse(r), a = Nh.createParser(n.fontType).parse(r);
10984
+ const r = new le(e), n = new Ih().parse(r), a = Gh.createParser(n.fontType).parse(r);
10990
10985
  this.fontData = {
10991
10986
  header: n,
10992
10987
  content: a
10993
10988
  };
10994
10989
  } else
10995
10990
  this.fontData = e;
10996
- this.shapeParser = new Hh(this.fontData);
10991
+ this.shapeParser = new zh(this.fontData);
10997
10992
  }
10998
10993
  /**
10999
10994
  * Return true if this font contains glyph of the specified character. Otherwise, return false.
@@ -11020,11 +11015,11 @@ class zh {
11020
11015
  release() {
11021
11016
  this.shapeParser.release();
11022
11017
  }
11023
- }
11024
- function Wh(t) {
11018
+ };
11019
+ function qh(t) {
11025
11020
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
11026
11021
  }
11027
- function qh(t) {
11022
+ function Vh(t) {
11028
11023
  if (t.__esModule) return t;
11029
11024
  var e = t.default;
11030
11025
  if (typeof e == "function") {
@@ -11044,11 +11039,11 @@ function qh(t) {
11044
11039
  }), r;
11045
11040
  }
11046
11041
  var Li = { exports: {} }, nn = {}, er = {};
11047
- er.byteLength = Yh;
11048
- er.toByteArray = Zh;
11049
- er.fromByteArray = Qh;
11050
- var Be = [], ve = [], Vh = typeof Uint8Array < "u" ? Uint8Array : Array, gr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
11051
- for (var rt = 0, Xh = gr.length; rt < Xh; ++rt)
11042
+ er.byteLength = jh;
11043
+ er.toByteArray = $h;
11044
+ er.fromByteArray = Jh;
11045
+ var Be = [], ve = [], Xh = typeof Uint8Array < "u" ? Uint8Array : Array, gr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
11046
+ for (var rt = 0, Yh = gr.length; rt < Yh; ++rt)
11052
11047
  Be[rt] = gr[rt], ve[gr.charCodeAt(rt)] = rt;
11053
11048
  ve[45] = 62;
11054
11049
  ve[95] = 63;
@@ -11061,30 +11056,30 @@ function Oi(t) {
11061
11056
  var n = r === e ? 0 : 4 - r % 4;
11062
11057
  return [r, n];
11063
11058
  }
11064
- function Yh(t) {
11059
+ function jh(t) {
11065
11060
  var e = Oi(t), r = e[0], n = e[1];
11066
11061
  return (r + n) * 3 / 4 - n;
11067
11062
  }
11068
- function jh(t, e, r) {
11063
+ function Zh(t, e, r) {
11069
11064
  return (e + r) * 3 / 4 - r;
11070
11065
  }
11071
- function Zh(t) {
11072
- var e, r = Oi(t), n = r[0], a = r[1], i = new Vh(jh(t, n, a)), s = 0, o = a > 0 ? n - 4 : n, c;
11066
+ function $h(t) {
11067
+ var e, r = Oi(t), n = r[0], a = r[1], i = new Xh(Zh(t, n, a)), s = 0, o = a > 0 ? n - 4 : n, c;
11073
11068
  for (c = 0; c < o; c += 4)
11074
11069
  e = ve[t.charCodeAt(c)] << 18 | ve[t.charCodeAt(c + 1)] << 12 | ve[t.charCodeAt(c + 2)] << 6 | ve[t.charCodeAt(c + 3)], i[s++] = e >> 16 & 255, i[s++] = e >> 8 & 255, i[s++] = e & 255;
11075
11070
  return a === 2 && (e = ve[t.charCodeAt(c)] << 2 | ve[t.charCodeAt(c + 1)] >> 4, i[s++] = e & 255), a === 1 && (e = ve[t.charCodeAt(c)] << 10 | ve[t.charCodeAt(c + 1)] << 4 | ve[t.charCodeAt(c + 2)] >> 2, i[s++] = e >> 8 & 255, i[s++] = e & 255), i;
11076
11071
  }
11077
- function $h(t) {
11072
+ function Kh(t) {
11078
11073
  return Be[t >> 18 & 63] + Be[t >> 12 & 63] + Be[t >> 6 & 63] + Be[t & 63];
11079
11074
  }
11080
- function Kh(t, e, r) {
11075
+ function Qh(t, e, r) {
11081
11076
  for (var n, a = [], i = e; i < r; i += 3)
11082
- n = (t[i] << 16 & 16711680) + (t[i + 1] << 8 & 65280) + (t[i + 2] & 255), a.push($h(n));
11077
+ n = (t[i] << 16 & 16711680) + (t[i + 1] << 8 & 65280) + (t[i + 2] & 255), a.push(Kh(n));
11083
11078
  return a.join("");
11084
11079
  }
11085
- function Qh(t) {
11080
+ function Jh(t) {
11086
11081
  for (var e, r = t.length, n = r % 3, a = [], i = 16383, s = 0, o = r - n; s < o; s += i)
11087
- a.push(Kh(t, s, s + i > o ? o : s + i));
11082
+ a.push(Qh(t, s, s + i > o ? o : s + i));
11088
11083
  return n === 1 ? (e = t[r - 1], a.push(
11089
11084
  Be[e >> 2] + Be[e << 4 & 63] + "=="
11090
11085
  )) : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], a.push(
@@ -11953,15 +11948,15 @@ cn.prototype.write = function(t) {
11953
11948
  cn.prototype.end = function() {
11954
11949
  return this.decoder.end();
11955
11950
  };
11956
- var Jh = typeof Object.hasOwn > "u" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
11957
- function el(t, e) {
11951
+ var el = typeof Object.hasOwn > "u" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
11952
+ function tl(t, e) {
11958
11953
  for (var r in e)
11959
- Jh(e, r) && (t[r] = e[r]);
11954
+ el(e, r) && (t[r] = e[r]);
11960
11955
  }
11961
- var Mi = el, vr = {}, yr = {}, Nt = { exports: {} };
11956
+ var Mi = tl, vr = {}, yr = {}, Nt = { exports: {} };
11962
11957
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
11963
11958
  var ga;
11964
- function tl() {
11959
+ function rl() {
11965
11960
  return ga || (ga = 1, function(t, e) {
11966
11961
  var r = nn, n = r.Buffer;
11967
11962
  function a(s, o) {
@@ -11993,10 +11988,10 @@ function tl() {
11993
11988
  }(Nt, Nt.exports)), Nt.exports;
11994
11989
  }
11995
11990
  var va;
11996
- function rl() {
11991
+ function nl() {
11997
11992
  if (va) return yr;
11998
11993
  va = 1;
11999
- var t = tl().Buffer, e = t.isEncoding || function(m) {
11994
+ var t = rl().Buffer, e = t.isEncoding || function(m) {
12000
11995
  switch (m = "" + m, m && m.toLowerCase()) {
12001
11996
  case "hex":
12002
11997
  case "utf8":
@@ -12151,7 +12146,7 @@ function rl() {
12151
12146
  return yr;
12152
12147
  }
12153
12148
  var mr, ya;
12154
- function nl() {
12149
+ function al() {
12155
12150
  if (ya) return mr;
12156
12151
  ya = 1;
12157
12152
  var t = Xe.Buffer;
@@ -12172,7 +12167,7 @@ function nl() {
12172
12167
  this.enc = u.encodingName, this.bomAware = u.bomAware, this.enc === "base64" ? this.encoder = i : this.enc === "utf8" ? this.encoder = c : this.enc === "cesu8" && (this.enc = "utf8", this.encoder = s, t.from("eda0bdedb2a9", "hex").toString() !== "💩" && (this.decoder = o, this.defaultCharUnicode = h.defaultCharUnicode));
12173
12168
  }
12174
12169
  e.prototype.encoder = a, e.prototype.decoder = n;
12175
- var r = rl().StringDecoder;
12170
+ var r = nl().StringDecoder;
12176
12171
  function n(u, h) {
12177
12172
  this.decoder = new r(h.enc);
12178
12173
  }
@@ -12238,7 +12233,7 @@ function nl() {
12238
12233
  }, mr;
12239
12234
  }
12240
12235
  var Me = {}, ma;
12241
- function al() {
12236
+ function il() {
12242
12237
  if (ma) return Me;
12243
12238
  ma = 1;
12244
12239
  var t = Xe.Buffer;
@@ -12357,7 +12352,7 @@ function al() {
12357
12352
  return Me;
12358
12353
  }
12359
12354
  var Gt = {}, ba;
12360
- function il() {
12355
+ function sl() {
12361
12356
  if (ba) return Gt;
12362
12357
  ba = 1;
12363
12358
  var t = Xe.Buffer;
@@ -12443,7 +12438,7 @@ function il() {
12443
12438
  return Gt;
12444
12439
  }
12445
12440
  var ft = {}, xa;
12446
- function sl() {
12441
+ function ol() {
12447
12442
  if (xa) return ft;
12448
12443
  xa = 1;
12449
12444
  var t = Xe.Buffer;
@@ -12539,7 +12534,7 @@ function sl() {
12539
12534
  }, ft;
12540
12535
  }
12541
12536
  var br = {}, Sa;
12542
- function ol() {
12537
+ function cl() {
12543
12538
  if (Sa) return br;
12544
12539
  Sa = 1;
12545
12540
  var t = Xe.Buffer;
@@ -12580,7 +12575,7 @@ function ol() {
12580
12575
  }, br;
12581
12576
  }
12582
12577
  var xr, wa;
12583
- function cl() {
12578
+ function ul() {
12584
12579
  return wa || (wa = 1, xr = {
12585
12580
  // Not supported by iconv, not sure why.
12586
12581
  10029: "maccenteuro",
@@ -12729,7 +12724,7 @@ function cl() {
12729
12724
  }), xr;
12730
12725
  }
12731
12726
  var Sr, Fa;
12732
- function ul() {
12727
+ function hl() {
12733
12728
  return Fa || (Fa = 1, Sr = {
12734
12729
  437: "cp437",
12735
12730
  737: "cp737",
@@ -13185,7 +13180,7 @@ function ul() {
13185
13180
  }), Sr;
13186
13181
  }
13187
13182
  var wr = {}, ka;
13188
- function hl() {
13183
+ function ll() {
13189
13184
  if (ka) return wr;
13190
13185
  ka = 1;
13191
13186
  var t = Xe.Buffer;
@@ -13425,7 +13420,7 @@ function hl() {
13425
13420
  }
13426
13421
  return wr;
13427
13422
  }
13428
- const ll = [
13423
+ const fl = [
13429
13424
  [
13430
13425
  "0",
13431
13426
  "\0",
@@ -13970,7 +13965,7 @@ const ll = [
13970
13965
  "fc40",
13971
13966
  "髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"
13972
13967
  ]
13973
- ], fl = [
13968
+ ], pl = [
13974
13969
  [
13975
13970
  "0",
13976
13971
  "\0",
@@ -17668,7 +17663,7 @@ const ll = [
17668
17663
  "8135f437",
17669
17664
  ""
17670
17665
  ]
17671
- ], pl = [
17666
+ ], dl = [
17672
17667
  128,
17673
17668
  165,
17674
17669
  169,
@@ -17876,7 +17871,7 @@ const ll = [
17876
17871
  65375,
17877
17872
  65510,
17878
17873
  65536
17879
- ], dl = [
17874
+ ], gl = [
17880
17875
  0,
17881
17876
  36,
17882
17877
  38,
@@ -18084,10 +18079,10 @@ const ll = [
18084
18079
  39265,
18085
18080
  39394,
18086
18081
  189e3
18087
- ], gl = {
18088
- uChars: pl,
18089
- gbChars: dl
18090
- }, vl = [
18082
+ ], vl = {
18083
+ uChars: dl,
18084
+ gbChars: gl
18085
+ }, yl = [
18091
18086
  [
18092
18087
  "0",
18093
18088
  "\0",
@@ -21190,7 +21185,7 @@ const ll = [
21190
21185
  "f9a1",
21191
21186
  "龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"
21192
21187
  ]
21193
- ], yl = [
21188
+ ], ml = [
21194
21189
  [
21195
21190
  "8740",
21196
21191
  "䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"
@@ -21695,7 +21690,7 @@ const ll = [
21695
21690
  ]
21696
21691
  ];
21697
21692
  var kr, Ca;
21698
- function ml() {
21693
+ function bl() {
21699
21694
  return Ca || (Ca = 1, kr = {
21700
21695
  // == Japanese/ShiftJIS ====================================================
21701
21696
  // All japanese encodings are based on JIS X set of standards:
@@ -21730,7 +21725,7 @@ function ml() {
21730
21725
  shiftjis: {
21731
21726
  type: "_dbcs",
21732
21727
  table: function() {
21733
- return ll;
21728
+ return fl;
21734
21729
  },
21735
21730
  encodeAdd: { "¥": 92, "‾": 126 },
21736
21731
  encodeSkipVals: [{ from: 60736, to: 63808 }]
@@ -21748,7 +21743,7 @@ function ml() {
21748
21743
  eucjp: {
21749
21744
  type: "_dbcs",
21750
21745
  table: function() {
21751
- return fl;
21746
+ return pl;
21752
21747
  },
21753
21748
  encodeAdd: { "¥": 92, "‾": 126 }
21754
21749
  },
@@ -21795,7 +21790,7 @@ function ml() {
21795
21790
  return Fr.concat(Ta);
21796
21791
  },
21797
21792
  gb18030: function() {
21798
- return gl;
21793
+ return vl;
21799
21794
  },
21800
21795
  encodeSkipVals: [128],
21801
21796
  encodeAdd: { "€": 41699 }
@@ -21809,7 +21804,7 @@ function ml() {
21809
21804
  cp949: {
21810
21805
  type: "_dbcs",
21811
21806
  table: function() {
21812
- return vl;
21807
+ return yl;
21813
21808
  }
21814
21809
  },
21815
21810
  cseuckr: "cp949",
@@ -21856,7 +21851,7 @@ function ml() {
21856
21851
  big5hkscs: {
21857
21852
  type: "_dbcs",
21858
21853
  table: function() {
21859
- return Ea.concat(yl);
21854
+ return Ea.concat(ml);
21860
21855
  },
21861
21856
  encodeSkipVals: [
21862
21857
  // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of
@@ -21938,10 +21933,9 @@ function ml() {
21938
21933
  }), kr;
21939
21934
  }
21940
21935
  var Ua;
21941
- function bl() {
21936
+ function xl() {
21942
21937
  return Ua || (Ua = 1, function(t) {
21943
21938
  for (var e = Mi, r = [
21944
- nl(),
21945
21939
  al(),
21946
21940
  il(),
21947
21941
  sl(),
@@ -21949,7 +21943,8 @@ function bl() {
21949
21943
  cl(),
21950
21944
  ul(),
21951
21945
  hl(),
21952
- ml()
21946
+ ll(),
21947
+ bl()
21953
21948
  ], n = 0; n < r.length; n++) {
21954
21949
  var a = r[n];
21955
21950
  e(t, a);
@@ -21957,7 +21952,7 @@ function bl() {
21957
21952
  }(vr)), vr;
21958
21953
  }
21959
21954
  var Tr, Aa;
21960
- function xl() {
21955
+ function Sl() {
21961
21956
  if (Aa) return Tr;
21962
21957
  Aa = 1;
21963
21958
  var t = Xe.Buffer;
@@ -22026,10 +22021,10 @@ function xl() {
22026
22021
  };
22027
22022
  }, Tr;
22028
22023
  }
22029
- const Sl = {}, wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22024
+ const wl = {}, Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22030
22025
  __proto__: null,
22031
- default: Sl
22032
- }, Symbol.toStringTag, { value: "Module" })), Fl = /* @__PURE__ */ qh(wl);
22026
+ default: wl
22027
+ }, Symbol.toStringTag, { value: "Module" })), kl = /* @__PURE__ */ Vh(Fl);
22033
22028
  (function(t) {
22034
22029
  var e = Xe.Buffer, r = sn, n = Mi, a = t.exports;
22035
22030
  a.encodings = null, a.defaultCharUnicode = "�", a.defaultCharSingleByte = "?", a.encode = function(o, c, u) {
@@ -22048,7 +22043,7 @@ const Sl = {}, wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
22048
22043
  }
22049
22044
  }, a.toEncoding = a.encode, a.fromEncoding = a.decode, a._codecDataCache = { __proto__: null }, a.getCodec = function(o) {
22050
22045
  if (!a.encodings) {
22051
- var c = bl();
22046
+ var c = xl();
22052
22047
  a.encodings = { __proto__: null }, n(a.encodings, c);
22053
22048
  }
22054
22049
  for (var u = a._canonicalizeEncoding(o), h = {}; ; ) {
@@ -22081,7 +22076,7 @@ const Sl = {}, wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
22081
22076
  return u.bomAware && !(c && c.stripBOM === !1) && (h = new r.StripBOM(h, c)), h;
22082
22077
  }, a.enableStreamingAPI = function(o) {
22083
22078
  if (!a.supportsStreams) {
22084
- var c = xl()(o);
22079
+ var c = Sl()(o);
22085
22080
  a.IconvLiteEncoderStream = c.IconvLiteEncoderStream, a.IconvLiteDecoderStream = c.IconvLiteDecoderStream, a.encodeStream = function(h, d) {
22086
22081
  return new a.IconvLiteEncoderStream(a.getEncoder(h, d), d);
22087
22082
  }, a.decodeStream = function(h, d) {
@@ -22091,15 +22086,15 @@ const Sl = {}, wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
22091
22086
  };
22092
22087
  var i;
22093
22088
  try {
22094
- i = Fl;
22089
+ i = kl;
22095
22090
  } catch {
22096
22091
  }
22097
22092
  i && i.Transform ? a.enableStreamingAPI(i) : a.encodeStream = a.decodeStream = function() {
22098
22093
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
22099
22094
  };
22100
22095
  })(Li);
22101
- var kl = Li.exports;
22102
- const Tl = /* @__PURE__ */ Wh(kl);
22096
+ var Tl = Li.exports;
22097
+ const El = /* @__PURE__ */ qh(Tl);
22103
22098
  class un extends Ia {
22104
22099
  /**
22105
22100
  * Creates a new instance of ShxTextShape
@@ -22107,7 +22102,8 @@ class un extends Ia {
22107
22102
  * @param shape - The shape data for this character
22108
22103
  */
22109
22104
  constructor(e, r, n, a) {
22110
- super(), this.fontSize = r, this.shape = n, this.font = a, this.code = e, this.width = this.calcWidth();
22105
+ var i;
22106
+ super(), this.fontSize = r, this.shape = n, this.font = a, this.code = e, a.data.header.fontType === fe.BIGFONT ? this.width = this.calcWidth() : this.width = ((i = n.lastPoint) == null ? void 0 : i.x) ?? this.calcWidth();
22111
22107
  }
22112
22108
  calcWidth() {
22113
22109
  const e = this.shape.bbox;
@@ -22146,9 +22142,9 @@ class un extends Ia {
22146
22142
  return e;
22147
22143
  }
22148
22144
  }
22149
- class El extends Ma {
22145
+ class Cl extends Ma {
22150
22146
  constructor(e) {
22151
- super(e), this.type = "shx", this.font = new zh(e.data), this.data = this.font.fontData;
22147
+ super(e), this.type = "shx", this.font = new Wh(e.data), this.data = this.font.fontData;
22152
22148
  }
22153
22149
  /**
22154
22150
  * Return true if this font contains glyph of the specified character. Otherwise, return false.
@@ -22230,7 +22226,7 @@ class El extends Ma {
22230
22226
  */
22231
22227
  getCode(e) {
22232
22228
  if (this.font.fontData.header.fontType === fe.BIGFONT && this.encoding) {
22233
- const n = Tl.encode(e[0], this.encoding);
22229
+ const n = El.encode(e[0], this.encoding);
22234
22230
  return n.length === 1 ? n[0] : n[0] << 8 | n[1];
22235
22231
  } else
22236
22232
  return e.charCodeAt(0);
@@ -22256,7 +22252,7 @@ class ze {
22256
22252
  */
22257
22253
  createFont(e) {
22258
22254
  if (e.type === "shx")
22259
- return new El(e);
22255
+ return new Cl(e);
22260
22256
  if (e.type === "mesh")
22261
22257
  return new Mh(e);
22262
22258
  throw new Error("Unsupported font data type");
@@ -22269,7 +22265,7 @@ class Oe {
22269
22265
  fontNotFound: new mn(),
22270
22266
  /** Event triggered when a font is successfully loaded */
22271
22267
  fontLoaded: new mn()
22272
- }, this.loader = new P.FileLoader(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new Cl();
22268
+ }, this.loader = new P.FileLoader(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new Ul();
22273
22269
  }
22274
22270
  /**
22275
22271
  * Gets the singleton instance of the FontManager
@@ -22529,7 +22525,7 @@ class Oe {
22529
22525
  return e == null ? (this.loadedFontMap.clear(), !0) : this.loadedFontMap.delete(e);
22530
22526
  }
22531
22527
  }
22532
- class Cl {
22528
+ class Ul {
22533
22529
  /**
22534
22530
  * Creates a new instance of DefaultFontLoader
22535
22531
  */
@@ -22626,12 +22622,12 @@ class Cl {
22626
22622
  }
22627
22623
  }
22628
22624
  var nt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.WORD = 1] = "WORD", t[t.STACK = 2] = "STACK", t[t.SPACE = 3] = "SPACE", t[t.NBSP = 4] = "NBSP", t[t.TABULATOR = 5] = "TABULATOR", t[t.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", t[t.NEW_COLUMN = 7] = "NEW_COLUMN", t[t.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", t[t.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", t))(nt || {}), pt = /* @__PURE__ */ ((t) => (t[t.BOTTOM = 0] = "BOTTOM", t[t.MIDDLE = 1] = "MIDDLE", t[t.TOP = 2] = "TOP", t))(pt || {}), Se = /* @__PURE__ */ ((t) => (t[t.DEFAULT = 0] = "DEFAULT", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.CENTER = 3] = "CENTER", t[t.JUSTIFIED = 4] = "JUSTIFIED", t[t.DISTRIBUTED = 5] = "DISTRIBUTED", t))(Se || {});
22629
- const Ul = {
22625
+ const Al = {
22630
22626
  c: "Ø",
22631
22627
  d: "°",
22632
22628
  p: "±",
22633
22629
  "%": "%"
22634
- }, Al = {
22630
+ }, Bl = {
22635
22631
  l: 1,
22636
22632
  r: 2,
22637
22633
  c: 3,
@@ -22639,14 +22635,14 @@ const Ul = {
22639
22635
  d: 5
22640
22636
  /* DISTRIBUTED */
22641
22637
  };
22642
- function Bl(t, e = !1) {
22638
+ function Ll(t, e = !1) {
22643
22639
  const r = /* @__PURE__ */ new Set(), n = /\\[fF](.*?)[;|]/g;
22644
22640
  return [...t.matchAll(n)].forEach((a) => {
22645
22641
  let i = a[1].toLowerCase();
22646
22642
  e && (i = i.replace(/\.(ttf|otf|woff|shx)$/, "")), r.add(i);
22647
22643
  }), r;
22648
22644
  }
22649
- class Ll {
22645
+ class Ol {
22650
22646
  /**
22651
22647
  * Creates a new ContextStack with an initial context.
22652
22648
  * @param initial The initial MTextContext to use as the base of the stack.
@@ -22698,7 +22694,7 @@ class Ll {
22698
22694
  this.stack[this.stack.length - 1] = e;
22699
22695
  }
22700
22696
  }
22701
- class Ol {
22697
+ class Rl {
22702
22698
  /**
22703
22699
  * Creates a new MTextParser instance
22704
22700
  * @param content - The MText content to parse
@@ -22708,7 +22704,7 @@ class Ol {
22708
22704
  constructor(e, r, n = {}) {
22709
22705
  this.continueStroke = !1, this.inStackContext = !1, this.scanner = new Er(e);
22710
22706
  const a = r ?? new Ut();
22711
- this.ctxStack = new Ll(a), this.yieldPropertyCommands = n.yieldPropertyCommands ?? !1, this.resetParagraphParameters = n.resetParagraphParameters ?? !1, this.mifDecoder = n.mifDecoder ?? this.decodeMultiByteChar.bind(this), this.mifCodeLength = n.mifCodeLength ?? "auto";
22707
+ this.ctxStack = new Ol(a), this.yieldPropertyCommands = n.yieldPropertyCommands ?? !1, this.resetParagraphParameters = n.resetParagraphParameters ?? !1, this.mifDecoder = n.mifDecoder ?? this.decodeMultiByteChar.bind(this), this.mifCodeLength = n.mifCodeLength ?? "auto";
22712
22708
  }
22713
22709
  /**
22714
22710
  * Decode multi-byte character from hex code
@@ -23089,7 +23085,7 @@ class Ol {
23089
23085
  break;
23090
23086
  case "q": {
23091
23087
  const u = r.get();
23092
- for (s = Al[u] || 0; r.peek() === ","; )
23088
+ for (s = Bl[u] || 0; r.peek() === ","; )
23093
23089
  r.consume(1);
23094
23090
  break;
23095
23091
  }
@@ -23226,7 +23222,7 @@ class Ol {
23226
23222
  continue;
23227
23223
  }
23228
23224
  if (s === "%" && this.scanner.peek(1) === "%") {
23229
- const c = this.scanner.peek(2).toLowerCase(), u = Ul[c];
23225
+ const c = this.scanner.peek(2).toLowerCase(), u = Al[c];
23230
23226
  if (u) {
23231
23227
  this.scanner.consume(3), a += u;
23232
23228
  continue;
@@ -23686,8 +23682,8 @@ class Cr {
23686
23682
  this.type = e, this.ctx = r, this.data = n;
23687
23683
  }
23688
23684
  }
23689
- var wt = /* @__PURE__ */ ((t) => (t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t[t.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", t[t.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", t[t.BY_STYLE = 5] = "BY_STYLE", t))(wt || {}), Rl = /* @__PURE__ */ ((t) => (t[t.TopLeft = 1] = "TopLeft", t[t.TopCenter = 2] = "TopCenter", t[t.TopRight = 3] = "TopRight", t[t.MiddleLeft = 4] = "MiddleLeft", t[t.MiddleCenter = 5] = "MiddleCenter", t[t.MiddleRight = 6] = "MiddleRight", t[t.BottomLeft = 7] = "BottomLeft", t[t.BottomCenter = 8] = "BottomCenter", t[t.BottomRight = 9] = "BottomRight", t))(Rl || {});
23690
- const Ml = /* @__PURE__ */ new P.Vector3(), Il = 1.666666;
23685
+ var wt = /* @__PURE__ */ ((t) => (t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t[t.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", t[t.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", t[t.BY_STYLE = 5] = "BY_STYLE", t))(wt || {}), Ml = /* @__PURE__ */ ((t) => (t[t.TopLeft = 1] = "TopLeft", t[t.TopCenter = 2] = "TopCenter", t[t.TopRight = 3] = "TopRight", t[t.MiddleLeft = 4] = "MiddleLeft", t[t.MiddleCenter = 5] = "MiddleCenter", t[t.MiddleRight = 6] = "MiddleRight", t[t.BottomLeft = 7] = "BottomLeft", t[t.BottomCenter = 8] = "BottomCenter", t[t.BottomRight = 9] = "BottomRight", t))(Ml || {});
23686
+ const Il = /* @__PURE__ */ new P.Vector3(), Dl = 1.666666;
23691
23687
  class ln extends Ut {
23692
23688
  /**
23693
23689
  * Creates a new RenderContext instance with optional initial values.
@@ -23721,7 +23717,7 @@ class ln extends Ut {
23721
23717
  this.color.rgb = [r, n, a];
23722
23718
  }
23723
23719
  }
23724
- class Dl {
23720
+ class _l {
23725
23721
  /**
23726
23722
  * Construct one instance of this class and initialize some properties with default values.
23727
23723
  * @param style Input text style
@@ -23820,7 +23816,7 @@ class Dl {
23820
23816
  * The height of current line of texts
23821
23817
  */
23822
23818
  get currentLineHeight() {
23823
- return this.defaultLineSpaceFactor * this.currentFontSize * Il + this.currentMaxFontSize;
23819
+ return this.defaultLineSpaceFactor * this.currentFontSize * Dl + this.currentMaxFontSize;
23824
23820
  }
23825
23821
  /**
23826
23822
  * The maximum font size in current line. Characters in one line may have different font and font
@@ -24223,7 +24219,7 @@ class Dl {
24223
24219
  if (e.forEach((n, a) => {
24224
24220
  n.boundingBox || n.computeBoundingBox(), a === 0 ? r = n.boundingBox : r.union(n.boundingBox);
24225
24221
  }), r) {
24226
- const n = r.getSize(Ml);
24222
+ const n = r.getSize(Il);
24227
24223
  switch (this.currentHorizontalAlignment) {
24228
24224
  case Se.LEFT:
24229
24225
  e.forEach(
@@ -24328,7 +24324,7 @@ class $t extends P.Object3D {
24328
24324
  * ```
24329
24325
  */
24330
24326
  static getFonts(e, r = !1) {
24331
- return Bl(e, r);
24327
+ return Ll(e, r);
24332
24328
  }
24333
24329
  /**
24334
24330
  * Creates a new instance of MText.
@@ -24496,12 +24492,12 @@ class $t extends P.Object3D {
24496
24492
  value: e.widthFactor ?? 1,
24497
24493
  isRelative: !0
24498
24494
  }, h.align = i, h.paragraph.align = a;
24499
- const d = new Dl(
24495
+ const d = new _l(
24500
24496
  r,
24501
24497
  this.styleManager,
24502
24498
  this.fontManager,
24503
24499
  u
24504
- ), g = new Ol(e.text, h, {
24500
+ ), g = new Rl(e.text, h, {
24505
24501
  resetParagraphParameters: !0,
24506
24502
  yieldPropertyCommands: !0
24507
24503
  }).parse();
@@ -24623,7 +24619,7 @@ class Ii {
24623
24619
  return e.isByLayer && e.layer ? `layer_${e.layer}_${e.color}` : `entity_${e.color}`;
24624
24620
  }
24625
24621
  }
24626
- class _l {
24622
+ class Pl {
24627
24623
  constructor(e = {}) {
24628
24624
  this.workers = [], this.inFlightPerWorker = [], this.pendingRequests = /* @__PURE__ */ new Map(), this.requestId = 0, this.readyPromise = null, this.poolSize = e.poolSize ?? Math.max(
24629
24625
  1,
@@ -24864,7 +24860,7 @@ class _l {
24864
24860
  this.terminate();
24865
24861
  }
24866
24862
  }
24867
- class Pl {
24863
+ class Nl {
24868
24864
  constructor() {
24869
24865
  this.fontManager = Oe.instance, this.defaultStyleManager = new Ii(), this.isInitialized = !1;
24870
24866
  }
@@ -24937,7 +24933,7 @@ class Pl {
24937
24933
  this.isInitialized || (await this.loadFonts([Oe.instance.defaultFont]), this.isInitialized = !0);
24938
24934
  }
24939
24935
  }
24940
- class Hl {
24936
+ class ql {
24941
24937
  /**
24942
24938
  * Constructor
24943
24939
  *
@@ -24946,7 +24942,7 @@ class Hl {
24946
24942
  * when render mode is 'worker'.
24947
24943
  */
24948
24944
  constructor(e = "main", r = {}) {
24949
- this.defaultMode = e, this.mainThreadRenderer = new Pl(), this.webWorkerRenderer = new _l(r), this.renderer = this.mainThreadRenderer, e === "worker" && (this.renderer = this.webWorkerRenderer);
24945
+ this.defaultMode = e, this.mainThreadRenderer = new Nl(), this.webWorkerRenderer = new Pl(r), this.renderer = this.mainThreadRenderer, e === "worker" && (this.renderer = this.webWorkerRenderer);
24950
24946
  }
24951
24947
  /**
24952
24948
  * Sets one new style manager to override the default style manager
@@ -25025,14 +25021,14 @@ class Hl {
25025
25021
  export {
25026
25022
  Ma as BaseFont,
25027
25023
  Ia as BaseTextShape,
25028
- Cl as DefaultFontLoader,
25024
+ Ul as DefaultFontLoader,
25029
25025
  mn as EventManager,
25030
25026
  ze as FontFactory,
25031
25027
  Oe as FontManager,
25032
25028
  $t as MText,
25033
- Rl as MTextAttachmentPoint,
25029
+ Ml as MTextAttachmentPoint,
25034
25030
  wt as MTextFlowDirection,
25035
- Pl as MainThreadRenderer,
25036
- Hl as UnifiedRenderer,
25037
- _l as WebWorkerRenderer
25031
+ Nl as MainThreadRenderer,
25032
+ ql as UnifiedRenderer,
25033
+ Pl as WebWorkerRenderer
25038
25034
  };