@shznet/pdf-sign-standalone 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +235 -162
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var yi = (d) => {
2
2
  throw TypeError(d);
3
- }, Ms = (d, t, e) => t.has(d) || yi("Cannot " + e), Y = (d, t, e) => (Ms(d, t, "read from private field"), e ? e.call(d) : t.get(d)), Ft = (d, t, e) => t.has(d) ? yi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), mt = (d, t, e, s) => (Ms(d, t, "write to private field"), t.set(d, e), e), It = (d, t, e) => (Ms(d, t, "access private method"), e), nn = (d, t, e, s) => ({
3
+ }, Ms = (d, t, e) => t.has(d) || yi("Cannot " + e), Y = (d, t, e) => (Ms(d, t, "read from private field"), e ? e.call(d) : t.get(d)), Ft = (d, t, e) => t.has(d) ? yi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), mt = (d, t, e, s) => (Ms(d, t, "write to private field"), t.set(d, e), e), Rt = (d, t, e) => (Ms(d, t, "access private method"), e), nn = (d, t, e, s) => ({
4
4
  set _(i) {
5
5
  mt(d, t, i);
6
6
  },
@@ -315,7 +315,7 @@ function cn() {
315
315
  function Qe(d) {
316
316
  Ke >= Ye.INFOS && console.info(`Info: ${d}`);
317
317
  }
318
- function I(d) {
318
+ function R(d) {
319
319
  Ke >= Ye.WARNINGS && console.warn(`Warning: ${d}`);
320
320
  }
321
321
  function j(d) {
@@ -796,7 +796,7 @@ class Ei {
796
796
  t.div.style.transform = e, t.div.hidden = !1;
797
797
  }
798
798
  }
799
- const Rt = "http://www.w3.org/2000/svg";
799
+ const It = "http://www.w3.org/2000/svg";
800
800
  class le {
801
801
  static CSS = 96;
802
802
  static PDF = 72;
@@ -933,7 +933,7 @@ function An(d, t = "document.pdf") {
933
933
  if (typeof d != "string")
934
934
  return t;
935
935
  if (Je(d))
936
- return I('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), t;
936
+ return R('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), t;
937
937
  const e = ((r) => {
938
938
  try {
939
939
  return new URL(r);
@@ -986,10 +986,10 @@ class Xs {
986
986
  started = /* @__PURE__ */ Object.create(null);
987
987
  times = [];
988
988
  time(t) {
989
- t in this.started && I(`Timer is already running for ${t}`), this.started[t] = Date.now();
989
+ t in this.started && R(`Timer is already running for ${t}`), this.started[t] = Date.now();
990
990
  }
991
991
  timeEnd(t) {
992
- t in this.started || I(`Timer has not been started for ${t}`), this.times.push({
992
+ t in this.started || R(`Timer has not been started for ${t}`), this.times.push({
993
993
  name: t,
994
994
  start: this.started[t],
995
995
  end: Date.now()
@@ -1074,7 +1074,7 @@ function ke(d) {
1074
1074
  const t = parseInt(d.slice(1), 16);
1075
1075
  return [(t & 16711680) >> 16, (t & 65280) >> 8, t & 255];
1076
1076
  }
1077
- return d.startsWith("rgb(") ? d.slice(4, -1).split(",").map((t) => parseInt(t)) : d.startsWith("rgba(") ? d.slice(5, -1).split(",").map((t) => parseInt(t)).slice(0, 3) : (I(`Not a valid color format: "${d}"`), [0, 0, 0]);
1077
+ return d.startsWith("rgb(") ? d.slice(4, -1).split(",").map((t) => parseInt(t)) : d.startsWith("rgba(") ? d.slice(5, -1).split(",").map((t) => parseInt(t)).slice(0, 3) : (R(`Not a valid color format: "${d}"`), [0, 0, 0]);
1078
1078
  }
1079
1079
  function En(d) {
1080
1080
  const t = document.createElement("span");
@@ -1297,7 +1297,7 @@ function Ci(d) {
1297
1297
  t.closePath();
1298
1298
  break;
1299
1299
  default:
1300
- I(`Unrecognized drawing path operator: ${d[e - 1]}`);
1300
+ R(`Unrecognized drawing path operator: ${d[e - 1]}`);
1301
1301
  break;
1302
1302
  }
1303
1303
  return t;
@@ -1556,7 +1556,7 @@ class kn {
1556
1556
  return `${_e}${this.#t++}`;
1557
1557
  }
1558
1558
  }
1559
- class Rs {
1559
+ class Is {
1560
1560
  #t = xi();
1561
1561
  #e = 0;
1562
1562
  #i = null;
@@ -1584,7 +1584,7 @@ class Rs {
1584
1584
  };
1585
1585
  let i;
1586
1586
  if (typeof e == "string" ? (s.url = e, i = await Pe(e, "blob")) : e instanceof File ? i = s.file = e : e instanceof Blob && (i = e), i.type === "image/svg+xml") {
1587
- const n = Rs._isSVGFittingCanvas, r = new FileReader(), a = new Image(), o = new Promise((h, l) => {
1587
+ const n = Is._isSVGFittingCanvas, r = new FileReader(), a = new Image(), o = new Promise((h, l) => {
1588
1588
  a.onload = () => {
1589
1589
  s.bitmap = a, s.isSvg = !0, h();
1590
1590
  }, r.onload = async () => {
@@ -1597,7 +1597,7 @@ class Rs {
1597
1597
  s.bitmap = await createImageBitmap(i);
1598
1598
  s.refCounter = 1;
1599
1599
  } catch (i) {
1600
- I(i), s = null;
1600
+ R(i), s = null;
1601
1601
  }
1602
1602
  return this.#i.set(t, s), s && this.#i.set(s.id, s), s;
1603
1603
  }
@@ -1785,7 +1785,7 @@ class De {
1785
1785
  a && !a(t, e) || (i.bind(t, ...r, e)(), n || Q(e));
1786
1786
  }
1787
1787
  }
1788
- class Is {
1788
+ class Rs {
1789
1789
  static _colorsMapping = /* @__PURE__ */ new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]);
1790
1790
  get _colors() {
1791
1791
  const t = /* @__PURE__ */ new Map([["CanvasText", null], ["Canvas", null]]);
@@ -1797,7 +1797,7 @@ class Is {
1797
1797
  return e;
1798
1798
  for (const [s, i] of this._colors)
1799
1799
  if (i.every((n, r) => n === e[r]))
1800
- return Is._colorsMapping.get(s);
1800
+ return Rs._colorsMapping.get(s);
1801
1801
  return e;
1802
1802
  }
1803
1803
  getHexCode(t) {
@@ -1837,14 +1837,14 @@ class zt {
1837
1837
  #P = !1;
1838
1838
  #M = !1;
1839
1839
  #B = !1;
1840
- #R = null;
1840
+ #I = null;
1841
1841
  #L = null;
1842
1842
  #O = null;
1843
1843
  #F = null;
1844
1844
  #G = null;
1845
1845
  #C = F.NONE;
1846
1846
  #x = /* @__PURE__ */ new Set();
1847
- #I = null;
1847
+ #R = null;
1848
1848
  #H = null;
1849
1849
  #z = null;
1850
1850
  #q = null;
@@ -2201,7 +2201,7 @@ class zt {
2201
2201
  #rt() {
2202
2202
  const t = document.getSelection();
2203
2203
  if (!t || t.isCollapsed) {
2204
- this.#I && (this.#E?.hide(), this.#I = null, this.#D({
2204
+ this.#R && (this.#E?.hide(), this.#R = null, this.#D({
2205
2205
  hasSelectedText: !1
2206
2206
  }));
2207
2207
  return;
@@ -2209,16 +2209,16 @@ class zt {
2209
2209
  const {
2210
2210
  anchorNode: e
2211
2211
  } = t;
2212
- if (e === this.#I)
2212
+ if (e === this.#R)
2213
2213
  return;
2214
2214
  const s = this.#Q(t).closest(".textLayer");
2215
2215
  if (!s) {
2216
- this.#I && (this.#E?.hide(), this.#I = null, this.#D({
2216
+ this.#R && (this.#E?.hide(), this.#R = null, this.#D({
2217
2217
  hasSelectedText: !1
2218
2218
  }));
2219
2219
  return;
2220
2220
  }
2221
- if (this.#E?.hide(), this.#I = e, this.#D({
2221
+ if (this.#E?.hide(), this.#R = e, this.#D({
2222
2222
  hasSelectedText: !0
2223
2223
  }), !(this.#C !== F.HIGHLIGHT && this.#C !== F.NONE) && (this.#C === F.HIGHLIGHT && this.showAllEditors("highlight", !0, !0), this.#v = this.isShiftKeyDown, !this.isShiftKeyDown)) {
2224
2224
  const i = this.#C === F.HIGHLIGHT ? this.#tt(s) : null;
@@ -2281,10 +2281,10 @@ class zt {
2281
2281
  }), e.focus();
2282
2282
  }
2283
2283
  #et() {
2284
- if (this.#R)
2284
+ if (this.#I)
2285
2285
  return;
2286
- this.#R = new AbortController();
2287
- const t = this.combinedSignal(this.#R);
2286
+ this.#I = new AbortController();
2287
+ const t = this.combinedSignal(this.#I);
2288
2288
  window.addEventListener("keydown", this.keydown.bind(this), {
2289
2289
  signal: t
2290
2290
  }), window.addEventListener("keyup", this.keyup.bind(this), {
@@ -2292,7 +2292,7 @@ class zt {
2292
2292
  });
2293
2293
  }
2294
2294
  #lt() {
2295
- this.#R?.abort(), this.#R = null;
2295
+ this.#I?.abort(), this.#I = null;
2296
2296
  }
2297
2297
  #ct() {
2298
2298
  if (this.#u)
@@ -2372,7 +2372,7 @@ class zt {
2372
2372
  try {
2373
2373
  s = JSON.parse(s);
2374
2374
  } catch (n) {
2375
- I(`paste: "${n.message}".`);
2375
+ R(`paste: "${n.message}".`);
2376
2376
  return;
2377
2377
  }
2378
2378
  if (!Array.isArray(s))
@@ -2401,7 +2401,7 @@ class zt {
2401
2401
  mustExec: !0
2402
2402
  });
2403
2403
  } catch (n) {
2404
- I(`paste: "${n.message}".`);
2404
+ R(`paste: "${n.message}".`);
2405
2405
  }
2406
2406
  }
2407
2407
  keydown(t) {
@@ -2855,7 +2855,7 @@ class zt {
2855
2855
  return this.#C !== F.NONE;
2856
2856
  }
2857
2857
  get imageManager() {
2858
- return L(this, "imageManager", new Rs());
2858
+ return L(this, "imageManager", new Is());
2859
2859
  }
2860
2860
  getSelectionBoxes(t) {
2861
2861
  if (!t)
@@ -3446,7 +3446,7 @@ class D {
3446
3446
  #v = !1;
3447
3447
  #E = D._zIndex++;
3448
3448
  static _borderLineWidth = -1;
3449
- static _colorManager = new Is();
3449
+ static _colorManager = new Rs();
3450
3450
  static _zIndex = 1;
3451
3451
  static _telemetryTimeout = 1e3;
3452
3452
  static get _resizerKeyboardManager() {
@@ -3497,7 +3497,7 @@ class D {
3497
3497
  return L(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
3498
3498
  }
3499
3499
  static deleteAnnotationElement(t) {
3500
- const e = new Rn({
3500
+ const e = new In({
3501
3501
  id: t.parent.getNextId(),
3502
3502
  parent: t.parent,
3503
3503
  uiManager: t._uiManager
@@ -3768,7 +3768,7 @@ class D {
3768
3768
  const t = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"], e = this._uiManager._signal;
3769
3769
  for (const s of t) {
3770
3770
  const i = document.createElement("div");
3771
- this.#l.append(i), i.classList.add("resizer", s), i.setAttribute("data-resizer-name", s), i.addEventListener("pointerdown", this.#R.bind(this, s), {
3771
+ this.#l.append(i), i.classList.add("resizer", s), i.setAttribute("data-resizer-name", s), i.addEventListener("pointerdown", this.#I.bind(this, s), {
3772
3772
  signal: e
3773
3773
  }), i.addEventListener("contextmenu", _t, {
3774
3774
  signal: e
@@ -3776,7 +3776,7 @@ class D {
3776
3776
  }
3777
3777
  this.div.prepend(this.#l);
3778
3778
  }
3779
- #R(t, e) {
3779
+ #I(t, e) {
3780
3780
  e.preventDefault();
3781
3781
  const {
3782
3782
  isMac: s
@@ -3839,32 +3839,32 @@ class D {
3839
3839
  return Math.round(t * 1e4) / 1e4;
3840
3840
  }
3841
3841
  #F(t, e) {
3842
- const [s, i] = this.parentDimensions, n = this.x, r = this.y, a = this.width, o = this.height, h = D.MIN_SIZE / s, l = D.MIN_SIZE / i, c = this.#M(this.rotation), u = (k, R) => [c[0] * k + c[2] * R, c[1] * k + c[3] * R], p = this.#M(360 - this.rotation), f = (k, R) => [p[0] * k + p[2] * R, p[1] * k + p[3] * R];
3842
+ const [s, i] = this.parentDimensions, n = this.x, r = this.y, a = this.width, o = this.height, h = D.MIN_SIZE / s, l = D.MIN_SIZE / i, c = this.#M(this.rotation), u = (k, I) => [c[0] * k + c[2] * I, c[1] * k + c[3] * I], p = this.#M(360 - this.rotation), f = (k, I) => [p[0] * k + p[2] * I, p[1] * k + p[3] * I];
3843
3843
  let g, b, m = !1, w = !1;
3844
3844
  switch (t) {
3845
3845
  case "topLeft":
3846
- m = !0, g = (k, R) => [0, 0], b = (k, R) => [k, R];
3846
+ m = !0, g = (k, I) => [0, 0], b = (k, I) => [k, I];
3847
3847
  break;
3848
3848
  case "topMiddle":
3849
- g = (k, R) => [k / 2, 0], b = (k, R) => [k / 2, R];
3849
+ g = (k, I) => [k / 2, 0], b = (k, I) => [k / 2, I];
3850
3850
  break;
3851
3851
  case "topRight":
3852
- m = !0, g = (k, R) => [k, 0], b = (k, R) => [0, R];
3852
+ m = !0, g = (k, I) => [k, 0], b = (k, I) => [0, I];
3853
3853
  break;
3854
3854
  case "middleRight":
3855
- w = !0, g = (k, R) => [k, R / 2], b = (k, R) => [0, R / 2];
3855
+ w = !0, g = (k, I) => [k, I / 2], b = (k, I) => [0, I / 2];
3856
3856
  break;
3857
3857
  case "bottomRight":
3858
- m = !0, g = (k, R) => [k, R], b = (k, R) => [0, 0];
3858
+ m = !0, g = (k, I) => [k, I], b = (k, I) => [0, 0];
3859
3859
  break;
3860
3860
  case "bottomMiddle":
3861
- g = (k, R) => [k / 2, R], b = (k, R) => [k / 2, 0];
3861
+ g = (k, I) => [k / 2, I], b = (k, I) => [k / 2, 0];
3862
3862
  break;
3863
3863
  case "bottomLeft":
3864
- m = !0, g = (k, R) => [0, R], b = (k, R) => [k, 0];
3864
+ m = !0, g = (k, I) => [0, I], b = (k, I) => [k, 0];
3865
3865
  break;
3866
3866
  case "middleLeft":
3867
- w = !0, g = (k, R) => [0, R / 2], b = (k, R) => [k, R / 2];
3867
+ w = !0, g = (k, I) => [0, I / 2], b = (k, I) => [k, I / 2];
3868
3868
  break;
3869
3869
  }
3870
3870
  const y = g(a, o), v = b(a, o);
@@ -3879,9 +3879,9 @@ class D {
3879
3879
  else {
3880
3880
  const {
3881
3881
  screenX: k,
3882
- screenY: R
3882
+ screenY: I
3883
3883
  } = e, [U, ft] = this.#h;
3884
- [M, C] = this.screenToPageTranslation(k - U, R - ft), this.#h[0] = k, this.#h[1] = R;
3884
+ [M, C] = this.screenToPageTranslation(k - U, I - ft), this.#h[0] = k, this.#h[1] = I;
3885
3885
  }
3886
3886
  if ([M, C] = f(M / s, C / i), m) {
3887
3887
  const k = Math.hypot(a, o);
@@ -4094,9 +4094,9 @@ class D {
4094
4094
  this.#H(t);
4095
4095
  return;
4096
4096
  }
4097
- this.#I(t);
4097
+ this.#R(t);
4098
4098
  }
4099
- #I(t) {
4099
+ #R(t) {
4100
4100
  const {
4101
4101
  isMac: e
4102
4102
  } = at.platform;
@@ -4113,7 +4113,7 @@ class D {
4113
4113
  passive: !1,
4114
4114
  signal: n
4115
4115
  }, a = (h) => {
4116
- i.abort(), this.#n = null, this.#f = !1, this._uiManager.endDragSession() || this.#I(h), s && this._onStopDragging();
4116
+ i.abort(), this.#n = null, this.#f = !1, this._uiManager.endDragSession() || this.#R(h), s && this._onStopDragging();
4117
4117
  };
4118
4118
  e && (this.#S = t.clientX, this.#_ = t.clientY, this.#n = t.pointerId, this.#o = t.pointerType, window.addEventListener("pointermove", (h) => {
4119
4119
  s || (s = !0, this._uiManager.toggleComment(this, !0, !1), this._onStartDragging());
@@ -4564,7 +4564,7 @@ class D {
4564
4564
  e?.nodeName === "DIV" && e.classList.contains("annotationContent") && e.remove();
4565
4565
  }
4566
4566
  }
4567
- class Rn extends D {
4567
+ class In extends D {
4568
4568
  constructor(t) {
4569
4569
  super(t), this.annotationElementId = t.annotationElementId, this.deleted = !0;
4570
4570
  }
@@ -4773,7 +4773,7 @@ class Mi extends Ls {
4773
4773
  });
4774
4774
  }
4775
4775
  }
4776
- class In {
4776
+ class Rn {
4777
4777
  #t = /* @__PURE__ */ new Set();
4778
4778
  constructor({
4779
4779
  ownerDocument: t = globalThis.document,
@@ -4813,7 +4813,7 @@ class In {
4813
4813
  try {
4814
4814
  await a.load(), this.#t.add(i), s?.(t);
4815
4815
  } catch {
4816
- I(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(a);
4816
+ R(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(a);
4817
4817
  }
4818
4818
  return;
4819
4819
  }
@@ -4834,7 +4834,7 @@ class In {
4834
4834
  try {
4835
4835
  await s.loaded;
4836
4836
  } catch (i) {
4837
- throw I(`Failed to load font '${s.family}': '${i}'.`), t.disableFontFace = !0, i;
4837
+ throw R(`Failed to load font '${s.family}': '${i}'.`), t.disableFontFace = !0, i;
4838
4838
  }
4839
4839
  }
4840
4840
  return;
@@ -4891,7 +4891,7 @@ class In {
4891
4891
  let h = 0;
4892
4892
  function l(y, v) {
4893
4893
  if (++h > 30) {
4894
- I("Load test font never loaded."), v();
4894
+ R("Load test font never loaded."), v();
4895
4895
  return;
4896
4896
  }
4897
4897
  if (o.font = "30px " + y, o.fillText(".", 0, 20), o.getImageData(0, 0, 1, 1).data[3] > 0) {
@@ -4961,7 +4961,7 @@ class Ln {
4961
4961
  try {
4962
4962
  i = t.get(s);
4963
4963
  } catch (r) {
4964
- I(`getPathGenerator - ignoring character: "${r}".`);
4964
+ R(`getPathGenerator - ignoring character: "${r}".`);
4965
4965
  }
4966
4966
  const n = Ci(i?.path);
4967
4967
  return this.fontExtraProperties || t.delete(s), this.compiledGlyphs[e] = n;
@@ -5532,7 +5532,7 @@ class $n {
5532
5532
  signal: n
5533
5533
  } = s;
5534
5534
  if (n.aborted) {
5535
- I("LoopbackPort - cannot use an `aborted` signal.");
5535
+ R("LoopbackPort - cannot use an `aborted` signal.");
5536
5536
  return;
5537
5537
  }
5538
5538
  const r = () => this.removeEventListener(t, e);
@@ -5935,7 +5935,7 @@ class ei extends Di {
5935
5935
  return e instanceof ArrayBuffer ? new Uint8Array(e) : Te(e);
5936
5936
  }
5937
5937
  }
5938
- class Ri {
5938
+ class Ii {
5939
5939
  addFilter(t) {
5940
5940
  return "none";
5941
5941
  }
@@ -5954,7 +5954,7 @@ class Ri {
5954
5954
  destroy(t = !1) {
5955
5955
  }
5956
5956
  }
5957
- class Un extends Ri {
5957
+ class Un extends Ii {
5958
5958
  #t;
5959
5959
  #e;
5960
5960
  #i;
@@ -5980,8 +5980,8 @@ class Un extends Ri {
5980
5980
  style: e
5981
5981
  } = t;
5982
5982
  e.visibility = "hidden", e.contain = "strict", e.width = e.height = 0, e.position = "absolute", e.top = e.left = 0, e.zIndex = -1;
5983
- const s = this.#a.createElementNS(Rt, "svg");
5984
- s.setAttribute("width", 0), s.setAttribute("height", 0), this.#i = this.#a.createElementNS(Rt, "defs"), t.append(s), s.append(this.#i), this.#a.body.append(t);
5983
+ const s = this.#a.createElementNS(It, "svg");
5984
+ s.setAttribute("width", 0), s.setAttribute("height", 0), this.#i = this.#a.createElementNS(It, "defs"), t.append(s), s.append(this.#i), this.#a.body.append(t);
5985
5985
  }
5986
5986
  return this.#i;
5987
5987
  }
@@ -6002,7 +6002,7 @@ class Un extends Ri {
6002
6002
  if (this.#t === void 0) {
6003
6003
  this.#t = "";
6004
6004
  const e = this.#a.URL;
6005
- e !== this.#a.baseURI && (Je(e) ? I('#createUrl: ignore "data:"-URL for performance reasons.') : this.#t = vi(e, ""));
6005
+ e !== this.#a.baseURI && (Je(e) ? R('#createUrl: ignore "data:"-URL for performance reasons.') : this.#t = vi(e, ""));
6006
6006
  }
6007
6007
  return `url(${this.#t}#${t})`;
6008
6008
  }
@@ -6104,34 +6104,34 @@ class Un extends Ri {
6104
6104
  t && this.#r?.size || (this.#i?.parentNode.parentNode.remove(), this.#i = null, this.#e?.clear(), this.#e = null, this.#r?.clear(), this.#r = null, this.#n = 0);
6105
6105
  }
6106
6106
  #p(t) {
6107
- const e = this.#a.createElementNS(Rt, "feColorMatrix");
6107
+ const e = this.#a.createElementNS(It, "feColorMatrix");
6108
6108
  e.setAttribute("type", "matrix"), e.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"), t.append(e);
6109
6109
  }
6110
6110
  #m(t) {
6111
- const e = this.#a.createElementNS(Rt, "feColorMatrix");
6111
+ const e = this.#a.createElementNS(It, "feColorMatrix");
6112
6112
  e.setAttribute("type", "matrix"), e.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"), t.append(e);
6113
6113
  }
6114
6114
  #f(t) {
6115
- const e = this.#a.createElementNS(Rt, "filter");
6115
+ const e = this.#a.createElementNS(It, "filter");
6116
6116
  return e.setAttribute("color-interpolation-filters", "sRGB"), e.setAttribute("id", t), this.#h.append(e), e;
6117
6117
  }
6118
6118
  #c(t, e, s) {
6119
- const i = this.#a.createElementNS(Rt, e);
6119
+ const i = this.#a.createElementNS(It, e);
6120
6120
  i.setAttribute("type", "discrete"), i.setAttribute("tableValues", s), t.append(i);
6121
6121
  }
6122
6122
  #g(t, e, s, i) {
6123
- const n = this.#a.createElementNS(Rt, "feComponentTransfer");
6123
+ const n = this.#a.createElementNS(It, "feComponentTransfer");
6124
6124
  i.append(n), this.#c(n, "feFuncR", t), this.#c(n, "feFuncG", e), this.#c(n, "feFuncB", s);
6125
6125
  }
6126
6126
  #b(t, e) {
6127
- const s = this.#a.createElementNS(Rt, "feComponentTransfer");
6127
+ const s = this.#a.createElementNS(It, "feComponentTransfer");
6128
6128
  e.append(s), this.#c(s, "feFuncA", t);
6129
6129
  }
6130
6130
  #w(t) {
6131
6131
  return this.#h.style.color = t, ke(getComputedStyle(this.#h).getPropertyValue("color"));
6132
6132
  }
6133
6133
  }
6134
- class Ii {
6134
+ class Ri {
6135
6135
  constructor({
6136
6136
  baseUrl: t = null
6137
6137
  }) {
@@ -6153,7 +6153,7 @@ class Ii {
6153
6153
  j("Abstract method `_fetch` called.");
6154
6154
  }
6155
6155
  }
6156
- class si extends Ii {
6156
+ class si extends Ri {
6157
6157
  async _fetch(t) {
6158
6158
  const e = await Pe(t, "arraybuffer");
6159
6159
  return new Uint8Array(e);
@@ -6187,12 +6187,12 @@ class ii extends Li {
6187
6187
  return new Uint8Array(e);
6188
6188
  }
6189
6189
  }
6190
- dt && I("Please use the `legacy` build in Node.js environments.");
6190
+ dt && R("Please use the `legacy` build in Node.js environments.");
6191
6191
  async function Fs(d) {
6192
6192
  const t = await process.getBuiltinModule("fs").promises.readFile(d);
6193
6193
  return new Uint8Array(t);
6194
6194
  }
6195
- class Vn extends Ri {
6195
+ class Vn extends Ii {
6196
6196
  }
6197
6197
  class Gn extends ki {
6198
6198
  _createCanvas(t, e) {
@@ -6204,7 +6204,7 @@ class jn extends Di {
6204
6204
  return Fs(t);
6205
6205
  }
6206
6206
  }
6207
- class Wn extends Ii {
6207
+ class Wn extends Ri {
6208
6208
  async _fetch(t) {
6209
6209
  return Fs(t);
6210
6210
  }
@@ -6654,21 +6654,21 @@ function hs(d, t, e, s, i, n, r, a) {
6654
6654
  if (f >= w)
6655
6655
  return;
6656
6656
  const y = h[n], v = h[n + 1], A = h[n + 2], x = h[r], _ = h[r + 1], E = h[r + 2], S = h[a], M = h[a + 1], C = h[a + 2], H = Math.round(f), V = Math.round(w);
6657
- let N, Z, k, R, U, ft, Dt, tt;
6657
+ let N, Z, k, I, U, ft, Dt, tt;
6658
6658
  for (let W = H; W <= V; W++) {
6659
6659
  if (W < b) {
6660
6660
  const et = W < f ? 0 : (f - W) / (f - b);
6661
- N = p - (p - g) * et, Z = y - (y - x) * et, k = v - (v - _) * et, R = A - (A - E) * et;
6661
+ N = p - (p - g) * et, Z = y - (y - x) * et, k = v - (v - _) * et, I = A - (A - E) * et;
6662
6662
  } else {
6663
6663
  let et;
6664
- W > w ? et = 1 : b === w ? et = 0 : et = (b - W) / (b - w), N = g - (g - m) * et, Z = x - (x - S) * et, k = _ - (_ - M) * et, R = E - (E - C) * et;
6664
+ W > w ? et = 1 : b === w ? et = 0 : et = (b - W) / (b - w), N = g - (g - m) * et, Z = x - (x - S) * et, k = _ - (_ - M) * et, I = E - (E - C) * et;
6665
6665
  }
6666
6666
  let q;
6667
6667
  W < f ? q = 0 : W > w ? q = 1 : q = (f - W) / (f - w), U = p - (p - m) * q, ft = y - (y - S) * q, Dt = v - (v - M) * q, tt = A - (A - C) * q;
6668
6668
  const Ut = Math.round(Math.min(N, U)), Nt = Math.round(Math.max(N, U));
6669
6669
  let Bt = c * W + Ut * 4;
6670
6670
  for (let et = Ut; et <= Nt; et++)
6671
- q = (N - et) / (N - U), q < 0 ? q = 0 : q > 1 && (q = 1), l[Bt++] = Z - (Z - ft) * q | 0, l[Bt++] = k - (k - Dt) * q | 0, l[Bt++] = R - (R - tt) * q | 0, l[Bt++] = 255;
6671
+ q = (N - et) / (N - U), q < 0 ? q = 0 : q > 1 && (q = 1), l[Bt++] = Z - (Z - ft) * q | 0, l[Bt++] = k - (k - Dt) * q | 0, l[Bt++] = I - (I - tt) * q | 0, l[Bt++] = 255;
6672
6672
  }
6673
6673
  }
6674
6674
  function Qn(d, t, e) {
@@ -6784,8 +6784,8 @@ class Bs {
6784
6784
  let x = g, _ = b, E = !1, S = !1;
6785
6785
  const M = Math.ceil(h * v), C = Math.ceil(l * A), H = Math.ceil(g * v), V = Math.ceil(b * A);
6786
6786
  M >= H ? x = h : E = !0, C >= V ? _ = l : S = !0;
6787
- const N = this.getSizeAndScale(x, this.ctx.canvas.width, v), Z = this.getSizeAndScale(_, this.ctx.canvas.height, A), k = t.cachedCanvases.getCanvas("pattern", N.size, Z.size), R = k.context, U = o.createCanvasGraphics(R, e);
6788
- if (U.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(U, n, a), R.translate(-N.scale * c, -Z.scale * u), U.transform(0, N.scale, 0, 0, Z.scale, 0, 0), R.save(), U.dependencyTracker?.save(), this.clipBbox(U, c, u, p, f), U.baseTransform = X(U.ctx), U.executeOperatorList(i), U.endDrawing(), U.dependencyTracker?.restore(), R.restore(), E || S) {
6787
+ const N = this.getSizeAndScale(x, this.ctx.canvas.width, v), Z = this.getSizeAndScale(_, this.ctx.canvas.height, A), k = t.cachedCanvases.getCanvas("pattern", N.size, Z.size), I = k.context, U = o.createCanvasGraphics(I, e);
6788
+ if (U.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(U, n, a), I.translate(-N.scale * c, -Z.scale * u), U.transform(0, N.scale, 0, 0, Z.scale, 0, 0), I.save(), U.dependencyTracker?.save(), this.clipBbox(U, c, u, p, f), U.baseTransform = X(U.ctx), U.executeOperatorList(i), U.endDrawing(), U.dependencyTracker?.restore(), I.restore(), E || S) {
6789
6789
  const ft = k.canvas;
6790
6790
  E && (x = h), S && (_ = l);
6791
6791
  const Dt = this.getSizeAndScale(x, this.ctx.canvas.width, v), tt = this.getSizeAndScale(_, this.ctx.canvas.height, A), W = Dt.size, q = tt.size, Ut = t.cachedCanvases.getCanvas("pattern-workaround", W, q), Nt = Ut.context, Bt = E ? Math.floor(g / h) : 0, et = S ? Math.floor(b / l) : 0;
@@ -7452,7 +7452,7 @@ class oe {
7452
7452
  const i = this.commonObjs.get(e), n = this.current;
7453
7453
  if (!i)
7454
7454
  throw new Error(`Can't find font for ${e}`);
7455
- if (n.fontMatrix = i.fontMatrix || gs, (n.fontMatrix[0] === 0 || n.fontMatrix[3] === 0) && I("Invalid font matrix for font " + e), s < 0 ? (s = -s, n.fontDirection = -1) : n.fontDirection = 1, this.current.font = i, this.current.fontSize = s, i.isType3Font)
7455
+ if (n.fontMatrix = i.fontMatrix || gs, (n.fontMatrix[0] === 0 || n.fontMatrix[3] === 0) && R("Invalid font matrix for font " + e), s < 0 ? (s = -s, n.fontDirection = -1) : n.fontDirection = 1, this.current.font = i, this.current.fontSize = s, i.isType3Font)
7456
7456
  return;
7457
7457
  const r = i.loadedName || "sans-serif", a = i.systemFontInfo?.css || `"${r}", ${i.fallbackName}`;
7458
7458
  let o = "normal";
@@ -7587,12 +7587,12 @@ class oe {
7587
7587
  }
7588
7588
  let H = !1;
7589
7589
  const V = (C.isSpace ? h : 0) + o, N = C.fontChar, Z = C.accent;
7590
- let k, R, U = C.width;
7590
+ let k, I, U = C.width;
7591
7591
  if (p) {
7592
7592
  const tt = C.vmetric || g, W = -(C.vmetric ? tt[1] : U * 0.5) * b, q = tt[2] * b;
7593
- U = tt ? -tt[0] : U, k = W / a, R = (S + q) / a;
7593
+ U = tt ? -tt[0] : U, k = W / a, I = (S + q) / a;
7594
7594
  } else
7595
- k = S / a, R = 0;
7595
+ k = S / a, I = 0;
7596
7596
  let ft;
7597
7597
  if (i.remeasure && U > 0) {
7598
7598
  ft = r.measureText(N);
@@ -7604,11 +7604,11 @@ class oe {
7604
7604
  }
7605
7605
  if (this.contentVisible && (C.isInFont || i.missingFile)) {
7606
7606
  if (m && !Z)
7607
- r.fillText(N, k, R), this.dependencyTracker?.recordCharacterBBox(t, r, ft ? {
7607
+ r.fillText(N, k, I), this.dependencyTracker?.recordCharacterBBox(t, r, ft ? {
7608
7608
  bbox: null
7609
- } : i, n / a, k, R, () => ft ?? r.measureText(N));
7610
- else if (this.paintChar(t, N, k, R, w, y), Z) {
7611
- const tt = k + n * Z.offset.x / a, W = R - n * Z.offset.y / a;
7609
+ } : i, n / a, k, I, () => ft ?? r.measureText(N));
7610
+ else if (this.paintChar(t, N, k, I, w, y), Z) {
7611
+ const tt = k + n * Z.offset.x / a, W = I - n * Z.offset.y / a;
7612
7612
  this.paintChar(t, Z.fontChar, tt, W, w, y);
7613
7613
  }
7614
7614
  }
@@ -7630,7 +7630,7 @@ class oe {
7630
7630
  continue;
7631
7631
  }
7632
7632
  const v = (b.isSpace ? l : 0) + h, A = n.charProcOperatorList[b.operatorListId];
7633
- A ? this.contentVisible && (this.save(), s.scale(r, r), s.transform(...u), this.executeOperatorList(A), this.restore()) : I(`Type3 character "${b.operatorListId}" is not available.`);
7633
+ A ? this.contentVisible && (this.save(), s.scale(r, r), s.transform(...u), this.executeOperatorList(A), this.restore()) : R(`Type3 character "${b.operatorListId}" is not available.`);
7634
7634
  const x = [b.width, 0];
7635
7635
  T.applyTransform(x, u), m = x[0] * r + v, s.translate(m, 0), i.x += m * c;
7636
7636
  }
@@ -7719,7 +7719,7 @@ class oe {
7719
7719
  return;
7720
7720
  this.save(t), this.inSMaskMode && (this.endSMaskMode(), this.current.activeSMask = null);
7721
7721
  const s = this.ctx;
7722
- e.isolated || Qe("TODO: Support non-isolated groups."), e.knockout && I("Knockout groups not supported.");
7722
+ e.isolated || Qe("TODO: Support non-isolated groups."), e.knockout && R("Knockout groups not supported.");
7723
7723
  const i = X(s);
7724
7724
  if (e.matrix && s.transform(...e.matrix), !e.bbox)
7725
7725
  throw new Error("Bounding box is required.");
@@ -7837,7 +7837,7 @@ class oe {
7837
7837
  return;
7838
7838
  const s = this.getObject(t, e);
7839
7839
  if (!s) {
7840
- I("Dependent image isn't ready yet");
7840
+ R("Dependent image isn't ready yet");
7841
7841
  return;
7842
7842
  }
7843
7843
  this.paintInlineImageXObject(t, s);
@@ -7847,7 +7847,7 @@ class oe {
7847
7847
  return;
7848
7848
  const r = this.getObject(t, e);
7849
7849
  if (!r) {
7850
- I("Dependent image isn't ready yet");
7850
+ R("Dependent image isn't ready yet");
7851
7851
  return;
7852
7852
  }
7853
7853
  const a = r.width, o = r.height, h = [];
@@ -8124,7 +8124,7 @@ class cr {
8124
8124
  else if (this.#e.has(n))
8125
8125
  r = this.#e.get(n).visible;
8126
8126
  else
8127
- return I(`Optional content group not found: ${n}`), !0;
8127
+ return R(`Optional content group not found: ${n}`), !0;
8128
8128
  switch (s) {
8129
8129
  case "And":
8130
8130
  if (!r)
@@ -8148,14 +8148,14 @@ class cr {
8148
8148
  if (!t)
8149
8149
  return Qe("Optional content group not defined."), !0;
8150
8150
  if (t.type === "OCG")
8151
- return this.#e.has(t.id) ? this.#e.get(t.id).visible : (I(`Optional content group not found: ${t.id}`), !0);
8151
+ return this.#e.has(t.id) ? this.#e.get(t.id).visible : (R(`Optional content group not found: ${t.id}`), !0);
8152
8152
  if (t.type === "OCMD") {
8153
8153
  if (t.expression)
8154
8154
  return this.#a(t.expression);
8155
8155
  if (!t.policy || t.policy === "AnyOn") {
8156
8156
  for (const e of t.ids) {
8157
8157
  if (!this.#e.has(e))
8158
- return I(`Optional content group not found: ${e}`), !0;
8158
+ return R(`Optional content group not found: ${e}`), !0;
8159
8159
  if (this.#e.get(e).visible)
8160
8160
  return !0;
8161
8161
  }
@@ -8163,7 +8163,7 @@ class cr {
8163
8163
  } else if (t.policy === "AllOn") {
8164
8164
  for (const e of t.ids) {
8165
8165
  if (!this.#e.has(e))
8166
- return I(`Optional content group not found: ${e}`), !0;
8166
+ return R(`Optional content group not found: ${e}`), !0;
8167
8167
  if (!this.#e.get(e).visible)
8168
8168
  return !1;
8169
8169
  }
@@ -8171,7 +8171,7 @@ class cr {
8171
8171
  } else if (t.policy === "AnyOff") {
8172
8172
  for (const e of t.ids) {
8173
8173
  if (!this.#e.has(e))
8174
- return I(`Optional content group not found: ${e}`), !0;
8174
+ return R(`Optional content group not found: ${e}`), !0;
8175
8175
  if (!this.#e.get(e).visible)
8176
8176
  return !0;
8177
8177
  }
@@ -8179,20 +8179,20 @@ class cr {
8179
8179
  } else if (t.policy === "AllOff") {
8180
8180
  for (const e of t.ids) {
8181
8181
  if (!this.#e.has(e))
8182
- return I(`Optional content group not found: ${e}`), !0;
8182
+ return R(`Optional content group not found: ${e}`), !0;
8183
8183
  if (this.#e.get(e).visible)
8184
8184
  return !1;
8185
8185
  }
8186
8186
  return !0;
8187
8187
  }
8188
- return I(`Unknown optional content policy ${t.policy}.`), !0;
8188
+ return R(`Unknown optional content policy ${t.policy}.`), !0;
8189
8189
  }
8190
- return I(`Unknown group type ${t.type}.`), !0;
8190
+ return R(`Unknown group type ${t.type}.`), !0;
8191
8191
  }
8192
8192
  setVisibility(t, e = !0, s = !0) {
8193
8193
  const i = this.#e.get(t);
8194
8194
  if (!i) {
8195
- I(`Optional content group not found: ${t}`);
8195
+ R(`Optional content group not found: ${t}`);
8196
8196
  return;
8197
8197
  }
8198
8198
  if (s && e && i.rbGroups.length)
@@ -8570,7 +8570,7 @@ function Bi(d) {
8570
8570
  }
8571
8571
  return null;
8572
8572
  }
8573
- function Re(d, t) {
8573
+ function Ie(d, t) {
8574
8574
  return new je(`Unexpected server response (${d}) while retrieving PDF "${t}".`, d, d === 404 || d === 0 && t.startsWith("file:"));
8575
8575
  }
8576
8576
  function Oi(d) {
@@ -8587,7 +8587,7 @@ function Hi(d, t, e) {
8587
8587
  };
8588
8588
  }
8589
8589
  function $i(d) {
8590
- return d instanceof Uint8Array ? d.buffer : d instanceof ArrayBuffer ? d : (I(`getArrayBuffer - unexpected data format: ${d}`), new Uint8Array(d).buffer);
8590
+ return d instanceof Uint8Array ? d.buffer : d instanceof ArrayBuffer ? d : (R(`getArrayBuffer - unexpected data format: ${d}`), new Uint8Array(d).buffer);
8591
8591
  }
8592
8592
  class fr {
8593
8593
  _responseOrigin = null;
@@ -8620,7 +8620,7 @@ class mr {
8620
8620
  const s = new Headers(t.headers), i = e.url;
8621
8621
  fetch(i, Hi(s, this._withCredentials, this._abortController)).then((n) => {
8622
8622
  if (t._responseOrigin = ts(n.url), !Oi(n.status))
8623
- throw Re(n.status, i);
8623
+ throw Ie(n.status, i);
8624
8624
  this._reader = n.body.getReader(), this._headersCapability.resolve();
8625
8625
  const r = n.headers, {
8626
8626
  allowRangeRequests: a,
@@ -8683,7 +8683,7 @@ class br {
8683
8683
  if (o !== t._responseOrigin)
8684
8684
  throw new Error(`Expected range response-origin "${o}" to match "${t._responseOrigin}".`);
8685
8685
  if (!Oi(a.status))
8686
- throw Re(a.status, r);
8686
+ throw Ie(a.status, r);
8687
8687
  this._readCapability.resolve(), this._reader = a.body.getReader();
8688
8688
  }).catch(this._readCapability.reject), this.onProgress = null;
8689
8689
  }
@@ -8761,7 +8761,7 @@ class wr {
8761
8761
  o ? s.onDone({
8762
8762
  begin: parseInt(o[1], 10),
8763
8763
  chunk: r
8764
- }) : (I('Missing or invalid "Content-Range" header.'), s.onError(0));
8764
+ }) : (R('Missing or invalid "Content-Range" header.'), s.onError(0));
8765
8765
  } else r ? s.onDone({
8766
8766
  begin: 0,
8767
8767
  chunk: r
@@ -8839,7 +8839,7 @@ class Ar {
8839
8839
  }
8840
8840
  }
8841
8841
  _onError(t) {
8842
- this._storedError = Re(t, this._url), this._headersCapability.reject(this._storedError);
8842
+ this._storedError = Ie(t, this._url), this._headersCapability.reject(this._storedError);
8843
8843
  for (const e of this._requests)
8844
8844
  e.reject(this._storedError);
8845
8845
  this._requests.length = 0, this._cachedChunks.length = 0;
@@ -8923,7 +8923,7 @@ class xr {
8923
8923
  this._requests.length = 0, this._close();
8924
8924
  }
8925
8925
  _onError(t) {
8926
- this._storedError ??= Re(t, this._url);
8926
+ this._storedError ??= Ie(t, this._url);
8927
8927
  for (const e of this._requests)
8928
8928
  e.reject(this._storedError);
8929
8929
  this._requests.length = 0, this._queuedChunk = null;
@@ -9002,7 +9002,7 @@ class Cr {
9002
9002
  s.promises.lstat(this._url).then((i) => {
9003
9003
  this._contentLength = i.size, this._setReadableStream(s.createReadStream(this._url)), this._headersCapability.resolve();
9004
9004
  }, (i) => {
9005
- i.code === "ENOENT" && (i = Re(0, this._url.href)), this._storedError = i, this._headersCapability.reject(i);
9005
+ i.code === "ENOENT" && (i = Ie(0, this._url.href)), this._storedError = i, this._headersCapability.reject(i);
9006
9006
  });
9007
9007
  }
9008
9008
  get headersReady() {
@@ -9270,7 +9270,7 @@ class yt {
9270
9270
  const e = this.#c, s = this.#m;
9271
9271
  for (const i of t) {
9272
9272
  if (e.length > Pr) {
9273
- I("Ignoring additional textDivs for performance reasons."), this.#i = !0;
9273
+ R("Ignoring additional textDivs for performance reasons."), this.#i = !0;
9274
9274
  return;
9275
9275
  }
9276
9276
  if (i.str === void 0) {
@@ -9381,7 +9381,7 @@ class yt {
9381
9381
  const r = n.measureText(""), a = r.fontBoundingBoxAscent, o = Math.abs(r.fontBoundingBoxDescent);
9382
9382
  n.canvas.width = n.canvas.height = 0;
9383
9383
  let h = 0.8;
9384
- return a ? h = a / (a + o) : (at.platform.isFirefox && I("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."), e.ascent ? h = e.ascent : e.descent && (h = 1 + e.descent)), this.#w.set(t, h), h;
9384
+ return a ? h = a / (a + o) : (at.platform.isFirefox && R("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."), e.ascent ? h = e.ascent : e.descent && (h = 1 + e.descent)), this.#w.set(t, h), h;
9385
9385
  }
9386
9386
  }
9387
9387
  const Mr = 100;
@@ -9395,7 +9395,7 @@ function Ui(d = {}) {
9395
9395
  docId: e
9396
9396
  } = t, s = d.url ? Nn(d.url) : null, i = d.data ? Bn(d.data) : null, n = d.httpHeaders || null, r = d.withCredentials === !0, a = d.password ?? null, o = d.range instanceof Vi ? d.range : null, h = Number.isInteger(d.rangeChunkSize) && d.rangeChunkSize > 0 ? d.rangeChunkSize : 2 ** 16;
9397
9397
  let l = d.worker instanceof Es ? d.worker : null;
9398
- const c = d.verbosity, u = typeof d.docBaseUrl == "string" && !Je(d.docBaseUrl) ? d.docBaseUrl : null, p = Fe(d.cMapUrl), f = d.cMapPacked !== !1, g = d.CMapReaderFactory || (dt ? jn : ei), b = Fe(d.iccUrl), m = Fe(d.standardFontDataUrl), w = d.StandardFontDataFactory || (dt ? Wn : si), y = Fe(d.wasmUrl), v = d.WasmFactory || (dt ? qn : ii), A = d.stopAtErrors !== !0, x = Number.isInteger(d.maxImageSize) && d.maxImageSize > -1 ? d.maxImageSize : -1, _ = d.isEvalSupported !== !1, E = typeof d.isOffscreenCanvasSupported == "boolean" ? d.isOffscreenCanvasSupported : !dt, S = typeof d.isImageDecoderSupported == "boolean" ? d.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), M = Number.isInteger(d.canvasMaxAreaInBytes) ? d.canvasMaxAreaInBytes : -1, C = typeof d.disableFontFace == "boolean" ? d.disableFontFace : dt, H = d.fontExtraProperties === !0, V = d.enableXfa === !0, N = d.ownerDocument || globalThis.document, Z = d.disableRange === !0, k = d.disableStream === !0, R = d.disableAutoFetch === !0, U = d.pdfBug === !0, ft = d.CanvasFactory || (dt ? Gn : zn), Dt = d.FilterFactory || (dt ? Vn : Un), tt = d.enableHWA === !0, W = d.useWasm !== !1, q = o ? o.length : d.length ?? NaN, Ut = typeof d.useSystemFonts == "boolean" ? d.useSystemFonts : !dt && !C, Nt = typeof d.useWorkerFetch == "boolean" ? d.useWorkerFetch : !!(g === ei && w === si && v === ii && p && m && y && ye(p, document.baseURI) && ye(m, document.baseURI) && ye(y, document.baseURI)), Bt = null;
9398
+ const c = d.verbosity, u = typeof d.docBaseUrl == "string" && !Je(d.docBaseUrl) ? d.docBaseUrl : null, p = Fe(d.cMapUrl), f = d.cMapPacked !== !1, g = d.CMapReaderFactory || (dt ? jn : ei), b = Fe(d.iccUrl), m = Fe(d.standardFontDataUrl), w = d.StandardFontDataFactory || (dt ? Wn : si), y = Fe(d.wasmUrl), v = d.WasmFactory || (dt ? qn : ii), A = d.stopAtErrors !== !0, x = Number.isInteger(d.maxImageSize) && d.maxImageSize > -1 ? d.maxImageSize : -1, _ = d.isEvalSupported !== !1, E = typeof d.isOffscreenCanvasSupported == "boolean" ? d.isOffscreenCanvasSupported : !dt, S = typeof d.isImageDecoderSupported == "boolean" ? d.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), M = Number.isInteger(d.canvasMaxAreaInBytes) ? d.canvasMaxAreaInBytes : -1, C = typeof d.disableFontFace == "boolean" ? d.disableFontFace : dt, H = d.fontExtraProperties === !0, V = d.enableXfa === !0, N = d.ownerDocument || globalThis.document, Z = d.disableRange === !0, k = d.disableStream === !0, I = d.disableAutoFetch === !0, U = d.pdfBug === !0, ft = d.CanvasFactory || (dt ? Gn : zn), Dt = d.FilterFactory || (dt ? Vn : Un), tt = d.enableHWA === !0, W = d.useWasm !== !1, q = o ? o.length : d.length ?? NaN, Ut = typeof d.useSystemFonts == "boolean" ? d.useSystemFonts : !dt && !C, Nt = typeof d.useWorkerFetch == "boolean" ? d.useWorkerFetch : !!(g === ei && w === si && v === ii && p && m && y && ye(p, document.baseURI) && ye(m, document.baseURI) && ye(y, document.baseURI)), Bt = null;
9399
9399
  ln(c);
9400
9400
  const et = {
9401
9401
  canvasFactory: new ft({
@@ -9426,7 +9426,7 @@ function Ui(d = {}) {
9426
9426
  apiVersion: "5.4.530",
9427
9427
  data: i,
9428
9428
  password: a,
9429
- disableAutoFetch: R,
9429
+ disableAutoFetch: I,
9430
9430
  rangeChunkSize: h,
9431
9431
  length: q,
9432
9432
  docBaseUrl: u,
@@ -9453,7 +9453,7 @@ function Ui(d = {}) {
9453
9453
  pdfBug: U,
9454
9454
  styleElement: Bt,
9455
9455
  loadingParams: {
9456
- disableAutoFetch: R,
9456
+ disableAutoFetch: I,
9457
9457
  enableXfa: V
9458
9458
  }
9459
9459
  };
@@ -9488,7 +9488,7 @@ function Ui(d = {}) {
9488
9488
  throw new Error("Loading aborted");
9489
9489
  if (l.destroyed)
9490
9490
  throw new Error("Worker was destroyed");
9491
- const js = new we(e, is, l.port), sn = new Rr(js, t, ss, de, et, tt);
9491
+ const js = new we(e, is, l.port), sn = new Ir(js, t, ss, de, et, tt);
9492
9492
  t._transport = sn, js.send("Ready", null);
9493
9493
  });
9494
9494
  }).catch(t._capability.reject), t;
@@ -10019,9 +10019,9 @@ const rt = class ve {
10019
10019
  if (Ft(this, Et), Ft(this, Vt, Promise.withResolvers()), Ft(this, Mt, null), Ft(this, Ht, null), Ft(this, he, null), this.name = t, this.destroyed = !1, this.verbosity = s, e) {
10020
10020
  if (Y(ve, ie).has(e))
10021
10021
  throw new Error("Cannot use more than one PDFWorker per port.");
10022
- Y(ve, ie).set(e, this), It(this, Et, Gi).call(this, e);
10022
+ Y(ve, ie).set(e, this), Rt(this, Et, Gi).call(this, e);
10023
10023
  } else
10024
- It(this, Et, ji).call(this);
10024
+ Rt(this, Et, ji).call(this);
10025
10025
  }
10026
10026
  get promise() {
10027
10027
  return Y(this, Vt).promise;
@@ -10063,10 +10063,10 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10063
10063
  });
10064
10064
  }, Gi = function(d) {
10065
10065
  mt(this, Ht, d), mt(this, Mt, new we("main", "worker", d)), Y(this, Mt).on("ready", () => {
10066
- }), It(this, Et, ze).call(this);
10066
+ }), Rt(this, Et, ze).call(this);
10067
10067
  }, ji = function() {
10068
10068
  if (Y(rt, Qt) || Y(rt, xe, qe)) {
10069
- It(this, Et, fe).call(this);
10069
+ Rt(this, Et, fe).call(this);
10070
10070
  return;
10071
10071
  }
10072
10072
  let {
@@ -10077,7 +10077,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10077
10077
  const t = new Worker(d, {
10078
10078
  type: "module"
10079
10079
  }), e = new we("main", "worker", t), s = () => {
10080
- i.abort(), e.destroy(), t.terminate(), this.destroyed ? Y(this, Vt).reject(new Error("Worker was destroyed")) : It(this, Et, fe).call(this);
10080
+ i.abort(), e.destroy(), t.terminate(), this.destroyed ? Y(this, Vt).reject(new Error("Worker was destroyed")) : Rt(this, Et, fe).call(this);
10081
10081
  }, i = new AbortController();
10082
10082
  t.addEventListener("error", () => {
10083
10083
  Y(this, he) || s();
@@ -10088,7 +10088,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10088
10088
  s();
10089
10089
  return;
10090
10090
  }
10091
- mt(this, Mt, e), mt(this, Ht, t), mt(this, he, t), It(this, Et, ze).call(this);
10091
+ mt(this, Mt, e), mt(this, Ht, t), mt(this, he, t), Rt(this, Et, ze).call(this);
10092
10092
  }), e.on("ready", (r) => {
10093
10093
  if (i.abort(), this.destroyed) {
10094
10094
  s();
@@ -10097,7 +10097,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10097
10097
  try {
10098
10098
  n();
10099
10099
  } catch {
10100
- It(this, Et, fe).call(this);
10100
+ Rt(this, Et, fe).call(this);
10101
10101
  }
10102
10102
  });
10103
10103
  const n = () => {
@@ -10109,9 +10109,9 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10109
10109
  } catch {
10110
10110
  Qe("The worker has been disabled.");
10111
10111
  }
10112
- It(this, Et, fe).call(this);
10112
+ Rt(this, Et, fe).call(this);
10113
10113
  }, fe = function() {
10114
- Y(rt, Qt) || (I("Setting up fake worker."), mt(rt, Qt, !0)), rt._setupFakeWorkerGlobal.then((d) => {
10114
+ Y(rt, Qt) || (R("Setting up fake worker."), mt(rt, Qt, !0)), rt._setupFakeWorkerGlobal.then((d) => {
10115
10115
  if (this.destroyed) {
10116
10116
  Y(this, Vt).reject(new Error("Worker was destroyed"));
10117
10117
  return;
@@ -10119,7 +10119,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10119
10119
  const t = new $n();
10120
10120
  mt(this, Ht, t);
10121
10121
  const e = `fake${nn(rt, us)._++}`, s = new we(e + "_worker", e, t);
10122
- d.setup(s, t), mt(this, Mt, new we(e, e + "_worker", t)), It(this, Et, ze).call(this);
10122
+ d.setup(s, t), mt(this, Mt, new we(e, e + "_worker", t)), Rt(this, Et, ze).call(this);
10123
10123
  }).catch((d) => {
10124
10124
  Y(this, Vt).reject(new Error(`Setting up fake worker failed: "${d.message}".`));
10125
10125
  });
@@ -10146,14 +10146,14 @@ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10146
10146
  return rt.create(d);
10147
10147
  };
10148
10148
  let Es = rt;
10149
- class Rr {
10149
+ class Ir {
10150
10150
  #t = /* @__PURE__ */ new Map();
10151
10151
  #e = /* @__PURE__ */ new Map();
10152
10152
  #i = /* @__PURE__ */ new Map();
10153
10153
  #s = /* @__PURE__ */ new Map();
10154
10154
  #a = null;
10155
10155
  constructor(t, e, s, i, n, r) {
10156
- this.messageHandler = t, this.loadingTask = e, this.commonObjs = new zi(), this.fontLoader = new In({
10156
+ this.messageHandler = t, this.loadingTask = e, this.commonObjs = new zi(), this.fontLoader = new Rn({
10157
10157
  ownerDocument: i.ownerDocument,
10158
10158
  styleElement: i.styleElement
10159
10159
  }), this.loadingParams = i.loadingParams, this._params = i, this.canvasFactory = n.canvasFactory, this.filterFactory = n.filterFactory, this.cMapReaderFactory = n.cMapReaderFactory, this.standardFontDataFactory = n.standardFontDataFactory, this.wasmFactory = n.wasmFactory, this.destroyed = !1, this.destroyCapability = null, this._networkStream = s, this._fullReader = null, this._lastProgress = null, this.downloadInfoCapability = Promise.withResolvers(), this.enableHWA = r, this.setupMessageHandler();
@@ -10180,7 +10180,7 @@ class Rr {
10180
10180
  r = bt.PRINT;
10181
10181
  break;
10182
10182
  default:
10183
- I(`getRenderingIntent - invalid intent: ${t}`);
10183
+ R(`getRenderingIntent - invalid intent: ${t}`);
10184
10184
  }
10185
10185
  const o = r & bt.PRINT && s instanceof Mi ? s : this.annotationStorage;
10186
10186
  switch (e) {
@@ -10196,7 +10196,7 @@ class Rr {
10196
10196
  r += bt.ANNOTATIONS_STORAGE, a = o.serializable;
10197
10197
  break;
10198
10198
  default:
10199
- I(`getRenderingIntent - invalid annotationMode: ${e}`);
10199
+ R(`getRenderingIntent - invalid annotationMode: ${e}`);
10200
10200
  }
10201
10201
  i && (r += bt.IS_EDITING), n && (r += bt.OPLIST);
10202
10202
  const {
@@ -10331,7 +10331,7 @@ class Rr {
10331
10331
  case "Font":
10332
10332
  if ("error" in n) {
10333
10333
  const c = n.error;
10334
- I(`Error during font loading: ${c}`), this.commonObjs.resolve(s, c);
10334
+ R(`Error during font loading: ${c}`), this.commonObjs.resolve(s, c);
10335
10335
  break;
10336
10336
  }
10337
10337
  const r = new G(n), a = this._params.pdfBug && globalThis.FontInspector?.enabled ? (c, u) => globalThis.FontInspector.fontAdded(c, u) : null, o = new Ln(r, a, n.extra, n.charProcOperatorList);
@@ -10401,7 +10401,7 @@ class Rr {
10401
10401
  return this.messageHandler.sendWithPromise("GetData", null);
10402
10402
  }
10403
10403
  saveDocument() {
10404
- this.annotationStorage.size <= 0 && I("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
10404
+ this.annotationStorage.size <= 0 && R("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
10405
10405
  const {
10406
10406
  map: t,
10407
10407
  transfer: e
@@ -10544,7 +10544,7 @@ class Rr {
10544
10544
  return this.#s.get(e) ?? null;
10545
10545
  }
10546
10546
  }
10547
- class Ir {
10547
+ class Rr {
10548
10548
  #t = null;
10549
10549
  onContinue = null;
10550
10550
  onError = null;
@@ -10588,7 +10588,7 @@ class ne {
10588
10588
  enableHWA: p = !1,
10589
10589
  operationsFilter: f = null
10590
10590
  }) {
10591
- this.callback = t, this.params = e, this.objs = s, this.commonObjs = i, this.annotationCanvasMap = n, this.operatorListIdx = null, this.operatorList = r, this._pageIndex = a, this.canvasFactory = o, this.filterFactory = h, this._pdfBug = c, this.pageColors = u, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = l === !0 && typeof window < "u", this.cancelled = !1, this.capability = Promise.withResolvers(), this.task = new Ir(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = e.canvas, this._canvasContext = e.canvas ? null : e.canvasContext, this._enableHWA = p, this._dependencyTracker = e.dependencyTracker, this._operationsFilter = f;
10591
+ this.callback = t, this.params = e, this.objs = s, this.commonObjs = i, this.annotationCanvasMap = n, this.operatorListIdx = null, this.operatorList = r, this._pageIndex = a, this.canvasFactory = o, this.filterFactory = h, this._pdfBug = c, this.pageColors = u, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = l === !0 && typeof window < "u", this.cancelled = !1, this.capability = Promise.withResolvers(), this.task = new Rr(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = e.canvas, this._canvasContext = e.canvas ? null : e.canvasContext, this._enableHWA = p, this._dependencyTracker = e.dependencyTracker, this._operationsFilter = f;
10592
10592
  }
10593
10593
  get completed() {
10594
10594
  return this.capability.promise.catch(function() {
@@ -10908,7 +10908,7 @@ class Fr {
10908
10908
  }
10909
10909
  class Xe extends Fr {
10910
10910
  _createSVG(t) {
10911
- return document.createElementNS(Rt, t);
10911
+ return document.createElementNS(It, t);
10912
10912
  }
10913
10913
  }
10914
10914
  const Nr = 9, qt = /* @__PURE__ */ new WeakSet(), Br = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60 * 1e3;
@@ -11144,10 +11144,10 @@ class K {
11144
11144
  r.borderStyle = "dashed";
11145
11145
  break;
11146
11146
  case Jt.BEVELED:
11147
- I("Unimplemented border style: beveled");
11147
+ R("Unimplemented border style: beveled");
11148
11148
  break;
11149
11149
  case Jt.INSET:
11150
- I("Unimplemented border style: inset");
11150
+ R("Unimplemented border style: inset");
11151
11151
  break;
11152
11152
  case Jt.UNDERLINE:
11153
11153
  r.borderBottomStyle = "solid";
@@ -11364,7 +11364,7 @@ class K {
11364
11364
  continue;
11365
11365
  const o = typeof a == "string" ? a : null, h = document.querySelector(`[data-element-id="${r}"]`);
11366
11366
  if (h && !qt.has(h)) {
11367
- I(`_getElementsByName - element not allowed: ${r}`);
11367
+ R(`_getElementsByName - element not allowed: ${r}`);
11368
11368
  continue;
11369
11369
  }
11370
11370
  s.push({
@@ -11514,7 +11514,7 @@ class Hs extends K {
11514
11514
  _bindResetFormAction(t, e) {
11515
11515
  const s = t.onclick;
11516
11516
  if (s || (t.href = this.linkService.getAnchorUrl("")), this.#t(), !this._fieldObjects) {
11517
- I('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), s || (t.onclick = () => !1);
11517
+ R('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), s || (t.onclick = () => !1);
11518
11518
  return;
11519
11519
  }
11520
11520
  t.onclick = () => {
@@ -11574,7 +11574,7 @@ class Hs extends K {
11574
11574
  const u = document.querySelector(`[data-element-id="${c}"]`);
11575
11575
  if (u) {
11576
11576
  if (!qt.has(u)) {
11577
- I(`_bindResetFormAction - element not allowed: ${c}`);
11577
+ R(`_bindResetFormAction - element not allowed: ${c}`);
11578
11578
  continue;
11579
11579
  }
11580
11580
  } else continue;
@@ -12213,7 +12213,7 @@ class jr {
12213
12213
  #t = null;
12214
12214
  #e = this.#G.bind(this);
12215
12215
  #i = this.#H.bind(this);
12216
- #s = this.#I.bind(this);
12216
+ #s = this.#R.bind(this);
12217
12217
  #a = this.#x.bind(this);
12218
12218
  #r = null;
12219
12219
  #n = null;
@@ -12448,20 +12448,20 @@ class jr {
12448
12448
  })), s.dateTime = this.#l.toISOString(), e.append(s);
12449
12449
  }
12450
12450
  Si({
12451
- html: this.#R || this.#o.str,
12451
+ html: this.#I || this.#o.str,
12452
12452
  dir: this.#o?.dir,
12453
12453
  className: "popupContent"
12454
12454
  }, t), this.#n.append(t);
12455
12455
  }
12456
- get #R() {
12456
+ get #I() {
12457
12457
  const t = this.#S, e = this.#o;
12458
12458
  return t?.str && (!e?.str || e.str === t.str) && this.#S.html || null;
12459
12459
  }
12460
12460
  get #L() {
12461
- return this.#R?.attributes?.style?.fontSize || 0;
12461
+ return this.#I?.attributes?.style?.fontSize || 0;
12462
12462
  }
12463
12463
  get #O() {
12464
- return this.#R?.attributes?.style?.color || null;
12464
+ return this.#I?.attributes?.style?.color || null;
12465
12465
  }
12466
12466
  #F(t) {
12467
12467
  const e = [], s = {
@@ -12557,9 +12557,9 @@ class jr {
12557
12557
  this.#t.toggleCommentPopup(this, !1);
12558
12558
  return;
12559
12559
  }
12560
- this.#p = !this.#p, this.#p ? (this.#I(), this.#n.addEventListener("click", this.#a), this.#n.addEventListener("keydown", this.#e)) : (this.#H(), this.#n.removeEventListener("click", this.#a), this.#n.removeEventListener("keydown", this.#e));
12560
+ this.#p = !this.#p, this.#p ? (this.#R(), this.#n.addEventListener("click", this.#a), this.#n.addEventListener("keydown", this.#e)) : (this.#H(), this.#n.removeEventListener("click", this.#a), this.#n.removeEventListener("keydown", this.#e));
12561
12561
  }
12562
- #I() {
12562
+ #R() {
12563
12563
  this.#m || this.render(), this.isVisible ? this.#p && this.#n.classList.add("focused") : (this.#C(), this.#n.hidden = !1, this.#n.style.zIndex = parseInt(this.#n.style.zIndex) + 1e3);
12564
12564
  }
12565
12565
  #H() {
@@ -12569,7 +12569,7 @@ class jr {
12569
12569
  this.#T = this.isVisible, this.#T && (this.#n.hidden = !0);
12570
12570
  }
12571
12571
  maybeShow() {
12572
- this.#t || (this.#k(), this.#T && (this.#m || this.#I(), this.#T = !1, this.#n.hidden = !1));
12572
+ this.#t || (this.#k(), this.#T && (this.#m || this.#R(), this.#T = !1, this.#n.hidden = !1));
12573
12573
  }
12574
12574
  get isVisible() {
12575
12575
  return this.#t ? !1 : this.#n.hidden === !1;
@@ -14477,7 +14477,7 @@ class J extends D {
14477
14477
  }
14478
14478
  return r;
14479
14479
  }
14480
- #R(t) {
14480
+ #I(t) {
14481
14481
  return this.#h.serialize(t, this.#M());
14482
14482
  }
14483
14483
  static startHighlighting(t, e, {
@@ -14688,7 +14688,7 @@ class J extends D {
14688
14688
  opacity: this.opacity,
14689
14689
  thickness: this.#g,
14690
14690
  quadPoints: this.#B(),
14691
- outlines: this.#R(s.rect)
14691
+ outlines: this.#I(s.rect)
14692
14692
  }), this.addComment(s), this.annotationElementId && !this.#F(s) ? null : (s.id = this.annotationElementId, s);
14693
14693
  }
14694
14694
  #F(t) {
@@ -15154,7 +15154,7 @@ class ia {
15154
15154
  #r;
15155
15155
  #n = "";
15156
15156
  #o = 0;
15157
- #l = new Ie();
15157
+ #l = new Re();
15158
15158
  #h;
15159
15159
  #u;
15160
15160
  constructor(t, e, s, i, n, r) {
@@ -15270,7 +15270,7 @@ class ia {
15270
15270
  };
15271
15271
  }
15272
15272
  }
15273
- class Ie extends P {
15273
+ class Re extends P {
15274
15274
  #t;
15275
15275
  #e = 0;
15276
15276
  #i;
@@ -15636,7 +15636,7 @@ class Us extends $ {
15636
15636
  return new ia(t, e, s, i, n, this._defaultDrawingOptions["stroke-width"]);
15637
15637
  }
15638
15638
  static deserializeDraw(t, e, s, i, n, r) {
15639
- return Ie.deserialize(t, e, s, i, n, r);
15639
+ return Re.deserialize(t, e, s, i, n, r);
15640
15640
  }
15641
15641
  static async deserialize(t, e, s) {
15642
15642
  let i = null;
@@ -15776,7 +15776,7 @@ class Us extends $ {
15776
15776
  }), null;
15777
15777
  }
15778
15778
  }
15779
- class Ps extends Ie {
15779
+ class Ps extends Re {
15780
15780
  toSVGPath() {
15781
15781
  let t = super.toSVGPath();
15782
15782
  return t.endsWith("Z") || (t += "Z"), t;
@@ -16073,7 +16073,7 @@ class te {
16073
16073
  }
16074
16074
  if (u.length === 0)
16075
16075
  return null;
16076
- const m = a ? new Ps() : new Ie();
16076
+ const m = a ? new Ps() : new Re();
16077
16077
  return m.build(u, e, s, 1, i, a ? 0 : c, n), {
16078
16078
  outline: m,
16079
16079
  newCurves: b,
@@ -16164,7 +16164,7 @@ class te {
16164
16164
  height: c
16165
16165
  };
16166
16166
  } catch (e) {
16167
- return I(`decompressSignature: ${e}`), null;
16167
+ return R(`decompressSignature: ${e}`), null;
16168
16168
  }
16169
16169
  }
16170
16170
  }
@@ -16427,7 +16427,7 @@ class Tt extends $ {
16427
16427
  }), n;
16428
16428
  }
16429
16429
  static deserializeDraw(t, e, s, i, n, r) {
16430
- return r.areContours ? Ps.deserialize(t, e, s, i, n, r) : Ie.deserialize(t, e, s, i, n, r);
16430
+ return r.areContours ? Ps.deserialize(t, e, s, i, n, r) : Re.deserialize(t, e, s, i, n, r);
16431
16431
  }
16432
16432
  static async deserialize(t, e, s) {
16433
16433
  const i = await super.deserialize(t, e, s);
@@ -17876,9 +17876,10 @@ class ca {
17876
17876
  this.element.appendChild(e), this.fieldElements.set(t.id, e);
17877
17877
  });
17878
17878
  }
17879
+ selectedFieldId = null;
17879
17880
  createFieldElement(t) {
17880
17881
  const e = document.createElement("div");
17881
- e.className = "sc-signature-field", e.dataset.id = t.id, e.dataset.moveable = String(t.draggable !== !1), e.style.position = "absolute", e.style.pointerEvents = "auto", e.style.boxSizing = "border-box", e.style.border = "1px solid #0056b3", e.style.backgroundColor = "rgba(0, 86, 179, 0.1)", e.style.cursor = t.draggable !== !1 ? "move" : "default", t.style && Object.assign(e.style, t.style);
17882
+ e.className = "sc-signature-field", e.dataset.id = t.id, e.dataset.moveable = String(t.draggable !== !1), e.style.position = "absolute", e.style.pointerEvents = "auto", e.style.boxSizing = "border-box", e.style.border = "1px solid #7FA1C3", e.style.backgroundColor = "rgba(127, 161, 195, 0.1)", e.style.cursor = t.draggable !== !1 ? "move" : "default", t.style && Object.assign(e.style, t.style);
17882
17883
  const s = document.createElement("div");
17883
17884
  if (s.className = "sc-field-content", s.style.overflow = "hidden", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", t.type === "text")
17884
17885
  s.textContent = t.content || "", s.style.whiteSpace = "pre-wrap", s.style.fontSize = "7pt", s.style.fontFamily = "sans-serif", s.style.lineHeight = "1.2", s.style.textAlign = "center";
@@ -17891,12 +17892,20 @@ class ca {
17891
17892
  const i = document.createElement("img");
17892
17893
  i.src = t.content || "", i.style.maxWidth = "100%", i.style.maxHeight = "100%", i.style.pointerEvents = "none", s.appendChild(i);
17893
17894
  }
17894
- return e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), this.updateElementPosition(e, t), e;
17895
+ return e.addEventListener("mousedown", (i) => {
17896
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17897
+ }), e.addEventListener("touchstart", (i) => {
17898
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17899
+ }, { passive: !1 }), e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), e.addEventListener("mouseenter", () => {
17900
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !0, !1);
17901
+ }), e.addEventListener("mouseleave", () => {
17902
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !1, !1);
17903
+ }), this.updateElementPosition(e, t), this.selectedFieldId === t.id && this.updateVisuals(e, t, !0, !0), e;
17895
17904
  }
17896
17905
  addResizeHandles(t) {
17897
17906
  ["nw", "ne", "sw", "se", "n", "e", "s", "w"].forEach((e) => {
17898
17907
  const s = document.createElement("div");
17899
- s.className = `sc-resize-handle sc-resize-${e}`, s.dataset.handle = e, s.style.position = "absolute", s.style.backgroundColor = "white", s.style.border = "1px solid #0056b3", s.style.zIndex = "2", s.style.boxSizing = "border-box";
17908
+ s.className = `sc-resize-handle sc-resize-${e}`, s.dataset.handle = e, s.style.position = "absolute", s.style.backgroundColor = "white", s.style.border = "1px solid #0056b3", s.style.zIndex = "2", s.style.boxSizing = "border-box", s.style.display = "none";
17900
17909
  const i = "8px", n = "6px", r = "14px";
17901
17910
  switch (e) {
17902
17911
  // Corners
@@ -17931,12 +17940,25 @@ class ca {
17931
17940
  }
17932
17941
  addDeleteButton(t, e) {
17933
17942
  const s = document.createElement("div");
17934
- s.className = "sc-delete-btn", s.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>', s.title = "Delete Field", s.style.position = "absolute", s.style.top = "0", s.style.right = "0", s.style.transform = "translate(50%, -50%)", s.style.width = "20px", s.style.height = "20px", s.style.borderRadius = "50%", s.style.backgroundColor = "#ff4d4f", s.style.color = "white", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", s.style.cursor = "pointer", s.style.zIndex = "20", s.style.boxShadow = "0 2px 4px rgba(0,0,0,0.2)", s.style.opacity = "0", s.style.transition = "opacity 0.2s", t.addEventListener("mouseenter", () => s.style.opacity = "1"), t.addEventListener("mouseleave", () => s.style.opacity = "0"), s.addEventListener("click", (i) => {
17943
+ s.className = "sc-delete-btn", s.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>', s.title = "Delete Field", s.style.position = "absolute", s.style.top = "0", s.style.right = "0", s.style.transform = "translate(50%, -50%)", s.style.width = "20px", s.style.height = "20px", s.style.borderRadius = "50%", s.style.backgroundColor = "#ff4d4f", s.style.color = "white", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", s.style.cursor = "pointer", s.style.zIndex = "20", s.style.boxShadow = "0 2px 4px rgba(0,0,0,0.2)", s.style.display = "none", s.addEventListener("click", (i) => {
17935
17944
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17936
17945
  }), s.addEventListener("touchstart", (i) => {
17937
17946
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17938
17947
  }, { passive: !1 }), t.appendChild(s);
17939
17948
  }
17949
+ select(t) {
17950
+ this.selectedFieldId = t, this.fields.forEach((e) => {
17951
+ const s = this.fieldElements.get(e.id);
17952
+ if (!s) return;
17953
+ const i = e.id === t;
17954
+ this.updateVisuals(s, e, i, i);
17955
+ });
17956
+ }
17957
+ updateVisuals(t, e, s, i) {
17958
+ t.querySelectorAll(".sc-resize-handle").forEach((r) => r.style.display = s ? "block" : "none");
17959
+ const n = t.querySelector(".sc-delete-btn");
17960
+ n && (n.style.display = s ? "flex" : "none"), i ? (t.style.border = "1px solid #0056b3", t.style.backgroundColor = "rgba(0, 86, 179, 0.1)") : s ? (t.style.border = "1px solid #0056b3", t.style.backgroundColor = "rgba(0, 86, 179, 0.05)") : (t.style.border = e.style?.border || "1px solid #7FA1C3", t.style.backgroundColor = e.style?.backgroundColor || "rgba(127, 161, 195, 0.1)");
17961
+ }
17940
17962
  updatePositions() {
17941
17963
  this.pageHeight !== 0 && this.fields.forEach((t) => {
17942
17964
  const e = this.fieldElements.get(t.id);
@@ -17971,7 +17993,7 @@ class tn {
17971
17993
  eventBus;
17972
17994
  element;
17973
17995
  constructor(t) {
17974
- this.container = t.container, this.pageIndex = t.pageIndex, this.scale = t.scale, this.eventBus = t.eventBus, this.element = document.createElement("div"), this.element.className = "page-view", this.element.dataset.pageIndex = this.pageIndex.toString(), this.element.style.position = "relative", this.element.style.flexShrink = "0", this.element.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)", this.canvasLayer = new aa(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new ca(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17996
+ this.container = t.container, this.pageIndex = t.pageIndex, this.scale = t.scale, this.eventBus = t.eventBus, this.element = document.createElement("div"), this.element.className = "page-view", this.element.dataset.pageIndex = this.pageIndex.toString(), this.element.style.position = "relative", this.element.style.flexShrink = "0", this.element.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)", this.element.style.margin = "0 auto", this.canvasLayer = new aa(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new ca(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17975
17997
  t.pageDimensions.width,
17976
17998
  t.pageDimensions.height,
17977
17999
  this.scale
@@ -17985,6 +18007,9 @@ class tn {
17985
18007
  setFields(t) {
17986
18008
  this.signatureLayer.setFields(t);
17987
18009
  }
18010
+ selectField(t) {
18011
+ this.signatureLayer.select(t);
18012
+ }
17988
18013
  async render() {
17989
18014
  if (!this.pdfPage) return;
17990
18015
  const t = this.pdfPage.getViewport({ scale: this.scale });
@@ -18047,7 +18072,7 @@ class da {
18047
18072
  this.container = t, this.pdfDocument = e, this.eventBus = s, this.totalPages = e.numPages, this.scale = i ?? 1, this.pageInfo = n ?? /* @__PURE__ */ new Map(), this.initContainer(), await this.renderCurrentPage();
18048
18073
  }
18049
18074
  initContainer() {
18050
- this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.alignItems = "center", this.container.style.padding = "20px", this.pageContainer = document.createElement("div"), this.pageContainer.className = "single-page-container", this.container.appendChild(this.pageContainer);
18075
+ this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.alignItems = "", this.container.style.padding = "20px", this.pageContainer = document.createElement("div"), this.pageContainer.className = "single-page-container", this.container.appendChild(this.pageContainer);
18051
18076
  }
18052
18077
  async renderCurrentPage() {
18053
18078
  this.pageView && (this.pageView.destroy(), this.pageView = null), this.pageContainer.innerHTML = "";
@@ -18085,7 +18110,10 @@ class da {
18085
18110
  return this.totalPages;
18086
18111
  }
18087
18112
  setScale(t) {
18088
- this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t }), this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18113
+ const e = this.scale, s = t, i = this.container, n = i.clientWidth, r = i.clientHeight, a = i.scrollLeft, o = i.scrollTop, h = a + n / 2, l = o + r / 2, c = s / e;
18114
+ this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t });
18115
+ const u = h * c - n / 2, p = l * c - r / 2;
18116
+ i.scrollLeft = u, i.scrollTop = p, this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18089
18117
  this.pageView && this.pageView.updateScaleFull(t), this.zoomTimeout = null;
18090
18118
  }, 150);
18091
18119
  }
@@ -18098,6 +18126,9 @@ class da {
18098
18126
  this.pageView.setFields(e);
18099
18127
  }
18100
18128
  }
18129
+ selectField(t) {
18130
+ this.pageView?.selectField(t);
18131
+ }
18101
18132
  destroy() {
18102
18133
  this.zoomTimeout && (clearTimeout(this.zoomTimeout), this.zoomTimeout = null), this.pageView && (this.pageView.destroy(), this.pageView = null), this.container.innerHTML = "";
18103
18134
  }
@@ -18119,7 +18150,7 @@ class ua {
18119
18150
  this.isDestroyed = !1, this.container = t, this.pdfDocument = e, this.eventBus = s, this.totalPages = e.numPages, this.scale = i ?? 1, this.pageInfo = n ?? /* @__PURE__ */ new Map(), this.initContainer(), await this.renderAllPages(), this.isDestroyed || this.setupIntersectionObserver();
18120
18151
  }
18121
18152
  initContainer() {
18122
- this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.gap = "20px", this.container.style.alignItems = "center", this.container.style.padding = "20px", this.container.scrollTop = 0;
18153
+ this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.gap = "20px", this.container.style.alignItems = "", this.container.style.padding = "20px", this.container.scrollTop = 0;
18123
18154
  }
18124
18155
  async renderAllPages() {
18125
18156
  this.pageViews.forEach((t) => t.destroy()), this.pageViews = [];
@@ -18195,8 +18226,28 @@ class ua {
18195
18226
  return this.totalPages;
18196
18227
  }
18197
18228
  setScale(t) {
18198
- this.scale = t, this.pageViews.forEach((e) => e.updateScalePreview(t)), this.eventBus.emit("scale:change", { scale: t }), this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18199
- this.pageViews.forEach((e) => e.updateScaleFull(t)), this.zoomTimeout = null;
18229
+ const e = this.scale, s = this.container, i = s.clientHeight, n = s.scrollTop + i / 2;
18230
+ let r = -1, a = 0;
18231
+ for (let o = 0; o < this.pageViews.length; o++) {
18232
+ const h = this.pageViews[o], l = h.element.offsetTop, c = h.element.offsetHeight, u = l + c;
18233
+ if (n < u) {
18234
+ r = o, a = (n - l) / c;
18235
+ break;
18236
+ }
18237
+ }
18238
+ if (r === -1 && this.pageViews.length > 0) {
18239
+ r = this.pageViews.length - 1;
18240
+ const o = this.pageViews[r];
18241
+ a = (n - o.element.offsetTop) / o.element.offsetHeight;
18242
+ }
18243
+ if (this.scale = t, this.pageViews.forEach((o) => o.updateScalePreview(t)), this.eventBus.emit("scale:change", { scale: t }), r !== -1) {
18244
+ const o = this.pageViews[r], h = o.element.offsetTop, l = o.element.offsetHeight, c = h + a * l;
18245
+ s.scrollTop = c - i / 2;
18246
+ const u = s.clientWidth, p = s.scrollLeft + u / 2, f = t / e;
18247
+ s.scrollLeft = p * f - u / 2;
18248
+ }
18249
+ this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18250
+ this.pageViews.forEach((o) => o.updateScaleFull(t)), this.zoomTimeout = null;
18200
18251
  }, 150);
18201
18252
  }
18202
18253
  getScale() {
@@ -18208,6 +18259,9 @@ class ua {
18208
18259
  e.setFields(s);
18209
18260
  });
18210
18261
  }
18262
+ selectField(t) {
18263
+ this.pageViews.forEach((e) => e.selectField(t));
18264
+ }
18211
18265
  destroy() {
18212
18266
  this.isDestroyed = !0, this.zoomTimeout && (clearTimeout(this.zoomTimeout), this.zoomTimeout = null), this.observer && (this.observer.disconnect(), this.observer = null), this.pageViews.forEach((t) => t.destroy()), this.pageViews = [], this.container.innerHTML = "";
18213
18267
  }
@@ -18224,6 +18278,7 @@ class pa {
18224
18278
  readyPromise = null;
18225
18279
  currentScale = 1;
18226
18280
  isDestroyed = !1;
18281
+ selectedFieldId = null;
18227
18282
  constructor(t) {
18228
18283
  this.container = t.container, this.eventBus = new rn(), this.loader = new ra(t.pdfLoaderOptions), this.currentViewMode = t.viewMode ?? "scroll", t.fields && (this.fields = [...t.fields]), this.zoomHandler = new an({
18229
18284
  container: this.container,
@@ -18235,6 +18290,11 @@ class pa {
18235
18290
  this.handleFieldDrop(e.fieldId, e.clientX, e.clientY, e.elementX, e.elementY);
18236
18291
  }), this.eventBus.on("field:ui:resize", (e) => {
18237
18292
  this.updateField(e.fieldId, e.updates);
18293
+ }), this.eventBus.on("field:focus", (e) => {
18294
+ this.selectField(e.fieldId);
18295
+ }), this.container.addEventListener("mousedown", (e) => {
18296
+ const s = e.target;
18297
+ s.closest(".sc-signature-field") || s.closest(".sc-resize-handle") || s.closest(".sc-delete-btn") || this.selectField(null);
18238
18298
  });
18239
18299
  }
18240
18300
  async load(t) {
@@ -18261,7 +18321,7 @@ class pa {
18261
18321
  this.strategy.destroy();
18262
18322
  return;
18263
18323
  }
18264
- this.fields.length > 0 && this.strategy.setFields(this.fields);
18324
+ this.fields.length > 0 && this.strategy.setFields(this.fields), this.selectedFieldId && this.strategy.selectField(this.selectedFieldId);
18265
18325
  }
18266
18326
  }
18267
18327
  createStrategy(t) {
@@ -18330,7 +18390,7 @@ class pa {
18330
18390
  throw new Error("PDF document not loaded");
18331
18391
  if (!this.strategy)
18332
18392
  throw new Error("PDF viewer not ready. Please wait for PDF to fully load.");
18333
- if (this.readyPromise && await this.readyPromise, t.pageNumber < 1 || t.pageNumber > this.pdfDocument.numPages)
18393
+ if (this.readyPromise && await this.readyPromise, typeof t.pageNumber != "number" || isNaN(t.pageNumber) || t.pageNumber < 1 || t.pageNumber > this.pdfDocument.numPages)
18334
18394
  throw new Error(`Invalid page number: ${t.pageNumber}. Document has ${this.pdfDocument.numPages} pages.`);
18335
18395
  if (t.rect.width <= 0 || t.rect.height <= 0)
18336
18396
  throw new Error("Field width and height must be greater than 0");
@@ -18352,12 +18412,22 @@ class pa {
18352
18412
  this.fields.push(t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:add", t), this.eventBus.emit("fields:change", this.fields);
18353
18413
  }
18354
18414
  removeField(t) {
18355
- this.fields = this.fields.filter((e) => e.id !== t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:remove", { fieldId: t }), this.eventBus.emit("fields:change", this.fields);
18415
+ this.selectedFieldId === t && this.selectField(null), this.fields = this.fields.filter((e) => e.id !== t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:remove", { fieldId: t }), this.eventBus.emit("fields:change", this.fields);
18356
18416
  }
18357
18417
  updateField(t, e) {
18358
18418
  const s = this.fields.findIndex((i) => i.id === t);
18359
18419
  s !== -1 && (this.fields[s] = { ...this.fields[s], ...e }, this.strategy?.setFields(this.fields), this.eventBus.emit("field:update", { fieldId: t, updates: e }), this.eventBus.emit("fields:change", this.fields));
18360
18420
  }
18421
+ selectField(t) {
18422
+ if (this.selectedFieldId === t)
18423
+ return;
18424
+ this.selectedFieldId = t, this.strategy?.selectField(t);
18425
+ let e = null;
18426
+ t && (e = this.fields.find((s) => String(s.id) === String(t)) || null, e || console.warn(`[PdfSignControl] Selection warning: Field with ID "${t}" not found in local state. Available IDs:`, this.fields.map((s) => s.id))), this.eventBus.emit("field:selection-change", { field: e });
18427
+ }
18428
+ clearFields() {
18429
+ this.selectField(null), this.fields = [], this.strategy?.setFields(this.fields), this.eventBus.emit("fields:change", this.fields);
18430
+ }
18361
18431
  handleFieldDrop(t, e, s, i, n) {
18362
18432
  const r = this.fields.find((v) => v.id === t);
18363
18433
  if (!r) return;
@@ -18563,6 +18633,9 @@ class ga {
18563
18633
  updateField(t, e) {
18564
18634
  this.viewer.updateField(t, e);
18565
18635
  }
18636
+ clearFields() {
18637
+ this.viewer.clearFields();
18638
+ }
18566
18639
  async print(t) {
18567
18640
  return this.viewer.print(t);
18568
18641
  }