@mlightcad/mtext-renderer 0.9.1 → 0.9.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.
@@ -1,5 +1,5 @@
1
1
  var jh = (n, e) => () => (e || n((e = { exports: {} }).exports, e), e.exports);
2
- var Kd = jh((O) => {
2
+ var t1 = jh((O) => {
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2010-2024 Three.js Authors
@@ -522,7 +522,7 @@ var Kd = jh((O) => {
522
522
  */
523
523
  spaces: {},
524
524
  convert: function(i, s, a) {
525
- return this.enabled === !1 || s === a || !s || !a || (this.spaces[s].transfer === ei && (i.r = pt(i.r), i.g = pt(i.g), i.b = pt(i.b)), this.spaces[s].primaries !== this.spaces[a].primaries && (i.applyMatrix3(this.spaces[s].toXYZ), i.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === ei && (i.r = or(i.r), i.g = or(i.g), i.b = or(i.b))), i;
525
+ return this.enabled === !1 || s === a || !s || !a || (this.spaces[s].transfer === ei && (i.r = pt(i.r), i.g = pt(i.g), i.b = pt(i.b)), this.spaces[s].primaries !== this.spaces[a].primaries && (i.applyMatrix3(this.spaces[s].toXYZ), i.applyMatrix3(this.spaces[a].fromXYZ)), this.spaces[a].transfer === ei && (i.r = hr(i.r), i.g = hr(i.g), i.b = hr(i.b))), i;
526
526
  },
527
527
  fromWorkingColorSpace: function(i, s) {
528
528
  return this.convert(i, this.workingColorSpace, s);
@@ -579,10 +579,10 @@ var Kd = jh((O) => {
579
579
  function pt(n) {
580
580
  return n < 0.04045 ? n * 0.0773993808 : Math.pow(n * 0.9478672986 + 0.0521327014, 2.4);
581
581
  }
582
- function or(n) {
582
+ function hr(n) {
583
583
  return n < 31308e-7 ? n * 12.92 : 1.055 * Math.pow(n, 0.41666) - 0.055;
584
584
  }
585
- let Yt;
585
+ let Zt;
586
586
  class tc {
587
587
  static getDataURL(e) {
588
588
  if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u")
@@ -591,9 +591,9 @@ var Kd = jh((O) => {
591
591
  if (e instanceof HTMLCanvasElement)
592
592
  t = e;
593
593
  else {
594
- Yt === void 0 && (Yt = Ys("canvas")), Yt.width = e.width, Yt.height = e.height;
595
- const r = Yt.getContext("2d");
596
- e instanceof ImageData ? r.putImageData(e, 0, 0) : r.drawImage(e, 0, 0, e.width, e.height), t = Yt;
594
+ Zt === void 0 && (Zt = Ys("canvas")), Zt.width = e.width, Zt.height = e.height;
595
+ const r = Zt.getContext("2d");
596
+ e instanceof ImageData ? r.putImageData(e, 0, 0) : r.drawImage(e, 0, 0, e.width, e.height), t = Zt;
597
597
  }
598
598
  return t.width > 2048 || t.height > 2048 ? (console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png");
599
599
  }
@@ -658,8 +658,8 @@ var Kd = jh((O) => {
658
658
  } : (console.warn("THREE.Texture: Unable to serialize Texture."), {});
659
659
  }
660
660
  let ic = 0;
661
- class Gt extends Yn {
662
- constructor(e = Gt.DEFAULT_IMAGE, t = Gt.DEFAULT_MAPPING, r = 1001, i = 1001, s = 1006, a = 1008, o = 1023, h = 1009, c = Gt.DEFAULT_ANISOTROPY, u = Ro) {
661
+ class Ht extends Yn {
662
+ constructor(e = Ht.DEFAULT_IMAGE, t = Ht.DEFAULT_MAPPING, r = 1001, i = 1001, s = 1006, a = 1008, o = 1023, h = 1009, c = Ht.DEFAULT_ANISOTROPY, u = Ro) {
663
663
  super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: ic++ }), this.uuid = gr(), this.name = "", this.source = new nc(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = r, this.wrapT = i, this.magFilter = s, this.minFilter = a, this.anisotropy = c, this.format = o, this.internalFormat = null, this.type = h, this.offset = new V(0, 0), this.repeat = new V(1, 1), this.center = new V(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Et(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = u, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.pmremVersion = 0;
664
664
  }
665
665
  get image() {
@@ -749,9 +749,9 @@ var Kd = jh((O) => {
749
749
  e === !0 && this.pmremVersion++;
750
750
  }
751
751
  }
752
- Gt.DEFAULT_IMAGE = null;
753
- Gt.DEFAULT_MAPPING = 300;
754
- Gt.DEFAULT_ANISOTROPY = 1;
752
+ Ht.DEFAULT_IMAGE = null;
753
+ Ht.DEFAULT_MAPPING = 300;
754
+ Ht.DEFAULT_ANISOTROPY = 1;
755
755
  class qr {
756
756
  constructor(e = 0, t = 0, r = 0, i = 1) {
757
757
  qr.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = r, this.w = i;
@@ -1537,7 +1537,7 @@ var Kd = jh((O) => {
1537
1537
  intersectsTriangle(e) {
1538
1538
  if (this.isEmpty())
1539
1539
  return !1;
1540
- this.getCenter(wr), sn.subVectors(this.max, wr), Zt.subVectors(e.a, wr), Jt.subVectors(e.b, wr), $t.subVectors(e.c, wr), yt.subVectors(Jt, Zt), mt.subVectors($t, Jt), Lt.subVectors(Zt, $t);
1540
+ this.getCenter(wr), sn.subVectors(this.max, wr), Jt.subVectors(e.a, wr), $t.subVectors(e.b, wr), jt.subVectors(e.c, wr), yt.subVectors($t, Jt), mt.subVectors(jt, $t), Lt.subVectors(Jt, jt);
1541
1541
  let t = [
1542
1542
  0,
1543
1543
  -yt.z,
@@ -1567,7 +1567,7 @@ var Kd = jh((O) => {
1567
1567
  Lt.x,
1568
1568
  0
1569
1569
  ];
1570
- return !si(t, Zt, Jt, $t, sn) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !si(t, Zt, Jt, $t, sn)) ? !1 : (an.crossVectors(yt, mt), t = [an.x, an.y, an.z], si(t, Zt, Jt, $t, sn));
1570
+ return !si(t, Jt, $t, jt, sn) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !si(t, Jt, $t, jt, sn)) ? !1 : (an.crossVectors(yt, mt), t = [an.x, an.y, an.z], si(t, Jt, $t, jt, sn));
1571
1571
  }
1572
1572
  clampPoint(e, t) {
1573
1573
  return t.copy(e).clamp(this.min, this.max);
@@ -1603,7 +1603,7 @@ var Kd = jh((O) => {
1603
1603
  /* @__PURE__ */ new A(),
1604
1604
  /* @__PURE__ */ new A(),
1605
1605
  /* @__PURE__ */ new A()
1606
- ], ze = /* @__PURE__ */ new A(), nn = /* @__PURE__ */ new Ae(), Zt = /* @__PURE__ */ new A(), Jt = /* @__PURE__ */ new A(), $t = /* @__PURE__ */ new A(), yt = /* @__PURE__ */ new A(), mt = /* @__PURE__ */ new A(), Lt = /* @__PURE__ */ new A(), wr = /* @__PURE__ */ new A(), sn = /* @__PURE__ */ new A(), an = /* @__PURE__ */ new A(), Ut = /* @__PURE__ */ new A();
1606
+ ], ze = /* @__PURE__ */ new A(), nn = /* @__PURE__ */ new Ae(), Jt = /* @__PURE__ */ new A(), $t = /* @__PURE__ */ new A(), jt = /* @__PURE__ */ new A(), yt = /* @__PURE__ */ new A(), mt = /* @__PURE__ */ new A(), Lt = /* @__PURE__ */ new A(), wr = /* @__PURE__ */ new A(), sn = /* @__PURE__ */ new A(), an = /* @__PURE__ */ new A(), Ut = /* @__PURE__ */ new A();
1607
1607
  function si(n, e, t, r, i) {
1608
1608
  for (let s = 0, a = n.length - 3; s <= a; s += 3) {
1609
1609
  Ut.fromArray(n, s);
@@ -1904,7 +1904,7 @@ var Kd = jh((O) => {
1904
1904
  ), this;
1905
1905
  }
1906
1906
  extractRotation(e) {
1907
- const t = this.elements, r = e.elements, i = 1 / jt.setFromMatrixColumn(e, 0).length(), s = 1 / jt.setFromMatrixColumn(e, 1).length(), a = 1 / jt.setFromMatrixColumn(e, 2).length();
1907
+ const t = this.elements, r = e.elements, i = 1 / Qt.setFromMatrixColumn(e, 0).length(), s = 1 / Qt.setFromMatrixColumn(e, 1).length(), a = 1 / Qt.setFromMatrixColumn(e, 2).length();
1908
1908
  return t[0] = r[0] * i, t[1] = r[1] * i, t[2] = r[2] * i, t[3] = 0, t[4] = r[4] * s, t[5] = r[5] * s, t[6] = r[6] * s, t[7] = 0, t[8] = r[8] * a, t[9] = r[9] * a, t[10] = r[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
1909
1909
  }
1910
1910
  makeRotationFromEuler(e) {
@@ -2145,8 +2145,8 @@ var Kd = jh((O) => {
2145
2145
  }
2146
2146
  decompose(e, t, r) {
2147
2147
  const i = this.elements;
2148
- let s = jt.set(i[0], i[1], i[2]).length();
2149
- const a = jt.set(i[4], i[5], i[6]).length(), o = jt.set(i[8], i[9], i[10]).length();
2148
+ let s = Qt.set(i[0], i[1], i[2]).length();
2149
+ const a = Qt.set(i[4], i[5], i[6]).length(), o = Qt.set(i[8], i[9], i[10]).length();
2150
2150
  this.determinant() < 0 && (s = -s), e.x = i[12], e.y = i[13], e.z = i[14], Ne.copy(this);
2151
2151
  const c = 1 / s, u = 1 / a, f = 1 / o;
2152
2152
  return Ne.elements[0] *= c, Ne.elements[1] *= c, Ne.elements[2] *= c, Ne.elements[4] *= u, Ne.elements[5] *= u, Ne.elements[6] *= u, Ne.elements[8] *= f, Ne.elements[9] *= f, Ne.elements[10] *= f, t.setFromRotationMatrix(Ne), r.x = s, r.y = a, r.z = o, this;
@@ -2189,7 +2189,7 @@ var Kd = jh((O) => {
2189
2189
  return e[t] = r[0], e[t + 1] = r[1], e[t + 2] = r[2], e[t + 3] = r[3], e[t + 4] = r[4], e[t + 5] = r[5], e[t + 6] = r[6], e[t + 7] = r[7], e[t + 8] = r[8], e[t + 9] = r[9], e[t + 10] = r[10], e[t + 11] = r[11], e[t + 12] = r[12], e[t + 13] = r[13], e[t + 14] = r[14], e[t + 15] = r[15], e;
2190
2190
  }
2191
2191
  }
2192
- const jt = /* @__PURE__ */ new A(), Ne = /* @__PURE__ */ new be(), ac = /* @__PURE__ */ new A(0, 0, 0), oc = /* @__PURE__ */ new A(1, 1, 1), xt = /* @__PURE__ */ new A(), cn = /* @__PURE__ */ new A(), Te = /* @__PURE__ */ new A(), js = /* @__PURE__ */ new be(), Qs = /* @__PURE__ */ new Bt();
2192
+ const Qt = /* @__PURE__ */ new A(), Ne = /* @__PURE__ */ new be(), ac = /* @__PURE__ */ new A(0, 0, 0), oc = /* @__PURE__ */ new A(1, 1, 1), xt = /* @__PURE__ */ new A(), cn = /* @__PURE__ */ new A(), Te = /* @__PURE__ */ new A(), js = /* @__PURE__ */ new be(), Qs = /* @__PURE__ */ new Bt();
2193
2193
  class Vr {
2194
2194
  constructor(e = 0, t = 0, r = 0, i = Vr.DEFAULT_ORDER) {
2195
2195
  this.isEuler = !0, this._x = e, this._y = t, this._z = r, this._order = i;
@@ -2311,7 +2311,7 @@ var Kd = jh((O) => {
2311
2311
  }
2312
2312
  }
2313
2313
  let cc = 0;
2314
- const Ks = /* @__PURE__ */ new A(), Qt = /* @__PURE__ */ new Bt(), at = /* @__PURE__ */ new be(), un = /* @__PURE__ */ new A(), Fr = /* @__PURE__ */ new A(), uc = /* @__PURE__ */ new A(), lc = /* @__PURE__ */ new Bt(), ea = /* @__PURE__ */ new A(1, 0, 0), ta = /* @__PURE__ */ new A(0, 1, 0), ra = /* @__PURE__ */ new A(0, 0, 1), na = { type: "added" }, fc = { type: "removed" }, Kt = { type: "childadded", child: null }, ui = { type: "childremoved", child: null };
2314
+ const Ks = /* @__PURE__ */ new A(), Kt = /* @__PURE__ */ new Bt(), at = /* @__PURE__ */ new be(), un = /* @__PURE__ */ new A(), Fr = /* @__PURE__ */ new A(), uc = /* @__PURE__ */ new A(), lc = /* @__PURE__ */ new Bt(), ea = /* @__PURE__ */ new A(1, 0, 0), ta = /* @__PURE__ */ new A(0, 1, 0), ra = /* @__PURE__ */ new A(0, 0, 1), na = { type: "added" }, fc = { type: "removed" }, er = { type: "childadded", child: null }, ui = { type: "childremoved", child: null };
2315
2315
  class De extends Yn {
2316
2316
  constructor() {
2317
2317
  super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: cc++ }), this.uuid = gr(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = De.DEFAULT_UP.clone();
@@ -2378,10 +2378,10 @@ var Kd = jh((O) => {
2378
2378
  this.quaternion.copy(e);
2379
2379
  }
2380
2380
  rotateOnAxis(e, t) {
2381
- return Qt.setFromAxisAngle(e, t), this.quaternion.multiply(Qt), this;
2381
+ return Kt.setFromAxisAngle(e, t), this.quaternion.multiply(Kt), this;
2382
2382
  }
2383
2383
  rotateOnWorldAxis(e, t) {
2384
- return Qt.setFromAxisAngle(e, t), this.quaternion.premultiply(Qt), this;
2384
+ return Kt.setFromAxisAngle(e, t), this.quaternion.premultiply(Kt), this;
2385
2385
  }
2386
2386
  rotateX(e) {
2387
2387
  return this.rotateOnAxis(ea, e);
@@ -2413,7 +2413,7 @@ var Kd = jh((O) => {
2413
2413
  lookAt(e, t, r) {
2414
2414
  e.isVector3 ? un.copy(e) : un.set(e, t, r);
2415
2415
  const i = this.parent;
2416
- this.updateWorldMatrix(!0, !1), Fr.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? at.lookAt(Fr, un, this.up) : at.lookAt(un, Fr, this.up), this.quaternion.setFromRotationMatrix(at), i && (at.extractRotation(i.matrixWorld), Qt.setFromRotationMatrix(at), this.quaternion.premultiply(Qt.invert()));
2416
+ this.updateWorldMatrix(!0, !1), Fr.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? at.lookAt(Fr, un, this.up) : at.lookAt(un, Fr, this.up), this.quaternion.setFromRotationMatrix(at), i && (at.extractRotation(i.matrixWorld), Kt.setFromRotationMatrix(at), this.quaternion.premultiply(Kt.invert()));
2417
2417
  }
2418
2418
  add(e) {
2419
2419
  if (arguments.length > 1) {
@@ -2421,7 +2421,7 @@ var Kd = jh((O) => {
2421
2421
  this.add(arguments[t]);
2422
2422
  return this;
2423
2423
  }
2424
- return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(na), Kt.child = e, this.dispatchEvent(Kt), Kt.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this);
2424
+ return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(na), er.child = e, this.dispatchEvent(er), er.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this);
2425
2425
  }
2426
2426
  remove(e) {
2427
2427
  if (arguments.length > 1) {
@@ -2440,7 +2440,7 @@ var Kd = jh((O) => {
2440
2440
  return this.remove(...this.children);
2441
2441
  }
2442
2442
  attach(e) {
2443
- return this.updateWorldMatrix(!0, !1), at.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), at.multiply(e.parent.matrixWorld)), e.applyMatrix4(at), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(na), Kt.child = e, this.dispatchEvent(Kt), Kt.child = null, this;
2443
+ return this.updateWorldMatrix(!0, !1), at.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), at.multiply(e.parent.matrixWorld)), e.applyMatrix4(at), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(na), er.child = e, this.dispatchEvent(er), er.child = null, this;
2444
2444
  }
2445
2445
  getObjectById(e) {
2446
2446
  return this.getObjectByProperty("id", e);
@@ -2612,7 +2612,7 @@ var Kd = jh((O) => {
2612
2612
  De.DEFAULT_UP = /* @__PURE__ */ new A(0, 1, 0);
2613
2613
  De.DEFAULT_MATRIX_AUTO_UPDATE = !0;
2614
2614
  De.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
2615
- const Ge = /* @__PURE__ */ new A(), ot = /* @__PURE__ */ new A(), li = /* @__PURE__ */ new A(), ht = /* @__PURE__ */ new A(), er = /* @__PURE__ */ new A(), tr = /* @__PURE__ */ new A(), ia = /* @__PURE__ */ new A(), fi = /* @__PURE__ */ new A(), pi = /* @__PURE__ */ new A(), di = /* @__PURE__ */ new A(), gi = /* @__PURE__ */ new qr(), yi = /* @__PURE__ */ new qr(), mi = /* @__PURE__ */ new qr();
2615
+ const Ge = /* @__PURE__ */ new A(), ot = /* @__PURE__ */ new A(), li = /* @__PURE__ */ new A(), ht = /* @__PURE__ */ new A(), tr = /* @__PURE__ */ new A(), rr = /* @__PURE__ */ new A(), ia = /* @__PURE__ */ new A(), fi = /* @__PURE__ */ new A(), pi = /* @__PURE__ */ new A(), di = /* @__PURE__ */ new A(), gi = /* @__PURE__ */ new qr(), yi = /* @__PURE__ */ new qr(), mi = /* @__PURE__ */ new qr();
2616
2616
  class qe {
2617
2617
  constructor(e = new A(), t = new A(), r = new A()) {
2618
2618
  this.a = e, this.b = t, this.c = r;
@@ -2689,29 +2689,29 @@ var Kd = jh((O) => {
2689
2689
  closestPointToPoint(e, t) {
2690
2690
  const r = this.a, i = this.b, s = this.c;
2691
2691
  let a, o;
2692
- er.subVectors(i, r), tr.subVectors(s, r), fi.subVectors(e, r);
2693
- const h = er.dot(fi), c = tr.dot(fi);
2692
+ tr.subVectors(i, r), rr.subVectors(s, r), fi.subVectors(e, r);
2693
+ const h = tr.dot(fi), c = rr.dot(fi);
2694
2694
  if (h <= 0 && c <= 0)
2695
2695
  return t.copy(r);
2696
2696
  pi.subVectors(e, i);
2697
- const u = er.dot(pi), f = tr.dot(pi);
2697
+ const u = tr.dot(pi), f = rr.dot(pi);
2698
2698
  if (u >= 0 && f <= u)
2699
2699
  return t.copy(i);
2700
2700
  const l = h * f - u * c;
2701
2701
  if (l <= 0 && h >= 0 && u <= 0)
2702
- return a = h / (h - u), t.copy(r).addScaledVector(er, a);
2702
+ return a = h / (h - u), t.copy(r).addScaledVector(tr, a);
2703
2703
  di.subVectors(e, s);
2704
- const p = er.dot(di), g = tr.dot(di);
2704
+ const p = tr.dot(di), g = rr.dot(di);
2705
2705
  if (g >= 0 && p <= g)
2706
2706
  return t.copy(s);
2707
2707
  const m = p * c - h * g;
2708
2708
  if (m <= 0 && c >= 0 && g <= 0)
2709
- return o = c / (c - g), t.copy(r).addScaledVector(tr, o);
2709
+ return o = c / (c - g), t.copy(r).addScaledVector(rr, o);
2710
2710
  const x = u * g - p * f;
2711
2711
  if (x <= 0 && f - u >= 0 && p - g >= 0)
2712
2712
  return ia.subVectors(s, i), o = (f - u) / (f - u + (p - g)), t.copy(i).addScaledVector(ia, o);
2713
2713
  const v = 1 / (x + m + l);
2714
- return a = m * v, o = l * v, t.copy(r).addScaledVector(er, a).addScaledVector(tr, o);
2714
+ return a = m * v, o = l * v, t.copy(r).addScaledVector(tr, a).addScaledVector(rr, o);
2715
2715
  }
2716
2716
  equals(e) {
2717
2717
  return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
@@ -2969,7 +2969,7 @@ var Kd = jh((O) => {
2969
2969
  return this.r = pt(e.r), this.g = pt(e.g), this.b = pt(e.b), this;
2970
2970
  }
2971
2971
  copyLinearToSRGB(e) {
2972
- return this.r = or(e.r), this.g = or(e.g), this.b = or(e.b), this;
2972
+ return this.r = hr(e.r), this.g = hr(e.g), this.b = hr(e.b), this;
2973
2973
  }
2974
2974
  convertSRGBToLinear() {
2975
2975
  return this.copySRGBToLinear(this), this;
@@ -3171,7 +3171,7 @@ var Kd = jh((O) => {
3171
3171
  return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this;
3172
3172
  }
3173
3173
  }
3174
- const fe = /* @__PURE__ */ new A(), fn = /* @__PURE__ */ new V();
3174
+ const pe = /* @__PURE__ */ new A(), fn = /* @__PURE__ */ new V();
3175
3175
  class Ve {
3176
3176
  constructor(e, t, r = !1) {
3177
3177
  if (Array.isArray(e))
@@ -3210,22 +3210,22 @@ var Kd = jh((O) => {
3210
3210
  fn.fromBufferAttribute(this, t), fn.applyMatrix3(e), this.setXY(t, fn.x, fn.y);
3211
3211
  else if (this.itemSize === 3)
3212
3212
  for (let t = 0, r = this.count; t < r; t++)
3213
- fe.fromBufferAttribute(this, t), fe.applyMatrix3(e), this.setXYZ(t, fe.x, fe.y, fe.z);
3213
+ pe.fromBufferAttribute(this, t), pe.applyMatrix3(e), this.setXYZ(t, pe.x, pe.y, pe.z);
3214
3214
  return this;
3215
3215
  }
3216
3216
  applyMatrix4(e) {
3217
3217
  for (let t = 0, r = this.count; t < r; t++)
3218
- fe.fromBufferAttribute(this, t), fe.applyMatrix4(e), this.setXYZ(t, fe.x, fe.y, fe.z);
3218
+ pe.fromBufferAttribute(this, t), pe.applyMatrix4(e), this.setXYZ(t, pe.x, pe.y, pe.z);
3219
3219
  return this;
3220
3220
  }
3221
3221
  applyNormalMatrix(e) {
3222
3222
  for (let t = 0, r = this.count; t < r; t++)
3223
- fe.fromBufferAttribute(this, t), fe.applyNormalMatrix(e), this.setXYZ(t, fe.x, fe.y, fe.z);
3223
+ pe.fromBufferAttribute(this, t), pe.applyNormalMatrix(e), this.setXYZ(t, pe.x, pe.y, pe.z);
3224
3224
  return this;
3225
3225
  }
3226
3226
  transformDirection(e) {
3227
3227
  for (let t = 0, r = this.count; t < r; t++)
3228
- fe.fromBufferAttribute(this, t), fe.transformDirection(e), this.setXYZ(t, fe.x, fe.y, fe.z);
3228
+ pe.fromBufferAttribute(this, t), pe.transformDirection(e), this.setXYZ(t, pe.x, pe.y, pe.z);
3229
3229
  return this;
3230
3230
  }
3231
3231
  set(e, t = 0) {
@@ -3301,13 +3301,13 @@ var Kd = jh((O) => {
3301
3301
  super(new Uint32Array(e), t, r);
3302
3302
  }
3303
3303
  }
3304
- class Ht extends Ve {
3304
+ class Wt extends Ve {
3305
3305
  constructor(e, t, r) {
3306
3306
  super(new Float32Array(e), t, r);
3307
3307
  }
3308
3308
  }
3309
3309
  let yc = 0;
3310
- const Be = /* @__PURE__ */ new be(), xi = /* @__PURE__ */ new De(), rr = /* @__PURE__ */ new A(), Ce = /* @__PURE__ */ new Ae(), Tr = /* @__PURE__ */ new Ae(), ge = /* @__PURE__ */ new A();
3310
+ const Be = /* @__PURE__ */ new be(), xi = /* @__PURE__ */ new De(), nr = /* @__PURE__ */ new A(), Ce = /* @__PURE__ */ new Ae(), Tr = /* @__PURE__ */ new Ae(), ge = /* @__PURE__ */ new A();
3311
3311
  class Ue extends Yn {
3312
3312
  constructor() {
3313
3313
  super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: yc++ }), this.uuid = gr(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};
@@ -3382,7 +3382,7 @@ var Kd = jh((O) => {
3382
3382
  return xi.lookAt(e), xi.updateMatrix(), this.applyMatrix4(xi.matrix), this;
3383
3383
  }
3384
3384
  center() {
3385
- return this.computeBoundingBox(), this.boundingBox.getCenter(rr).negate(), this.translate(rr.x, rr.y, rr.z), this;
3385
+ return this.computeBoundingBox(), this.boundingBox.getCenter(nr).negate(), this.translate(nr.x, nr.y, nr.z), this;
3386
3386
  }
3387
3387
  setFromPoints(e) {
3388
3388
  const t = this.getAttribute("position");
@@ -3392,7 +3392,7 @@ var Kd = jh((O) => {
3392
3392
  const a = e[i];
3393
3393
  r.push(a.x, a.y, a.z || 0);
3394
3394
  }
3395
- this.setAttribute("position", new Ht(r, 3));
3395
+ this.setAttribute("position", new Wt(r, 3));
3396
3396
  } else {
3397
3397
  const r = Math.min(e.length, t.count);
3398
3398
  for (let i = 0; i < r; i++) {
@@ -3445,7 +3445,7 @@ var Kd = jh((O) => {
3445
3445
  for (let s = 0, a = t.length; s < a; s++) {
3446
3446
  const o = t[s], h = this.morphTargetsRelative;
3447
3447
  for (let c = 0, u = o.count; c < u; c++)
3448
- ge.fromBufferAttribute(o, c), h && (rr.fromBufferAttribute(e, c), ge.add(rr)), i = Math.max(i, r.distanceToSquared(ge));
3448
+ ge.fromBufferAttribute(o, c), h && (nr.fromBufferAttribute(e, c), ge.add(nr)), i = Math.max(i, r.distanceToSquared(ge));
3449
3449
  }
3450
3450
  this.boundingSphere.radius = Math.sqrt(i), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this);
3451
3451
  }
@@ -3762,7 +3762,7 @@ var Kd = jh((O) => {
3762
3762
  const t = e.attributes.position, r = [0];
3763
3763
  for (let i = 1, s = t.count; i < s; i++)
3764
3764
  In.fromBufferAttribute(t, i - 1), Pn.fromBufferAttribute(t, i), r[i] = r[i - 1], r[i] += In.distanceTo(Pn);
3765
- e.setAttribute("lineDistance", new Ht(r, 1));
3765
+ e.setAttribute("lineDistance", new Wt(r, 1));
3766
3766
  } else
3767
3767
  console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
3768
3768
  return this;
@@ -3837,7 +3837,7 @@ var Kd = jh((O) => {
3837
3837
  const t = e.attributes.position, r = [];
3838
3838
  for (let i = 0, s = t.count; i < s; i += 2)
3839
3839
  ua.fromBufferAttribute(t, i), la.fromBufferAttribute(t, i + 1), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + ua.distanceTo(la);
3840
- e.setAttribute("lineDistance", new Ht(r, 1));
3840
+ e.setAttribute("lineDistance", new Wt(r, 1));
3841
3841
  } else
3842
3842
  console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
3843
3843
  return this;
@@ -4495,7 +4495,7 @@ var Kd = jh((O) => {
4495
4495
  return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this;
4496
4496
  }
4497
4497
  };
4498
- class hr extends ts {
4498
+ class cr extends ts {
4499
4499
  constructor(e) {
4500
4500
  super(e), this.uuid = gr(), this.type = "Shape", this.holes = [];
4501
4501
  }
@@ -4562,7 +4562,7 @@ var Kd = jh((O) => {
4562
4562
  for (s = t - r; s >= e; s -= r) a = ga(s, n[s], n[s + 1], a);
4563
4563
  return a && Zn(a, a.next) && (Pr(a), a = a.next), a;
4564
4564
  }
4565
- function qt(n, e) {
4565
+ function Vt(n, e) {
4566
4566
  if (!n) return n;
4567
4567
  e || (e = n);
4568
4568
  let t = n, r;
@@ -4585,7 +4585,7 @@ var Kd = jh((O) => {
4585
4585
  continue;
4586
4586
  }
4587
4587
  if (n = c, n === o) {
4588
- a ? a === 1 ? (n = Rc(qt(n), e, t), Dr(n, e, t, r, i, s, 2)) : a === 2 && Dc(n, e, t, r, i, s) : Dr(qt(n), e, t, r, i, s, 1);
4588
+ a ? a === 1 ? (n = Rc(Vt(n), e, t), Dr(n, e, t, r, i, s, 2)) : a === 2 && Dc(n, e, t, r, i, s) : Dr(Vt(n), e, t, r, i, s, 1);
4589
4589
  break;
4590
4590
  }
4591
4591
  }
@@ -4596,7 +4596,7 @@ var Kd = jh((O) => {
4596
4596
  const i = e.x, s = t.x, a = r.x, o = e.y, h = t.y, c = r.y, u = i < s ? i < a ? i : a : s < a ? s : a, f = o < h ? o < c ? o : c : h < c ? h : c, l = i > s ? i > a ? i : a : s > a ? s : a, p = o > h ? o > c ? o : c : h > c ? h : c;
4597
4597
  let g = r.next;
4598
4598
  for (; g !== e; ) {
4599
- if (g.x >= u && g.x <= l && g.y >= f && g.y <= p && ar(i, o, s, h, a, c, g.x, g.y) && oe(g.prev, g, g.next) >= 0) return !1;
4599
+ if (g.x >= u && g.x <= l && g.y >= f && g.y <= p && or(i, o, s, h, a, c, g.x, g.y) && oe(g.prev, g, g.next) >= 0) return !1;
4600
4600
  g = g.next;
4601
4601
  }
4602
4602
  return !0;
@@ -4607,15 +4607,15 @@ var Kd = jh((O) => {
4607
4607
  const o = i.x, h = s.x, c = a.x, u = i.y, f = s.y, l = a.y, p = o < h ? o < c ? o : c : h < c ? h : c, g = u < f ? u < l ? u : l : f < l ? f : l, m = o > h ? o > c ? o : c : h > c ? h : c, x = u > f ? u > l ? u : l : f > l ? f : l, v = rs(p, g, e, t, r), w = rs(m, x, e, t, r);
4608
4608
  let b = n.prevZ, S = n.nextZ;
4609
4609
  for (; b && b.z >= v && S && S.z <= w; ) {
4610
- if (b.x >= p && b.x <= m && b.y >= g && b.y <= x && b !== i && b !== a && ar(o, u, h, f, c, l, b.x, b.y) && oe(b.prev, b, b.next) >= 0 || (b = b.prevZ, S.x >= p && S.x <= m && S.y >= g && S.y <= x && S !== i && S !== a && ar(o, u, h, f, c, l, S.x, S.y) && oe(S.prev, S, S.next) >= 0)) return !1;
4610
+ if (b.x >= p && b.x <= m && b.y >= g && b.y <= x && b !== i && b !== a && or(o, u, h, f, c, l, b.x, b.y) && oe(b.prev, b, b.next) >= 0 || (b = b.prevZ, S.x >= p && S.x <= m && S.y >= g && S.y <= x && S !== i && S !== a && or(o, u, h, f, c, l, S.x, S.y) && oe(S.prev, S, S.next) >= 0)) return !1;
4611
4611
  S = S.nextZ;
4612
4612
  }
4613
4613
  for (; b && b.z >= v; ) {
4614
- if (b.x >= p && b.x <= m && b.y >= g && b.y <= x && b !== i && b !== a && ar(o, u, h, f, c, l, b.x, b.y) && oe(b.prev, b, b.next) >= 0) return !1;
4614
+ if (b.x >= p && b.x <= m && b.y >= g && b.y <= x && b !== i && b !== a && or(o, u, h, f, c, l, b.x, b.y) && oe(b.prev, b, b.next) >= 0) return !1;
4615
4615
  b = b.prevZ;
4616
4616
  }
4617
4617
  for (; S && S.z <= w; ) {
4618
- if (S.x >= p && S.x <= m && S.y >= g && S.y <= x && S !== i && S !== a && ar(o, u, h, f, c, l, S.x, S.y) && oe(S.prev, S, S.next) >= 0) return !1;
4618
+ if (S.x >= p && S.x <= m && S.y >= g && S.y <= x && S !== i && S !== a && or(o, u, h, f, c, l, S.x, S.y) && oe(S.prev, S, S.next) >= 0) return !1;
4619
4619
  S = S.nextZ;
4620
4620
  }
4621
4621
  return !0;
@@ -4626,7 +4626,7 @@ var Kd = jh((O) => {
4626
4626
  const i = r.prev, s = r.next.next;
4627
4627
  !Zn(i, s) && Wo(i, r, r.next, s) && Ir(i, s) && Ir(s, i) && (e.push(i.i / t | 0), e.push(r.i / t | 0), e.push(s.i / t | 0), Pr(r), Pr(r.next), r = n = s), r = r.next;
4628
4628
  } while (r !== n);
4629
- return qt(r);
4629
+ return Vt(r);
4630
4630
  }
4631
4631
  function Dc(n, e, t, r, i, s) {
4632
4632
  let a = n;
@@ -4635,7 +4635,7 @@ var Kd = jh((O) => {
4635
4635
  for (; o !== a.prev; ) {
4636
4636
  if (a.i !== o.i && Vc(a, o)) {
4637
4637
  let h = qo(a, o);
4638
- a = qt(a, a.next), h = qt(h, h.next), Dr(a, e, t, r, i, s, 0), Dr(h, e, t, r, i, s, 0);
4638
+ a = Vt(a, a.next), h = Vt(h, h.next), Dr(a, e, t, r, i, s, 0), Dr(h, e, t, r, i, s, 0);
4639
4639
  return;
4640
4640
  }
4641
4641
  o = o.next;
@@ -4660,7 +4660,7 @@ var Kd = jh((O) => {
4660
4660
  if (!t)
4661
4661
  return e;
4662
4662
  const r = qo(t, n);
4663
- return qt(r, r.next), qt(t, t.next);
4663
+ return Vt(r, r.next), Vt(t, t.next);
4664
4664
  }
4665
4665
  function Nc(n, e) {
4666
4666
  let t = e, r = -1 / 0, i;
@@ -4678,7 +4678,7 @@ var Kd = jh((O) => {
4678
4678
  let u = 1 / 0, f;
4679
4679
  t = i;
4680
4680
  do
4681
- s >= t.x && t.x >= h && s !== t.x && ar(a < c ? s : r, a, h, c, a < c ? r : s, a, t.x, t.y) && (f = Math.abs(a - t.y) / (s - t.x), Ir(t, n) && (f < u || f === u && (t.x > i.x || t.x === i.x && Gc(i, t))) && (i = t, u = f)), t = t.next;
4681
+ s >= t.x && t.x >= h && s !== t.x && or(a < c ? s : r, a, h, c, a < c ? r : s, a, t.x, t.y) && (f = Math.abs(a - t.y) / (s - t.x), Ir(t, n) && (f < u || f === u && (t.x > i.x || t.x === i.x && Gc(i, t))) && (i = t, u = f)), t = t.next;
4682
4682
  while (t !== o);
4683
4683
  return i;
4684
4684
  }
@@ -4716,7 +4716,7 @@ var Kd = jh((O) => {
4716
4716
  while (e !== n);
4717
4717
  return t;
4718
4718
  }
4719
- function ar(n, e, t, r, i, s, a, o) {
4719
+ function or(n, e, t, r, i, s, a, o) {
4720
4720
  return (i - a) * (e - o) >= (n - a) * (s - o) && (n - a) * (r - o) >= (t - a) * (e - o) && (t - a) * (s - o) >= (i - a) * (r - o);
4721
4721
  }
4722
4722
  function Vc(n, e) {
@@ -4813,8 +4813,8 @@ var Kd = jh((O) => {
4813
4813
  for (let t = 0; t < e.length; t++)
4814
4814
  n.push(e[t].x), n.push(e[t].y);
4815
4815
  }
4816
- class cr extends Ue {
4817
- constructor(e = new hr([new V(0, 0.5), new V(-0.5, -0.5), new V(0.5, -0.5)]), t = 12) {
4816
+ class ur extends Ue {
4817
+ constructor(e = new cr([new V(0, 0.5), new V(-0.5, -0.5), new V(0.5, -0.5)]), t = 12) {
4818
4818
  super(), this.type = "ShapeGeometry", this.parameters = {
4819
4819
  shapes: e,
4820
4820
  curveSegments: t
@@ -4826,7 +4826,7 @@ var Kd = jh((O) => {
4826
4826
  else
4827
4827
  for (let u = 0; u < e.length; u++)
4828
4828
  c(e[u]), this.addGroup(o, h, u), o += h, h = 0;
4829
- this.setIndex(r), this.setAttribute("position", new Ht(i, 3)), this.setAttribute("normal", new Ht(s, 3)), this.setAttribute("uv", new Ht(a, 2));
4829
+ this.setIndex(r), this.setAttribute("position", new Wt(i, 3)), this.setAttribute("normal", new Wt(s, 3)), this.setAttribute("uv", new Wt(a, 2));
4830
4830
  function c(u) {
4831
4831
  const f = i.length / 3, l = u.extractPoints(t);
4832
4832
  let p = l.shape;
@@ -4864,7 +4864,7 @@ var Kd = jh((O) => {
4864
4864
  const a = t[e.shapes[i]];
4865
4865
  r.push(a);
4866
4866
  }
4867
- return new cr(r, e.curveSegments);
4867
+ return new ur(r, e.curveSegments);
4868
4868
  }
4869
4869
  }
4870
4870
  function Jc(n, e) {
@@ -5092,7 +5092,7 @@ var Kd = jh((O) => {
5092
5092
  function t(v) {
5093
5093
  const w = [];
5094
5094
  for (let b = 0, S = v.length; b < S; b++) {
5095
- const C = v[b], _ = new hr();
5095
+ const C = v[b], _ = new cr();
5096
5096
  _.curves = C.curves, w.push(_);
5097
5097
  }
5098
5098
  return w;
@@ -5124,14 +5124,14 @@ var Kd = jh((O) => {
5124
5124
  let a, o, h;
5125
5125
  const c = [];
5126
5126
  if (s.length === 1)
5127
- return o = s[0], h = new hr(), h.curves = o.curves, c.push(h), c;
5127
+ return o = s[0], h = new cr(), h.curves = o.curves, c.push(h), c;
5128
5128
  let u = !i(s[0].getPoints());
5129
5129
  u = e ? !u : u;
5130
5130
  const f = [], l = [];
5131
5131
  let p = [], g = 0, m;
5132
5132
  l[g] = void 0, p[g] = [];
5133
5133
  for (let v = 0, w = s.length; v < w; v++)
5134
- o = s[v], m = o.getPoints(), a = i(m), a = e ? !a : a, a ? (!u && l[g] && g++, l[g] = { s: new hr(), p: m }, l[g].s.curves = o.curves, u && g++, p[g] = []) : p[g].push({ h: o, p: m[0] });
5134
+ o = s[v], m = o.getPoints(), a = i(m), a = e ? !a : a, a ? (!u && l[g] && g++, l[g] = { s: new cr(), p: m }, l[g].s.curves = o.curves, u && g++, p[g] = []) : p[g].push({ h: o, p: m[0] });
5135
5135
  if (!l[0]) return t(s);
5136
5136
  if (l.length > 1) {
5137
5137
  let v = !1, w = 0;
@@ -5231,7 +5231,7 @@ var Kd = jh((O) => {
5231
5231
  this.unsupportedChars[e] || (this.unsupportedChars[e] = 0), this.unsupportedChars[e]++;
5232
5232
  }
5233
5233
  }
5234
- class Zo extends hr {
5234
+ class Zo extends cr {
5235
5235
  constructor() {
5236
5236
  super(...arguments), this.width = 0;
5237
5237
  }
@@ -5260,7 +5260,7 @@ var Kd = jh((O) => {
5260
5260
  const i = () => {
5261
5261
  n.removeEventListener("success", s), n.removeEventListener("error", a);
5262
5262
  }, s = () => {
5263
- t(Wt(n.result)), i();
5263
+ t(qt(n.result)), i();
5264
5264
  }, a = () => {
5265
5265
  r(n.error), i();
5266
5266
  };
@@ -5291,7 +5291,7 @@ var Kd = jh((O) => {
5291
5291
  if (e === "store")
5292
5292
  return t.objectStoreNames[1] ? void 0 : t.objectStore(t.objectStoreNames[0]);
5293
5293
  }
5294
- return Wt(n[e]);
5294
+ return qt(n[e]);
5295
5295
  },
5296
5296
  set(n, e, t) {
5297
5297
  return n[e] = t, !0;
@@ -5305,15 +5305,15 @@ var Kd = jh((O) => {
5305
5305
  }
5306
5306
  function su(n) {
5307
5307
  return ru().includes(n) ? function(...e) {
5308
- return n.apply(os(this), e), Wt(this.request);
5308
+ return n.apply(os(this), e), qt(this.request);
5309
5309
  } : function(...e) {
5310
- return Wt(n.apply(os(this), e));
5310
+ return qt(n.apply(os(this), e));
5311
5311
  };
5312
5312
  }
5313
5313
  function au(n) {
5314
5314
  return typeof n == "function" ? su(n) : (n instanceof IDBTransaction && iu(n), is(n, tu()) ? new Proxy(n, as) : n);
5315
5315
  }
5316
- function Wt(n) {
5316
+ function qt(n) {
5317
5317
  if (n instanceof IDBRequest)
5318
5318
  return nu(n);
5319
5319
  if (Ci.has(n))
@@ -5323,9 +5323,9 @@ var Kd = jh((O) => {
5323
5323
  }
5324
5324
  const os = (n) => Jn.get(n);
5325
5325
  function ou(n, e, { blocked: t, upgrade: r, blocking: i, terminated: s } = {}) {
5326
- const a = indexedDB.open(n, e), o = Wt(a);
5326
+ const a = indexedDB.open(n, e), o = qt(a);
5327
5327
  return r && a.addEventListener("upgradeneeded", (h) => {
5328
- r(Wt(a.result), h.oldVersion, h.newVersion, Wt(a.transaction), h);
5328
+ r(qt(a.result), h.oldVersion, h.newVersion, qt(a.transaction), h);
5329
5329
  }), t && a.addEventListener("blocked", (h) => t(
5330
5330
  // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
5331
5331
  h.oldVersion,
@@ -6032,7 +6032,7 @@ var Kd = jh((O) => {
6032
6032
  Fs[28] = 0;
6033
6033
  Ts[28] = 258;
6034
6034
  var Su = wu;
6035
- function nr(n, e, t, r, i) {
6035
+ function ir(n, e, t, r, i) {
6036
6036
  return Math.pow(1 - i, 3) * n + 3 * Math.pow(1 - i, 2) * i * e + 3 * (1 - i) * Math.pow(i, 2) * t + Math.pow(i, 3) * r;
6037
6037
  }
6038
6038
  function _t() {
@@ -6059,15 +6059,15 @@ var Kd = jh((O) => {
6059
6059
  if (p === 0)
6060
6060
  continue;
6061
6061
  var x = -m / p;
6062
- 0 < x && x < 1 && (l === 0 && this.addX(nr(h[l], c[l], u[l], f[l], x)), l === 1 && this.addY(nr(h[l], c[l], u[l], f[l], x)));
6062
+ 0 < x && x < 1 && (l === 0 && this.addX(ir(h[l], c[l], u[l], f[l], x)), l === 1 && this.addY(ir(h[l], c[l], u[l], f[l], x)));
6063
6063
  continue;
6064
6064
  }
6065
6065
  var v = Math.pow(p, 2) - 4 * m * g;
6066
6066
  if (!(v < 0)) {
6067
6067
  var w = (-p + Math.sqrt(v)) / (2 * g);
6068
- 0 < w && w < 1 && (l === 0 && this.addX(nr(h[l], c[l], u[l], f[l], w)), l === 1 && this.addY(nr(h[l], c[l], u[l], f[l], w)));
6068
+ 0 < w && w < 1 && (l === 0 && this.addX(ir(h[l], c[l], u[l], f[l], w)), l === 1 && this.addY(ir(h[l], c[l], u[l], f[l], w)));
6069
6069
  var b = (-p - Math.sqrt(v)) / (2 * g);
6070
- 0 < b && b < 1 && (l === 0 && this.addX(nr(h[l], c[l], u[l], f[l], b)), l === 1 && this.addY(nr(h[l], c[l], u[l], f[l], b)));
6070
+ 0 < b && b < 1 && (l === 0 && this.addX(ir(h[l], c[l], u[l], f[l], b)), l === 1 && this.addY(ir(h[l], c[l], u[l], f[l], b)));
6071
6071
  }
6072
6072
  }
6073
6073
  };
@@ -10436,7 +10436,7 @@ var Kd = jh((O) => {
10436
10436
  })
10437
10437
  };
10438
10438
  };
10439
- var ur = {
10439
+ var lr = {
10440
10440
  sequenceIndex: M.uShort,
10441
10441
  lookupListIndex: M.uShort
10442
10442
  };
@@ -10450,7 +10450,7 @@ var Kd = jh((O) => {
10450
10450
  var s = this.parseUShort(), a = this.parseUShort();
10451
10451
  return {
10452
10452
  input: this.parseUShortList(s - 1),
10453
- lookupRecords: this.parseRecordList(a, ur)
10453
+ lookupRecords: this.parseRecordList(a, lr)
10454
10454
  };
10455
10455
  })
10456
10456
  };
@@ -10463,7 +10463,7 @@ var Kd = jh((O) => {
10463
10463
  var s = this.parseUShort(), a = this.parseUShort();
10464
10464
  return {
10465
10465
  classes: this.parseUShortList(s - 1),
10466
- lookupRecords: this.parseRecordList(a, ur)
10466
+ lookupRecords: this.parseRecordList(a, lr)
10467
10467
  };
10468
10468
  })
10469
10469
  };
@@ -10472,7 +10472,7 @@ var Kd = jh((O) => {
10472
10472
  return {
10473
10473
  substFormat: t,
10474
10474
  coverages: this.parseList(r, M.pointer(M.coverage)),
10475
- lookupRecords: this.parseRecordList(i, ur)
10475
+ lookupRecords: this.parseRecordList(i, lr)
10476
10476
  };
10477
10477
  }
10478
10478
  H.assert(!1, "0x" + e.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
@@ -10488,7 +10488,7 @@ var Kd = jh((O) => {
10488
10488
  backtrack: this.parseUShortList(),
10489
10489
  input: this.parseUShortList(this.parseShort() - 1),
10490
10490
  lookahead: this.parseUShortList(),
10491
- lookupRecords: this.parseRecordList(ur)
10491
+ lookupRecords: this.parseRecordList(lr)
10492
10492
  };
10493
10493
  })
10494
10494
  };
@@ -10504,7 +10504,7 @@ var Kd = jh((O) => {
10504
10504
  backtrack: this.parseUShortList(),
10505
10505
  input: this.parseUShortList(this.parseShort() - 1),
10506
10506
  lookahead: this.parseUShortList(),
10507
- lookupRecords: this.parseRecordList(ur)
10507
+ lookupRecords: this.parseRecordList(lr)
10508
10508
  };
10509
10509
  })
10510
10510
  };
@@ -10514,7 +10514,7 @@ var Kd = jh((O) => {
10514
10514
  backtrackCoverage: this.parseList(M.pointer(M.coverage)),
10515
10515
  inputCoverage: this.parseList(M.pointer(M.coverage)),
10516
10516
  lookaheadCoverage: this.parseList(M.pointer(M.coverage)),
10517
- lookupRecords: this.parseRecordList(ur)
10517
+ lookupRecords: this.parseRecordList(lr)
10518
10518
  };
10519
10519
  H.assert(!1, "0x" + e.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
10520
10520
  };
@@ -10810,14 +10810,14 @@ var Kd = jh((O) => {
10810
10810
  fontBBox: [0, b.yMin, b.ascender, b.advanceWidthMax]
10811
10811
  }), W = n.metas && Object.keys(n.metas).length > 0 ? Bh.make(n.metas) : void 0, $ = [S, C, _, E, re, D, ne, ae, B];
10812
10812
  ie && $.push(ie), n.tables.gsub && $.push(Eh.make(n.tables.gsub)), W && $.push(W);
10813
- for (var Xt = _h($), Qr = Xt.encode(), Kr = Ms(Qr), xr = Xt.fields, en = !1, gt = 0; gt < xr.length; gt += 1)
10813
+ for (var Yt = _h($), Qr = Yt.encode(), Kr = Ms(Qr), xr = Yt.fields, en = !1, gt = 0; gt < xr.length; gt += 1)
10814
10814
  if (xr[gt].name === "head table") {
10815
10815
  xr[gt].value.checkSumAdjustment = 2981146554 - Kr, en = !0;
10816
10816
  break;
10817
10817
  }
10818
10818
  if (!en)
10819
10819
  throw new Error("Could not find head table with checkSum to adjust.");
10820
- return Xt;
10820
+ return Yt;
10821
10821
  }
10822
10822
  var Vl = { make: _h, fontToTable: ql, computeCheckSum: Ms };
10823
10823
  function Bi(n, e) {
@@ -11425,7 +11425,7 @@ var Kd = jh((O) => {
11425
11425
  function Ql(n, e, t, r, i) {
11426
11426
  return i.lowMemory ? jl(n, e, t, r) : $l(n, e, t, r);
11427
11427
  }
11428
- var Rh = { getPath: Lh, parse: Ql }, Dh, Vt, Ih, ms;
11428
+ var Rh = { getPath: Lh, parse: Ql }, Dh, Xt, Ih, ms;
11429
11429
  function Ph(n) {
11430
11430
  this.font = n, this.getCommands = function(e) {
11431
11431
  return Rh.getPath(e).commands;
@@ -11651,7 +11651,7 @@ var Kd = jh((O) => {
11651
11651
  if (!i) {
11652
11652
  Tt.prototype = sf, i = this._fpgmState = new Tt("fpgm", t.tables.fpgm), i.funcs = [], i.font = t, O.DEBUG && (console.log("---EXEC FPGM---"), i.step = -1);
11653
11653
  try {
11654
- Vt(i);
11654
+ Xt(i);
11655
11655
  } catch (c) {
11656
11656
  console.log("Hinting error in FPGM:" + c), this._errorState = 3;
11657
11657
  return;
@@ -11666,7 +11666,7 @@ var Kd = jh((O) => {
11666
11666
  r.cvt = [];
11667
11667
  O.DEBUG && (console.log("---EXEC PREP---"), r.step = -1);
11668
11668
  try {
11669
- Vt(r);
11669
+ Xt(r);
11670
11670
  } catch (c) {
11671
11671
  this._errorState < 2 && console.log("Hinting error in PREP:" + c), this._errorState = 2;
11672
11672
  }
@@ -11702,7 +11702,7 @@ var Kd = jh((O) => {
11702
11702
  n.instructions && !o.inhibitGridFit && (o = new Tt("glyf", n.instructions), o.gZone = o.z0 = o.z1 = o.z2 = a, o.contours = s, a.push(
11703
11703
  new dt(0, 0),
11704
11704
  new dt(Math.round(n.advanceWidth * t), 0)
11705
- ), O.DEBUG && (console.log("---EXEC COMPOSITE---"), o.step = -1), Vt(o), a.length -= 2);
11705
+ ), O.DEBUG && (console.log("---EXEC COMPOSITE---"), o.step = -1), Xt(o), a.length -= 2);
11706
11706
  }
11707
11707
  return a;
11708
11708
  };
@@ -11725,14 +11725,14 @@ var Kd = jh((O) => {
11725
11725
  if (a.push(
11726
11726
  new dt(0, 0),
11727
11727
  new dt(Math.round(n.advanceWidth * t), 0)
11728
- ), Vt(e), a.length -= 2, O.DEBUG) {
11728
+ ), Xt(e), a.length -= 2, O.DEBUG) {
11729
11729
  console.log("FINISHED GLYPH", e.stack);
11730
11730
  for (var g = 0; g < s; g++)
11731
11731
  console.log(g, a[g].x, a[g].y);
11732
11732
  }
11733
11733
  }
11734
11734
  };
11735
- Vt = function(n) {
11735
+ Xt = function(n) {
11736
11736
  var e = n.prog;
11737
11737
  if (e) {
11738
11738
  var t = e.length, r;
@@ -11924,7 +11924,7 @@ var Kd = jh((O) => {
11924
11924
  var i = n.ip, s = n.prog;
11925
11925
  n.prog = n.funcs[t];
11926
11926
  for (var a = 0; a < r; a++)
11927
- Vt(n), O.DEBUG && console.log(
11927
+ Xt(n), O.DEBUG && console.log(
11928
11928
  ++n.step,
11929
11929
  a + 1 < r ? "next loopcall" : "done loopcall",
11930
11930
  a
@@ -11935,7 +11935,7 @@ var Kd = jh((O) => {
11935
11935
  var e = n.stack.pop();
11936
11936
  O.DEBUG && console.log(n.step, "CALL[]", e);
11937
11937
  var t = n.ip, r = n.prog;
11938
- n.prog = n.funcs[e], Vt(n), n.ip = t, n.prog = r, O.DEBUG && console.log(++n.step, "returning from", e);
11938
+ n.prog = n.funcs[e], Xt(n), n.ip = t, n.prog = r, O.DEBUG && console.log(++n.step, "returning from", e);
11939
11939
  }
11940
11940
  function Of(n) {
11941
11941
  var e = n.stack, t = e.pop();
@@ -14626,7 +14626,7 @@ var Kd = jh((O) => {
14626
14626
  );
14627
14627
  if (e == null) {
14628
14628
  const t = this.font.generateShapes(this.char, this.fontSize);
14629
- return e = new cr(t, 4), e.hasAttribute("uv") && e.deleteAttribute("uv"), e.hasAttribute("normal") && e.deleteAttribute("normal"), Op(e, 1e-6);
14629
+ return e = new ur(t, 4), e.hasAttribute("uv") && e.deleteAttribute("uv"), e.hasAttribute("normal") && e.deleteAttribute("normal"), Op(e, 1e-6);
14630
14630
  }
14631
14631
  return e;
14632
14632
  }
@@ -14865,7 +14865,7 @@ var Kd = jh((O) => {
14865
14865
  return e;
14866
14866
  }
14867
14867
  function go(n, e) {
14868
- const t = kt.area(n.getPoints(32)) > 0, r = e === t ? n.curves.slice() : Wp(n.curves), i = new hr();
14868
+ const t = kt.area(n.getPoints(32)) > 0, r = e === t ? n.curves.slice() : Wp(n.curves), i = new cr();
14869
14869
  return i.curves.push(...r), i;
14870
14870
  }
14871
14871
  function qp(n, e = 32) {
@@ -16207,8 +16207,8 @@ var Kd = jh((O) => {
16207
16207
  Qn.toByteArray = hd;
16208
16208
  Qn.fromByteArray = ld;
16209
16209
  var et = [], _e = [], id = typeof Uint8Array < "u" ? Uint8Array : Array, Ii = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
16210
- for (var ir = 0, sd = Ii.length; ir < sd; ++ir)
16211
- et[ir] = Ii[ir], _e[Ii.charCodeAt(ir)] = ir;
16210
+ for (var sr = 0, sd = Ii.length; sr < sd; ++sr)
16211
+ et[sr] = Ii[sr], _e[Ii.charCodeAt(sr)] = sr;
16212
16212
  _e[45] = 62;
16213
16213
  _e[95] = 63;
16214
16214
  function Vh(n) {
@@ -16910,12 +16910,12 @@ var Kd = jh((O) => {
16910
16910
  }, o.prototype.writeInt32BE = function(d, y, T) {
16911
16911
  return d = +d, y = y >>> 0, T || $(this, d, y, 4, 2147483647, -2147483648), d < 0 && (d = 4294967295 + d + 1), this[y] = d >>> 24, this[y + 1] = d >>> 16, this[y + 2] = d >>> 8, this[y + 3] = d & 255, y + 4;
16912
16912
  };
16913
- function Xt(F, d, y, T, k, L) {
16913
+ function Yt(F, d, y, T, k, L) {
16914
16914
  if (y + T > F.length) throw new RangeError("Index out of range");
16915
16915
  if (y < 0) throw new RangeError("Index out of range");
16916
16916
  }
16917
16917
  function Qr(F, d, y, T, k) {
16918
- return d = +d, y = y >>> 0, k || Xt(F, d, y, 4), t.write(F, d, y, T, 23, 4), y + 4;
16918
+ return d = +d, y = y >>> 0, k || Yt(F, d, y, 4), t.write(F, d, y, T, 23, 4), y + 4;
16919
16919
  }
16920
16920
  o.prototype.writeFloatLE = function(d, y, T) {
16921
16921
  return Qr(this, d, y, !0, T);
@@ -16923,7 +16923,7 @@ var Kd = jh((O) => {
16923
16923
  return Qr(this, d, y, !1, T);
16924
16924
  };
16925
16925
  function Kr(F, d, y, T, k) {
16926
- return d = +d, y = y >>> 0, k || Xt(F, d, y, 8), t.write(F, d, y, T, 52, 8), y + 8;
16926
+ return d = +d, y = y >>> 0, k || Yt(F, d, y, 8), t.write(F, d, y, T, 52, 8), y + 8;
16927
16927
  }
16928
16928
  o.prototype.writeDoubleLE = function(d, y, T) {
16929
16929
  return Kr(this, d, y, !0, T);
@@ -17060,26 +17060,26 @@ var Kd = jh((O) => {
17060
17060
  return d;
17061
17061
  }();
17062
17062
  })(Ls);
17063
- var Rn = Ls, lr = Rn.Buffer, Oe = {}, Le;
17063
+ var Rn = Ls, fr = Rn.Buffer, Oe = {}, Le;
17064
17064
  for (Le in Rn)
17065
17065
  Rn.hasOwnProperty(Le) && (Le === "SlowBuffer" || Le === "Buffer" || (Oe[Le] = Rn[Le]));
17066
- var fr = Oe.Buffer = {};
17067
- for (Le in lr)
17068
- lr.hasOwnProperty(Le) && (Le === "allocUnsafe" || Le === "allocUnsafeSlow" || (fr[Le] = lr[Le]));
17069
- Oe.Buffer.prototype = lr.prototype;
17070
- (!fr.from || fr.from === Uint8Array.from) && (fr.from = function(n, e, t) {
17066
+ var pr = Oe.Buffer = {};
17067
+ for (Le in fr)
17068
+ fr.hasOwnProperty(Le) && (Le === "allocUnsafe" || Le === "allocUnsafeSlow" || (pr[Le] = fr[Le]));
17069
+ Oe.Buffer.prototype = fr.prototype;
17070
+ (!pr.from || pr.from === Uint8Array.from) && (pr.from = function(n, e, t) {
17071
17071
  if (typeof n == "number")
17072
17072
  throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof n);
17073
17073
  if (n && typeof n.length > "u")
17074
17074
  throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n);
17075
- return lr(n, e, t);
17075
+ return fr(n, e, t);
17076
17076
  });
17077
- fr.alloc || (fr.alloc = function(n, e, t) {
17077
+ pr.alloc || (pr.alloc = function(n, e, t) {
17078
17078
  if (typeof n != "number")
17079
17079
  throw new TypeError('The "size" argument must be of type number. Received type ' + typeof n);
17080
17080
  if (n < 0 || n >= 2 * (1 << 30))
17081
17081
  throw new RangeError('The value "' + n + '" is invalid for option "size"');
17082
- var r = lr(n);
17082
+ var r = fr(n);
17083
17083
  return !e || e.length === 0 ? r.fill(0) : typeof t == "string" ? r.fill(e, t) : r.fill(e), r;
17084
17084
  });
17085
17085
  if (!Oe.kStringMaxLength)
@@ -27300,7 +27300,7 @@ var Kd = jh((O) => {
27300
27300
  }
27301
27301
  e.setAttribute(
27302
27302
  "position",
27303
- new Ht(r, 3)
27303
+ new Wt(r, 3)
27304
27304
  ), e.setIndex(i);
27305
27305
  }
27306
27306
  return e;
@@ -27809,7 +27809,7 @@ var Kd = jh((O) => {
27809
27809
  return e.isByLayer && e.layer ? `layer_${e.layer}_${e.color}` : `entity_${e.color}`;
27810
27810
  }
27811
27811
  }
27812
- var sr = /* @__PURE__ */ ((n) => (n[n.NONE = 0] = "NONE", n[n.WORD = 1] = "WORD", n[n.STACK = 2] = "STACK", n[n.SPACE = 3] = "SPACE", n[n.NBSP = 4] = "NBSP", n[n.TABULATOR = 5] = "TABULATOR", n[n.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", n[n.NEW_COLUMN = 7] = "NEW_COLUMN", n[n.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", n[n.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", n))(sr || {}), Mr = /* @__PURE__ */ ((n) => (n[n.BOTTOM = 0] = "BOTTOM", n[n.MIDDLE = 1] = "MIDDLE", n[n.TOP = 2] = "TOP", n))(Mr || {}), We = /* @__PURE__ */ ((n) => (n[n.DEFAULT = 0] = "DEFAULT", n[n.LEFT = 1] = "LEFT", n[n.RIGHT = 2] = "RIGHT", n[n.CENTER = 3] = "CENTER", n[n.JUSTIFIED = 4] = "JUSTIFIED", n[n.DISTRIBUTED = 5] = "DISTRIBUTED", n))(We || {});
27812
+ var ar = /* @__PURE__ */ ((n) => (n[n.NONE = 0] = "NONE", n[n.WORD = 1] = "WORD", n[n.STACK = 2] = "STACK", n[n.SPACE = 3] = "SPACE", n[n.NBSP = 4] = "NBSP", n[n.TABULATOR = 5] = "TABULATOR", n[n.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", n[n.NEW_COLUMN = 7] = "NEW_COLUMN", n[n.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", n[n.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", n))(ar || {}), Mr = /* @__PURE__ */ ((n) => (n[n.BOTTOM = 0] = "BOTTOM", n[n.MIDDLE = 1] = "MIDDLE", n[n.TOP = 2] = "TOP", n))(Mr || {}), We = /* @__PURE__ */ ((n) => (n[n.DEFAULT = 0] = "DEFAULT", n[n.LEFT = 1] = "LEFT", n[n.RIGHT = 2] = "RIGHT", n[n.CENTER = 3] = "CENTER", n[n.JUSTIFIED = 4] = "JUSTIFIED", n[n.DISTRIBUTED = 5] = "DISTRIBUTED", n))(We || {});
27813
27813
  const Hd = {
27814
27814
  c: "Ø",
27815
27815
  d: "°",
@@ -28870,8 +28870,57 @@ var Kd = jh((O) => {
28870
28870
  this.type = e, this.ctx = t, this.data = r;
28871
28871
  }
28872
28872
  }
28873
- var pr = /* @__PURE__ */ ((n) => (n[n.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", n[n.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", n[n.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", n[n.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", n[n.BY_STYLE = 5] = "BY_STYLE", n))(pr || {}), pe = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.NEW_PARAGRAPH = "NEW_PARAGRAPH", n.STACK = "STACK", n))(pe || {});
28874
- const Yd = /* @__PURE__ */ new A(), Zd = 1.666666, On = 0.3, vs = "";
28873
+ var Gt = /* @__PURE__ */ ((n) => (n[n.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", n[n.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", n[n.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", n[n.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", n[n.BY_STYLE = 5] = "BY_STYLE", n))(Gt || {}), fe = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.NEW_PARAGRAPH = "NEW_PARAGRAPH", n.STACK = "STACK", n))(fe || {});
28874
+ const vs = "";
28875
+ function Yd(n) {
28876
+ if (!(!n || [
28877
+ n.min.x,
28878
+ n.min.y,
28879
+ n.min.z,
28880
+ n.max.x,
28881
+ n.max.y,
28882
+ n.max.z
28883
+ ].some((t) => !Number.isFinite(t))))
28884
+ return n;
28885
+ }
28886
+ function Zd(n, e, t) {
28887
+ const r = [];
28888
+ if (n.filter((l) => l.char !== vs).forEach((l) => {
28889
+ const p = Yd(
28890
+ new Ae().copy(l.box).applyMatrix4(e)
28891
+ );
28892
+ p && r.push({
28893
+ type: l.type === fe.NEW_PARAGRAPH ? fe.NEW_PARAGRAPH : fe.CHAR,
28894
+ box: p,
28895
+ char: l.type === fe.NEW_PARAGRAPH ? `
28896
+ ` : l.char,
28897
+ children: []
28898
+ });
28899
+ }), t !== fe.STACK)
28900
+ return r;
28901
+ const i = (l) => l.type === fe.CHAR && l.char.trim().length === 0, s = (l) => l.type === fe.CHAR && l.char.trim().length > 0, a = r.findIndex(s);
28902
+ if (a < 0) return r;
28903
+ let o = -1;
28904
+ for (let l = r.length - 1; l >= 0; l--)
28905
+ if (s(r[l])) {
28906
+ o = l;
28907
+ break;
28908
+ }
28909
+ const h = r.slice(0, a).filter(i), c = r.slice(o + 1).filter(i), u = r.slice(a, o + 1).filter(s);
28910
+ if (u.length === 0) return [...h, ...c];
28911
+ const f = new Ae().copy(u[0].box);
28912
+ return u.slice(1).forEach((l) => f.union(l.box)), [
28913
+ ...h,
28914
+ {
28915
+ type: fe.STACK,
28916
+ char: "",
28917
+ box: f,
28918
+ children: u
28919
+ },
28920
+ ...c
28921
+ ];
28922
+ }
28923
+ const Jd = /* @__PURE__ */ new A(), $d = 1.666666, On = 0.3;
28875
28924
  class Ns extends jr {
28876
28925
  /**
28877
28926
  * Creates a new RenderContext instance with optional initial values.
@@ -28905,7 +28954,7 @@ var Kd = jh((O) => {
28905
28954
  this.color.rgb = [t, r, i];
28906
28955
  }
28907
28956
  }
28908
- class Jd {
28957
+ class jd {
28909
28958
  /**
28910
28959
  * Construct one instance of this class and initialize some properties with default values.
28911
28960
  * @param style Input text style
@@ -28929,7 +28978,7 @@ var Kd = jh((O) => {
28929
28978
  }), this._currentContext.setColorFromHex(e.color), this._currentContext.fontFace.family = this.textStyle.font.toLowerCase(), this._currentContext.widthFactor = {
28930
28979
  value: i.widthFactor,
28931
28980
  isRelative: !0
28932
- }, this._currentContext.oblique = e.obliqueAngle || 0, this._maxFontSize = 0, this._currentHorizontalAlignment = i.horizontalAlignment, this._lastCharBoxTarget = void 0, this._currentIndent = 0, this._currentLeftMargin = 0, this._currentRightMargin = 0, this.initLineParams();
28981
+ }, this._currentContext.oblique = e.obliqueAngle || 0, this._maxFontSize = 0, this._currentHorizontalAlignment = i.horizontalAlignment, this._lastCharBoxTarget = void 0, this._lineHasRenderableChar = !1, this._pendingEmptyLineFontSizeAdjust = void 0, this._currentIndent = 0, this._currentLeftMargin = 0, this._currentRightMargin = 0, this.initLineParams();
28933
28982
  }
28934
28983
  get fontManager() {
28935
28984
  return this._fontManager;
@@ -29004,7 +29053,8 @@ var Kd = jh((O) => {
29004
29053
  * The height of current line of texts
29005
29054
  */
29006
29055
  get currentLineHeight() {
29007
- return this.defaultLineSpaceFactor * this.currentFontSize * Zd + this.currentMaxFontSize;
29056
+ const e = this.defaultLineSpaceFactor * this.currentFontSize * $d, t = this.currentMaxFontSize > 0 ? this.currentMaxFontSize : this.currentFontSize;
29057
+ return e + t;
29008
29058
  }
29009
29059
  /**
29010
29060
  * The maximum font size in current line. Characters in one line may have different font and font
@@ -29079,7 +29129,7 @@ var Kd = jh((O) => {
29079
29129
  break;
29080
29130
  case "c":
29081
29131
  case "C":
29082
- e.changes.aci ? e.changes.aci === 0 ? this._currentContext.setColorFromHex(this._options.byBlockColor) : e.changes.aci === 256 ? this._currentContext.setColorFromHex(this._options.byLayerColor) : this._currentContext.color.aci = e.changes.aci : e.changes.rgb && (this._currentContext.color.rgb = e.changes.rgb);
29132
+ e.changes.aci !== void 0 && e.changes.aci !== null ? e.changes.aci === 0 ? this._currentContext.setColorFromHex(this._options.byBlockColor) : e.changes.aci === 256 ? this._currentContext.setColorFromHex(this._options.byLayerColor) : this._currentContext.color.aci = e.changes.aci : e.changes.rgb && (this._currentContext.color.rgb = e.changes.rgb);
29083
29133
  break;
29084
29134
  case "W":
29085
29135
  e.changes.widthFactor && (e.changes.widthFactor.isRelative ? this._currentContext.widthFactor = {
@@ -29158,7 +29208,7 @@ var Kd = jh((O) => {
29158
29208
  this._lastCharBoxTarget = void 0;
29159
29209
  const t = [], r = [], i = [], s = [], a = new fa();
29160
29210
  for (const o of e)
29161
- if (o.type === sr.NEW_PARAGRAPH)
29211
+ if (o.type === ar.NEW_PARAGRAPH)
29162
29212
  this.startNewParagraph(
29163
29213
  t,
29164
29214
  r,
@@ -29166,7 +29216,7 @@ var Kd = jh((O) => {
29166
29216
  s,
29167
29217
  a
29168
29218
  );
29169
- else if (o.type === sr.WORD) {
29219
+ else if (o.type === ar.WORD) {
29170
29220
  const h = o.data;
29171
29221
  Array.isArray(h) ? h.forEach(
29172
29222
  (c) => this.processWord(
@@ -29183,9 +29233,9 @@ var Kd = jh((O) => {
29183
29233
  i,
29184
29234
  s
29185
29235
  );
29186
- } else if (o.type === sr.SPACE)
29236
+ } else if (o.type === ar.SPACE)
29187
29237
  this.processBlank(i, s);
29188
- else if (o.type === sr.PROPERTIES_CHANGED) {
29238
+ else if (o.type === ar.PROPERTIES_CHANGED) {
29189
29239
  this.processGeometries(
29190
29240
  t,
29191
29241
  r,
@@ -29194,8 +29244,15 @@ var Kd = jh((O) => {
29194
29244
  a
29195
29245
  );
29196
29246
  const h = o.data;
29197
- h.command === void 0 ? this._contextStack.length > 0 && (this._currentContext = this._contextStack.pop()) : (h.depth > 0 && this._contextStack.push(this._currentContext.clone()), this.processFormat(h));
29198
- } else if (o.type === sr.STACK) {
29247
+ if (h.command === void 0)
29248
+ for (; this._contextStack.length > h.depth; )
29249
+ this._currentContext = this._contextStack.pop();
29250
+ else {
29251
+ for (; this._contextStack.length < h.depth; )
29252
+ this._contextStack.push(this._currentContext.clone());
29253
+ this.processFormat(h);
29254
+ }
29255
+ } else if (o.type === ar.STACK) {
29199
29256
  this.processGeometries(
29200
29257
  t,
29201
29258
  r,
@@ -29211,7 +29268,7 @@ var Kd = jh((O) => {
29211
29268
  i,
29212
29269
  s
29213
29270
  );
29214
- const c = h[2] === "^" ? pe.CHAR : pe.STACK;
29271
+ const c = h[2] === "^" ? fe.CHAR : fe.STACK;
29215
29272
  this.processGeometries(
29216
29273
  t,
29217
29274
  r,
@@ -29229,7 +29286,7 @@ var Kd = jh((O) => {
29229
29286
  a
29230
29287
  ), this.processLastLine(), a;
29231
29288
  }
29232
- processGeometries(e, t, r, i, s, a = pe.CHAR) {
29289
+ processGeometries(e, t, r, i, s, a = fe.CHAR) {
29233
29290
  if (e.length > 0 || t.length > 0) {
29234
29291
  const o = this.toThreeObject(
29235
29292
  e,
@@ -29367,12 +29424,12 @@ var Kd = jh((O) => {
29367
29424
  new A(e + r, a, 0)
29368
29425
  );
29369
29426
  this.resolveCharBoxTarget(i, s) === "mesh" ? i.push({
29370
- type: pe.CHAR,
29427
+ type: fe.CHAR,
29371
29428
  box: o,
29372
29429
  char: vs,
29373
29430
  children: []
29374
29431
  }) : s.push({
29375
- type: pe.CHAR,
29432
+ type: fe.CHAR,
29376
29433
  box: o,
29377
29434
  char: vs,
29378
29435
  children: []
@@ -29387,7 +29444,7 @@ var Kd = jh((O) => {
29387
29444
  }
29388
29445
  processBlank(e, t) {
29389
29446
  if (this._options.collectCharBoxes !== !1) {
29390
- const r = this._hOffset, i = this.flowDirection == pr.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, s = new Ae(
29447
+ const r = this._hOffset, i = this.flowDirection == Gt.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, s = new Ae(
29391
29448
  new A(r, i, 0),
29392
29449
  new A(
29393
29450
  r + this._currentContext.blankWidth,
@@ -29396,12 +29453,12 @@ var Kd = jh((O) => {
29396
29453
  )
29397
29454
  );
29398
29455
  this.resolveCharBoxTarget(e, t) === "mesh" ? e.push({
29399
- type: pe.CHAR,
29456
+ type: fe.CHAR,
29400
29457
  box: s,
29401
29458
  char: " ",
29402
29459
  children: []
29403
29460
  }) : t.push({
29404
- type: pe.CHAR,
29461
+ type: fe.CHAR,
29405
29462
  box: s,
29406
29463
  char: " ",
29407
29464
  children: []
@@ -29413,13 +29470,13 @@ var Kd = jh((O) => {
29413
29470
  if (this._options.collectCharBoxes === !1 || !e || !t) return;
29414
29471
  const r = new A(this._hOffset, this._vOffset, 0), i = new Ae(r.clone(), r.clone());
29415
29472
  this.resolveCharBoxTarget(e, t) === "mesh" ? e.push({
29416
- type: pe.NEW_PARAGRAPH,
29473
+ type: fe.NEW_PARAGRAPH,
29417
29474
  box: i,
29418
29475
  char: `
29419
29476
  `,
29420
29477
  children: []
29421
29478
  }) : t.push({
29422
- type: pe.NEW_PARAGRAPH,
29479
+ type: fe.NEW_PARAGRAPH,
29423
29480
  box: i,
29424
29481
  char: `
29425
29482
  `,
@@ -29432,6 +29489,7 @@ var Kd = jh((O) => {
29432
29489
  this.processBlank(i, s);
29433
29490
  return;
29434
29491
  }
29492
+ this._lineHasRenderableChar || this.applyPendingEmptyLineYAdjust();
29435
29493
  const o = a.toGeometry();
29436
29494
  o.scale(this.currentWidthFactor, 1, 1);
29437
29495
  let h = this._currentContext.oblique;
@@ -29458,17 +29516,17 @@ var Kd = jh((O) => {
29458
29516
  }
29459
29517
  const c = this.fontManager.getFontType(this.currentFont);
29460
29518
  this._currentContext.bold && c === "mesh" && o.scale(1.06, 1.06, 1), this.hOffset > (this.maxLineWidth || 1 / 0) && this.startNewLine(i, s);
29461
- const u = this.hOffset, f = this.flowDirection == pr.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.defaultFontSize, l = a.width * this.currentWidthFactor, p = this.currentFontSize;
29462
- if (o.translate(u, f, 0), this.currentHorizontalAlignment == We.DISTRIBUTED ? this._hOffset += a.width * this.currentWidthFactor : this._hOffset += a.width * this.currentWordSpace * this.currentWidthFactor, t.push(o), this._options.collectCharBoxes !== !1) {
29519
+ const u = this.hOffset, f = this.flowDirection == Gt.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.defaultFontSize, l = a.width * this.currentWidthFactor, p = this.currentFontSize;
29520
+ if (o.translate(u, f, 0), this.currentHorizontalAlignment == We.DISTRIBUTED ? this._hOffset += a.width * this.currentWidthFactor : this._hOffset += a.width * this.currentWordSpace * this.currentWidthFactor, t.push(o), this._lineHasRenderableChar = !0, this._options.collectCharBoxes !== !1) {
29463
29521
  o.userData.char = e, o.boundingBox || o.computeBoundingBox();
29464
29522
  const x = new Ae().copy(o.boundingBox);
29465
- o instanceof cr ? (this._lastCharBoxTarget = "mesh", i.push({
29466
- type: pe.CHAR,
29523
+ o instanceof ur ? (this._lastCharBoxTarget = "mesh", i.push({
29524
+ type: fe.CHAR,
29467
29525
  box: x,
29468
29526
  char: e,
29469
29527
  children: []
29470
29528
  })) : (this._lastCharBoxTarget = "line", s.push({
29471
- type: pe.CHAR,
29529
+ type: fe.CHAR,
29472
29530
  box: x,
29473
29531
  char: e,
29474
29532
  children: []
@@ -29571,7 +29629,12 @@ var Kd = jh((O) => {
29571
29629
  this.recordLineBreak(e, t), this.advanceToNextLine();
29572
29630
  }
29573
29631
  advanceToNextLine() {
29574
- this._hOffset = 0, this.flowDirection == pr.BOTTOM_TO_TOP ? this._vOffset += this.currentLineHeight : this._vOffset -= this.currentLineHeight, this._lineCount++, this.processAlignment(), this._currentLineObjects = [], this._lineCount == 2 ? this._totalHeight = this.currentMaxFontSize : this._totalHeight = this._totalHeight + this.currentLineHeight, this._maxFontSize = 0;
29632
+ this._hOffset = 0, this._lineHasRenderableChar ? this._pendingEmptyLineFontSizeAdjust = void 0 : this._pendingEmptyLineFontSizeAdjust = this.currentFontSize, this.flowDirection == Gt.BOTTOM_TO_TOP ? this._vOffset += this.currentLineHeight : this._vOffset -= this.currentLineHeight, this._lineCount++, this.processAlignment(), this._currentLineObjects = [], this._lineCount == 2 ? this._totalHeight = this.currentMaxFontSize : this._totalHeight = this._totalHeight + this.currentLineHeight, this._maxFontSize = 0, this._lineHasRenderableChar = !1;
29633
+ }
29634
+ applyPendingEmptyLineYAdjust() {
29635
+ if (this._pendingEmptyLineFontSizeAdjust === void 0) return;
29636
+ const e = this.currentFontSize - this._pendingEmptyLineFontSizeAdjust;
29637
+ e !== 0 && (this.flowDirection == Gt.BOTTOM_TO_TOP ? this._vOffset += e : this._vOffset -= e), this._pendingEmptyLineFontSizeAdjust = void 0;
29575
29638
  }
29576
29639
  resolveCharBoxTarget(e, t) {
29577
29640
  return this._lastCharBoxTarget ? this._lastCharBoxTarget : e.length > 0 && t.length === 0 ? "mesh" : t.length > 0 && e.length === 0 ? "line" : this.fontManager.getFontType(this.currentFont) === "mesh" ? "mesh" : "line";
@@ -29593,7 +29656,7 @@ var Kd = jh((O) => {
29593
29656
  if (e.forEach((a, o) => {
29594
29657
  a.geometry.boundingBox || a.geometry.computeBoundingBox(), o === 0 ? t = a.geometry.boundingBox : t.union(a.geometry.boundingBox);
29595
29658
  }), !t) return;
29596
- const r = t, i = r.getSize(Yd), s = (a, o) => {
29659
+ const r = t, i = r.getSize(Jd), s = (a, o) => {
29597
29660
  var c;
29598
29661
  const h = (c = a.userData) == null ? void 0 : c.charBoxes;
29599
29662
  if (h && h.length > 0) {
@@ -29663,14 +29726,14 @@ var Kd = jh((O) => {
29663
29726
  layer: this._style.layer,
29664
29727
  isByLayer: this._style.isByLayer,
29665
29728
  color: o
29666
- }), u = this._options.collectCharBoxes !== !1, f = e.filter((p) => p instanceof cr);
29729
+ }), u = this._options.collectCharBoxes !== !1, f = e.filter((p) => p instanceof ur);
29667
29730
  if (f.length > 0) {
29668
29731
  const p = f.length > 1 ? lo(f) : f[0], g = new Dn(p, h);
29669
29732
  g.userData.bboxIntersectionCheck = !0, g.userData.charBoxType = s, u && r.length > 0 && (g.userData.charBoxes = r.slice()), a.add(g);
29670
29733
  }
29671
29734
  const l = [
29672
29735
  ...t,
29673
- ...e.filter((p) => !(p instanceof cr))
29736
+ ...e.filter((p) => !(p instanceof ur))
29674
29737
  ];
29675
29738
  if (l.length > 0) {
29676
29739
  const p = l.length > 1 ? lo(l) : l[0], g = new vc(p, c);
@@ -29875,7 +29938,7 @@ var Kd = jh((O) => {
29875
29938
  e.width && e.attachmentPoint && ([1, 4, 7].includes(e.attachmentPoint) ? i = We.LEFT : [2, 5, 8].includes(e.attachmentPoint) ? i = We.CENTER : [3, 6, 9].includes(e.attachmentPoint) && (i = We.RIGHT));
29876
29939
  let s = Mr.BOTTOM;
29877
29940
  e.attachmentPoint && ([1, 2, 3].includes(e.attachmentPoint) ? s = Mr.TOP : [4, 5, 6].includes(e.attachmentPoint) ? s = Mr.MIDDLE : [7, 8, 9].includes(e.attachmentPoint) && (s = Mr.BOTTOM));
29878
- const a = e.height || 0, o = e.lineSpaceFactor || 0.3, h = e.drawingDirection ?? pr.LEFT_TO_RIGHT, c = {
29941
+ const a = e.height || 0, o = e.lineSpaceFactor || 0.3, h = e.drawingDirection ?? Gt.LEFT_TO_RIGHT, c = {
29879
29942
  fontSize: a,
29880
29943
  widthFactor: e.widthFactor ?? 1,
29881
29944
  lineSpaceFactor: o,
@@ -29891,7 +29954,7 @@ var Kd = jh((O) => {
29891
29954
  value: e.widthFactor ?? 1,
29892
29955
  isRelative: !0
29893
29956
  }, u.align = s, u.paragraph.align = i;
29894
- const f = new Jd(
29957
+ const f = new jd(
29895
29958
  t,
29896
29959
  this.styleManager,
29897
29960
  this.fontManager,
@@ -29945,7 +30008,7 @@ var Kd = jh((O) => {
29945
30008
  s -= e, a += t;
29946
30009
  break;
29947
30010
  }
29948
- return i == pr.BOTTOM_TO_TOP && (a -= t), { x: s, y: a };
30011
+ return i == Gt.BOTTOM_TO_TOP && (a -= t), { x: s, y: a };
29949
30012
  }
29950
30013
  /**
29951
30014
  * Recursively calculates bounding boxes for an object and its children.
@@ -29957,32 +30020,12 @@ var Kd = jh((O) => {
29957
30020
  e.updateWorldMatrix(!1, !1);
29958
30021
  const r = (s = e.userData) == null ? void 0 : s.charBoxes;
29959
30022
  if (r && r.length > 0) {
29960
- const h = r.filter((u) => u.char !== vs).map((u) => {
29961
- const f = u.box ? new Ae().copy(u.box).applyMatrix4(e.matrixWorld) : void 0;
29962
- return {
29963
- type: u.type === pe.NEW_PARAGRAPH ? pe.NEW_PARAGRAPH : pe.CHAR,
29964
- box: f,
29965
- char: u.type === pe.NEW_PARAGRAPH ? `
29966
- ` : u.char,
29967
- children: []
29968
- };
29969
- });
29970
- if (((a = e.userData) == null ? void 0 : a.charBoxType) === pe.STACK) {
29971
- const u = new Ae();
29972
- h.forEach((f) => {
29973
- u.union(f.box);
29974
- }), t.push({
29975
- type: pe.STACK,
29976
- char: "",
29977
- box: u,
29978
- children: h
29979
- });
29980
- } else
29981
- h.forEach((u) => {
29982
- t.push({
29983
- ...u
29984
- });
29985
- });
30023
+ const h = (a = e.userData) == null ? void 0 : a.charBoxType, c = Zd(
30024
+ r,
30025
+ e.matrixWorld,
30026
+ h
30027
+ );
30028
+ t.push(...c);
29986
30029
  return;
29987
30030
  }
29988
30031
  if (e instanceof bs || e instanceof Dn) {
@@ -29991,7 +30034,7 @@ var Kd = jh((O) => {
29991
30034
  h.boundingBox === null && h.computeBoundingBox();
29992
30035
  const c = new Ae().copy(h.boundingBox);
29993
30036
  c.applyMatrix4(e.matrixWorld), t.push({
29994
- type: pe.CHAR,
30037
+ type: fe.CHAR,
29995
30038
  box: c,
29996
30039
  char: "",
29997
30040
  children: []
@@ -30033,7 +30076,7 @@ var Kd = jh((O) => {
30033
30076
  }
30034
30077
  }
30035
30078
  }
30036
- const es = ft.instance, $d = new Gd();
30079
+ const es = ft.instance, Qd = new Gd();
30037
30080
  self.addEventListener("message", async (n) => {
30038
30081
  const { type: e, id: t, data: r } = n.data;
30039
30082
  try {
@@ -30044,12 +30087,12 @@ var Kd = jh((O) => {
30044
30087
  let o = new Gs(
30045
30088
  i,
30046
30089
  s,
30047
- $d,
30090
+ Qd,
30048
30091
  es,
30049
30092
  a
30050
30093
  );
30051
30094
  await o.asyncDraw(), o.updateMatrixWorld(!0);
30052
- const { data: h, transferableObjects: c } = jd(o);
30095
+ const { data: h, transferableObjects: c } = Kd(o);
30053
30096
  self.postMessage(
30054
30097
  {
30055
30098
  type: "render",
@@ -30105,12 +30148,12 @@ var Kd = jh((O) => {
30105
30148
  });
30106
30149
  }
30107
30150
  });
30108
- function jd(n) {
30151
+ function Kd(n) {
30109
30152
  const e = n.matrixWorld.clone(), t = new A(), r = new Bt(), i = new A();
30110
30153
  e.decompose(t, r, i);
30111
30154
  const s = n.box.clone();
30112
30155
  s.applyMatrix4(e);
30113
- const { children: a, transferableObjects: o } = Qd(n);
30156
+ const { children: a, transferableObjects: o } = e1(n);
30114
30157
  return { data: {
30115
30158
  // Basic properties
30116
30159
  type: "MText",
@@ -30146,7 +30189,7 @@ var Kd = jh((O) => {
30146
30189
  children: a
30147
30190
  }, transferableObjects: o };
30148
30191
  }
30149
- function Qd(n) {
30192
+ function e1(n) {
30150
30193
  const e = [], t = [];
30151
30194
  return n.traverse((r) => {
30152
30195
  if (r instanceof Dn || r instanceof bs) {
@@ -30221,4 +30264,4 @@ var Kd = jh((O) => {
30221
30264
  }), { children: e, transferableObjects: t };
30222
30265
  }
30223
30266
  });
30224
- export default Kd();
30267
+ export default t1();