@signosoft/signpad-js 0.4.4 → 0.4.6

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.
@@ -64,7 +64,7 @@ const { is: Xg, defineProperty: Pg, getOwnPropertyDescriptor: Vg, getOwnProperty
64
64
  return I;
65
65
  } }, wI = (Q, A) => !Xg(Q, A), PI = { attribute: !0, type: String, converter: mA, reflect: !1, useDefault: !1, hasChanged: wI };
66
66
  Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), XA.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
67
- class RA extends HTMLElement {
67
+ class GA extends HTMLElement {
68
68
  static addInitializer(A) {
69
69
  this._$Ei(), (this.l ??= []).push(A);
70
70
  }
@@ -245,7 +245,7 @@ class RA extends HTMLElement {
245
245
  firstUpdated(A) {
246
246
  }
247
247
  }
248
- RA.elementStyles = [], RA.shadowRootOptions = { mode: "open" }, RA[NA("elementProperties")] = /* @__PURE__ */ new Map(), RA[NA("finalized")] = /* @__PURE__ */ new Map(), AC?.({ ReactiveElement: RA }), (XA.reactiveElementVersions ??= []).push("2.1.2");
248
+ GA.elementStyles = [], GA.shadowRootOptions = { mode: "open" }, GA[NA("elementProperties")] = /* @__PURE__ */ new Map(), GA[NA("finalized")] = /* @__PURE__ */ new Map(), AC?.({ ReactiveElement: GA }), (XA.reactiveElementVersions ??= []).push("2.1.2");
249
249
  const IC = { attribute: !0, type: String, converter: mA, reflect: !1, hasChanged: wI }, gC = (Q = IC, A, I) => {
250
250
  const { kind: g, metadata: E } = I;
251
251
  let D = globalThis.litPropertyMetadata.get(E);
@@ -380,7 +380,7 @@ class iC {
380
380
  * Fallback handling when startSigning cannot proceed.
381
381
  */
382
382
  handleStartSigningError() {
383
- this.component.currentState === h.CONNECTED_MOUSE_FALLBACK && (this.component.resetDrawingState(), this.component.mouseManager?.addListeners(), this.component.stateManager.transitionTo(
383
+ this.component.currentState === h.CONNECTED_MOUSE_FALLBACK && (this.component.resetDrawingState(), this.component.pointerManager?.addListeners(), this.component.stateManager.transitionTo(
384
384
  h.CONNECTED_MOUSE_FALLBACK
385
385
  ));
386
386
  }
@@ -588,7 +588,7 @@ const ZA = class ZA {
588
588
  A
589
589
  );
590
590
  } finally {
591
- this.component.mouseManager?.removeListeners(), this.component.resetDrawingState(), console.log(
591
+ this.component.pointerManager?.removeListeners(), this.component.resetDrawingState(), console.log(
592
592
  "[ConnectionManager] Signing stopped and mouse listeners removed."
593
593
  );
594
594
  }
@@ -691,7 +691,7 @@ const ZA = class ZA {
691
691
  resolveConnectionTarget(A, I) {
692
692
  if (A.connected && !A.isPointerFallback) {
693
693
  const g = A.deviceInfo?.deviceName ?? A.deviceInfo?.name ?? P.CONNECTED_UNKNOWN;
694
- return this.component.setDeviceStatusText(g), this.component.mouseManager?.areListenersAttached() && this.component.mouseManager?.removeListeners(), {
694
+ return this.component.setDeviceStatusText(g), this.component.pointerManager?.areListenersAttached() && this.component.pointerManager?.removeListeners(), {
695
695
  targetState: h.CONNECTED_PHYSICAL,
696
696
  statusMessageKey: k.TEXT_SIGN_WITH_PHYSICAL
697
697
  };
@@ -841,17 +841,17 @@ class DC {
841
841
  */
842
842
  handleSideEffects(A, I) {
843
843
  const g = (E) => E === h.INITIAL || E === h.DISCONNECTED || E === h.ERROR;
844
- g(A) ? (this.component.setDeviceStatusText(P.MOUSE), this.component.setCanvasPointerInputEnabled(!0), g(I) || (this.component.resetDrawingState(), this.component.mouseManager?.removeListeners())) : (A === h.CONNECTED_PHYSICAL || A === h.CONNECTED_MOUSE_FALLBACK) && (A === h.CONNECTED_MOUSE_FALLBACK ? I === h.PROCESSING_OK || I === h.PROCESSING_CANCEL ? (this.component.mouseManager?.removeListeners(), this.component.setCanvasPointerInputEnabled(!1)) : (this.component.mouseManager?.addListeners(), this.component.setCanvasPointerInputEnabled(!0)) : (this.component.mouseManager?.removeListeners(), this.component.setCanvasPointerInputEnabled(!1)));
844
+ g(A) ? (this.component.setDeviceStatusText(P.MOUSE), this.component.setCanvasPointerInputEnabled(!0), g(I) || (this.component.resetDrawingState(), this.component.pointerManager?.removeListeners())) : (A === h.CONNECTED_PHYSICAL || A === h.CONNECTED_MOUSE_FALLBACK) && (A === h.CONNECTED_MOUSE_FALLBACK ? I === h.PROCESSING_OK || I === h.PROCESSING_CANCEL ? (this.component.pointerManager?.removeListeners(), this.component.setCanvasPointerInputEnabled(!1)) : (this.component.pointerManager?.addListeners(), this.component.setCanvasPointerInputEnabled(!0)) : (this.component.pointerManager?.removeListeners(), this.component.setCanvasPointerInputEnabled(!1)));
845
845
  }
846
846
  }
847
847
  class wC {
848
848
  /**
849
- * Creates an instance of MouseManager.
850
- * @param canvas - The HTMLCanvasElement to attach mouse listeners to.
849
+ * Creates an instance of PointerManager.
850
+ * @param canvas - The HTMLCanvasElement to attach pointer listeners to.
851
851
  * @param onPenDataCallback - The callback function that receives generated IPenData.
852
852
  */
853
853
  constructor(A, I) {
854
- this.isDrawing = !1, this.sequenceCounter = 0, this.sessionStartTime = null, this.debugListenerRegistrationCount = 0, this.listenersAttached = !1, this.canvas = A, this.onPenData = I, this.boundHandleMouseDown = this.handleMouseDown.bind(this), this.boundHandleMouseMove = this.handleMouseMove.bind(this), this.boundHandleMouseUp = this.handleMouseUp.bind(this), this.boundHandleMouseLeave = this.handleMouseLeave.bind(this);
854
+ this.isDrawing = !1, this.sequenceCounter = 0, this.sessionStartTime = null, this.debugListenerRegistrationCount = 0, this.listenersAttached = !1, this.canvas = A, this.onPenData = I, this.boundHandlePointerDown = this.handlePointerDown.bind(this), this.boundHandlePointerMove = this.handlePointerMove.bind(this), this.boundHandlePointerUp = this.handlePointerUp.bind(this), this.boundHandlePointerLeave = this.handlePointerLeave.bind(this), this.boundHandlePointerCancel = this.handlePointerCancel.bind(this);
855
855
  }
856
856
  // --- PUBLIC GETTERS ---
857
857
  /**
@@ -862,29 +862,44 @@ class wC {
862
862
  }
863
863
  // --- PUBLIC METHODS ---
864
864
  /**
865
- * Attaches mouse event listeners to the canvas to enable signature capture.
865
+ * Attaches pointer event listeners to the canvas to enable signature capture.
866
866
  */
867
867
  addListeners() {
868
868
  if (this.listenersAttached) {
869
- console.log("[Signpad Debug] Mouse listeners already registered");
869
+ console.log("[Signpad Debug] Pointer listeners already registered");
870
870
  return;
871
871
  }
872
872
  this.listenersAttached = !0, this.debugListenerRegistrationCount += 1, console.log(
873
- `[Signpad Debug] Mouse listeners registered (${this.debugListenerRegistrationCount})`
874
- ), this.canvas.addEventListener("mousedown", this.boundHandleMouseDown), this.canvas.addEventListener("mousemove", this.boundHandleMouseMove), this.canvas.addEventListener("mouseup", this.boundHandleMouseUp), this.canvas.addEventListener("mouseleave", this.boundHandleMouseLeave);
873
+ `[Signpad Debug] Pointer listeners registered (${this.debugListenerRegistrationCount})`
874
+ ), this.canvas.style.touchAction = "none", this.canvas.addEventListener("pointerdown", this.boundHandlePointerDown), this.canvas.addEventListener("pointermove", this.boundHandlePointerMove), this.canvas.addEventListener("pointerup", this.boundHandlePointerUp), this.canvas.addEventListener("pointerleave", this.boundHandlePointerLeave), this.canvas.addEventListener(
875
+ "pointercancel",
876
+ this.boundHandlePointerCancel
877
+ );
875
878
  }
876
879
  /**
877
- * Removes mouse event listeners from the canvas and stops active drawing.
880
+ * Removes pointer event listeners from the canvas and stops active drawing.
878
881
  */
879
882
  removeListeners() {
880
883
  if (!this.listenersAttached) {
881
- console.log("[Signpad Debug] Mouse listeners already removed");
884
+ console.log("[Signpad Debug] Pointer listeners already removed");
882
885
  return;
883
886
  }
884
- this.listenersAttached = !1, console.log("[Signpad Debug] Mouse listeners removed"), this.canvas.removeEventListener("mousedown", this.boundHandleMouseDown), this.canvas.removeEventListener("mousemove", this.boundHandleMouseMove), this.canvas.removeEventListener("mouseup", this.boundHandleMouseUp), this.canvas.removeEventListener("mouseleave", this.boundHandleMouseLeave), this.isDrawing = !1, this.sequenceCounter = 0;
885
- }
886
- /**
887
- * Returns true if mouse listeners are currently attached.
887
+ this.listenersAttached = !1, console.log("[Signpad Debug] Pointer listeners removed"), this.canvas.style.touchAction = "", this.canvas.removeEventListener(
888
+ "pointerdown",
889
+ this.boundHandlePointerDown
890
+ ), this.canvas.removeEventListener(
891
+ "pointermove",
892
+ this.boundHandlePointerMove
893
+ ), this.canvas.removeEventListener("pointerup", this.boundHandlePointerUp), this.canvas.removeEventListener(
894
+ "pointerleave",
895
+ this.boundHandlePointerLeave
896
+ ), this.canvas.removeEventListener(
897
+ "pointercancel",
898
+ this.boundHandlePointerCancel
899
+ ), this.isDrawing = !1, this.sequenceCounter = 0;
900
+ }
901
+ /**
902
+ * Returns true if pointer listeners are currently attached.
888
903
  */
889
904
  areListenersAttached() {
890
905
  return this.listenersAttached;
@@ -897,51 +912,68 @@ class wC {
897
912
  }
898
913
  // --- PRIVATE METHODS ---
899
914
  /**
900
- * Handles the 'mousedown' event: starts a stroke and initializes the session time.
915
+ * Handles the 'pointerdown' event: starts a stroke and initializes the session time.
916
+ * @private
917
+ */
918
+ handlePointerDown(A) {
919
+ this.isDrawing = !0, this.sequenceCounter = 0, this.sessionStartTime === null && (this.sessionStartTime = Date.now()), this.processPointerEvent(A, !0);
920
+ }
921
+ /**
922
+ * Handles the 'pointermove' event: continues the stroke if pointer is down.
901
923
  * @private
902
924
  */
903
- handleMouseDown(A) {
904
- this.isDrawing = !0, this.sequenceCounter = 0, this.sessionStartTime === null && (this.sessionStartTime = Date.now()), this.processMouseEvent(A, !0);
925
+ handlePointerMove(A) {
926
+ this.isDrawing && (this.sequenceCounter++, this.processPointerEvent(A, !0));
905
927
  }
906
928
  /**
907
- * Handles the 'mousemove' event: continues the stroke if mouse is down.
929
+ * Handles the 'pointerup' event: ends the stroke.
908
930
  * @private
909
931
  */
910
- handleMouseMove(A) {
911
- this.isDrawing && (this.sequenceCounter++, this.processMouseEvent(A, !0));
932
+ handlePointerUp(A) {
933
+ this.isDrawing && (this.isDrawing = !1, this.processPointerEvent(A, !1), this.sequenceCounter = 0);
912
934
  }
913
935
  /**
914
- * Handles the 'mouseup' event: ends the stroke.
936
+ * Handles the 'pointerleave' event: ends the stroke if the pointer leaves the canvas area.
915
937
  * @private
916
938
  */
917
- handleMouseUp(A) {
918
- this.isDrawing && (this.isDrawing = !1, this.processMouseEvent(A, !1), this.sequenceCounter = 0);
939
+ handlePointerLeave(A) {
940
+ this.isDrawing && (this.isDrawing = !1, this.processPointerEvent(A, !1), this.sequenceCounter = 0);
919
941
  }
920
942
  /**
921
- * Handles the 'mouseleave' event: ends the stroke if the mouse leaves the canvas area.
943
+ * Handles the 'pointercancel' event: terminates a stroke interrupted by the browser
944
+ * (e.g. iOS scroll taking over, incoming call, screen lock).
922
945
  * @private
923
946
  */
924
- handleMouseLeave(A) {
925
- this.isDrawing && (this.isDrawing = !1, this.processMouseEvent(A, !1), this.sequenceCounter = 0);
947
+ handlePointerCancel(A) {
948
+ this.isDrawing && (this.isDrawing = !1, this.processPointerEvent(A, !1), this.sequenceCounter = 0);
926
949
  }
927
950
  /**
928
- * Core logic to transform a MouseEvent into IPenData.
929
- * @param event - The raw browser MouseEvent.
930
- * @param inContact - Whether the "pen" (mouse button) is touching the surface.
951
+ * Core logic to transform a PointerEvent into IPenData.
952
+ * @param event - The raw browser PointerEvent.
953
+ * @param inContact - Whether the pointer is actively drawing on the surface.
931
954
  * @private
932
955
  */
933
- processMouseEvent(A, I) {
956
+ processPointerEvent(A, I) {
934
957
  const { x: g, y: E } = this.getNormalizedCoordinates(A), D = {
935
958
  relativeX: g,
936
959
  relativeY: E,
937
- pressure: I ? 0.5 : 0,
960
+ pressure: this.getPressure(A, I),
938
961
  inContact: I,
939
962
  timestamp: this.timestampToSeconds()
940
963
  };
941
964
  this.onPenData(D);
942
965
  }
943
966
  /**
944
- * Converts absolute mouse coordinates into a normalized 0-1 range relative to canvas size.
967
+ * Returns the pressure value for a pointer event.
968
+ * Pen devices (Apple Pencil, stylus) report real pressure in the 0–1 range.
969
+ * Mouse and touch devices fall back to 0.5 (in contact) / 0 (not in contact).
970
+ * @private
971
+ */
972
+ getPressure(A, I) {
973
+ return I ? A.pointerType === "pen" ? A.pressure : 0.5 : 0;
974
+ }
975
+ /**
976
+ * Converts absolute pointer coordinates into a normalized 0-1 range relative to canvas size.
945
977
  * @private
946
978
  */
947
979
  getNormalizedCoordinates(A) {
@@ -958,7 +990,7 @@ class wC {
958
990
  return Number(I.toFixed(3));
959
991
  }
960
992
  }
961
- const SC = "OK", sC = "Clear", aC = "Cancel", yC = "Clear signature", KC = "Disconnect", hC = "Connect Signpad", MC = "Mouse", GC = "Connected (Unknown Device)", RC = "Auto-connecting to device...", tC = "Connecting to your device...", NC = "Reverting to default input...", kC = "Disconnecting device...", FC = "Component initialized.", JC = "Connect your device.", UC = "Please sign using the device pen.", cC = "Please sign using your mouse.", LC = "Sign in the area above using mouse or pen.", eC = "Signing with {device}", YC = "No device found.", nC = "Connection error.", HC = "Error during disconnection.", rC = "Error instantiating driver.", qC = "Signpad disconnected.", lC = "Invalid license key.", dC = "Ready to connect.", fC = "Signpad detected. Click 'Connect Signpad' to begin.", pC = "Ready to sign. Use your mouse.", xC = "Ready to sign. Use the device pen.", OC = {
993
+ const SC = "OK", sC = "Clear", aC = "Cancel", yC = "Clear signature", KC = "Disconnect", hC = "Connect Signpad", MC = "Mouse", tC = "Connected (Unknown Device)", GC = "Auto-connecting to device...", RC = "Connecting to your device...", NC = "Reverting to default input...", kC = "Disconnecting device...", FC = "Component initialized.", JC = "Connect your device.", UC = "Please sign using the device pen.", cC = "Please sign using your mouse.", LC = "Sign in the area above using mouse or pen.", eC = "Signing with {device}", YC = "No device found.", nC = "Connection error.", rC = "Error during disconnection.", HC = "Error instantiating driver.", qC = "Signpad disconnected.", lC = "Invalid license key.", dC = "Ready to connect.", fC = "Signpad detected. Click 'Connect Signpad' to begin.", pC = "Ready to sign. Use your mouse.", xC = "Ready to sign. Use the device pen.", OC = {
962
994
  OK: SC,
963
995
  CLEAR: sC,
964
996
  CANCEL: aC,
@@ -966,9 +998,9 @@ const SC = "OK", sC = "Clear", aC = "Cancel", yC = "Clear signature", KC = "Disc
966
998
  DISCONNECT: KC,
967
999
  CONNECT_SIGNPAD: hC,
968
1000
  MOUSE: MC,
969
- CONNECTED_UNKNOWN_DEVICE: GC,
970
- AUTO_CONNECTING: RC,
971
- CONNECTING_TO_DEVICE: tC,
1001
+ CONNECTED_UNKNOWN_DEVICE: tC,
1002
+ AUTO_CONNECTING: GC,
1003
+ CONNECTING_TO_DEVICE: RC,
972
1004
  REVERTING_TO_DEFAULT: NC,
973
1005
  DISCONNECTING_DEVICE: kC,
974
1006
  COMPONENT_INITIALIZED: FC,
@@ -979,8 +1011,8 @@ const SC = "OK", sC = "Clear", aC = "Cancel", yC = "Clear signature", KC = "Disc
979
1011
  TEXT_SIGNING_WITH_DEVICE: eC,
980
1012
  NO_DEVICE_FOUND: YC,
981
1013
  CONNECTION_ERROR: nC,
982
- ERROR_DISCONNECTION: HC,
983
- ERROR_INSTANTIATING_DRIVER: rC,
1014
+ ERROR_DISCONNECTION: rC,
1015
+ ERROR_INSTANTIATING_DRIVER: HC,
984
1016
  SIGNPAD_DISCONNECTED: qC,
985
1017
  INVALID_LICENSE_KEY: lC,
986
1018
  READY_TO_CONNECT: dC,
@@ -1306,10 +1338,10 @@ var zI = (() => {
1306
1338
  };
1307
1339
  }
1308
1340
  console.log.bind(console);
1309
- var V = console.error.bind(console), AA, oA, FA = !1, IA, p, DA, z, gA, H, sI, PA, aI, yI, JA = (C) => C.startsWith("file://");
1341
+ var V = console.error.bind(console), AA, oA, FA = !1, IA, p, DA, z, gA, r, sI, PA, aI, yI, JA = (C) => C.startsWith("file://");
1310
1342
  function KI() {
1311
1343
  var C = oA.buffer;
1312
- IA = new Int8Array(C), DA = new Int16Array(C), g.HEAPU8 = p = new Uint8Array(C), z = new Uint16Array(C), gA = new Int32Array(C), H = new Uint32Array(C), sI = new Float32Array(C), yI = new Float64Array(C), PA = new BigInt64Array(C), aI = new BigUint64Array(C);
1344
+ IA = new Int8Array(C), DA = new Int16Array(C), g.HEAPU8 = p = new Uint8Array(C), z = new Uint16Array(C), gA = new Int32Array(C), r = new Uint32Array(C), sI = new Float32Array(C), yI = new Float64Array(C), PA = new BigInt64Array(C), aI = new BigUint64Array(C);
1313
1345
  }
1314
1346
  var CA = 0, sA = null;
1315
1347
  function hI(C) {
@@ -1347,23 +1379,23 @@ var zI = (() => {
1347
1379
  }
1348
1380
  var MI = (C) => {
1349
1381
  for (; 0 < C.length; ) C.shift()(g);
1350
- }, GI = [], RI = [], ag = () => {
1382
+ }, tI = [], GI = [], ag = () => {
1351
1383
  var C = g.preRun.shift();
1352
- RI.push(C);
1384
+ GI.push(C);
1353
1385
  };
1354
1386
  class yg {
1355
1387
  constructor(B) {
1356
1388
  this.Z = B - 24;
1357
1389
  }
1358
1390
  }
1359
- var tI = 0, UA = {}, zA = (C) => {
1391
+ var RI = 0, UA = {}, zA = (C) => {
1360
1392
  for (; C.length; ) {
1361
1393
  var B = C.pop();
1362
1394
  C.pop()(B);
1363
1395
  }
1364
1396
  };
1365
1397
  function aA(C) {
1366
- return this.fromWireType(H[C >> 2]);
1398
+ return this.fromWireType(r[C >> 2]);
1367
1399
  }
1368
1400
  var wA = {}, BA = {}, cA = {}, LA = class extends Error {
1369
1401
  constructor(C) {
@@ -1372,16 +1404,16 @@ var zI = (() => {
1372
1404
  }, yA = (C, B, i) => {
1373
1405
  function o(K) {
1374
1406
  if (K = i(K), K.length !== C.length) throw new LA("Mismatched type converter count");
1375
- for (var t = 0; t < C.length; ++t) b(C[t], K[t]);
1407
+ for (var R = 0; R < C.length; ++R) b(C[R], K[R]);
1376
1408
  }
1377
1409
  C.forEach((K) => cA[K] = B);
1378
1410
  var w = Array(B.length), s = [], y = 0;
1379
- B.forEach((K, t) => {
1380
- BA.hasOwnProperty(K) ? w[t] = BA[K] : (s.push(K), wA.hasOwnProperty(K) || (wA[K] = []), wA[K].push(() => {
1381
- w[t] = BA[K], ++y, y === s.length && o(w);
1411
+ B.forEach((K, R) => {
1412
+ BA.hasOwnProperty(K) ? w[R] = BA[K] : (s.push(K), wA.hasOwnProperty(K) || (wA[K] = []), wA[K].push(() => {
1413
+ w[R] = BA[K], ++y, y === s.length && o(w);
1382
1414
  }));
1383
1415
  }), s.length === 0 && o(w);
1384
- }, NI, r = (C) => {
1416
+ }, NI, H = (C) => {
1385
1417
  for (var B = ""; p[C]; ) B += NI[p[C++]];
1386
1418
  return B;
1387
1419
  }, N = class extends Error {
@@ -1410,7 +1442,7 @@ var zI = (() => {
1410
1442
  case 2:
1411
1443
  return i ? (o) => DA[o >> 1] : (o) => z[o >> 1];
1412
1444
  case 4:
1413
- return i ? (o) => gA[o >> 2] : (o) => H[o >> 2];
1445
+ return i ? (o) => gA[o >> 2] : (o) => r[o >> 2];
1414
1446
  case 8:
1415
1447
  return i ? (o) => PA[o >> 3] : (o) => aI[o >> 3];
1416
1448
  default:
@@ -1452,7 +1484,7 @@ var zI = (() => {
1452
1484
  var B = C.charCodeAt(0);
1453
1485
  return 48 <= B && 57 >= B ? `_${C}` : C;
1454
1486
  };
1455
- function Gg(C, B, i, o, w, s, y, K) {
1487
+ function tg(C, B, i, o, w, s, y, K) {
1456
1488
  this.name = C, this.constructor = B, this.ka = i, this.ia = o, this.ea = w, this.Ba = s, this.oa = y, this.za = K, this.Ja = [];
1457
1489
  }
1458
1490
  var AI = (C, B, i) => {
@@ -1466,7 +1498,7 @@ var zI = (() => {
1466
1498
  var B = typeof C;
1467
1499
  return B === "object" || B === "array" || B === "function" ? C.toString() : "" + C;
1468
1500
  };
1469
- function Rg(C, B) {
1501
+ function Gg(C, B) {
1470
1502
  if (B === null) {
1471
1503
  if (this.ra) throw new N(`null is not a valid ${this.name}`);
1472
1504
  return 0;
@@ -1475,7 +1507,7 @@ var zI = (() => {
1475
1507
  if (!B.Y.Z) throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);
1476
1508
  return AI(B.Y.Z, B.Y.aa.$, this.$);
1477
1509
  }
1478
- function tg(C, B) {
1510
+ function Rg(C, B) {
1479
1511
  if (B === null) {
1480
1512
  if (this.ra) throw new N(`null is not a valid ${this.name}`);
1481
1513
  if (this.qa) {
@@ -1529,14 +1561,14 @@ var zI = (() => {
1529
1561
  if (!!B.ha != !!B.da) throw new LA("Both smartPtrType and smartPtr must be specified");
1530
1562
  return B.count = { value: 1 }, KA(Object.create(C, { Y: { value: B, writable: !0 } }));
1531
1563
  };
1532
- function HA(C, B, i, o, w, s, y, K, t, G, R) {
1533
- this.name = C, this.$ = B, this.ra = i, this.pa = o, this.qa = w, this.Ia = s, this.Oa = y, this.xa = K, this.sa = t, this.Ka = G, this.ia = R, w || B.ea !== void 0 ? this.toWireType = tg : (this.toWireType = o ? Rg : Ng, this.fa = null);
1564
+ function rA(C, B, i, o, w, s, y, K, R, t, G) {
1565
+ this.name = C, this.$ = B, this.ra = i, this.pa = o, this.qa = w, this.Ia = s, this.Oa = y, this.xa = K, this.sa = R, this.Ka = t, this.ia = G, w || B.ea !== void 0 ? this.toWireType = Rg : (this.toWireType = o ? Gg : Ng, this.fa = null);
1534
1566
  }
1535
1567
  var LI = (C, B, i) => {
1536
1568
  if (!g.hasOwnProperty(C)) throw new LA("Replacing nonexistent public symbol");
1537
1569
  g[C].ba !== void 0 && i !== void 0 ? g[C].ba[i] = B : (g[C] = B, g[C].la = i);
1538
1570
  }, eI = [], YI, Z = (C, B) => {
1539
- C = r(C);
1571
+ C = H(C);
1540
1572
  var i;
1541
1573
  if ((i = eI[B]) || (eI[B] = i = YI.get(B)), typeof i != "function") throw new N(`unknown function pointer with signature ${C}: ${B}`);
1542
1574
  return i;
@@ -1545,7 +1577,7 @@ var zI = (() => {
1545
1577
  }
1546
1578
  var nI = (C) => {
1547
1579
  C = xg(C);
1548
- var B = r(C);
1580
+ var B = H(C);
1549
1581
  return EA(C), B;
1550
1582
  }, gI = (C, B) => {
1551
1583
  function i(s) {
@@ -1554,40 +1586,40 @@ var zI = (() => {
1554
1586
  var o = [], w = {};
1555
1587
  throw B.forEach(i), new Jg(`${C}: ` + o.map(nI).join([", "]));
1556
1588
  };
1557
- function HI(C) {
1589
+ function rI(C) {
1558
1590
  for (var B = 1; B < C.length; ++B) if (C[B] !== null && C[B].fa === void 0) return !0;
1559
1591
  return !1;
1560
1592
  }
1561
- function rI(C, B, i, o, w, s) {
1593
+ function HI(C, B, i, o, w, s) {
1562
1594
  var y = B.length;
1563
1595
  if (2 > y) throw new N("argTypes array size mismatch! Must at least get return value and 'this' types!");
1564
- var K = B[1] !== null && i !== null, t = HI(B);
1596
+ var K = B[1] !== null && i !== null, R = rI(B);
1565
1597
  for (i = B[0].name !== "void", o = [C, Kg, o, w, zA, B[0], B[1]], w = 0; w < y - 2; ++w) o.push(B[w + 2]);
1566
- if (!t) for (w = K ? 1 : 2; w < B.length; ++w) B[w].fa !== null && o.push(B[w].fa);
1567
- t = HI(B), w = B.length - 2;
1568
- var G = [], R = ["fn"];
1569
- for (K && R.push("thisWired"), y = 0; y < w; ++y) G.push(`arg${y}`), R.push(`arg${y}Wired`);
1570
- G = G.join(","), R = R.join(","), G = `return function (${G}) {
1571
- `, t && (G += `var destructors = [];
1598
+ if (!R) for (w = K ? 1 : 2; w < B.length; ++w) B[w].fa !== null && o.push(B[w].fa);
1599
+ R = rI(B), w = B.length - 2;
1600
+ var t = [], G = ["fn"];
1601
+ for (K && G.push("thisWired"), y = 0; y < w; ++y) t.push(`arg${y}`), G.push(`arg${y}Wired`);
1602
+ t = t.join(","), G = G.join(","), t = `return function (${t}) {
1603
+ `, R && (t += `var destructors = [];
1572
1604
  `);
1573
- var J = t ? "destructors" : "null", e = "humanName throwBindingError invoker fn runDestructors retType classParam".split(" ");
1574
- for (K && (G += `var thisWired = classParam['toWireType'](${J}, this);
1575
- `), y = 0; y < w; ++y) G += `var arg${y}Wired = argType${y}['toWireType'](${J}, arg${y});
1605
+ var J = R ? "destructors" : "null", e = "humanName throwBindingError invoker fn runDestructors retType classParam".split(" ");
1606
+ for (K && (t += `var thisWired = classParam['toWireType'](${J}, this);
1607
+ `), y = 0; y < w; ++y) t += `var arg${y}Wired = argType${y}['toWireType'](${J}, arg${y});
1576
1608
  `, e.push(`argType${y}`);
1577
- if (G += (i || s ? "var rv = " : "") + `invoker(${R});
1578
- `, t) G += `runDestructors(destructors);
1609
+ if (t += (i || s ? "var rv = " : "") + `invoker(${G});
1610
+ `, R) t += `runDestructors(destructors);
1579
1611
  `;
1580
- else for (y = K ? 1 : 2; y < B.length; ++y) s = y === 1 ? "thisWired" : "arg" + (y - 2) + "Wired", B[y].fa !== null && (G += `${s}_dtor(${s});
1612
+ else for (y = K ? 1 : 2; y < B.length; ++y) s = y === 1 ? "thisWired" : "arg" + (y - 2) + "Wired", B[y].fa !== null && (t += `${s}_dtor(${s});
1581
1613
  `, e.push(`${s}_dtor`));
1582
- i && (G += `var ret = retType['fromWireType'](rv);
1614
+ i && (t += `var ret = retType['fromWireType'](rv);
1583
1615
  return ret;
1584
1616
  `);
1585
- let [q, L] = [e, G + `}
1617
+ let [q, L] = [e, t + `}
1586
1618
  `];
1587
1619
  return B = new Function(...q, L)(...o), YA(C, B);
1588
1620
  }
1589
1621
  for (var qI = (C, B) => {
1590
- for (var i = [], o = 0; o < C; o++) i.push(H[B + 4 * o >> 2]);
1622
+ for (var i = [], o = 0; o < C; o++) i.push(r[B + 4 * o >> 2]);
1591
1623
  return i;
1592
1624
  }, lI = (C) => {
1593
1625
  C = C.trim();
@@ -1633,12 +1665,12 @@ return ret;
1633
1665
  return i ? function(o) {
1634
1666
  return this.fromWireType(gA[o >> 2]);
1635
1667
  } : function(o) {
1636
- return this.fromWireType(H[o >> 2]);
1668
+ return this.fromWireType(r[o >> 2]);
1637
1669
  };
1638
1670
  default:
1639
1671
  throw new TypeError(`invalid integer width (${B}): ${C}`);
1640
1672
  }
1641
- }, rA = (C, B) => {
1673
+ }, HA = (C, B) => {
1642
1674
  var i = BA[C];
1643
1675
  if (i === void 0) throw C = `${B} has unknown type ${nI(C)}`, new N(C);
1644
1676
  return i;
@@ -1732,14 +1764,14 @@ return ret;
1732
1764
  i = i < 2 * C.length ? i / 2 : C.length;
1733
1765
  for (var w = 0; w < i; ++w) DA[B >> 1] = C.charCodeAt(w), B += 2;
1734
1766
  return DA[B >> 1] = 0, B - o;
1735
- }, ng = (C) => 2 * C.length, Hg = (C, B) => {
1767
+ }, ng = (C) => 2 * C.length, rg = (C, B) => {
1736
1768
  for (var i = 0, o = ""; !(i >= B / 4); ) {
1737
1769
  var w = gA[C + 4 * i >> 2];
1738
1770
  if (w == 0) break;
1739
1771
  ++i, 65536 <= w ? (w -= 65536, o += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023)) : o += String.fromCharCode(w);
1740
1772
  }
1741
1773
  return o;
1742
- }, rg = (C, B, i) => {
1774
+ }, Hg = (C, B, i) => {
1743
1775
  if (i ??= 2147483647, 4 > i) return 0;
1744
1776
  var o = B;
1745
1777
  i = o + i - 4;
@@ -1760,15 +1792,15 @@ return ret;
1760
1792
  return B;
1761
1793
  }, OI = (C, B, i) => {
1762
1794
  var o = [];
1763
- return C = C.toWireType(o, i), o.length && (H[B >> 2] = m(o)), C;
1795
+ return C = C.toWireType(o, i), o.length && (r[B >> 2] = m(o)), C;
1764
1796
  }, qA = [], lg = {}, lA = (C) => {
1765
1797
  var B = lg[C];
1766
- return B === void 0 ? r(C) : B;
1798
+ return B === void 0 ? H(C) : B;
1767
1799
  }, TI = () => typeof globalThis == "object" ? globalThis : Function("return this")(), dg = (C) => {
1768
1800
  var B = qA.length;
1769
1801
  return qA.push(C), B;
1770
1802
  }, fg = (C, B) => {
1771
- for (var i = Array(C), o = 0; o < C; ++o) i[o] = rA(H[B + 4 * o >> 2], `parameter ${o}`);
1803
+ for (var i = Array(C), o = 0; o < C; ++o) i[o] = HA(r[B + 4 * o >> 2], `parameter ${o}`);
1772
1804
  return i;
1773
1805
  }, jI = Array(256), dA = 0; 256 > dA; ++dA) jI[dA] = String.fromCharCode(dA);
1774
1806
  NI = jI, (() => {
@@ -1798,7 +1830,7 @@ return ret;
1798
1830
  } });
1799
1831
  const B = Symbol.dispose;
1800
1832
  B && (C[B] = C.delete);
1801
- })(), Object.assign(HA.prototype, { Ca(C) {
1833
+ })(), Object.assign(rA.prototype, { Ca(C) {
1802
1834
  return this.xa && (C = this.xa(C)), C;
1803
1835
  }, va(C) {
1804
1836
  this.ia?.(C);
@@ -1820,32 +1852,32 @@ return ret;
1820
1852
  );
1821
1853
  return w === null ? B.call(this) : this.qa ? nA(o.$.ka, { aa: o, Z: w, ha: this, da: C }) : nA(o.$.ka, { aa: o, Z: w });
1822
1854
  } }), g.printErr && (V = g.printErr), g.wasmBinary && (AA = g.wasmBinary), g.ccall = (C, B, i, o) => {
1823
- var w = { string: (G) => {
1824
- var R = 0;
1825
- if (G != null && G !== 0) {
1826
- R = fI(G) + 1;
1827
- var J = bI(R);
1828
- SA(G, J, R), R = J;
1855
+ var w = { string: (t) => {
1856
+ var G = 0;
1857
+ if (t != null && t !== 0) {
1858
+ G = fI(t) + 1;
1859
+ var J = bI(G);
1860
+ SA(t, J, G), G = J;
1829
1861
  }
1830
- return R;
1831
- }, array: (G) => {
1832
- var R = bI(G.length);
1833
- return IA.set(G, R), R;
1862
+ return G;
1863
+ }, array: (t) => {
1864
+ var G = bI(t.length);
1865
+ return IA.set(t, G), G;
1834
1866
  } };
1835
1867
  C = g["_" + C];
1836
1868
  var s = [], y = 0;
1837
1869
  if (o) for (var K = 0; K < o.length; K++) {
1838
- var t = w[i[K]];
1839
- t ? (y === 0 && (y = Tg()), s[K] = t(o[K])) : s[K] = o[K];
1870
+ var R = w[i[K]];
1871
+ R ? (y === 0 && (y = Tg()), s[K] = R(o[K])) : s[K] = o[K];
1840
1872
  }
1841
- return i = C(...s), i = (function(G) {
1842
- return y !== 0 && Og(y), B === "string" ? G ? hA(G) : "" : B === "boolean" ? !!G : G;
1873
+ return i = C(...s), i = (function(t) {
1874
+ return y !== 0 && Og(y), B === "string" ? t ? hA(t) : "" : B === "boolean" ? !!t : t;
1843
1875
  })(i);
1844
1876
  };
1845
1877
  var pg = {
1846
1878
  k: (C, B, i) => {
1847
1879
  var o = new yg(C);
1848
- throw H[o.Z + 16 >> 2] = 0, H[o.Z + 4 >> 2] = B, H[o.Z + 8 >> 2] = i, tI = C, tI;
1880
+ throw r[o.Z + 16 >> 2] = 0, r[o.Z + 4 >> 2] = B, r[o.Z + 8 >> 2] = i, RI = C, RI;
1849
1881
  },
1850
1882
  F: () => hI(""),
1851
1883
  t: (C) => {
@@ -1854,26 +1886,26 @@ return ret;
1854
1886
  var i = B.sa, o = B.ia, w = B.wa, s = w.map((y) => y.Fa).concat(w.map((y) => y.Ma));
1855
1887
  yA([C], s, (y) => {
1856
1888
  var K = {};
1857
- return w.forEach((t, G) => {
1858
- var R = y[G], J = t.Da, e = t.Ea, q = y[G + w.length], L = t.La, j = t.Na;
1859
- K[t.Aa] = { read: (v) => R.fromWireType(J(e, v)), write: (v, MA) => {
1889
+ return w.forEach((R, t) => {
1890
+ var G = y[t], J = R.Da, e = R.Ea, q = y[t + w.length], L = R.La, j = R.Na;
1891
+ K[R.Aa] = { read: (v) => G.fromWireType(J(e, v)), write: (v, MA) => {
1860
1892
  var x = [];
1861
1893
  L(j, v, q.toWireType(x, MA)), zA(x);
1862
- }, optional: y[G].optional };
1863
- }), [{ name: B.name, fromWireType: (t) => {
1864
- var G = {}, R;
1865
- for (R in K) G[R] = K[R].read(t);
1866
- return o(t), G;
1867
- }, toWireType: (t, G) => {
1868
- for (var R in K) if (!(R in G || K[R].optional)) throw new TypeError(`Missing field: "${R}"`);
1894
+ }, optional: y[t].optional };
1895
+ }), [{ name: B.name, fromWireType: (R) => {
1896
+ var t = {}, G;
1897
+ for (G in K) t[G] = K[G].read(R);
1898
+ return o(R), t;
1899
+ }, toWireType: (R, t) => {
1900
+ for (var G in K) if (!(G in t || K[G].optional)) throw new TypeError(`Missing field: "${G}"`);
1869
1901
  var J = i();
1870
- for (R in K) K[R].write(J, G[R]);
1871
- return t !== null && t.push(o, J), J;
1902
+ for (G in K) K[G].write(J, t[G]);
1903
+ return R !== null && R.push(o, J), J;
1872
1904
  }, ga: 8, readValueFromPointer: aA, fa: o }];
1873
1905
  });
1874
1906
  },
1875
1907
  x: (C, B, i, o, w) => {
1876
- B = r(B), o = o === 0n;
1908
+ B = H(B), o = o === 0n;
1877
1909
  let s = (y) => y;
1878
1910
  if (o) {
1879
1911
  const y = 8 * i;
@@ -1882,7 +1914,7 @@ return ret;
1882
1914
  b(C, { name: B, fromWireType: s, toWireType: (y, K) => (typeof K == "number" && (K = BigInt(K)), K), ga: 8, readValueFromPointer: kI(B, i, !o), fa: null });
1883
1915
  },
1884
1916
  K: (C, B, i, o) => {
1885
- B = r(B), b(C, {
1917
+ B = H(B), b(C, {
1886
1918
  name: B,
1887
1919
  fromWireType: function(w) {
1888
1920
  return !!w;
@@ -1897,79 +1929,79 @@ return ret;
1897
1929
  fa: null
1898
1930
  });
1899
1931
  },
1900
- M: (C, B, i, o, w, s, y, K, t, G, R, J, e) => {
1901
- R = r(R), s = Z(w, s), K &&= Z(y, K), G &&= Z(t, G), e = Z(J, e);
1902
- var q = Mg(R);
1932
+ M: (C, B, i, o, w, s, y, K, R, t, G, J, e) => {
1933
+ G = H(G), s = Z(w, s), K &&= Z(y, K), t &&= Z(R, t), e = Z(J, e);
1934
+ var q = Mg(G);
1903
1935
  $A(q, function() {
1904
- gI(`Cannot construct ${R} due to unbound types`, [o]);
1936
+ gI(`Cannot construct ${G} due to unbound types`, [o]);
1905
1937
  }), yA([C, B, i], o ? [o] : [], (L) => {
1906
1938
  if (L = L[0], o)
1907
1939
  var j = L.$, v = j.ka;
1908
1940
  else v = eA.prototype;
1909
- L = YA(R, function(...QI) {
1910
- if (Object.getPrototypeOf(this) !== MA) throw new N(`Use 'new' to construct ${R}`);
1911
- if (x.ja === void 0) throw new N(`${R} has no accessible constructor`);
1941
+ L = YA(G, function(...QI) {
1942
+ if (Object.getPrototypeOf(this) !== MA) throw new N(`Use 'new' to construct ${G}`);
1943
+ if (x.ja === void 0) throw new N(`${G} has no accessible constructor`);
1912
1944
  var mI = x.ja[QI.length];
1913
- if (mI === void 0) throw new N(`Tried to invoke ctor of ${R} with invalid number of parameters (${QI.length}) - expected (${Object.keys(x.ja).toString()}) parameters instead!`);
1945
+ if (mI === void 0) throw new N(`Tried to invoke ctor of ${G} with invalid number of parameters (${QI.length}) - expected (${Object.keys(x.ja).toString()}) parameters instead!`);
1914
1946
  return mI.apply(this, QI);
1915
1947
  });
1916
1948
  var MA = Object.create(v, { constructor: { value: L } });
1917
1949
  L.prototype = MA;
1918
- var x = new Gg(R, L, MA, e, j, s, K, G);
1950
+ var x = new tg(G, L, MA, e, j, s, K, t);
1919
1951
  if (x.ea) {
1920
- var GA;
1921
- (GA = x.ea).ua ?? (GA.ua = []), x.ea.ua.push(x);
1952
+ var tA;
1953
+ (tA = x.ea).ua ?? (tA.ua = []), x.ea.ua.push(x);
1922
1954
  }
1923
- return j = new HA(R, x, !0, !1, !1), GA = new HA(R + "*", x, !1, !1, !1), v = new HA(R + " const*", x, !1, !0, !1), JI[C] = { pointerType: GA, ya: v }, LI(q, L), [j, GA, v];
1955
+ return j = new rA(G, x, !0, !1, !1), tA = new rA(G + "*", x, !1, !1, !1), v = new rA(G + " const*", x, !1, !0, !1), JI[C] = { pointerType: tA, ya: v }, LI(q, L), [j, tA, v];
1924
1956
  });
1925
1957
  },
1926
- y: (C, B, i, o, w, s, y, K, t) => {
1927
- var G = qI(i, o);
1928
- B = r(B), B = lI(B), s = Z(w, s), yA([], [C], (R) => {
1958
+ y: (C, B, i, o, w, s, y, K, R) => {
1959
+ var t = qI(i, o);
1960
+ B = H(B), B = lI(B), s = Z(w, s), yA([], [C], (G) => {
1929
1961
  function J() {
1930
- gI(`Cannot call ${e} due to unbound types`, G);
1962
+ gI(`Cannot call ${e} due to unbound types`, t);
1931
1963
  }
1932
- R = R[0];
1933
- var e = `${R.name}.${B}`;
1934
- B.startsWith("@@") && (B = Symbol[B.substring(2)]), K && R.$.Ja.push(B);
1935
- var q = R.$.ka, L = q[B];
1936
- return L === void 0 || L.ba === void 0 && L.className !== R.name && L.la === i - 2 ? (J.la = i - 2, J.className = R.name, q[B] = J) : (UI(q, B, e), q[B].ba[i - 2] = J), yA([], G, (j) => (j = rI(e, j, R, s, y, t), q[B].ba === void 0 ? (j.la = i - 2, q[B] = j) : q[B].ba[i - 2] = j, [])), [];
1964
+ G = G[0];
1965
+ var e = `${G.name}.${B}`;
1966
+ B.startsWith("@@") && (B = Symbol[B.substring(2)]), K && G.$.Ja.push(B);
1967
+ var q = G.$.ka, L = q[B];
1968
+ return L === void 0 || L.ba === void 0 && L.className !== G.name && L.la === i - 2 ? (J.la = i - 2, J.className = G.name, q[B] = J) : (UI(q, B, e), q[B].ba[i - 2] = J), yA([], t, (j) => (j = HI(e, j, G, s, y, R), q[B].ba === void 0 ? (j.la = i - 2, q[B] = j) : q[B].ba[i - 2] = j, [])), [];
1937
1969
  });
1938
1970
  },
1939
1971
  I: (C) => b(C, Ug),
1940
1972
  z: (C, B, i, o) => {
1941
1973
  function w() {
1942
1974
  }
1943
- B = r(B), w.values = {}, b(C, { name: B, constructor: w, fromWireType: function(s) {
1975
+ B = H(B), w.values = {}, b(C, { name: B, constructor: w, fromWireType: function(s) {
1944
1976
  return this.constructor.values[s];
1945
1977
  }, toWireType: (s, y) => y.value, ga: 8, readValueFromPointer: cg(B, i, o), fa: null }), $A(B, w);
1946
1978
  },
1947
1979
  o: (C, B, i) => {
1948
- var o = rA(C, "enum");
1949
- B = r(B), C = o.constructor, o = Object.create(o.constructor.prototype, { value: { value: i }, constructor: { value: YA(`${o.name}_${B}`, function() {
1980
+ var o = HA(C, "enum");
1981
+ B = H(B), C = o.constructor, o = Object.create(o.constructor.prototype, { value: { value: i }, constructor: { value: YA(`${o.name}_${B}`, function() {
1950
1982
  }) } }), C.values[i] = o, C[B] = o;
1951
1983
  },
1952
1984
  w: (C, B, i) => {
1953
- B = r(B), b(C, { name: B, fromWireType: (o) => o, toWireType: (o, w) => w, ga: 8, readValueFromPointer: Lg(B, i), fa: null });
1985
+ B = H(B), b(C, { name: B, fromWireType: (o) => o, toWireType: (o, w) => w, ga: 8, readValueFromPointer: Lg(B, i), fa: null });
1954
1986
  },
1955
1987
  h: (C, B, i, o, w, s, y) => {
1956
1988
  var K = qI(B, i);
1957
- C = r(C), C = lI(C), w = Z(o, w), $A(C, function() {
1989
+ C = H(C), C = lI(C), w = Z(o, w), $A(C, function() {
1958
1990
  gI(`Cannot call ${C} due to unbound types`, K);
1959
- }, B - 1), yA([], K, (t) => (t = [t[0], null].concat(t.slice(1)), LI(C, rI(C, t, null, w, s, y), B - 1), []));
1991
+ }, B - 1), yA([], K, (R) => (R = [R[0], null].concat(R.slice(1)), LI(C, HI(C, R, null, w, s, y), B - 1), []));
1960
1992
  },
1961
1993
  p: (C, B, i, o, w) => {
1962
- B = r(B);
1994
+ B = H(B);
1963
1995
  let s = (K) => K;
1964
1996
  if (o === 0) {
1965
1997
  var y = 32 - 8 * i;
1966
1998
  s = (K) => K << y >>> y, w = s(w);
1967
1999
  }
1968
- b(C, { name: B, fromWireType: s, toWireType: (K, t) => t, ga: 8, readValueFromPointer: kI(B, i, o !== 0), fa: null });
2000
+ b(C, { name: B, fromWireType: s, toWireType: (K, R) => R, ga: 8, readValueFromPointer: kI(B, i, o !== 0), fa: null });
1969
2001
  },
1970
2002
  f: (C, B, i) => {
1971
2003
  function o(s) {
1972
- return new w(IA.buffer, H[s + 4 >> 2], H[s >> 2]);
2004
+ return new w(IA.buffer, r[s + 4 >> 2], r[s >> 2]);
1973
2005
  }
1974
2006
  var w = [
1975
2007
  Int8Array,
@@ -1983,13 +2015,13 @@ return ret;
1983
2015
  BigInt64Array,
1984
2016
  BigUint64Array
1985
2017
  ][B];
1986
- i = r(i), b(C, { name: i, fromWireType: o, ga: 8, readValueFromPointer: o }, { Ga: !0 });
2018
+ i = H(i), b(C, { name: i, fromWireType: o, ga: 8, readValueFromPointer: o }, { Ga: !0 });
1987
2019
  },
1988
2020
  J: (C, B) => {
1989
- B = r(B), b(C, { name: B, fromWireType: function(i) {
1990
- for (var o = H[i >> 2], w = i + 4, s, y = w, K = 0; K <= o; ++K) {
1991
- var t = w + K;
1992
- (K == o || p[t] == 0) && (y = y ? hA(y, t - y) : "", s === void 0 ? s = y : (s += "\0", s += y), y = t + 1);
2021
+ B = H(B), b(C, { name: B, fromWireType: function(i) {
2022
+ for (var o = r[i >> 2], w = i + 4, s, y = w, K = 0; K <= o; ++K) {
2023
+ var R = w + K;
2024
+ (K == o || p[R] == 0) && (y = y ? hA(y, R - y) : "", s === void 0 ? s = y : (s += "\0", s += y), y = R + 1);
1993
2025
  }
1994
2026
  return EA(i), s;
1995
2027
  }, toWireType: function(i, o) {
@@ -1997,41 +2029,41 @@ return ret;
1997
2029
  var w = typeof o == "string";
1998
2030
  if (!(w || ArrayBuffer.isView(o) && o.BYTES_PER_ELEMENT == 1)) throw new N("Cannot pass non-string to std::string");
1999
2031
  var s = w ? fI(o) : o.length, y = WI(4 + s + 1), K = y + 4;
2000
- return H[y >> 2] = s, w ? SA(o, K, s + 1) : p.set(o, K), i !== null && i.push(EA, y), y;
2032
+ return r[y >> 2] = s, w ? SA(o, K, s + 1) : p.set(o, K), i !== null && i.push(EA, y), y;
2001
2033
  }, ga: 8, readValueFromPointer: aA, fa(i) {
2002
2034
  EA(i);
2003
2035
  } });
2004
2036
  },
2005
2037
  s: (C, B, i) => {
2006
- if (i = r(i), B === 2)
2038
+ if (i = H(i), B === 2)
2007
2039
  var o = eg, w = Yg, s = ng, y = (K) => z[K >> 1];
2008
- else B === 4 && (o = Hg, w = rg, s = qg, y = (K) => H[K >> 2]);
2040
+ else B === 4 && (o = rg, w = Hg, s = qg, y = (K) => r[K >> 2]);
2009
2041
  b(C, { name: i, fromWireType: (K) => {
2010
- for (var t = H[K >> 2], G, R = K + 4, J = 0; J <= t; ++J) {
2042
+ for (var R = r[K >> 2], t, G = K + 4, J = 0; J <= R; ++J) {
2011
2043
  var e = K + 4 + J * B;
2012
- (J == t || y(e) == 0) && (R = o(R, e - R), G === void 0 ? G = R : (G += "\0", G += R), R = e + B);
2044
+ (J == R || y(e) == 0) && (G = o(G, e - G), t === void 0 ? t = G : (t += "\0", t += G), G = e + B);
2013
2045
  }
2014
- return EA(K), G;
2015
- }, toWireType: (K, t) => {
2016
- if (typeof t != "string") throw new N(`Cannot pass non-string to C++ string type ${i}`);
2017
- var G = s(t), R = WI(4 + G + B);
2018
- return H[R >> 2] = G / B, w(t, R + 4, G + B), K !== null && K.push(EA, R), R;
2046
+ return EA(K), t;
2047
+ }, toWireType: (K, R) => {
2048
+ if (typeof R != "string") throw new N(`Cannot pass non-string to C++ string type ${i}`);
2049
+ var t = s(R), G = WI(4 + t + B);
2050
+ return r[G >> 2] = t / B, w(R, G + 4, t + B), K !== null && K.push(EA, G), G;
2019
2051
  }, ga: 8, readValueFromPointer: aA, fa(K) {
2020
2052
  EA(K);
2021
2053
  } });
2022
2054
  },
2023
2055
  u: (C, B, i, o, w, s) => {
2024
- UA[C] = { name: r(B), sa: Z(i, o), ia: Z(w, s), wa: [] };
2056
+ UA[C] = { name: H(B), sa: Z(i, o), ia: Z(w, s), wa: [] };
2025
2057
  },
2026
- i: (C, B, i, o, w, s, y, K, t, G) => {
2027
- UA[C].wa.push({ Aa: r(B), Fa: i, Da: Z(o, w), Ea: s, Ma: y, La: Z(K, t), Na: G });
2058
+ i: (C, B, i, o, w, s, y, K, R, t) => {
2059
+ UA[C].wa.push({ Aa: H(B), Fa: i, Da: Z(o, w), Ea: s, Ma: y, La: Z(K, R), Na: t });
2028
2060
  },
2029
2061
  L: (C, B) => {
2030
- B = r(B), b(C, { Ha: !0, name: B, ga: 0, fromWireType: () => {
2062
+ B = H(B), b(C, { Ha: !0, name: B, ga: 0, fromWireType: () => {
2031
2063
  }, toWireType: () => {
2032
2064
  } });
2033
2065
  },
2034
- l: (C, B, i) => (C = O(C), B = rA(B, "emval::as"), OI(B, i, C)),
2066
+ l: (C, B, i) => (C = O(C), B = HA(B, "emval::as"), OI(B, i, C)),
2035
2067
  q: (C, B, i, o) => (C = qA[C], B = O(B), C(null, B, i, o)),
2036
2068
  n: (C, B, i, o, w) => (C = qA[C], B = O(B), i = lA(i), C(B, B[i], o, w)),
2037
2069
  a: CI,
@@ -2043,12 +2075,12 @@ return ret;
2043
2075
  var w = `return function (obj, func, destructorsRef, args) {
2044
2076
  `, s = 0, y = [];
2045
2077
  i === 0 && y.push("obj");
2046
- for (var K = ["retType"], t = [o], G = 0; G < C; ++G) y.push(`arg${G}`), K.push(`argType${G}`), t.push(B[G]), w += ` var arg${G} = argType${G}.readValueFromPointer(args${s ? "+" + s : ""});
2047
- `, s += B[G].ga;
2078
+ for (var K = ["retType"], R = [o], t = 0; t < C; ++t) y.push(`arg${t}`), K.push(`argType${t}`), R.push(B[t]), w += ` var arg${t} = argType${t}.readValueFromPointer(args${s ? "+" + s : ""});
2079
+ `, s += B[t].ga;
2048
2080
  return w += ` var rv = ${i === 1 ? "new func" : "func.call"}(${y.join(", ")});
2049
- `, o.Ha || (K.push("emval_returnValue"), t.push(OI), w += ` return emval_returnValue(retType, destructorsRef, rv);
2081
+ `, o.Ha || (K.push("emval_returnValue"), R.push(OI), w += ` return emval_returnValue(retType, destructorsRef, rv);
2050
2082
  `), C = new Function(...K, w + `};
2051
- `)(...t), i = `methodCaller<(${B.map((R) => R.name).join(", ")}) => ${o.name}>`, dg(YA(i, C));
2083
+ `)(...R), i = `methodCaller<(${B.map((G) => G.name).join(", ")}) => ${o.name}>`, dg(YA(i, C));
2052
2084
  },
2053
2085
  A: (C) => (C = lA(C), m(g[C])),
2054
2086
  g: (C, B) => (C = O(C), B = O(B), m(C[B])),
@@ -2066,10 +2098,10 @@ return ret;
2066
2098
  r: (C, B, i) => {
2067
2099
  C = O(C), B = O(B), i = O(i), C[B] = i;
2068
2100
  },
2069
- j: (C, B) => (C = rA(C, "_emval_take_value"), C = C.readValueFromPointer(B), m(C)),
2101
+ j: (C, B) => (C = HA(C, "_emval_take_value"), C = C.readValueFromPointer(B), m(C)),
2070
2102
  C: (C, B, i, o) => {
2071
2103
  var w = (/* @__PURE__ */ new Date()).getFullYear(), s = new Date(w, 0, 1).getTimezoneOffset();
2072
- w = new Date(w, 6, 1).getTimezoneOffset(), H[C >> 2] = 60 * Math.max(s, w), gA[B >> 2] = +(s != w), B = (y) => {
2104
+ w = new Date(w, 6, 1).getTimezoneOffset(), r[C >> 2] = 60 * Math.max(s, w), gA[B >> 2] = +(s != w), B = (y) => {
2073
2105
  var K = Math.abs(y);
2074
2106
  return `UTC${0 <= y ? "-" : "+"}${String(Math.floor(K / 60)).padStart(2, "0")}${String(K % 60).padStart(2, "0")}`;
2075
2107
  }, C = B(s), B = B(w), w < s ? (SA(C, i, 17), SA(B, o, 17)) : (SA(C, o, 17), SA(B, i, 17));
@@ -2103,9 +2135,9 @@ return ret;
2103
2135
  try {
2104
2136
  const K = y + "/public-key";
2105
2137
  globalThis.ja("Fetching public key from: " + K);
2106
- const t = await fetch(K, { method: "GET", headers: { Accept: "text/plain;charset=UTF-8" } });
2107
- if (!t.ok) throw Error(`HTTP ${t.status}: ${t.statusText}`);
2108
- const G = await t.text(), R = globalThis.ta(G), J = await crypto.subtle.importKey("spki", R, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, !1, ["verify"]);
2138
+ const R = await fetch(K, { method: "GET", headers: { Accept: "text/plain;charset=UTF-8" } });
2139
+ if (!R.ok) throw Error(`HTTP ${R.status}: ${R.statusText}`);
2140
+ const t = await R.text(), G = globalThis.ta(t), J = await crypto.subtle.importKey("spki", G, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, !1, ["verify"]);
2109
2141
  globalThis.ja("Public key imported successfully");
2110
2142
  const e = new TextEncoder().encode(w), q = globalThis.ta(s), L = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", J, q, e);
2111
2143
  globalThis.ja("RSA verification result: " + L), g.ccall(
@@ -2158,15 +2190,15 @@ return ret;
2158
2190
  if (g.calledRun = !0, !FA) {
2159
2191
  if (T.P(), E(g), g.onRuntimeInitialized?.(), g.postRun) for (typeof g.postRun == "function" && (g.postRun = [g.postRun]); g.postRun.length; ) {
2160
2192
  var B = g.postRun.shift();
2161
- GI.push(B);
2193
+ tI.push(B);
2162
2194
  }
2163
- MI(GI);
2195
+ MI(tI);
2164
2196
  }
2165
2197
  }
2166
2198
  if (0 < CA) sA = BI;
2167
2199
  else {
2168
2200
  if (g.preRun) for (typeof g.preRun == "function" && (g.preRun = [g.preRun]); g.preRun.length; ) ag();
2169
- MI(RI), 0 < CA ? sA = BI : g.setStatus ? (g.setStatus("Running..."), setTimeout(() => {
2201
+ MI(GI), 0 < CA ? sA = BI : g.setStatus ? (g.setStatus("Running..."), setTimeout(() => {
2170
2202
  setTimeout(() => g.setStatus(""), 1), C();
2171
2203
  }, 1)) : C();
2172
2204
  }
@@ -4165,7 +4197,7 @@ window.SignatureDeviceConfigData = {
4165
4197
  }
4166
4198
  },
4167
4199
  STU430: {
4168
- delay: 4e3,
4200
+ delay: 5e3,
4169
4201
  images: {
4170
4202
  idle: "idle_stu430",
4171
4203
  signing: "signing_stu430"
@@ -4425,20 +4457,20 @@ window.SignatureDeviceImagesData = {
4425
4457
  }
4426
4458
  }
4427
4459
  };
4428
- var GB = Object.defineProperty, RB = Object.getOwnPropertyDescriptor, og = (Q) => {
4460
+ var tB = Object.defineProperty, GB = Object.getOwnPropertyDescriptor, og = (Q) => {
4429
4461
  throw TypeError(Q);
4430
4462
  }, SI = (Q, A, I, g) => {
4431
- for (var E = g > 1 ? void 0 : g ? RB(A, I) : A, D = Q.length - 1, S; D >= 0; D--)
4463
+ for (var E = g > 1 ? void 0 : g ? GB(A, I) : A, D = Q.length - 1, S; D >= 0; D--)
4432
4464
  (S = Q[D]) && (E = (g ? S(A, I, E) : S(E)) || E);
4433
- return g && E && GB(A, I, E), E;
4434
- }, Dg = (Q, A, I) => A.has(Q) || og("Cannot " + I), Y = (Q, A, I) => (Dg(Q, A, "read from private field"), I ? I.call(Q) : A.get(Q)), W = (Q, A, I) => A.has(Q) ? og("Cannot add the same private member more than once") : A instanceof WeakSet ? A.add(Q) : A.set(Q, I), U = (Q, A, I, g) => (Dg(Q, A, "write to private field"), A.set(Q, I), I), xA, OA, TA, jA, iA, WA, X, u, bA, _, tA, oI;
4465
+ return g && E && tB(A, I, E), E;
4466
+ }, Dg = (Q, A, I) => A.has(Q) || og("Cannot " + I), Y = (Q, A, I) => (Dg(Q, A, "read from private field"), I ? I.call(Q) : A.get(Q)), W = (Q, A, I) => A.has(Q) ? og("Cannot add the same private member more than once") : A instanceof WeakSet ? A.add(Q) : A.set(Q, I), U = (Q, A, I, g) => (Dg(Q, A, "write to private field"), A.set(Q, I), I), xA, OA, TA, jA, iA, WA, X, u, bA, _, RA, oI;
4435
4467
  let kA = class extends Wg {
4436
4468
  /**
4437
4469
  * Component constructor.
4438
4470
  * Initializes all sub-managers.
4439
4471
  */
4440
4472
  constructor() {
4441
- super(), this.config = {}, W(this, xA, h.INITIAL), W(this, OA, k.COMPONENT_INITIALIZED), W(this, TA, !1), W(this, jA, P.MOUSE), W(this, iA, null), W(this, WA, !1), W(this, X, !1), W(this, u, null), W(this, bA, !1), W(this, _, !1), W(this, tA, 0), W(this, oI, 16), this.canvasManager = null, this.mouseManager = null, this.webHIDAPI = navigator.hid, this.handleWindowResize = () => {
4473
+ super(), this.config = {}, W(this, xA, h.INITIAL), W(this, OA, k.COMPONENT_INITIALIZED), W(this, TA, !1), W(this, jA, P.MOUSE), W(this, iA, null), W(this, WA, !1), W(this, X, !1), W(this, u, null), W(this, bA, !1), W(this, _, !1), W(this, RA, 0), W(this, oI, 16), this.canvasManager = null, this.pointerManager = null, this.webHIDAPI = navigator.hid, this.handleWindowResize = () => {
4442
4474
  this.canvasManager?.configureCanvasForDPI();
4443
4475
  }, this.connect = async () => {
4444
4476
  await this.prepareForManualConnect(), !(await this.tryAuthorizedManualConnect() || this.stateManager.isError) && await this.tryInteractiveManualConnectFallback();
@@ -4505,7 +4537,7 @@ let kA = class extends Wg {
4505
4537
  */
4506
4538
  async firstUpdated() {
4507
4539
  if (this.canvasRef)
4508
- this.addWebHIDListeners(), this.initializeCanvasManager(), this.initializeMouseManager(), window.addEventListener("resize", this.handleWindowResize), this.canvasManager?.configureCanvasForDPI(), U(this, bA, !0);
4540
+ this.addWebHIDListeners(), this.initializeCanvasManager(), this.initializePointerManager(), window.addEventListener("resize", this.handleWindowResize), this.canvasManager?.configureCanvasForDPI(), U(this, bA, !0);
4509
4541
  else {
4510
4542
  this.stateManager.transitionTo(
4511
4543
  h.ERROR,
@@ -4601,7 +4633,7 @@ let kA = class extends Wg {
4601
4633
  * @returns void
4602
4634
  */
4603
4635
  resetDrawingState() {
4604
- this.canvasManager?.clear(), this.mouseManager?.resetSession(), this.stateManager.setDrawingStarted(!1);
4636
+ this.canvasManager?.clear(), this.pointerManager?.resetSession(), this.stateManager.setDrawingStarted(!1);
4605
4637
  }
4606
4638
  /**
4607
4639
  * Enables or disables browser pointer interaction on the drawing canvas.
@@ -4616,7 +4648,7 @@ let kA = class extends Wg {
4616
4648
  * @returns void
4617
4649
  */
4618
4650
  disconnectedCallback() {
4619
- super.disconnectedCallback(), window.removeEventListener("resize", this.handleWindowResize), this.removeWebHIDListeners(), this.stateManager.isConnected && this.disconnect(), this.stateManager.isConnected || this.mouseManager?.removeListeners();
4651
+ super.disconnectedCallback(), window.removeEventListener("resize", this.handleWindowResize), this.removeWebHIDListeners(), this.stateManager.isConnected && this.disconnect(), this.stateManager.isConnected || this.pointerManager?.removeListeners();
4620
4652
  }
4621
4653
  async prepareForManualConnect() {
4622
4654
  this.currentState === h.CONNECTED_MOUSE_FALLBACK && await this.disconnectForSeamlessSwitch(
@@ -4666,12 +4698,12 @@ let kA = class extends Wg {
4666
4698
  );
4667
4699
  }
4668
4700
  /**
4669
- * Initializes the MouseManager for mouse and touch fallback.
4701
+ * Initializes the PointerManager for pointer/touch fallback.
4670
4702
  * @private
4671
4703
  * @returns void
4672
4704
  */
4673
- initializeMouseManager() {
4674
- this.mouseManager = new wC(
4705
+ initializePointerManager() {
4706
+ this.pointerManager = new wC(
4675
4707
  this.canvasRef,
4676
4708
  (Q) => {
4677
4709
  this.stateManager.isBusy || this.stateManager.isError || (this.canvasManager?.drawSegment(Q), Q.inContact && !this.hasStartedDrawing && this.stateManager.setDrawingStarted(!0), this.dispatchPenEventThrottled(Q));
@@ -4684,11 +4716,11 @@ let kA = class extends Wg {
4684
4716
  */
4685
4717
  dispatchPenEventThrottled(Q) {
4686
4718
  if (!Q.inContact) {
4687
- this.dispatch(n.SIGN_PEN, Q), U(this, tA, 0);
4719
+ this.dispatch(n.SIGN_PEN, Q), U(this, RA, 0);
4688
4720
  return;
4689
4721
  }
4690
4722
  const A = performance.now();
4691
- A - Y(this, tA) < Y(this, oI) || (U(this, tA, A), this.dispatch(n.SIGN_PEN, Q));
4723
+ A - Y(this, RA) < Y(this, oI) || (U(this, RA, A), this.dispatch(n.SIGN_PEN, Q));
4692
4724
  }
4693
4725
  /**
4694
4726
  * Initializes the driver once a lease is provided via config.
@@ -4761,7 +4793,7 @@ let kA = class extends Wg {
4761
4793
  * Used for smooth mode switching (mouse <-> physical).
4762
4794
  */
4763
4795
  async disconnectForSeamlessSwitch(Q) {
4764
- this.stateManager.transitionTo(h.DISCONNECTING, Q), await this.connectionManager.disconnect(), this.resetDrawingState(), this.dispatch(n.SIGN_DISCONNECT);
4796
+ this.stateManager.transitionTo(h.DISCONNECTING, Q), await this.connectionManager.stopSigning(), await this.connectionManager.disconnect(), this.resetDrawingState(), this.dispatch(n.SIGN_DISCONNECT);
4765
4797
  }
4766
4798
  /**
4767
4799
  * Forces the component into mouse fallback mode without re-attempting physical reconnection.
@@ -4770,7 +4802,7 @@ let kA = class extends Wg {
4770
4802
  this.setDeviceStatusText(P.MOUSE), this.stateManager.transitionTo(
4771
4803
  h.CONNECTED_MOUSE_FALLBACK,
4772
4804
  k.TEXT_SIGN_WITH_MOUSE
4773
- ), this.mouseManager?.addListeners(), this.setCanvasPointerInputEnabled(!0);
4805
+ ), this.pointerManager?.addListeners(), this.setCanvasPointerInputEnabled(!0);
4774
4806
  }
4775
4807
  /**
4776
4808
  * Starts fallback signing without running device connect flow.
@@ -4954,7 +4986,7 @@ X = /* @__PURE__ */ new WeakMap();
4954
4986
  u = /* @__PURE__ */ new WeakMap();
4955
4987
  bA = /* @__PURE__ */ new WeakMap();
4956
4988
  _ = /* @__PURE__ */ new WeakMap();
4957
- tA = /* @__PURE__ */ new WeakMap();
4989
+ RA = /* @__PURE__ */ new WeakMap();
4958
4990
  oI = /* @__PURE__ */ new WeakMap();
4959
4991
  kA.styles = [jg(MB)];
4960
4992
  SI([