idmission-web-sdk 2.3.99 → 2.3.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('react-dom'), require('tus-js-client'), require('prop-types'), require('mediainfo.js'), require('react-dom/server')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom/client', 'platform', 'styled-components', 'react-dom', 'tus-js-client', 'prop-types', 'mediainfo.js', 'react-dom/server'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.ReactDOM, global.platform, global.styled, global.ReactDOM, global.tusJsClient, global.PropTypes, global.mediainfo_js, global.server));
5
- })(this, (function (exports, React, ReactDOM, platform, styled, reactDom, tusJsClient, require$$0, mediainfo_js, server) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('react-dom'), require('tus-js-client'), require('prop-types'), require('react-dom/server')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom/client', 'platform', 'styled-components', 'react-dom', 'tus-js-client', 'prop-types', 'react-dom/server'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.ReactDOM, global.platform, global.styled, global.ReactDOM, global.tusJsClient, global.PropTypes, global.server));
5
+ })(this, (function (exports, React, ReactDOM, platform, styled, reactDom, tusJsClient, require$$0, server) { 'use strict';
6
6
 
7
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
8
  function _interopNamespaceDefault(e) {
8
9
  var n = Object.create(null);
9
10
  if (e) {
@@ -211,7 +212,7 @@
211
212
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
213
  };
213
214
 
214
- var webSdkVersion = '2.3.99';
215
+ var webSdkVersion = '2.3.101';
215
216
 
216
217
  function getPlatform() {
217
218
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3615,9 +3616,9 @@
3615
3616
  }
3616
3617
  var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
3617
3618
 
3618
- function _createForOfIteratorHelperLoose$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3619
- function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
3620
- function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3619
+ function _createForOfIteratorHelperLoose$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3620
+ function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
3621
+ function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3621
3622
  var t = self;
3622
3623
  function e() {
3623
3624
  throw Error("Invalid UTF8");
@@ -5844,7 +5845,7 @@
5844
5845
  height: (_hn4 = hn(e, 4)) != null ? _hn4 : 0,
5845
5846
  angle: 0
5846
5847
  }), (_en2 = en$1(t, ws, 4)) != null && _en2.g().length) {
5847
- for (var _iterator = _createForOfIteratorHelperLoose$2(en$1(t, ws, 4).g()), _step; !(_step = _iterator()).done;) {
5848
+ for (var _iterator = _createForOfIteratorHelperLoose$3(en$1(t, ws, 4).g()), _step; !(_step = _iterator()).done;) {
5848
5849
  var _We, _We2, _We3, _un3;
5849
5850
  var _e16 = _step.value;
5850
5851
  i.keypoints.push({
@@ -5859,7 +5860,7 @@
5859
5860
  }
5860
5861
  function Qi(t) {
5861
5862
  var e = [];
5862
- for (var _iterator2 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step2; !(_step2 = _iterator2()).done;) {
5863
+ for (var _iterator2 = _createForOfIteratorHelperLoose$3(rn(t, Fs, 1)), _step2; !(_step2 = _iterator2()).done;) {
5863
5864
  var _fn2, _fn3, _fn4;
5864
5865
  var _n14 = _step2.value;
5865
5866
  e.push({
@@ -5872,7 +5873,7 @@
5872
5873
  }
5873
5874
  function to(t) {
5874
5875
  var e = [];
5875
- for (var _iterator3 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step3; !(_step3 = _iterator3()).done;) {
5876
+ for (var _iterator3 = _createForOfIteratorHelperLoose$3(rn(t, Ts, 1)), _step3; !(_step3 = _iterator3()).done;) {
5876
5877
  var _fn5, _fn6, _fn7;
5877
5878
  var _n15 = _step3.value;
5878
5879
  e.push({
@@ -6020,7 +6021,7 @@
6020
6021
  var r = new Uint32Array(e.length);
6021
6022
  for (var _n16 = 0; _n16 < e.length; _n16++) r[_n16] = t.i.stringToNewUTF8(e[_n16]);
6022
6023
  e = t.i._malloc(4 * r.length), t.i.HEAPU32.set(r, e >> 2), n(e);
6023
- for (var _iterator4 = _createForOfIteratorHelperLoose$2(r), _step4; !(_step4 = _iterator4()).done;) {
6024
+ for (var _iterator4 = _createForOfIteratorHelperLoose$3(r), _step4; !(_step4 = _iterator4()).done;) {
6024
6025
  var _e17 = _step4.value;
6025
6026
  t.i._free(_e17);
6026
6027
  }
@@ -6386,7 +6387,7 @@
6386
6387
  }
6387
6388
  t.push(n);
6388
6389
  };
6389
- for (var _iterator7 = _createForOfIteratorHelperLoose$2(this.g), _step7; !(_step7 = _iterator7()).done;) {
6390
+ for (var _iterator7 = _createForOfIteratorHelperLoose$3(this.g), _step7; !(_step7 = _iterator7()).done;) {
6390
6391
  _loop();
6391
6392
  }
6392
6393
  return new _Yo(t, this.ba(), this.K(), this.canvas, this.l, this.width, this.height);
@@ -6518,7 +6519,7 @@
6518
6519
  }
6519
6520
  t.push(n);
6520
6521
  };
6521
- for (var _iterator8 = _createForOfIteratorHelperLoose$2(this.g), _step8; !(_step8 = _iterator8()).done;) {
6522
+ for (var _iterator8 = _createForOfIteratorHelperLoose$3(this.g), _step8; !(_step8 = _iterator8()).done;) {
6522
6523
  _loop2();
6523
6524
  }
6524
6525
  return new _ia(t, this.K(), this.canvas, this.l, this.width, this.height);
@@ -6998,7 +6999,7 @@
6998
6999
  yn(e, si, this.h);
6999
7000
  var n = new qr();
7000
7001
  Hr(n, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect_in"), $r(n, "DETECTIONS:detections"), n.o(e), es$1(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
7001
- for (var _iterator9 = _createForOfIteratorHelperLoose$2(t), _step9; !(_step9 = _iterator9()).done;) {
7002
+ for (var _iterator9 = _createForOfIteratorHelperLoose$3(t), _step9; !(_step9 = _iterator9()).done;) {
7002
7003
  var _e23 = _step9.value;
7003
7004
  t = Es(_e23), _this43.j.detections.push(Zi(t));
7004
7005
  }
@@ -7092,7 +7093,7 @@
7092
7093
  yn(e, di, this.h);
7093
7094
  var n = new qr();
7094
7095
  Hr(n, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:face_landmarks"), n.o(e), es$1(t, n), this.g.attachProtoVectorListener("face_landmarks", function (t, e) {
7095
- for (var _iterator10 = _createForOfIteratorHelperLoose$2(t), _step10; !(_step10 = _iterator10()).done;) {
7096
+ for (var _iterator10 = _createForOfIteratorHelperLoose$3(t), _step10; !(_step10 = _iterator10()).done;) {
7096
7097
  var _e24 = _step10.value;
7097
7098
  t = Ms(_e24), _this45.j.faceLandmarks.push(Qi(t));
7098
7099
  }
@@ -7101,7 +7102,7 @@
7101
7102
  _o(_this45, t);
7102
7103
  }), this.outputFaceBlendshapes && (rs(t, "blendshapes"), $r(n, "BLENDSHAPES:blendshapes"), this.g.attachProtoVectorListener("blendshapes", function (t, e) {
7103
7104
  if (_this45.outputFaceBlendshapes) {
7104
- for (var _iterator11 = _createForOfIteratorHelperLoose$2(t), _step11; !(_step11 = _iterator11()).done;) {
7105
+ for (var _iterator11 = _createForOfIteratorHelperLoose$3(t), _step11; !(_step11 = _iterator11()).done;) {
7105
7106
  var _t$g;
7106
7107
  var _e25 = _step11.value;
7107
7108
  t = fs(_e25), _this45.j.faceBlendshapes.push(Ji((_t$g = t.g()) != null ? _t$g : []));
@@ -7112,7 +7113,7 @@
7112
7113
  _o(_this45, t);
7113
7114
  })), this.outputFacialTransformationMatrixes && (rs(t, "face_geometry"), $r(n, "FACE_GEOMETRY:face_geometry"), this.g.attachProtoVectorListener("face_geometry", function (t, e) {
7114
7115
  if (_this45.outputFacialTransformationMatrixes) {
7115
- for (var _iterator12 = _createForOfIteratorHelperLoose$2(t), _step12; !(_step12 = _iterator12()).done;) {
7116
+ for (var _iterator12 = _createForOfIteratorHelperLoose$3(t), _step12; !(_step12 = _iterator12()).done;) {
7116
7117
  var _ln2, _ln3, _He;
7117
7118
  var _e26 = _step12.value;
7118
7119
  (t = en$1(ai(_e26), Ps, 2)) && _this45.j.facialTransformationMatrixes.push({
@@ -7243,11 +7244,11 @@
7243
7244
  e = !0;
7244
7245
  }
7245
7246
  var n = [];
7246
- for (var _iterator13 = _createForOfIteratorHelperLoose$2(t), _step13; !(_step13 = _iterator13()).done;) {
7247
+ for (var _iterator13 = _createForOfIteratorHelperLoose$3(t), _step13; !(_step13 = _iterator13()).done;) {
7247
7248
  var _s9 = _step13.value;
7248
7249
  var r = fs(_s9);
7249
7250
  t = [];
7250
- for (var _iterator14 = _createForOfIteratorHelperLoose$2(r.g()), _step14; !(_step14 = _iterator14()).done;) {
7251
+ for (var _iterator14 = _createForOfIteratorHelperLoose$3(r.g()), _step14; !(_step14 = _iterator14()).done;) {
7251
7252
  var _fn8, _ref9, _un4, _ref10, _un5;
7252
7253
  var _n24 = _step14.value;
7253
7254
  r = e && null != hn(_n24, 1) ? ln(hn(_n24, 1)) : -1, t.push({
@@ -7293,11 +7294,11 @@
7293
7294
  yn(e, Oi, this.v);
7294
7295
  var n = new qr();
7295
7296
  Hr(n, "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "HAND_GESTURES:hand_gestures"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es$1(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
7296
- for (var _iterator15 = _createForOfIteratorHelperLoose$2(t), _step15; !(_step15 = _iterator15()).done;) {
7297
+ for (var _iterator15 = _createForOfIteratorHelperLoose$3(t), _step15; !(_step15 = _iterator15()).done;) {
7297
7298
  var _e28 = _step15.value;
7298
7299
  t = Ms(_e28);
7299
7300
  var _n25 = [];
7300
- for (var _iterator16 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step16; !(_step16 = _iterator16()).done;) {
7301
+ for (var _iterator16 = _createForOfIteratorHelperLoose$3(rn(t, Fs, 1)), _step16; !(_step16 = _iterator16()).done;) {
7301
7302
  var _fn9, _fn10, _fn11;
7302
7303
  var _e29 = _step16.value;
7303
7304
  _n25.push({
@@ -7312,11 +7313,11 @@
7312
7313
  }), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
7313
7314
  _o(_this49, t);
7314
7315
  }), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
7315
- for (var _iterator17 = _createForOfIteratorHelperLoose$2(t), _step17; !(_step17 = _iterator17()).done;) {
7316
+ for (var _iterator17 = _createForOfIteratorHelperLoose$3(t), _step17; !(_step17 = _iterator17()).done;) {
7316
7317
  var _e30 = _step17.value;
7317
7318
  t = Ls(_e30);
7318
7319
  var _n26 = [];
7319
- for (var _iterator18 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step18; !(_step18 = _iterator18()).done;) {
7320
+ for (var _iterator18 = _createForOfIteratorHelperLoose$3(rn(t, Ts, 1)), _step18; !(_step18 = _iterator18()).done;) {
7320
7321
  var _fn12, _fn13, _fn14;
7321
7322
  var _e31 = _step18.value;
7322
7323
  _n26.push({
@@ -7401,7 +7402,7 @@
7401
7402
  yn(e, Si, this.j);
7402
7403
  var n = new qr();
7403
7404
  Hr(n, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es$1(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
7404
- for (var _iterator19 = _createForOfIteratorHelperLoose$2(t), _step19; !(_step19 = _iterator19()).done;) {
7405
+ for (var _iterator19 = _createForOfIteratorHelperLoose$3(t), _step19; !(_step19 = _iterator19()).done;) {
7405
7406
  var _e32 = _step19.value;
7406
7407
  t = Ms(_e32), _this51.landmarks.push(Qi(t));
7407
7408
  }
@@ -7409,7 +7410,7 @@
7409
7410
  }), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
7410
7411
  _o(_this51, t);
7411
7412
  }), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
7412
- for (var _iterator20 = _createForOfIteratorHelperLoose$2(t), _step20; !(_step20 = _iterator20()).done;) {
7413
+ for (var _iterator20 = _createForOfIteratorHelperLoose$3(t), _step20; !(_step20 = _iterator20()).done;) {
7413
7414
  var _e33 = _step20.value;
7414
7415
  t = Ls(_e33), _this51.worldLandmarks.push(to(t));
7415
7416
  }
@@ -7420,11 +7421,11 @@
7420
7421
  var n = _this51.handedness,
7421
7422
  r = n.push;
7422
7423
  var s = [];
7423
- for (var _iterator21 = _createForOfIteratorHelperLoose$2(t), _step21; !(_step21 = _iterator21()).done;) {
7424
+ for (var _iterator21 = _createForOfIteratorHelperLoose$3(t), _step21; !(_step21 = _iterator21()).done;) {
7424
7425
  var _e34 = _step21.value;
7425
7426
  t = fs(_e34);
7426
7427
  var _n27 = [];
7427
- for (var _iterator22 = _createForOfIteratorHelperLoose$2(t.g()), _step22; !(_step22 = _iterator22()).done;) {
7428
+ for (var _iterator22 = _createForOfIteratorHelperLoose$3(t.g()), _step22; !(_step22 = _iterator22()).done;) {
7428
7429
  var _fn15, _ln4, _ref11, _un6, _ref12, _un7;
7429
7430
  var _e35 = _step22.value;
7430
7431
  _n27.push({
@@ -7816,7 +7817,7 @@
7816
7817
  dn(a, 3, !0), gn(a, 1, e.keypoint.x), gn(a, 2, e.keypoint.y), on(i, 5, oh, a);
7817
7818
  } else {
7818
7819
  if (!e.scribble) throw Error("Must provide either a keypoint or a scribble.");
7819
- for (var _iterator23 = _createForOfIteratorHelperLoose$2((o = new sh(), e.scribble)), _step23; !(_step23 = _iterator23()).done;) {
7820
+ for (var _iterator23 = _createForOfIteratorHelperLoose$3((o = new sh(), e.scribble)), _step23; !(_step23 = _iterator23()).done;) {
7820
7821
  a = _step23.value;
7821
7822
  dn(e = new nh(), 3, !0), gn(e, 1, a.x), gn(e, 2, a.y), an(o, nh, e);
7822
7823
  }
@@ -7917,7 +7918,7 @@
7917
7918
  yn(e, Vi, this.h);
7918
7919
  var n = new qr();
7919
7920
  Hr(n, "mediapipe.tasks.vision.ObjectDetectorGraph"), Yr(n, "IMAGE:input_frame_gpu"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "DETECTIONS:detections"), n.o(e), es$1(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
7920
- for (var _iterator24 = _createForOfIteratorHelperLoose$2(t), _step24; !(_step24 = _iterator24()).done;) {
7921
+ for (var _iterator24 = _createForOfIteratorHelperLoose$3(t), _step24; !(_step24 = _iterator24()).done;) {
7921
7922
  var _e37 = _step24.value;
7922
7923
  t = Es(_e37), _this61.j.detections.push(Zi(t));
7923
7924
  }
@@ -8017,7 +8018,7 @@
8017
8018
  var n = new qr();
8018
8019
  Hr(n, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:normalized_landmarks"), $r(n, "WORLD_LANDMARKS:world_landmarks"), n.o(e), es$1(t, n), wo(this, t), this.g.attachProtoVectorListener("normalized_landmarks", function (t, e) {
8019
8020
  _this63.landmarks = [];
8020
- for (var _iterator25 = _createForOfIteratorHelperLoose$2(t), _step25; !(_step25 = _iterator25()).done;) {
8021
+ for (var _iterator25 = _createForOfIteratorHelperLoose$3(t), _step25; !(_step25 = _iterator25()).done;) {
8021
8022
  var _e39 = _step25.value;
8022
8023
  t = Ms(_e39), _this63.landmarks.push(Qi(t));
8023
8024
  }
@@ -8026,7 +8027,7 @@
8026
8027
  _this63.landmarks = [], _o(_this63, t);
8027
8028
  }), this.g.attachProtoVectorListener("world_landmarks", function (t, e) {
8028
8029
  _this63.worldLandmarks = [];
8029
- for (var _iterator26 = _createForOfIteratorHelperLoose$2(t), _step26; !(_step26 = _iterator26()).done;) {
8030
+ for (var _iterator26 = _createForOfIteratorHelperLoose$3(t), _step26; !(_step26 = _iterator26()).done;) {
8030
8031
  var _e40 = _step26.value;
8031
8032
  t = Ls(_e40), _this63.worldLandmarks.push(to(t));
8032
8033
  }
@@ -9504,9 +9505,9 @@
9504
9505
  return e;
9505
9506
  }
9506
9507
 
9507
- function _createForOfIteratorHelperLoose$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9508
- function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
9509
- function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9508
+ function _createForOfIteratorHelperLoose$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9509
+ function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
9510
+ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9510
9511
  var consoleLogger = {
9511
9512
  type: 'logger',
9512
9513
  log: function log(args) {
@@ -10353,7 +10354,7 @@
10353
10354
  }
10354
10355
  if (!useOptionsReplaceForData) {
10355
10356
  data = _extends({}, data);
10356
- for (var _iterator = _createForOfIteratorHelperLoose$1(optionsKeys), _step; !(_step = _iterator()).done;) {
10357
+ for (var _iterator = _createForOfIteratorHelperLoose$2(optionsKeys), _step; !(_step = _iterator()).done;) {
10357
10358
  var key = _step.value;
10358
10359
  delete data[key];
10359
10360
  }
@@ -14945,7 +14946,7 @@
14945
14946
  });
14946
14947
  }
14947
14948
 
14948
- var _excluded = ["enabled", "anonymousActionType", "store"],
14949
+ var _excluded$1 = ["enabled", "anonymousActionType", "store"],
14949
14950
  _excluded2 = ["connection"];
14950
14951
  var trackedConnections = /* @__PURE__ */new Map();
14951
14952
  var getTrackedConnectionState = function getTrackedConnectionState(name) {
@@ -14990,7 +14991,7 @@
14990
14991
  enabled = _devtoolsOptions.enabled,
14991
14992
  anonymousActionType = _devtoolsOptions.anonymousActionType,
14992
14993
  store = _devtoolsOptions.store,
14993
- options = _objectWithoutPropertiesLoose(_devtoolsOptions, _excluded);
14994
+ options = _objectWithoutPropertiesLoose(_devtoolsOptions, _excluded$1);
14994
14995
  var extensionConnector;
14995
14996
  try {
14996
14997
  extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
@@ -15151,9 +15152,9 @@
15151
15152
  if (parsed !== void 0) f(parsed);
15152
15153
  };
15153
15154
 
15154
- function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15155
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15156
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15155
+ function _createForOfIteratorHelperLoose$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15156
+ function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
15157
+ function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15157
15158
  var isIterable = function isIterable(obj) {
15158
15159
  return Symbol.iterator in obj;
15159
15160
  };
@@ -15169,7 +15170,7 @@
15169
15170
  if (mapA.size !== mapB.size) {
15170
15171
  return false;
15171
15172
  }
15172
- for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
15173
+ for (var _iterator = _createForOfIteratorHelperLoose$1(mapA), _step; !(_step = _iterator()).done;) {
15173
15174
  var _step$value = _step.value,
15174
15175
  key = _step$value[0],
15175
15176
  value = _step$value[1];
@@ -24200,23 +24201,10 @@
24200
24201
  return t.length > 0 ? t : undefined;
24201
24202
  }
24202
24203
 
24203
- function makeReadChunk(file) {
24204
- var _this = this;
24205
- return function (chunkSize, offset) {
24206
- return __awaiter(_this, void 0, void 0, function () {
24207
- var _a;
24208
- return __generator(this, function (_b) {
24209
- switch (_b.label) {
24210
- case 0:
24211
- _a = Uint8Array.bind;
24212
- return [4 /*yield*/, file.slice(offset, offset + chunkSize).arrayBuffer()];
24213
- case 1:
24214
- return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _b.sent()]))()];
24215
- }
24216
- });
24217
- });
24218
- };
24219
- }
24204
+ // function makeReadChunk(file: File | Blob): ReadChunkFunc {
24205
+ // return async (chunkSize: number, offset: number) =>
24206
+ // new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer())
24207
+ // }
24220
24208
  var signatureRecorder = null;
24221
24209
  var signatureChunks = [];
24222
24210
  var videoSignatureInitialState = {
@@ -24297,42 +24285,39 @@
24297
24285
  signatureRecorder.stop();
24298
24286
  signatureRecorder.onstop = function () {
24299
24287
  return __awaiter(void 0, void 0, void 0, function () {
24300
- var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt, mediaInfo;
24301
- var _b;
24302
- return __generator(this, function (_c) {
24303
- switch (_c.label) {
24304
- case 0:
24305
- recordingStoppedAt = performance.now();
24306
- set({
24307
- recordingStoppedAt: recordingStoppedAt
24308
- });
24309
- inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
24310
- blob = new Blob(signatureChunks, {
24311
- type: inferredType
24312
- });
24313
- signatureChunks = [];
24314
- signatureRecorder = null;
24315
- if (!signatureData) return [2 /*return*/];
24316
- _a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
24317
- return [4 /*yield*/, (_b = get().mediaInfo) === null || _b === void 0 ? void 0 : _b.analyzeData(blob.size, makeReadChunk(blob))];
24318
- case 1:
24319
- mediaInfo = _c.sent();
24320
- onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
24321
- mediaInfo: mediaInfo,
24322
- mimeType: inferredType,
24323
- timingData: {
24324
- recordingStartRequestedAt: recordingStartRequestedAt,
24325
- recordingStartedAt: recordingStartedAt,
24326
- firstChunkReceivedAt: firstChunkReceivedAt,
24327
- signatureStartedAt: signatureStartedAt,
24328
- signatureEndedAt: signatureEndedAt,
24329
- recordingStopRequestedAt: recordingStopRequestedAt,
24330
- recordingStoppedAt: recordingStoppedAt,
24331
- lastChunkReceivedAt: lastChunkReceivedAt
24332
- }
24333
- });
24334
- return [2 /*return*/];
24335
- }
24288
+ var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt;
24289
+ return __generator(this, function (_b) {
24290
+ recordingStoppedAt = performance.now();
24291
+ set({
24292
+ recordingStoppedAt: recordingStoppedAt
24293
+ });
24294
+ inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
24295
+ blob = new Blob(signatureChunks, {
24296
+ type: inferredType
24297
+ });
24298
+ signatureChunks = [];
24299
+ signatureRecorder = null;
24300
+ if (!signatureData) return [2 /*return*/];
24301
+ _a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
24302
+ // const mediaInfo = await get().mediaInfo?.analyzeData(
24303
+ // blob.size,
24304
+ // makeReadChunk(blob),
24305
+ // )
24306
+ onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
24307
+ // mediaInfo,
24308
+ mimeType: inferredType,
24309
+ timingData: {
24310
+ recordingStartRequestedAt: recordingStartRequestedAt,
24311
+ recordingStartedAt: recordingStartedAt,
24312
+ firstChunkReceivedAt: firstChunkReceivedAt,
24313
+ signatureStartedAt: signatureStartedAt,
24314
+ signatureEndedAt: signatureEndedAt,
24315
+ recordingStopRequestedAt: recordingStopRequestedAt,
24316
+ recordingStoppedAt: recordingStoppedAt,
24317
+ lastChunkReceivedAt: lastChunkReceivedAt
24318
+ }
24319
+ });
24320
+ return [2 /*return*/];
24336
24321
  });
24337
24322
  });
24338
24323
  };
@@ -24396,27 +24381,50 @@
24396
24381
  var frameCheckCanvas = React.useRef(null);
24397
24382
  React.useEffect(function () {
24398
24383
  if (!captureMediaInfo) return;
24399
- mediainfo_js.mediaInfoFactory({
24400
- format: 'object',
24401
- full: true,
24402
- locateFile: function locateFile(filename) {
24403
- return "".concat(DEFAULT_CDN_URL, "/").concat(filename);
24404
- }
24405
- }).then(function (mediaInfo) {
24406
- useVideoSignatureStore.setState({
24407
- mediaInfo: mediaInfo
24384
+ // Use dynamic import to avoid build-time WASM loading issues
24385
+ var loadMediaInfo = function loadMediaInfo() {
24386
+ return __awaiter(_this, void 0, void 0, function () {
24387
+ var mediaInfoFactory, e_1;
24388
+ return __generator(this, function (_a) {
24389
+ switch (_a.label) {
24390
+ case 0:
24391
+ _a.trys.push([0, 3,, 4]);
24392
+ return [4 /*yield*/, Promise.resolve().then(function () { return index; })
24393
+ // const mediaInfo =
24394
+ ];
24395
+ case 1:
24396
+ mediaInfoFactory = _a.sent().mediaInfoFactory;
24397
+ // const mediaInfo =
24398
+ return [4 /*yield*/, mediaInfoFactory({
24399
+ format: 'object',
24400
+ full: true,
24401
+ locateFile: function locateFile(filename) {
24402
+ return "".concat(DEFAULT_CDN_URL, "/").concat(filename);
24403
+ }
24404
+ })
24405
+ // useVideoSignatureStore.setState({ mediaInfo })
24406
+ ];
24407
+ case 2:
24408
+ // const mediaInfo =
24409
+ _a.sent();
24410
+ return [3 /*break*/, 4];
24411
+ case 3:
24412
+ e_1 = _a.sent();
24413
+ warn('error loading mediaInfo', e_1);
24414
+ return [3 /*break*/, 4];
24415
+ case 4:
24416
+ return [2 /*return*/];
24417
+ }
24418
+ });
24408
24419
  });
24409
- })["catch"](function (e) {
24410
- warn('error loading mediaInfo', e);
24411
- });
24420
+ };
24421
+ loadMediaInfo();
24412
24422
  return function () {
24413
- var mediaInfo = useVideoSignatureStore.getState().mediaInfo;
24414
- if (mediaInfo) {
24415
- mediaInfo.close();
24416
- useVideoSignatureStore.setState({
24417
- mediaInfo: undefined
24418
- });
24419
- }
24423
+ // const mediaInfo = useVideoSignatureStore.getState().mediaInfo
24424
+ // if (mediaInfo) {
24425
+ // mediaInfo.close()
24426
+ // useVideoSignatureStore.setState({ mediaInfo: undefined })
24427
+ // }
24420
24428
  };
24421
24429
  }, [captureMediaInfo]);
24422
24430
  var signaturePadEmpty = useVideoSignatureStore().signaturePadEmpty;
@@ -29370,6 +29378,8 @@
29370
29378
  documentServiceUrl = _a.documentServiceUrl,
29371
29379
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
29372
29380
  useDocumentServiceForLivenessChecks = _a.useDocumentServiceForLivenessChecks,
29381
+ _c = _a.captureMediaInfo,
29382
+ captureMediaInfo = _c === void 0 ? false : _c,
29373
29383
  onLoadingStarted = _a.onLoadingStarted,
29374
29384
  onLoadingProgress = _a.onLoadingProgress,
29375
29385
  onLoadingCompleted = _a.onLoadingCompleted,
@@ -29389,48 +29399,48 @@
29389
29399
  onCameraAccessDenied = _a.onCameraAccessDenied,
29390
29400
  onCameraTamperingDetected = _a.onCameraTamperingDetected,
29391
29401
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
29392
- _c = _a.loadingOverlayMode,
29393
- loadingOverlayMode = _c === void 0 ? 'default' : _c,
29402
+ _d = _a.loadingOverlayMode,
29403
+ loadingOverlayMode = _d === void 0 ? 'default' : _d,
29394
29404
  customOverlayContent = _a.customOverlayContent,
29395
- _d = _a.skipSuccessScreen,
29396
- skipSuccessScreen = _d === void 0 ? false : _d,
29397
- _e = _a.captureAudio,
29398
- captureAudio = _e === void 0 ? false : _e,
29405
+ _e = _a.skipSuccessScreen,
29406
+ skipSuccessScreen = _e === void 0 ? false : _e,
29407
+ _f = _a.captureAudio,
29408
+ captureAudio = _f === void 0 ? false : _f,
29399
29409
  idCardForFaceMatch = _a.idCardForFaceMatch,
29400
- _f = _a.minSignaturePadPoints,
29401
- minSignaturePadPoints = _f === void 0 ? DEFAULT_MIN_SIGNATURE_PAD_POINTS : _f,
29402
- _g = _a.headTrackingDisabled,
29403
- headTrackingDisabled = _g === void 0 ? false : _g,
29404
- _h = _a.headTrackingBoundaryPercentage,
29405
- headTrackingBoundaryPercentage = _h === void 0 ? DEFAULT_HEAD_TRACKING_BOUNDARY_PERCENTAGE : _h,
29406
- _j = _a.headTrackingBoundaryType,
29407
- headTrackingBoundaryType = _j === void 0 ? DEFAULT_HEAD_TRACKING_BOUNDARY_TYPE : _j,
29408
- _k = _a.modelLoadTimeoutMs,
29409
- modelLoadTimeoutMs = _k === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _k,
29410
- _l = _a.allowSignatureAfterLivenessCheckFailure,
29411
- allowSignatureAfterLivenessCheckFailure = _l === void 0 ? false : _l,
29412
- _m = _a.restartVideoOnSignaturePadCleared,
29413
- restartVideoOnSignaturePadCleared = _m === void 0 ? true : _m,
29410
+ _g = _a.minSignaturePadPoints,
29411
+ minSignaturePadPoints = _g === void 0 ? DEFAULT_MIN_SIGNATURE_PAD_POINTS : _g,
29412
+ _h = _a.headTrackingDisabled,
29413
+ headTrackingDisabled = _h === void 0 ? false : _h,
29414
+ _j = _a.headTrackingBoundaryPercentage,
29415
+ headTrackingBoundaryPercentage = _j === void 0 ? DEFAULT_HEAD_TRACKING_BOUNDARY_PERCENTAGE : _j,
29416
+ _k = _a.headTrackingBoundaryType,
29417
+ headTrackingBoundaryType = _k === void 0 ? DEFAULT_HEAD_TRACKING_BOUNDARY_TYPE : _k,
29418
+ _l = _a.modelLoadTimeoutMs,
29419
+ modelLoadTimeoutMs = _l === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _l,
29420
+ _m = _a.allowSignatureAfterLivenessCheckFailure,
29421
+ allowSignatureAfterLivenessCheckFailure = _m === void 0 ? false : _m,
29422
+ _o = _a.restartVideoOnSignaturePadCleared,
29423
+ restartVideoOnSignaturePadCleared = _o === void 0 ? true : _o,
29414
29424
  faceLivenessProps = _a.faceLivenessProps,
29415
- _o = _a.skipLivenessValidation,
29416
- skipLivenessValidation = _o === void 0 ? false : _o,
29417
- _p = _a.allowManualSelfieCaptureOnLoadingError,
29418
- allowManualSelfieCaptureOnLoadingError = _p === void 0 ? false : _p,
29425
+ _p = _a.skipLivenessValidation,
29426
+ skipLivenessValidation = _p === void 0 ? false : _p,
29427
+ _q = _a.allowManualSelfieCaptureOnLoadingError,
29428
+ allowManualSelfieCaptureOnLoadingError = _q === void 0 ? false : _q,
29419
29429
  guidesComponent = _a.guidesComponent,
29420
- _q = _a.showFaceGuideThenSignaturePad,
29421
- showFaceGuideThenSignaturePad = _q === void 0 ? false : _q,
29430
+ _r = _a.showFaceGuideThenSignaturePad,
29431
+ showFaceGuideThenSignaturePad = _r === void 0 ? false : _r,
29422
29432
  minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
29423
29433
  minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
29424
29434
  minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold,
29425
- _r = _a.theme,
29426
- theme = _r === void 0 ? 'default' : _r,
29435
+ _s = _a.theme,
29436
+ theme = _s === void 0 ? 'default' : _s,
29427
29437
  classNames = _a.classNames,
29428
29438
  colors = _a.colors,
29429
29439
  verbiage = _a.verbiage,
29430
29440
  geolocationEnabled = _a.geolocationEnabled,
29431
29441
  geolocationRequired = _a.geolocationRequired,
29432
- _s = _a.debugMode,
29433
- debugMode = _s === void 0 ? false : _s;
29442
+ _t = _a.debugMode,
29443
+ debugMode = _t === void 0 ? false : _t;
29434
29444
  useLanguage(lang);
29435
29445
  useDebugLogging(debugMode);
29436
29446
  return /*#__PURE__*/React.createElement(AuthProvider, {
@@ -29480,6 +29490,7 @@
29480
29490
  loadingOverlayMode: loadingOverlayMode,
29481
29491
  skipSuccessScreen: skipSuccessScreen,
29482
29492
  captureAudio: captureAudio,
29493
+ captureMediaInfo: captureMediaInfo,
29483
29494
  minSignaturePadPoints: minSignaturePadPoints,
29484
29495
  headTrackingDisabled: headTrackingDisabled,
29485
29496
  headTrackingBoundaryPercentage: headTrackingBoundaryPercentage,
@@ -29502,7 +29513,7 @@
29502
29513
  onModelError: onModelError,
29503
29514
  onUserCancel: onUserCancel
29504
29515
  };
29505
- }, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onSelfieCaptured, customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, minSignaturePadPoints, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, restartVideoOnSignaturePadCleared, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, guidesComponent, showFaceGuideThenSignaturePad, minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
29516
+ }, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onSelfieCaptured, customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, captureMediaInfo, minSignaturePadPoints, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, restartVideoOnSignaturePadCleared, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, guidesComponent, showFaceGuideThenSignaturePad, minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
29506
29517
  })))));
29507
29518
  };
29508
29519
 
@@ -30576,6 +30587,2724 @@
30576
30587
  stopAll: stopAll
30577
30588
  });
30578
30589
 
30590
+ var _excluded = ["locateFile"];
30591
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
30592
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
30593
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
30594
+ function isError(error) {
30595
+ return error !== null && typeof error === 'object' && Object.prototype.hasOwnProperty.call(error, 'message');
30596
+ }
30597
+ function unknownToError(error) {
30598
+ if (isError(error)) {
30599
+ return error;
30600
+ }
30601
+ return new Error(typeof error === 'string' ? error : 'Unknown error');
30602
+ }
30603
+
30604
+ // DO NOT EDIT! File generated using `generate-types` script.
30605
+
30606
+ var INT_FIELDS = ['Active_Height', 'Active_Width', 'AudioCount', 'Audio_Channels_Total', 'BitDepth_Detected', 'BitDepth', 'BitDepth_Stored', 'Channels', 'Channels_Original', 'Chapters_Pos_Begin', 'Chapters_Pos_End', 'Comic_Position_Total', 'Count', 'DataSize', 'ElementCount', 'EPG_Positions_Begin', 'EPG_Positions_End', 'FirstPacketOrder', 'FooterSize', 'Format_Settings_GMC', 'Format_Settings_RefFrames', 'Format_Settings_SliceCount', 'FrameCount', 'FrameRate_Den', 'FrameRate_Num', 'GeneralCount', 'HeaderSize', 'Height_CleanAperture', 'Height', 'Height_Offset', 'Height_Original', 'ImageCount', 'Lines_MaxCharacterCount', 'Lines_MaxCountPerEvent', 'Matrix_Channels', 'MenuCount', 'OtherCount', 'Part_Position', 'Part_Position_Total', 'Played_Count', 'Reel_Position', 'Reel_Position_Total', 'Resolution', 'Sampled_Height', 'Sampled_Width', 'SamplingCount', 'Season_Position', 'Season_Position_Total', 'Source_FrameCount', 'Source_SamplingCount', 'Source_StreamSize_Encoded', 'Source_StreamSize', 'Status', 'Stored_Height', 'Stored_Width', 'StreamCount', 'StreamKindID', 'StreamKindPos', 'StreamSize_Demuxed', 'StreamSize_Encoded', 'StreamSize', 'TextCount', 'Track_Position', 'Track_Position_Total', 'Video0_Delay', 'VideoCount', 'Width_CleanAperture', 'Width', 'Width_Offset', 'Width_Original'];
30607
+ var FLOAT_FIELDS = ['Active_DisplayAspectRatio', 'BitRate_Encoded', 'BitRate_Maximum', 'BitRate_Minimum', 'BitRate', 'BitRate_Nominal', 'Bits-Pixel_Frame', 'BitsPixel_Frame', 'Compression_Ratio', 'Delay', 'Delay_Original', 'DisplayAspectRatio_CleanAperture', 'DisplayAspectRatio', 'DisplayAspectRatio_Original', 'Duration_End_Command', 'Duration_End', 'Duration_FirstFrame', 'Duration_LastFrame', 'Duration', 'Duration_Start2End', 'Duration_Start_Command', 'Duration_Start', 'Events_MinDuration', 'FrameRate_Maximum', 'FrameRate_Minimum', 'FrameRate', 'FrameRate_Nominal', 'FrameRate_Original_Den', 'FrameRate_Original', 'FrameRate_Original_Num', 'FrameRate_Real', 'Interleave_Duration', 'Interleave_Preload', 'Interleave_VideoFrames', 'OverallBitRate_Maximum', 'OverallBitRate_Minimum', 'OverallBitRate', 'OverallBitRate_Nominal', 'PixelAspectRatio_CleanAperture', 'PixelAspectRatio', 'PixelAspectRatio_Original', 'SamplesPerFrame', 'SamplingRate', 'Source_Duration_FirstFrame', 'Source_Duration_LastFrame', 'Source_Duration', 'TimeStamp_FirstFrame', 'Video_Delay'];
30608
+ var MAX_UINT32_PLUS_ONE = Math.pow(2, 32);
30609
+ var DEFAULT_OPTIONS = {
30610
+ coverData: false,
30611
+ chunkSize: 256 * 1024,
30612
+ format: 'object',
30613
+ full: false
30614
+ };
30615
+ /**
30616
+ * Wrapper for the MediaInfoLib WASM module.
30617
+ *
30618
+ * This class should not be instantiated directly. Use the {@link mediaInfoFactory} function
30619
+ * to create instances of `MediaInfo`.
30620
+ *
30621
+ * @typeParam TFormat - The format type, defaults to `object`.
30622
+ */
30623
+ var MediaInfo = /*#__PURE__*/function () {
30624
+ /** @group General Use */
30625
+
30626
+ /**
30627
+ * The constructor should not be called directly, instead use {@link mediaInfoFactory}.
30628
+ *
30629
+ * @hidden
30630
+ * @param mediainfoModule WASM module
30631
+ * @param options User options
30632
+ */
30633
+ function MediaInfo(mediainfoModule, options) {
30634
+ this.isAnalyzing = false;
30635
+ this.mediainfoModule = mediainfoModule;
30636
+ this.options = options;
30637
+ this.mediainfoModuleInstance = this.instantiateModuleInstance();
30638
+ }
30639
+
30640
+ /**
30641
+ * Convenience method for analyzing a buffer chunk by chunk.
30642
+ *
30643
+ * @param size Return total buffer size in bytes.
30644
+ * @param readChunk Read chunk of data and return an {@link Uint8Array}.
30645
+ * @group General Use
30646
+ */
30647
+
30648
+ /**
30649
+ * Convenience method for analyzing a buffer chunk by chunk.
30650
+ *
30651
+ * @param size Return total buffer size in bytes.
30652
+ * @param readChunk Read chunk of data and return an {@link Uint8Array}.
30653
+ * @param callback Function that is called once the processing is done
30654
+ * @group General Use
30655
+ */
30656
+ var _proto = MediaInfo.prototype;
30657
+ _proto.analyzeData = function analyzeData(size, readChunk, callback) {
30658
+ var _this = this;
30659
+ // Support promise signature
30660
+ if (callback === undefined) {
30661
+ return new Promise(function (resolve, reject) {
30662
+ var resultCb = function resultCb(result, error) {
30663
+ _this.isAnalyzing = false;
30664
+ if (error || !result) {
30665
+ reject(unknownToError(error));
30666
+ } else {
30667
+ resolve(result);
30668
+ }
30669
+ };
30670
+ _this.analyzeData(size, readChunk, resultCb);
30671
+ });
30672
+ }
30673
+ if (this.isAnalyzing) {
30674
+ callback('', new Error('cannot start a new analysis while another is in progress'));
30675
+ return;
30676
+ }
30677
+ this.reset();
30678
+ this.isAnalyzing = true;
30679
+ var finalize = function finalize() {
30680
+ try {
30681
+ _this.openBufferFinalize();
30682
+ var result = _this.inform();
30683
+ if (_this.options.format === 'object') {
30684
+ callback(_this.parseResultJson(result));
30685
+ } else {
30686
+ callback(result);
30687
+ }
30688
+ } finally {
30689
+ _this.isAnalyzing = false;
30690
+ }
30691
+ };
30692
+ var offset = 0;
30693
+ var runReadDataLoop = function runReadDataLoop(fileSize) {
30694
+ var readNextChunk = function readNextChunk(data) {
30695
+ if (continueBuffer(data)) {
30696
+ getChunk();
30697
+ } else {
30698
+ finalize();
30699
+ }
30700
+ };
30701
+ var getChunk = function getChunk() {
30702
+ var dataValue;
30703
+ try {
30704
+ var safeSize = Math.min(_this.options.chunkSize, fileSize - offset);
30705
+ dataValue = readChunk(safeSize, offset);
30706
+ } catch (error) {
30707
+ _this.isAnalyzing = false;
30708
+ callback('', unknownToError(error));
30709
+ return;
30710
+ }
30711
+ if (dataValue instanceof Promise) {
30712
+ dataValue.then(readNextChunk)["catch"](function (error) {
30713
+ _this.isAnalyzing = false;
30714
+ callback('', unknownToError(error));
30715
+ });
30716
+ } else {
30717
+ readNextChunk(dataValue);
30718
+ }
30719
+ };
30720
+ var continueBuffer = function continueBuffer(data) {
30721
+ if (data.length === 0 || _this.openBufferContinue(data, data.length)) {
30722
+ return false;
30723
+ }
30724
+ var seekTo = _this.openBufferContinueGotoGet();
30725
+ if (seekTo === -1) {
30726
+ offset += data.length;
30727
+ } else {
30728
+ offset = seekTo;
30729
+ _this.openBufferInit(fileSize, seekTo);
30730
+ }
30731
+ return true;
30732
+ };
30733
+ _this.openBufferInit(fileSize, offset);
30734
+ getChunk();
30735
+ };
30736
+ var fileSizeValue = typeof size === 'function' ? size() : size;
30737
+ if (fileSizeValue instanceof Promise) {
30738
+ fileSizeValue.then(runReadDataLoop)["catch"](function (error) {
30739
+ callback(null, unknownToError(error));
30740
+ });
30741
+ } else {
30742
+ runReadDataLoop(fileSizeValue);
30743
+ }
30744
+ }
30745
+
30746
+ /**
30747
+ * Close the MediaInfoLib WASM instance.
30748
+ *
30749
+ * @group General Use
30750
+ */;
30751
+ _proto.close = function close() {
30752
+ if (typeof this.mediainfoModuleInstance.close === 'function') {
30753
+ this.mediainfoModuleInstance.close();
30754
+ }
30755
+ }
30756
+
30757
+ /**
30758
+ * Reset the MediaInfoLib WASM instance to its initial state.
30759
+ *
30760
+ * This method ensures that the instance is ready for a new parse.
30761
+ * @group General Use
30762
+ */;
30763
+ _proto.reset = function reset() {
30764
+ this.mediainfoModuleInstance["delete"]();
30765
+ this.mediainfoModuleInstance = this.instantiateModuleInstance();
30766
+ }
30767
+
30768
+ /**
30769
+ * Receive result data from the WASM instance.
30770
+ *
30771
+ * (This is a low-level MediaInfoLib function.)
30772
+ *
30773
+ * @returns Result data (format can be configured in options)
30774
+ * @group Low-level
30775
+ */;
30776
+ _proto.inform = function inform() {
30777
+ return this.mediainfoModuleInstance.inform();
30778
+ }
30779
+
30780
+ /**
30781
+ * Send more data to the WASM instance.
30782
+ *
30783
+ * (This is a low-level MediaInfoLib function.)
30784
+ *
30785
+ * @param data Data buffer
30786
+ * @param size Buffer size
30787
+ * @returns Processing state: `0` (no bits set) = not finished, Bit `0` set = enough data read for providing information
30788
+ * @group Low-level
30789
+ */;
30790
+ _proto.openBufferContinue = function openBufferContinue(data, size) {
30791
+ // bit 3 set -> done
30792
+ return !!(this.mediainfoModuleInstance.open_buffer_continue(data, size) & 0x08);
30793
+ }
30794
+
30795
+ /**
30796
+ * Retrieve seek position from WASM instance.
30797
+ * The MediaInfoLib function `Open_Buffer_GoTo` returns an integer with 64 bit precision.
30798
+ * It would be cut at 32 bit due to the JavaScript bindings. Here we transport the low and high
30799
+ * parts separately and put them together.
30800
+ *
30801
+ * (This is a low-level MediaInfoLib function.)
30802
+ *
30803
+ * @returns Seek position (where MediaInfoLib wants go in the data buffer)
30804
+ * @group Low-level
30805
+ */;
30806
+ _proto.openBufferContinueGotoGet = function openBufferContinueGotoGet() {
30807
+ // JS bindings don't support 64 bit int
30808
+ // https://github.com/buzz/mediainfo.js/issues/11
30809
+ var seekTo = -1;
30810
+ var seekToLow = this.mediainfoModuleInstance.open_buffer_continue_goto_get_lower();
30811
+ var seekToHigh = this.mediainfoModuleInstance.open_buffer_continue_goto_get_upper();
30812
+ if (seekToLow == -1 && seekToHigh == -1) {
30813
+ seekTo = -1;
30814
+ } else if (seekToLow < 0) {
30815
+ seekTo = seekToLow + MAX_UINT32_PLUS_ONE + seekToHigh * MAX_UINT32_PLUS_ONE;
30816
+ } else {
30817
+ seekTo = seekToLow + seekToHigh * MAX_UINT32_PLUS_ONE;
30818
+ }
30819
+ return seekTo;
30820
+ }
30821
+
30822
+ /**
30823
+ * Inform MediaInfoLib that no more data is being read.
30824
+ *
30825
+ * (This is a low-level MediaInfoLib function.)
30826
+ *
30827
+ * @group Low-level
30828
+ */;
30829
+ _proto.openBufferFinalize = function openBufferFinalize() {
30830
+ this.mediainfoModuleInstance.open_buffer_finalize();
30831
+ }
30832
+
30833
+ /**
30834
+ * Prepare MediaInfoLib to process a data buffer.
30835
+ *
30836
+ * (This is a low-level MediaInfoLib function.)
30837
+ *
30838
+ * @param size Expected buffer size
30839
+ * @param offset Buffer offset
30840
+ * @group Low-level
30841
+ */;
30842
+ _proto.openBufferInit = function openBufferInit(size, offset) {
30843
+ this.mediainfoModuleInstance.open_buffer_init(size, offset);
30844
+ }
30845
+
30846
+ /**
30847
+ * Parse result JSON. Convert integer/float fields.
30848
+ *
30849
+ * @param result Serialized JSON from MediaInfo
30850
+ * @returns Parsed JSON object
30851
+ */;
30852
+ _proto.parseResultJson = function parseResultJson(resultString) {
30853
+ var intFields = INT_FIELDS;
30854
+ var floatFields = FLOAT_FIELDS;
30855
+
30856
+ // Parse JSON
30857
+ var result = JSON.parse(resultString);
30858
+ if (result.media) {
30859
+ var newMedia = _extends({}, result.media, {
30860
+ track: []
30861
+ });
30862
+ if (Array.isArray(result.media.track)) {
30863
+ for (var _iterator = _createForOfIteratorHelperLoose(result.media.track), _step; !(_step = _iterator()).done;) {
30864
+ var track = _step.value;
30865
+ var newTrack = {
30866
+ '@type': track['@type']
30867
+ };
30868
+ for (var _i = 0, _Object$entries = Object.entries(track); _i < _Object$entries.length; _i++) {
30869
+ var _Object$entries$_i = _Object$entries[_i],
30870
+ key = _Object$entries$_i[0],
30871
+ val = _Object$entries$_i[1];
30872
+ if (key === '@type') {
30873
+ continue;
30874
+ }
30875
+ if (typeof val === 'string' && intFields.includes(key)) {
30876
+ var _extends2;
30877
+ newTrack = _extends({}, newTrack, (_extends2 = {}, _extends2[key] = Number.parseInt(val, 10), _extends2));
30878
+ } else if (typeof val === 'string' && floatFields.includes(key)) {
30879
+ var _extends3;
30880
+ newTrack = _extends({}, newTrack, (_extends3 = {}, _extends3[key] = Number.parseFloat(val), _extends3));
30881
+ } else {
30882
+ var _extends4;
30883
+ newTrack = _extends({}, newTrack, (_extends4 = {}, _extends4[key] = val, _extends4));
30884
+ }
30885
+ }
30886
+ newMedia.track.push(newTrack);
30887
+ }
30888
+ }
30889
+ return _extends({}, result, {
30890
+ media: newMedia
30891
+ });
30892
+ }
30893
+ return result;
30894
+ }
30895
+
30896
+ /**
30897
+ * Instantiate a new WASM module instance.
30898
+ *
30899
+ * @returns MediaInfo module instance
30900
+ */;
30901
+ _proto.instantiateModuleInstance = function instantiateModuleInstance() {
30902
+ return new this.mediainfoModule.MediaInfo(this.options.format === 'object' ? 'JSON' : this.options.format, this.options.coverData, this.options.full);
30903
+ };
30904
+ return MediaInfo;
30905
+ }(); // This code implements the `-sMODULARIZE` settings by taking the generated
30906
+ // JS program code (INNER_JS_CODE) and wrapping it in a factory function.
30907
+ // When targetting node and ES6 we use `await import ..` in the generated code
30908
+ // so the outer function needs to be marked as async.
30909
+ function Module(_x) {
30910
+ return _Module.apply(this, arguments);
30911
+ }
30912
+ function _Module() {
30913
+ _Module = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(moduleArg) {
30914
+ var moduleRtn, Module, thisProgram, _scriptName, scriptDirectory, locateFile, readAsync, out, err, wasmBinary, ABORT, readyPromiseResolve, readyPromiseReject, wasmMemory, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64, HEAP64, HEAPU64, runtimeInitialized, updateMemoryViews, initRuntime, runDependencies, dependenciesFulfilled, addRunDependency, removeRunDependency, abort, wasmBinaryFile, findWasmBinary, getBinarySync, getWasmBinary, _getWasmBinary, instantiateArrayBuffer, _instantiateArrayBuffer, instantiateAsync, _instantiateAsync, getWasmImports, createWasm, _createWasm, __abort_js, AsciiToString, awaitingDependencies, registeredTypes, typeDependencies, BindingError, throwBindingError, sharedRegisterType, registerType, integerReadValueFromPointer, __embind_register_bigint, __embind_register_bool, shallowCopyInternalPointer, throwInstanceAlreadyDeleted, finalizationRegistry, detachFinalizer, runDestructor, releaseClassHandle, _attachFinalizer, init_ClassHandle, ClassHandle, createNamedFunction, registeredPointers, ensureOverloadTable, exposePublicSymbol, char_0, char_9, makeLegalFunctionName, RegisteredClass, upcastPointer, embindRepr, constNoSmartPtrRawPointerToWireType, genericPointerToWireType, nonConstNoSmartPtrRawPointerToWireType, readPointer, _downcastPointer, registeredInstances, getBasestPointer, getInheritedInstance, InternalError, throwInternalError, makeClassHandle, RegisteredPointer_fromWireType, init_RegisteredPointer, RegisteredPointer, replacePublicSymbol, wasmTableMirror, wasmTable, getWasmTableEntry, embind__requireFunction, UnboundTypeError, getTypeName, throwUnboundTypeError, whenDependentTypesAreResolved, __embind_register_class, heap32VectorToArray, runDestructors, usesDestructorStack, createJsInvoker, craftInvokerFunction, __embind_register_class_constructor, getFunctionName, __embind_register_class_function, emval_freelist, emval_handles, __emval_decref, Emval, EmValType, __embind_register_emval, floatReadValueFromPointer, __embind_register_float, __embind_register_integer, __embind_register_memory_view, __embind_register_smart_ptr, stringToUTF8Array, stringToUTF8, lengthBytesUTF8, UTF8Decoder, findStringEnd, UTF8ArrayToString, UTF8ToString, __embind_register_std_string, UTF16Decoder, UTF16ToString, stringToUTF16, lengthBytesUTF16, UTF32ToString, stringToUTF32, lengthBytesUTF32, __embind_register_std_wstring, __embind_register_void, emval_methodCallers, emval_addMethodCaller, requireRegisteredType, emval_lookupTypes, emval_returnValue, emval_symbols, getStringOrSymbol, __emval_create_invoker, __emval_incref, __emval_invoke, __emval_run_destructors, INT53_MAX, INT53_MIN, bigintToI53Checked, __gmtime_js, __tzset_js, _emscripten_date_now, getHeapMax, alignMemory, growMemory, _emscripten_resize_heap, ENV, getExecutableName, _getEnvStrings, _environ_get, _environ_sizes_get, _fd_close, _fd_seek, printCharBuffers, printChar, _fd_write, ___getTypeName, _malloc, _free, assignWasmExports, wasmImports, wasmExports, run;
30915
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
30916
+ while (1) switch (_context6.prev = _context6.next) {
30917
+ case 0:
30918
+ run = function _run() {
30919
+ if (runDependencies > 0) {
30920
+ dependenciesFulfilled = run;
30921
+ return;
30922
+ }
30923
+
30924
+ // a preRun added a dependency, run will be called later
30925
+ if (runDependencies > 0) {
30926
+ dependenciesFulfilled = run;
30927
+ return;
30928
+ }
30929
+ function doRun() {
30930
+ // run may have just been called through dependencies being fulfilled just in this very frame,
30931
+ // or while the async setStatus time below was happening
30932
+ Module['calledRun'] = true;
30933
+ if (ABORT) return;
30934
+ initRuntime();
30935
+ readyPromiseResolve == null || readyPromiseResolve(Module);
30936
+ }
30937
+ {
30938
+ doRun();
30939
+ }
30940
+ };
30941
+ assignWasmExports = function _assignWasmExports(wasmExports) {
30942
+ ___getTypeName = wasmExports['__getTypeName'];
30943
+ _malloc = wasmExports['malloc'];
30944
+ _free = wasmExports['free'];
30945
+ wasmExports['_emscripten_stack_restore'];
30946
+ wasmExports['_emscripten_stack_alloc'];
30947
+ wasmExports['emscripten_stack_get_current'];
30948
+ };
30949
+ _fd_seek = function _fd_seek2(fd, offset, whence, newOffset) {
30950
+ return 70;
30951
+ };
30952
+ __gmtime_js = function _gmtime_js(time, tmPtr) {
30953
+ time = bigintToI53Checked(time);
30954
+ var date = new Date(time * 1000);
30955
+ HEAP32[tmPtr >> 2] = date.getUTCSeconds();
30956
+ HEAP32[tmPtr + 4 >> 2] = date.getUTCMinutes();
30957
+ HEAP32[tmPtr + 8 >> 2] = date.getUTCHours();
30958
+ HEAP32[tmPtr + 12 >> 2] = date.getUTCDate();
30959
+ HEAP32[tmPtr + 16 >> 2] = date.getUTCMonth();
30960
+ HEAP32[tmPtr + 20 >> 2] = date.getUTCFullYear() - 1900;
30961
+ HEAP32[tmPtr + 24 >> 2] = date.getUTCDay();
30962
+ var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0);
30963
+ var yday = (date.getTime() - start) / (1000 * 60 * 60 * 24) | 0;
30964
+ HEAP32[tmPtr + 28 >> 2] = yday;
30965
+ };
30966
+ craftInvokerFunction = function _craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, /** boolean= */isAsync) {
30967
+ // humanName: a human-readable string name for the function to be generated.
30968
+ // argTypes: An array that contains the embind type objects for all types in the function signature.
30969
+ // argTypes[0] is the type object for the function return value.
30970
+ // argTypes[1] is the type object for function this object/class type, or null if not crafting an invoker for a class method.
30971
+ // argTypes[2...] are the actual function parameters.
30972
+ // classType: The embind type object for the class to be bound, or null if this is not a method of a class.
30973
+ // cppInvokerFunc: JS Function object to the C++-side function that interops into C++ code.
30974
+ // cppTargetFunc: Function pointer (an integer to FUNCTION_TABLE) to the target C++ function the cppInvokerFunc will end up calling.
30975
+ // isAsync: Optional. If true, returns an async function. Async bindings are only supported with JSPI.
30976
+ var argCount = argTypes.length;
30977
+ if (argCount < 2) {
30978
+ throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
30979
+ }
30980
+ var isClassMethodFunc = argTypes[1] !== null && classType !== null;
30981
+
30982
+ // Free functions with signature "void function()" do not need an invoker that marshalls between wire types.
30983
+ // TODO: This omits argument count check - enable only at -O3 or similar.
30984
+ // if (ENABLE_UNSAFE_OPTS && argCount == 2 && argTypes[0].name == "void" && !isClassMethodFunc) {
30985
+ // return FUNCTION_TABLE[fn];
30986
+ // }
30987
+
30988
+ // Determine if we need to use a dynamic stack to store the destructors for the function parameters.
30989
+ // TODO: Remove this completely once all function invokers are being dynamically generated.
30990
+ var needsDestructorStack = usesDestructorStack(argTypes);
30991
+ var returns = !argTypes[0].isVoid;
30992
+ // Builld the arguments that will be passed into the closure around the invoker
30993
+ // function.
30994
+ var retType = argTypes[0];
30995
+ var instType = argTypes[1];
30996
+ var closureArgs = [humanName, throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, retType.fromWireType.bind(retType), instType == null ? void 0 : instType.toWireType.bind(instType)];
30997
+ for (var i = 2; i < argCount; ++i) {
30998
+ var argType = argTypes[i];
30999
+ closureArgs.push(argType.toWireType.bind(argType));
31000
+ }
31001
+ if (!needsDestructorStack) {
31002
+ // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
31003
+ for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) {
31004
+ if (argTypes[i].destructorFunction !== null) {
31005
+ closureArgs.push(argTypes[i].destructorFunction);
31006
+ }
31007
+ }
31008
+ }
31009
+ var invokerFactory = createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync);
31010
+ var invokerFn = invokerFactory.apply(void 0, closureArgs);
31011
+ return createNamedFunction(humanName, invokerFn);
31012
+ };
31013
+ createJsInvoker = function _createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync) {
31014
+ var needsDestructorStack = usesDestructorStack(argTypes);
31015
+ var argCount = argTypes.length - 2;
31016
+ var argsList = [];
31017
+ var argsListWired = ['fn'];
31018
+ if (isClassMethodFunc) {
31019
+ argsListWired.push('thisWired');
31020
+ }
31021
+ for (var i = 0; i < argCount; ++i) {
31022
+ argsList.push("arg" + i);
31023
+ argsListWired.push("arg" + i + "Wired");
31024
+ }
31025
+ argsList = argsList.join(',');
31026
+ argsListWired = argsListWired.join(',');
31027
+ var invokerFnBody = "return function (" + argsList + ") {\n";
31028
+ if (needsDestructorStack) {
31029
+ invokerFnBody += 'var destructors = [];\n';
31030
+ }
31031
+ var dtorStack = needsDestructorStack ? 'destructors' : 'null';
31032
+ var args1 = ['humanName', 'throwBindingError', 'invoker', 'fn', 'runDestructors', 'fromRetWire', 'toClassParamWire'];
31033
+ if (isClassMethodFunc) {
31034
+ invokerFnBody += "var thisWired = toClassParamWire(" + dtorStack + ", this);\n";
31035
+ }
31036
+ for (var i = 0; i < argCount; ++i) {
31037
+ var argName = "toArg" + i + "Wire";
31038
+ invokerFnBody += "var arg" + i + "Wired = " + argName + "(" + dtorStack + ", arg" + i + ");\n";
31039
+ args1.push(argName);
31040
+ }
31041
+ invokerFnBody += (returns || isAsync ? 'var rv = ' : '') + ("invoker(" + argsListWired + ");\n");
31042
+ if (needsDestructorStack) {
31043
+ invokerFnBody += 'runDestructors(destructors);\n';
31044
+ } else {
31045
+ for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) {
31046
+ // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
31047
+ var paramName = i === 1 ? 'thisWired' : 'arg' + (i - 2) + 'Wired';
31048
+ if (argTypes[i].destructorFunction !== null) {
31049
+ invokerFnBody += paramName + "_dtor(" + paramName + ");\n";
31050
+ args1.push(paramName + "_dtor");
31051
+ }
31052
+ }
31053
+ }
31054
+ if (returns) {
31055
+ invokerFnBody += 'var ret = fromRetWire(rv);\n' + 'return ret;\n';
31056
+ }
31057
+ invokerFnBody += '}\n';
31058
+ return new Function(args1, invokerFnBody);
31059
+ };
31060
+ usesDestructorStack = function _usesDestructorStack(argTypes) {
31061
+ // Skip return value at index 0 - it's not deleted here.
31062
+ for (var i = 1; i < argTypes.length; ++i) {
31063
+ // The type does not define a destructor function - must use dynamic stack
31064
+ if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) {
31065
+ return true;
31066
+ }
31067
+ }
31068
+ return false;
31069
+ };
31070
+ RegisteredPointer = function _RegisteredPointer(name, registeredClass, isReference, isConst,
31071
+ // smart pointer properties
31072
+ isSmartPointer, pointeeType, sharingPolicy, rawGetPointee, rawConstructor, rawShare, rawDestructor) {
31073
+ this.name = name;
31074
+ this.registeredClass = registeredClass;
31075
+ this.isReference = isReference;
31076
+ this.isConst = isConst;
31077
+
31078
+ // smart pointer properties
31079
+ this.isSmartPointer = isSmartPointer;
31080
+ this.pointeeType = pointeeType;
31081
+ this.sharingPolicy = sharingPolicy;
31082
+ this.rawGetPointee = rawGetPointee;
31083
+ this.rawConstructor = rawConstructor;
31084
+ this.rawShare = rawShare;
31085
+ this.rawDestructor = rawDestructor;
31086
+ if (!isSmartPointer && registeredClass.baseClass === undefined) {
31087
+ if (isConst) {
31088
+ this.toWireType = constNoSmartPtrRawPointerToWireType;
31089
+ this.destructorFunction = null;
31090
+ } else {
31091
+ this.toWireType = nonConstNoSmartPtrRawPointerToWireType;
31092
+ this.destructorFunction = null;
31093
+ }
31094
+ } else {
31095
+ this.toWireType = genericPointerToWireType;
31096
+ // Here we must leave this.destructorFunction undefined, since whether genericPointerToWireType returns
31097
+ // a pointer that needs to be freed up is runtime-dependent, and cannot be evaluated at registration time.
31098
+ // TODO: Create an alternative mechanism that allows removing the use of var destructors = []; array in
31099
+ // craftInvokerFunction altogether.
31100
+ }
31101
+ };
31102
+ RegisteredPointer_fromWireType = function _RegisteredPointer_fr(ptr) {
31103
+ // ptr is a raw pointer (or a raw smartpointer)
31104
+
31105
+ // rawPointer is a maybe-null raw pointer
31106
+ var rawPointer = this.getPointee(ptr);
31107
+ if (!rawPointer) {
31108
+ this.destructor(ptr);
31109
+ return null;
31110
+ }
31111
+ var registeredInstance = getInheritedInstance(this.registeredClass, rawPointer);
31112
+ if (undefined !== registeredInstance) {
31113
+ // JS object has been neutered, time to repopulate it
31114
+ if (0 === registeredInstance.$$.count.value) {
31115
+ registeredInstance.$$.ptr = rawPointer;
31116
+ registeredInstance.$$.smartPtr = ptr;
31117
+ return registeredInstance['clone']();
31118
+ } else {
31119
+ // else, just increment reference count on existing object
31120
+ // it already has a reference to the smart pointer
31121
+ var rv = registeredInstance['clone']();
31122
+ this.destructor(ptr);
31123
+ return rv;
31124
+ }
31125
+ }
31126
+ function makeDefaultHandle() {
31127
+ if (this.isSmartPointer) {
31128
+ return makeClassHandle(this.registeredClass.instancePrototype, {
31129
+ ptrType: this.pointeeType,
31130
+ ptr: rawPointer,
31131
+ smartPtrType: this,
31132
+ smartPtr: ptr
31133
+ });
31134
+ } else {
31135
+ return makeClassHandle(this.registeredClass.instancePrototype, {
31136
+ ptrType: this,
31137
+ ptr: ptr
31138
+ });
31139
+ }
31140
+ }
31141
+ var actualType = this.registeredClass.getActualType(rawPointer);
31142
+ var registeredPointerRecord = registeredPointers[actualType];
31143
+ if (!registeredPointerRecord) {
31144
+ return makeDefaultHandle.call(this);
31145
+ }
31146
+ var toType;
31147
+ if (this.isConst) {
31148
+ toType = registeredPointerRecord.constPointerType;
31149
+ } else {
31150
+ toType = registeredPointerRecord.pointerType;
31151
+ }
31152
+ var dp = _downcastPointer(rawPointer, this.registeredClass, toType.registeredClass);
31153
+ if (dp === null) {
31154
+ return makeDefaultHandle.call(this);
31155
+ }
31156
+ if (this.isSmartPointer) {
31157
+ return makeClassHandle(toType.registeredClass.instancePrototype, {
31158
+ ptrType: toType,
31159
+ ptr: dp,
31160
+ smartPtrType: this,
31161
+ smartPtr: ptr
31162
+ });
31163
+ } else {
31164
+ return makeClassHandle(toType.registeredClass.instancePrototype, {
31165
+ ptrType: toType,
31166
+ ptr: dp
31167
+ });
31168
+ }
31169
+ };
31170
+ readPointer = function _readPointer(pointer) {
31171
+ return this.fromWireType(HEAPU32[pointer >> 2]);
31172
+ };
31173
+ nonConstNoSmartPtrRawPointerToWireType = function _nonConstNoSmartPtrRa(destructors, handle) {
31174
+ if (handle === null) {
31175
+ if (this.isReference) {
31176
+ throwBindingError("null is not a valid " + this.name);
31177
+ }
31178
+ return 0;
31179
+ }
31180
+ if (!handle.$$) {
31181
+ throwBindingError("Cannot pass \"" + embindRepr(handle) + "\" as a " + this.name);
31182
+ }
31183
+ if (!handle.$$.ptr) {
31184
+ throwBindingError("Cannot pass deleted object as a pointer of type " + this.name);
31185
+ }
31186
+ if (handle.$$.ptrType.isConst) {
31187
+ throwBindingError("Cannot convert argument of type " + handle.$$.ptrType.name + " to parameter type " + this.name);
31188
+ }
31189
+ var handleClass = handle.$$.ptrType.registeredClass;
31190
+ var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
31191
+ return ptr;
31192
+ };
31193
+ genericPointerToWireType = function _genericPointerToWire(destructors, handle) {
31194
+ var ptr;
31195
+ if (handle === null) {
31196
+ if (this.isReference) {
31197
+ throwBindingError("null is not a valid " + this.name);
31198
+ }
31199
+ if (this.isSmartPointer) {
31200
+ ptr = this.rawConstructor();
31201
+ if (destructors !== null) {
31202
+ destructors.push(this.rawDestructor, ptr);
31203
+ }
31204
+ return ptr;
31205
+ } else {
31206
+ return 0;
31207
+ }
31208
+ }
31209
+ if (!handle || !handle.$$) {
31210
+ throwBindingError("Cannot pass \"" + embindRepr(handle) + "\" as a " + this.name);
31211
+ }
31212
+ if (!handle.$$.ptr) {
31213
+ throwBindingError("Cannot pass deleted object as a pointer of type " + this.name);
31214
+ }
31215
+ if (!this.isConst && handle.$$.ptrType.isConst) {
31216
+ throwBindingError("Cannot convert argument of type " + (handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name) + " to parameter type " + this.name);
31217
+ }
31218
+ var handleClass = handle.$$.ptrType.registeredClass;
31219
+ ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
31220
+ if (this.isSmartPointer) {
31221
+ // TODO: this is not strictly true
31222
+ // We could support BY_EMVAL conversions from raw pointers to smart pointers
31223
+ // because the smart pointer can hold a reference to the handle
31224
+ if (undefined === handle.$$.smartPtr) {
31225
+ throwBindingError('Passing raw pointer to smart pointer is illegal');
31226
+ }
31227
+ switch (this.sharingPolicy) {
31228
+ case 0:
31229
+ // NONE
31230
+ // no upcasting
31231
+ if (handle.$$.smartPtrType === this) {
31232
+ ptr = handle.$$.smartPtr;
31233
+ } else {
31234
+ throwBindingError("Cannot convert argument of type " + (handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name) + " to parameter type " + this.name);
31235
+ }
31236
+ break;
31237
+ case 1:
31238
+ // INTRUSIVE
31239
+ ptr = handle.$$.smartPtr;
31240
+ break;
31241
+ case 2:
31242
+ // BY_EMVAL
31243
+ if (handle.$$.smartPtrType === this) {
31244
+ ptr = handle.$$.smartPtr;
31245
+ } else {
31246
+ var clonedHandle = handle['clone']();
31247
+ ptr = this.rawShare(ptr, Emval.toHandle(function () {
31248
+ return clonedHandle['delete']();
31249
+ }));
31250
+ if (destructors !== null) {
31251
+ destructors.push(this.rawDestructor, ptr);
31252
+ }
31253
+ }
31254
+ break;
31255
+ default:
31256
+ throwBindingError('Unsupporting sharing policy');
31257
+ }
31258
+ }
31259
+ return ptr;
31260
+ };
31261
+ constNoSmartPtrRawPointerToWireType = function _constNoSmartPtrRawPo(destructors, handle) {
31262
+ if (handle === null) {
31263
+ if (this.isReference) {
31264
+ throwBindingError("null is not a valid " + this.name);
31265
+ }
31266
+ return 0;
31267
+ }
31268
+ if (!handle.$$) {
31269
+ throwBindingError("Cannot pass \"" + embindRepr(handle) + "\" as a " + this.name);
31270
+ }
31271
+ if (!handle.$$.ptr) {
31272
+ throwBindingError("Cannot pass deleted object as a pointer of type " + this.name);
31273
+ }
31274
+ var handleClass = handle.$$.ptrType.registeredClass;
31275
+ var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
31276
+ return ptr;
31277
+ };
31278
+ RegisteredClass = function _RegisteredClass(name, constructor, instancePrototype, rawDestructor, baseClass, getActualType, upcast, downcast) {
31279
+ this.name = name;
31280
+ this.constructor = constructor;
31281
+ this.instancePrototype = instancePrototype;
31282
+ this.rawDestructor = rawDestructor;
31283
+ this.baseClass = baseClass;
31284
+ this.getActualType = getActualType;
31285
+ this.upcast = upcast;
31286
+ this.downcast = downcast;
31287
+ this.pureVirtualFunctions = [];
31288
+ };
31289
+ ClassHandle = function _ClassHandle() {};
31290
+ registerType = function _registerType(rawType, registeredInstance, options) {
31291
+ if (options === void 0) {
31292
+ options = {};
31293
+ }
31294
+ return sharedRegisterType(rawType, registeredInstance, options);
31295
+ };
31296
+ sharedRegisterType = function _sharedRegisterType(rawType, registeredInstance, options) {
31297
+ if (options === void 0) {
31298
+ options = {};
31299
+ }
31300
+ var name = registeredInstance.name;
31301
+ if (!rawType) {
31302
+ throwBindingError("type \"" + name + "\" must have a positive integer typeid pointer");
31303
+ }
31304
+ if (registeredTypes.hasOwnProperty(rawType)) {
31305
+ if (options.ignoreDuplicateRegistrations) {
31306
+ return;
31307
+ } else {
31308
+ throwBindingError("Cannot register type '" + name + "' twice");
31309
+ }
31310
+ }
31311
+ registeredTypes[rawType] = registeredInstance;
31312
+ delete typeDependencies[rawType];
31313
+ if (awaitingDependencies.hasOwnProperty(rawType)) {
31314
+ var callbacks = awaitingDependencies[rawType];
31315
+ delete awaitingDependencies[rawType];
31316
+ callbacks.forEach(function (cb) {
31317
+ return cb();
31318
+ });
31319
+ }
31320
+ };
31321
+ _createWasm = function _createWasm3() {
31322
+ _createWasm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
31323
+ var _wasmBinaryFile;
31324
+ var receiveInstance, receiveInstantiationResult, info, result, exports;
31325
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
31326
+ while (1) switch (_context5.prev = _context5.next) {
31327
+ case 0:
31328
+ receiveInstantiationResult = function _receiveInstantiation(result) {
31329
+ // 'result' is a ResultObject object which has both the module and instance.
31330
+ // receiveInstance() will swap in the exports (to Module.asm) so they can be called
31331
+ // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
31332
+ // When the regression is fixed, can restore the above PTHREADS-enabled path.
31333
+ return receiveInstance(result['instance']);
31334
+ };
31335
+ receiveInstance = function _receiveInstance(instance, module) {
31336
+ wasmExports = instance.exports;
31337
+ wasmMemory = wasmExports['memory'];
31338
+ updateMemoryViews();
31339
+ wasmTable = wasmExports['__indirect_function_table'];
31340
+ assignWasmExports(wasmExports);
31341
+ removeRunDependency();
31342
+ return wasmExports;
31343
+ }; // Load the wasm module and create an instance of using native support in the JS engine.
31344
+ // handle a generated wasm instance, receiving its exports and
31345
+ // performing other necessary setup
31346
+ /** @param {WebAssembly.Module=} module*/
31347
+ // wait for the pthread pool (if any)
31348
+ addRunDependency();
31349
+
31350
+ // Prefer streaming instantiation if available.
31351
+ info = getWasmImports();
31352
+ (_wasmBinaryFile = wasmBinaryFile) != null ? _wasmBinaryFile : wasmBinaryFile = findWasmBinary();
31353
+ _context5.next = 7;
31354
+ return instantiateAsync(wasmBinary, wasmBinaryFile, info);
31355
+ case 7:
31356
+ result = _context5.sent;
31357
+ exports = receiveInstantiationResult(result);
31358
+ return _context5.abrupt("return", exports);
31359
+ case 10:
31360
+ case "end":
31361
+ return _context5.stop();
31362
+ }
31363
+ }, _callee5);
31364
+ }));
31365
+ return _createWasm.apply(this, arguments);
31366
+ };
31367
+ createWasm = function _createWasm2() {
31368
+ return _createWasm.apply(this, arguments);
31369
+ };
31370
+ getWasmImports = function _getWasmImports() {
31371
+ // prepare imports
31372
+ return {
31373
+ env: wasmImports,
31374
+ wasi_snapshot_preview1: wasmImports
31375
+ };
31376
+ };
31377
+ _instantiateAsync = function _instantiateAsync3() {
31378
+ _instantiateAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(binary, binaryFile, imports) {
31379
+ var response, instantiationResult;
31380
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
31381
+ while (1) switch (_context4.prev = _context4.next) {
31382
+ case 0:
31383
+ _context4.prev = 0;
31384
+ response = fetch(binaryFile, {
31385
+ credentials: 'same-origin'
31386
+ });
31387
+ _context4.next = 4;
31388
+ return WebAssembly.instantiateStreaming(response, imports);
31389
+ case 4:
31390
+ instantiationResult = _context4.sent;
31391
+ return _context4.abrupt("return", instantiationResult);
31392
+ case 8:
31393
+ _context4.prev = 8;
31394
+ _context4.t0 = _context4["catch"](0);
31395
+ // We expect the most common failure cause to be a bad MIME type for the binary,
31396
+ // in which case falling back to ArrayBuffer instantiation should work.
31397
+ err("wasm streaming compile failed: " + _context4.t0);
31398
+ err('falling back to ArrayBuffer instantiation');
31399
+ // fall back of instantiateArrayBuffer below
31400
+ case 12:
31401
+ return _context4.abrupt("return", instantiateArrayBuffer(binaryFile, imports));
31402
+ case 13:
31403
+ case "end":
31404
+ return _context4.stop();
31405
+ }
31406
+ }, _callee4, null, [[0, 8]]);
31407
+ }));
31408
+ return _instantiateAsync.apply(this, arguments);
31409
+ };
31410
+ instantiateAsync = function _instantiateAsync2(_x6, _x7, _x8) {
31411
+ return _instantiateAsync.apply(this, arguments);
31412
+ };
31413
+ _instantiateArrayBuffer = function _instantiateArrayBuff2() {
31414
+ _instantiateArrayBuffer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(binaryFile, imports) {
31415
+ var binary, instance;
31416
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
31417
+ while (1) switch (_context3.prev = _context3.next) {
31418
+ case 0:
31419
+ _context3.prev = 0;
31420
+ _context3.next = 3;
31421
+ return getWasmBinary(binaryFile);
31422
+ case 3:
31423
+ binary = _context3.sent;
31424
+ _context3.next = 6;
31425
+ return WebAssembly.instantiate(binary, imports);
31426
+ case 6:
31427
+ instance = _context3.sent;
31428
+ return _context3.abrupt("return", instance);
31429
+ case 10:
31430
+ _context3.prev = 10;
31431
+ _context3.t0 = _context3["catch"](0);
31432
+ err("failed to asynchronously prepare wasm: " + _context3.t0);
31433
+ abort(_context3.t0);
31434
+ case 14:
31435
+ case "end":
31436
+ return _context3.stop();
31437
+ }
31438
+ }, _callee3, null, [[0, 10]]);
31439
+ }));
31440
+ return _instantiateArrayBuffer.apply(this, arguments);
31441
+ };
31442
+ instantiateArrayBuffer = function _instantiateArrayBuff(_x4, _x5) {
31443
+ return _instantiateArrayBuffer.apply(this, arguments);
31444
+ };
31445
+ _getWasmBinary = function _getWasmBinary3() {
31446
+ _getWasmBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(binaryFile) {
31447
+ var response;
31448
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31449
+ while (1) switch (_context2.prev = _context2.next) {
31450
+ case 0:
31451
+ _context2.prev = 0;
31452
+ _context2.next = 3;
31453
+ return readAsync(binaryFile);
31454
+ case 3:
31455
+ response = _context2.sent;
31456
+ return _context2.abrupt("return", new Uint8Array(response));
31457
+ case 7:
31458
+ _context2.prev = 7;
31459
+ _context2.t0 = _context2["catch"](0);
31460
+ case 9:
31461
+ return _context2.abrupt("return", getBinarySync());
31462
+ case 10:
31463
+ case "end":
31464
+ return _context2.stop();
31465
+ }
31466
+ }, _callee2, null, [[0, 7]]);
31467
+ }));
31468
+ return _getWasmBinary.apply(this, arguments);
31469
+ };
31470
+ getWasmBinary = function _getWasmBinary2(_x3) {
31471
+ return _getWasmBinary.apply(this, arguments);
31472
+ };
31473
+ getBinarySync = function _getBinarySync(file) {
31474
+ throw 'both async and sync fetching of the wasm failed';
31475
+ };
31476
+ findWasmBinary = function _findWasmBinary() {
31477
+ if (Module['locateFile']) {
31478
+ return locateFile('MediaInfoModule.wasm');
31479
+ }
31480
+ // Use bundler-friendly `new URL(..., import.meta.url)` pattern; works in browsers too.
31481
+ return new URL('MediaInfoModule.wasm', (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('sdk2.umd.development.js', document.baseURI).href))).href;
31482
+ };
31483
+ abort = function _abort(what) {
31484
+ what = 'Aborted(' + what + ')';
31485
+ // TODO(sbc): Should we remove printing and leave it up to whoever
31486
+ // catches the exception?
31487
+ err(what);
31488
+ ABORT = true;
31489
+ what += '. Build with -sASSERTIONS for more info.';
31490
+
31491
+ // Use a wasm runtime error, because a JS error might be seen as a foreign
31492
+ // exception, which means we'd run destructors on it. We need the error to
31493
+ // simply make the program stop.
31494
+ // FIXME This approach does not work in Wasm EH because it currently does not assume
31495
+ // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
31496
+ // a trap or not based on a hidden field within the object. So at the moment
31497
+ // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
31498
+ // allows this in the wasm spec.
31499
+
31500
+ // Suppress closure compiler warning here. Closure compiler's builtin extern
31501
+ // definition for WebAssembly.RuntimeError claims it takes no arguments even
31502
+ // though it can.
31503
+ // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
31504
+ /** @suppress {checkTypes} */
31505
+ var e = new WebAssembly.RuntimeError(what);
31506
+ readyPromiseReject == null || readyPromiseReject(e);
31507
+ // Throw the error whether or not MODULARIZE is set because abort is used
31508
+ // in code paths apart from instantiation where an exception is expected
31509
+ // to be thrown when abort is called.
31510
+ throw e;
31511
+ };
31512
+ removeRunDependency = function _removeRunDependency(id) {
31513
+ runDependencies--;
31514
+ if (runDependencies == 0) {
31515
+ if (dependenciesFulfilled) {
31516
+ var callback = dependenciesFulfilled;
31517
+ dependenciesFulfilled = null;
31518
+ callback(); // can add another dependenciesFulfilled
31519
+ }
31520
+ }
31521
+ };
31522
+ addRunDependency = function _addRunDependency(id) {
31523
+ runDependencies++;
31524
+ };
31525
+ initRuntime = function _initRuntime() {
31526
+ runtimeInitialized = true;
31527
+
31528
+ // No ATINITS hooks
31529
+
31530
+ wasmExports['__wasm_call_ctors']();
31531
+
31532
+ // No ATPOSTCTORS hooks
31533
+ };
31534
+ updateMemoryViews = function _updateMemoryViews() {
31535
+ var b = wasmMemory.buffer;
31536
+ HEAP8 = new Int8Array(b);
31537
+ HEAP16 = new Int16Array(b);
31538
+ HEAPU8 = new Uint8Array(b);
31539
+ HEAPU16 = new Uint16Array(b);
31540
+ HEAP32 = new Int32Array(b);
31541
+ HEAPU32 = new Uint32Array(b);
31542
+ HEAPF32 = new Float32Array(b);
31543
+ HEAPF64 = new Float64Array(b);
31544
+ HEAP64 = new BigInt64Array(b);
31545
+ HEAPU64 = new BigUint64Array(b);
31546
+ };
31547
+ locateFile = function _locateFile(path) {
31548
+ if (Module['locateFile']) {
31549
+ return Module['locateFile'](path, scriptDirectory);
31550
+ }
31551
+ return scriptDirectory + path;
31552
+ };
31553
+ if (moduleArg === void 0) {
31554
+ moduleArg = {};
31555
+ }
31556
+ // include: shell.js
31557
+ // The Module object: Our interface to the outside world. We import
31558
+ // and export values on it. There are various ways Module can be used:
31559
+ // 1. Not defined. We create it here
31560
+ // 2. A function parameter, function(moduleArg) => Promise<Module>
31561
+ // 3. pre-run appended it, var Module = {}; ..generated code..
31562
+ // 4. External script tag defines var Module.
31563
+ // We need to check if Module already exists (e.g. case 3 above).
31564
+ // Substitution will be replaced with actual code on later stage of the build,
31565
+ // this way Closure Compiler will not mangle it (e.g. case 4. above).
31566
+ // Note that if you want to run closure, and also to use Module
31567
+ // after the generated code, you will need to define var Module = {};
31568
+ // before the code. Then that object will be used in the code, and you
31569
+ // can continue to use Module afterwards as well.
31570
+ Module = moduleArg;
31571
+ thisProgram = './this.program';
31572
+ _scriptName = (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('sdk2.umd.development.js', document.baseURI).href)); // `/` should be present at the end if `scriptDirectory` is not empty
31573
+ scriptDirectory = ''; // Hooks that are implemented differently in different runtime environments.
31574
+ try {
31575
+ scriptDirectory = new URL('.', _scriptName).href; // includes trailing slash
31576
+ } catch (_unused2) {
31577
+ // Must be a `blob:` or `data:` URL (e.g. `blob:http://site.com/etc/etc`), we cannot
31578
+ // infer anything from them.
31579
+ }
31580
+ // include: web_or_worker_shell_read.js
31581
+ readAsync = /*#__PURE__*/function () {
31582
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
31583
+ var response;
31584
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
31585
+ while (1) switch (_context.prev = _context.next) {
31586
+ case 0:
31587
+ _context.next = 2;
31588
+ return fetch(url, {
31589
+ credentials: 'same-origin'
31590
+ });
31591
+ case 2:
31592
+ response = _context.sent;
31593
+ if (!response.ok) {
31594
+ _context.next = 5;
31595
+ break;
31596
+ }
31597
+ return _context.abrupt("return", response.arrayBuffer());
31598
+ case 5:
31599
+ throw new Error(response.status + ' : ' + response.url);
31600
+ case 6:
31601
+ case "end":
31602
+ return _context.stop();
31603
+ }
31604
+ }, _callee);
31605
+ }));
31606
+ return function readAsync(_x2) {
31607
+ return _ref.apply(this, arguments);
31608
+ };
31609
+ }();
31610
+ // end include: web_or_worker_shell_read.js
31611
+ out = console.log.bind(console);
31612
+ err = console.error.bind(console); // end include: shell.js
31613
+ // include: preamble.js
31614
+ // === Preamble library stuff ===
31615
+ // Documentation for the public APIs defined in this file must be updated in:
31616
+ // site/source/docs/api_reference/preamble.js.rst
31617
+ // A prebuilt local version of the documentation is available at:
31618
+ // site/build/text/docs/api_reference/preamble.js.txt
31619
+ // You can also build docs locally as HTML or other formats in site/
31620
+ // An online HTML version (which may be of a different version of Emscripten)
31621
+ // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
31622
+ // Wasm globals
31623
+ //========================================
31624
+ // Runtime essentials
31625
+ //========================================
31626
+ // whether we are quitting the application. no code should run after this.
31627
+ // set in exit() and abort()
31628
+ ABORT = false; // include: runtime_common.js
31629
+ // include: runtime_stack_check.js
31630
+ // end include: runtime_stack_check.js
31631
+ // include: runtime_exceptions.js
31632
+ // end include: runtime_exceptions.js
31633
+ // include: runtime_debug.js
31634
+ // end include: runtime_debug.js
31635
+ // Memory management
31636
+ // BigInt64Array type is not correctly defined in closure
31637
+ runtimeInitialized = false;
31638
+ // A counter of dependencies for calling run(). If we need to
31639
+ // do asynchronous work before running, increment this and
31640
+ // decrement it. Incrementing must happen in a place like
31641
+ // Module.preRun (used by emcc to add file preloading).
31642
+ // Note that you can add dependencies in preRun, even though
31643
+ // it happens right before run - run will be postponed until
31644
+ // the dependencies are met.
31645
+ runDependencies = 0;
31646
+ dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
31647
+ /** @param {string|number=} what */
31648
+ // Create the wasm instance.
31649
+ // Receives the wasm imports, returns the exports.
31650
+ __abort_js = function __abort_js() {
31651
+ return abort('');
31652
+ };
31653
+ AsciiToString = function AsciiToString(ptr) {
31654
+ var str = '';
31655
+ while (1) {
31656
+ var ch = HEAPU8[ptr++];
31657
+ if (!ch) return str;
31658
+ str += String.fromCharCode(ch);
31659
+ }
31660
+ };
31661
+ awaitingDependencies = {};
31662
+ registeredTypes = {};
31663
+ typeDependencies = {};
31664
+ BindingError = /*#__PURE__*/function (_Error) {
31665
+ function BindingError(message) {
31666
+ var _this2;
31667
+ _this2 = _Error.call(this, message) || this;
31668
+ _this2.name = 'BindingError';
31669
+ return _this2;
31670
+ }
31671
+ _inheritsLoose(BindingError, _Error);
31672
+ return BindingError;
31673
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
31674
+ throwBindingError = function throwBindingError(message) {
31675
+ throw new BindingError(message);
31676
+ };
31677
+ /** @param {Object=} options */
31678
+ /** @param {Object=} options */
31679
+ integerReadValueFromPointer = function integerReadValueFromPointer(name, width, signed) {
31680
+ // integers are quite common, so generate very specialized functions
31681
+ switch (width) {
31682
+ case 1:
31683
+ return signed ? function (pointer) {
31684
+ return HEAP8[pointer];
31685
+ } : function (pointer) {
31686
+ return HEAPU8[pointer];
31687
+ };
31688
+ case 2:
31689
+ return signed ? function (pointer) {
31690
+ return HEAP16[pointer >> 1];
31691
+ } : function (pointer) {
31692
+ return HEAPU16[pointer >> 1];
31693
+ };
31694
+ case 4:
31695
+ return signed ? function (pointer) {
31696
+ return HEAP32[pointer >> 2];
31697
+ } : function (pointer) {
31698
+ return HEAPU32[pointer >> 2];
31699
+ };
31700
+ case 8:
31701
+ return signed ? function (pointer) {
31702
+ return HEAP64[pointer >> 3];
31703
+ } : function (pointer) {
31704
+ return HEAPU64[pointer >> 3];
31705
+ };
31706
+ default:
31707
+ throw new TypeError("invalid integer width (" + width + "): " + name);
31708
+ }
31709
+ };
31710
+ /** @suppress {globalThis} */
31711
+ __embind_register_bigint = function __embind_register_bigint(primitiveType, name, size, minRange, maxRange) {
31712
+ name = AsciiToString(name);
31713
+ var isUnsignedType = minRange === 0n;
31714
+ var fromWireType = function fromWireType(value) {
31715
+ return value;
31716
+ };
31717
+ if (isUnsignedType) {
31718
+ // uint64 get converted to int64 in ABI, fix them up like we do for 32-bit integers.
31719
+ var bitSize = size * 8;
31720
+ fromWireType = function fromWireType(value) {
31721
+ return BigInt.asUintN(bitSize, value);
31722
+ };
31723
+ maxRange = fromWireType(maxRange);
31724
+ }
31725
+ registerType(primitiveType, {
31726
+ name: name,
31727
+ fromWireType: fromWireType,
31728
+ toWireType: function toWireType(destructors, value) {
31729
+ if (typeof value == 'number') {
31730
+ value = BigInt(value);
31731
+ }
31732
+ return value;
31733
+ },
31734
+ readValueFromPointer: integerReadValueFromPointer(name, size, !isUnsignedType),
31735
+ destructorFunction: null // This type does not need a destructor
31736
+ });
31737
+ };
31738
+ /** @suppress {globalThis} */
31739
+ __embind_register_bool = function __embind_register_bool(rawType, name, trueValue, falseValue) {
31740
+ name = AsciiToString(name);
31741
+ registerType(rawType, {
31742
+ name: name,
31743
+ fromWireType: function fromWireType(wt) {
31744
+ // ambiguous emscripten ABI: sometimes return values are
31745
+ // true or false, and sometimes integers (0 or 1)
31746
+ return !!wt;
31747
+ },
31748
+ toWireType: function toWireType(destructors, o) {
31749
+ return o ? trueValue : falseValue;
31750
+ },
31751
+ readValueFromPointer: function readValueFromPointer(pointer) {
31752
+ return this.fromWireType(HEAPU8[pointer]);
31753
+ },
31754
+ destructorFunction: null // This type does not need a destructor
31755
+ });
31756
+ };
31757
+ shallowCopyInternalPointer = function shallowCopyInternalPointer(o) {
31758
+ return {
31759
+ count: o.count,
31760
+ deleteScheduled: o.deleteScheduled,
31761
+ preservePointerOnDelete: o.preservePointerOnDelete,
31762
+ ptr: o.ptr,
31763
+ ptrType: o.ptrType,
31764
+ smartPtr: o.smartPtr,
31765
+ smartPtrType: o.smartPtrType
31766
+ };
31767
+ };
31768
+ throwInstanceAlreadyDeleted = function throwInstanceAlreadyDeleted(obj) {
31769
+ function getInstanceTypeName(handle) {
31770
+ return handle.$$.ptrType.registeredClass.name;
31771
+ }
31772
+ throwBindingError(getInstanceTypeName(obj) + ' instance already deleted');
31773
+ };
31774
+ finalizationRegistry = false;
31775
+ detachFinalizer = function detachFinalizer(handle) {};
31776
+ runDestructor = function runDestructor($$) {
31777
+ if ($$.smartPtr) {
31778
+ $$.smartPtrType.rawDestructor($$.smartPtr);
31779
+ } else {
31780
+ $$.ptrType.registeredClass.rawDestructor($$.ptr);
31781
+ }
31782
+ };
31783
+ releaseClassHandle = function releaseClassHandle($$) {
31784
+ $$.count.value -= 1;
31785
+ var toDelete = 0 === $$.count.value;
31786
+ if (toDelete) {
31787
+ runDestructor($$);
31788
+ }
31789
+ };
31790
+ _attachFinalizer = function attachFinalizer(handle) {
31791
+ if ('undefined' === typeof FinalizationRegistry) {
31792
+ _attachFinalizer = function attachFinalizer(handle) {
31793
+ return handle;
31794
+ };
31795
+ return handle;
31796
+ }
31797
+ // If the running environment has a FinalizationRegistry (see
31798
+ // https://github.com/tc39/proposal-weakrefs), then attach finalizers
31799
+ // for class handles. We check for the presence of FinalizationRegistry
31800
+ // at run-time, not build-time.
31801
+ finalizationRegistry = new FinalizationRegistry(function (info) {
31802
+ releaseClassHandle(info.$$);
31803
+ });
31804
+ _attachFinalizer = function attachFinalizer(handle) {
31805
+ var $$ = handle.$$;
31806
+ var hasSmartPtr = !!$$.smartPtr;
31807
+ if (hasSmartPtr) {
31808
+ // We should not call the destructor on raw pointers in case other code expects the pointee to live
31809
+ var info = {
31810
+ $$: $$
31811
+ };
31812
+ finalizationRegistry.register(handle, info, handle);
31813
+ }
31814
+ return handle;
31815
+ };
31816
+ detachFinalizer = function detachFinalizer(handle) {
31817
+ return finalizationRegistry.unregister(handle);
31818
+ };
31819
+ return _attachFinalizer(handle);
31820
+ };
31821
+ init_ClassHandle = function init_ClassHandle() {
31822
+ var proto = ClassHandle.prototype;
31823
+ Object.assign(proto, {
31824
+ isAliasOf: function isAliasOf(other) {
31825
+ if (!(this instanceof ClassHandle)) {
31826
+ return false;
31827
+ }
31828
+ if (!(other instanceof ClassHandle)) {
31829
+ return false;
31830
+ }
31831
+ var leftClass = this.$$.ptrType.registeredClass;
31832
+ var left = this.$$.ptr;
31833
+ other.$$ = /** @type {Object} */other.$$;
31834
+ var rightClass = other.$$.ptrType.registeredClass;
31835
+ var right = other.$$.ptr;
31836
+ while (leftClass.baseClass) {
31837
+ left = leftClass.upcast(left);
31838
+ leftClass = leftClass.baseClass;
31839
+ }
31840
+ while (rightClass.baseClass) {
31841
+ right = rightClass.upcast(right);
31842
+ rightClass = rightClass.baseClass;
31843
+ }
31844
+ return leftClass === rightClass && left === right;
31845
+ },
31846
+ clone: function clone() {
31847
+ if (!this.$$.ptr) {
31848
+ throwInstanceAlreadyDeleted(this);
31849
+ }
31850
+ if (this.$$.preservePointerOnDelete) {
31851
+ this.$$.count.value += 1;
31852
+ return this;
31853
+ } else {
31854
+ var clone = _attachFinalizer(Object.create(Object.getPrototypeOf(this), {
31855
+ $$: {
31856
+ value: shallowCopyInternalPointer(this.$$)
31857
+ }
31858
+ }));
31859
+ clone.$$.count.value += 1;
31860
+ clone.$$.deleteScheduled = false;
31861
+ return clone;
31862
+ }
31863
+ },
31864
+ "delete": function _delete() {
31865
+ if (!this.$$.ptr) {
31866
+ throwInstanceAlreadyDeleted(this);
31867
+ }
31868
+ if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
31869
+ throwBindingError('Object already scheduled for deletion');
31870
+ }
31871
+ detachFinalizer(this);
31872
+ releaseClassHandle(this.$$);
31873
+ if (!this.$$.preservePointerOnDelete) {
31874
+ this.$$.smartPtr = undefined;
31875
+ this.$$.ptr = undefined;
31876
+ }
31877
+ },
31878
+ isDeleted: function isDeleted() {
31879
+ return !this.$$.ptr;
31880
+ },
31881
+ deleteLater: function deleteLater() {
31882
+ if (!this.$$.ptr) {
31883
+ throwInstanceAlreadyDeleted(this);
31884
+ }
31885
+ if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
31886
+ throwBindingError('Object already scheduled for deletion');
31887
+ }
31888
+ this.$$.deleteScheduled = true;
31889
+ return this;
31890
+ }
31891
+ });
31892
+
31893
+ // Support `using ...` from https://github.com/tc39/proposal-explicit-resource-management.
31894
+ var symbolDispose = Symbol.dispose;
31895
+ if (symbolDispose) {
31896
+ proto[symbolDispose] = proto['delete'];
31897
+ }
31898
+ };
31899
+ /** @constructor */
31900
+ createNamedFunction = function createNamedFunction(name, func) {
31901
+ return Object.defineProperty(func, 'name', {
31902
+ value: name
31903
+ });
31904
+ };
31905
+ registeredPointers = {};
31906
+ ensureOverloadTable = function ensureOverloadTable(proto, methodName, humanName) {
31907
+ if (undefined === proto[methodName].overloadTable) {
31908
+ var prevFunc = proto[methodName];
31909
+ // Inject an overload resolver function that routes to the appropriate overload based on the number of arguments.
31910
+ proto[methodName] = function () {
31911
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31912
+ args[_key] = arguments[_key];
31913
+ }
31914
+ // TODO This check can be removed in -O3 level "unsafe" optimizations.
31915
+ if (!proto[methodName].overloadTable.hasOwnProperty(args.length)) {
31916
+ throwBindingError("Function '" + humanName + "' called with an invalid number of arguments (" + args.length + ") - expects one of (" + proto[methodName].overloadTable + ")!");
31917
+ }
31918
+ return proto[methodName].overloadTable[args.length].apply(this, args);
31919
+ };
31920
+ // Move the previous function into the overload table.
31921
+ proto[methodName].overloadTable = [];
31922
+ proto[methodName].overloadTable[prevFunc.argCount] = prevFunc;
31923
+ }
31924
+ };
31925
+ /** @param {number=} numArguments */
31926
+ exposePublicSymbol = function exposePublicSymbol(name, value, numArguments) {
31927
+ if (Module.hasOwnProperty(name)) {
31928
+ {
31929
+ throwBindingError("Cannot register public name '" + name + "' twice");
31930
+ }
31931
+
31932
+ // We are exposing a function with the same name as an existing function. Create an overload table and a function selector
31933
+ // that routes between the two.
31934
+ ensureOverloadTable(Module, name, name);
31935
+ if (Module[name].overloadTable.hasOwnProperty(numArguments)) {
31936
+ throwBindingError("Cannot register multiple overloads of a function with the same number of arguments (" + numArguments + ")!");
31937
+ }
31938
+ // Add the new function into the overload table.
31939
+ Module[name].overloadTable[numArguments] = value;
31940
+ } else {
31941
+ Module[name] = value;
31942
+ Module[name].argCount = numArguments;
31943
+ }
31944
+ };
31945
+ char_0 = 48;
31946
+ char_9 = 57;
31947
+ makeLegalFunctionName = function makeLegalFunctionName(name) {
31948
+ name = name.replace(/[^a-zA-Z0-9_]/g, '$');
31949
+ var f = name.charCodeAt(0);
31950
+ if (f >= char_0 && f <= char_9) {
31951
+ return "_" + name;
31952
+ }
31953
+ return name;
31954
+ };
31955
+ /** @constructor */
31956
+ upcastPointer = function upcastPointer(ptr, ptrClass, desiredClass) {
31957
+ while (ptrClass !== desiredClass) {
31958
+ if (!ptrClass.upcast) {
31959
+ throwBindingError("Expected null or instance of " + desiredClass.name + ", got an instance of " + ptrClass.name);
31960
+ }
31961
+ ptr = ptrClass.upcast(ptr);
31962
+ ptrClass = ptrClass.baseClass;
31963
+ }
31964
+ return ptr;
31965
+ };
31966
+ embindRepr = function embindRepr(v) {
31967
+ if (v === null) {
31968
+ return 'null';
31969
+ }
31970
+ var t = typeof v;
31971
+ if (t === 'object' || t === 'array' || t === 'function') {
31972
+ return v.toString();
31973
+ } else {
31974
+ return '' + v;
31975
+ }
31976
+ };
31977
+ /** @suppress {globalThis} */
31978
+ /** @suppress {globalThis} */
31979
+ /** @suppress {globalThis} */
31980
+ /** @suppress {globalThis} */
31981
+ _downcastPointer = function downcastPointer(ptr, ptrClass, desiredClass) {
31982
+ if (ptrClass === desiredClass) {
31983
+ return ptr;
31984
+ }
31985
+ if (undefined === desiredClass.baseClass) {
31986
+ return null; // no conversion
31987
+ }
31988
+ var rv = _downcastPointer(ptr, ptrClass, desiredClass.baseClass);
31989
+ if (rv === null) {
31990
+ return null;
31991
+ }
31992
+ return desiredClass.downcast(rv);
31993
+ };
31994
+ registeredInstances = {};
31995
+ getBasestPointer = function getBasestPointer(class_, ptr) {
31996
+ if (ptr === undefined) {
31997
+ throwBindingError('ptr should not be undefined');
31998
+ }
31999
+ while (class_.baseClass) {
32000
+ ptr = class_.upcast(ptr);
32001
+ class_ = class_.baseClass;
32002
+ }
32003
+ return ptr;
32004
+ };
32005
+ getInheritedInstance = function getInheritedInstance(class_, ptr) {
32006
+ ptr = getBasestPointer(class_, ptr);
32007
+ return registeredInstances[ptr];
32008
+ };
32009
+ InternalError = /*#__PURE__*/function (_Error2) {
32010
+ function InternalError(message) {
32011
+ var _this3;
32012
+ _this3 = _Error2.call(this, message) || this;
32013
+ _this3.name = 'InternalError';
32014
+ return _this3;
32015
+ }
32016
+ _inheritsLoose(InternalError, _Error2);
32017
+ return InternalError;
32018
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
32019
+ throwInternalError = function throwInternalError(message) {
32020
+ throw new InternalError(message);
32021
+ };
32022
+ makeClassHandle = function makeClassHandle(prototype, record) {
32023
+ if (!record.ptrType || !record.ptr) {
32024
+ throwInternalError('makeClassHandle requires ptr and ptrType');
32025
+ }
32026
+ var hasSmartPtrType = !!record.smartPtrType;
32027
+ var hasSmartPtr = !!record.smartPtr;
32028
+ if (hasSmartPtrType !== hasSmartPtr) {
32029
+ throwInternalError('Both smartPtrType and smartPtr must be specified');
32030
+ }
32031
+ record.count = {
32032
+ value: 1
32033
+ };
32034
+ return _attachFinalizer(Object.create(prototype, {
32035
+ $$: {
32036
+ value: record,
32037
+ writable: true
32038
+ }
32039
+ }));
32040
+ };
32041
+ /** @suppress {globalThis} */
32042
+ init_RegisteredPointer = function init_RegisteredPointer() {
32043
+ Object.assign(RegisteredPointer.prototype, {
32044
+ getPointee: function getPointee(ptr) {
32045
+ if (this.rawGetPointee) {
32046
+ ptr = this.rawGetPointee(ptr);
32047
+ }
32048
+ return ptr;
32049
+ },
32050
+ destructor: function destructor(ptr) {
32051
+ var _this$rawDestructor;
32052
+ (_this$rawDestructor = this.rawDestructor) == null || _this$rawDestructor.call(this, ptr);
32053
+ },
32054
+ readValueFromPointer: readPointer,
32055
+ fromWireType: RegisteredPointer_fromWireType
32056
+ });
32057
+ };
32058
+ /** @constructor
32059
+ @param {*=} pointeeType,
32060
+ @param {*=} sharingPolicy,
32061
+ @param {*=} rawGetPointee,
32062
+ @param {*=} rawConstructor,
32063
+ @param {*=} rawShare,
32064
+ @param {*=} rawDestructor,
32065
+ */
32066
+ /** @param {number=} numArguments */
32067
+ replacePublicSymbol = function replacePublicSymbol(name, value, numArguments) {
32068
+ if (!Module.hasOwnProperty(name)) {
32069
+ throwInternalError('Replacing nonexistent public symbol');
32070
+ }
32071
+ // If there's an overload table for this symbol, replace the symbol in the overload table instead.
32072
+ if (undefined !== Module[name].overloadTable && undefined !== numArguments) ;else {
32073
+ Module[name] = value;
32074
+ Module[name].argCount = numArguments;
32075
+ }
32076
+ };
32077
+ wasmTableMirror = [];
32078
+ /** @type {WebAssembly.Table} */
32079
+ getWasmTableEntry = function getWasmTableEntry(funcPtr) {
32080
+ var func = wasmTableMirror[funcPtr];
32081
+ if (!func) {
32082
+ /** @suppress {checkTypes} */
32083
+ wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
32084
+ }
32085
+ return func;
32086
+ };
32087
+ embind__requireFunction = function embind__requireFunction(signature, rawFunction, isAsync) {
32088
+ signature = AsciiToString(signature);
32089
+ function makeDynCaller() {
32090
+ var rtn = getWasmTableEntry(rawFunction);
32091
+ return rtn;
32092
+ }
32093
+ var fp = makeDynCaller();
32094
+ if (typeof fp != 'function') {
32095
+ throwBindingError("unknown function pointer with signature " + signature + ": " + rawFunction);
32096
+ }
32097
+ return fp;
32098
+ };
32099
+ UnboundTypeError = /*#__PURE__*/function (_Error3) {
32100
+ function UnboundTypeError() {
32101
+ return _Error3.apply(this, arguments) || this;
32102
+ }
32103
+ _inheritsLoose(UnboundTypeError, _Error3);
32104
+ return UnboundTypeError;
32105
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
32106
+ getTypeName = function getTypeName(type) {
32107
+ var ptr = ___getTypeName(type);
32108
+ var rv = AsciiToString(ptr);
32109
+ _free(ptr);
32110
+ return rv;
32111
+ };
32112
+ throwUnboundTypeError = function throwUnboundTypeError(message, types) {
32113
+ var unboundTypes = [];
32114
+ var seen = {};
32115
+ function visit(type) {
32116
+ if (seen[type]) {
32117
+ return;
32118
+ }
32119
+ if (registeredTypes[type]) {
32120
+ return;
32121
+ }
32122
+ if (typeDependencies[type]) {
32123
+ typeDependencies[type].forEach(visit);
32124
+ return;
32125
+ }
32126
+ unboundTypes.push(type);
32127
+ seen[type] = true;
32128
+ }
32129
+ types.forEach(visit);
32130
+ throw new UnboundTypeError(message + ": " + unboundTypes.map(getTypeName).join([', ']));
32131
+ };
32132
+ whenDependentTypesAreResolved = function whenDependentTypesAreResolved(myTypes, dependentTypes, getTypeConverters) {
32133
+ myTypes.forEach(function (type) {
32134
+ return typeDependencies[type] = dependentTypes;
32135
+ });
32136
+ function onComplete(typeConverters) {
32137
+ var myTypeConverters = getTypeConverters(typeConverters);
32138
+ if (myTypeConverters.length !== myTypes.length) {
32139
+ throwInternalError('Mismatched type converter count');
32140
+ }
32141
+ for (var i = 0; i < myTypes.length; ++i) {
32142
+ registerType(myTypes[i], myTypeConverters[i]);
32143
+ }
32144
+ }
32145
+ var typeConverters = new Array(dependentTypes.length);
32146
+ var unregisteredTypes = [];
32147
+ var registered = 0;
32148
+ dependentTypes.forEach(function (dt, i) {
32149
+ if (registeredTypes.hasOwnProperty(dt)) {
32150
+ typeConverters[i] = registeredTypes[dt];
32151
+ } else {
32152
+ unregisteredTypes.push(dt);
32153
+ if (!awaitingDependencies.hasOwnProperty(dt)) {
32154
+ awaitingDependencies[dt] = [];
32155
+ }
32156
+ awaitingDependencies[dt].push(function () {
32157
+ typeConverters[i] = registeredTypes[dt];
32158
+ ++registered;
32159
+ if (registered === unregisteredTypes.length) {
32160
+ onComplete(typeConverters);
32161
+ }
32162
+ });
32163
+ }
32164
+ });
32165
+ if (0 === unregisteredTypes.length) {
32166
+ onComplete(typeConverters);
32167
+ }
32168
+ };
32169
+ __embind_register_class = function __embind_register_class(rawType, rawPointerType, rawConstPointerType, baseClassRawType, getActualTypeSignature, getActualType, upcastSignature, upcast, downcastSignature, downcast, name, destructorSignature, rawDestructor) {
32170
+ name = AsciiToString(name);
32171
+ getActualType = embind__requireFunction(getActualTypeSignature, getActualType);
32172
+ upcast && (upcast = embind__requireFunction(upcastSignature, upcast));
32173
+ downcast && (downcast = embind__requireFunction(downcastSignature, downcast));
32174
+ rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);
32175
+ var legalFunctionName = makeLegalFunctionName(name);
32176
+ exposePublicSymbol(legalFunctionName, function () {
32177
+ // this code cannot run if baseClassRawType is zero
32178
+ throwUnboundTypeError("Cannot construct " + name + " due to unbound types", [baseClassRawType]);
32179
+ });
32180
+ whenDependentTypesAreResolved([rawType, rawPointerType, rawConstPointerType], baseClassRawType ? [baseClassRawType] : [], function (base) {
32181
+ base = base[0];
32182
+ var baseClass;
32183
+ var basePrototype;
32184
+ if (baseClassRawType) {
32185
+ baseClass = base.registeredClass;
32186
+ basePrototype = baseClass.instancePrototype;
32187
+ } else {
32188
+ basePrototype = ClassHandle.prototype;
32189
+ }
32190
+ var constructor = createNamedFunction(name, function () {
32191
+ if (Object.getPrototypeOf(this) !== instancePrototype) {
32192
+ throw new BindingError("Use 'new' to construct " + name);
32193
+ }
32194
+ if (undefined === registeredClass.constructor_body) {
32195
+ throw new BindingError(name + " has no accessible constructor");
32196
+ }
32197
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
32198
+ args[_key2] = arguments[_key2];
32199
+ }
32200
+ var body = registeredClass.constructor_body[args.length];
32201
+ if (undefined === body) {
32202
+ throw new BindingError("Tried to invoke ctor of " + name + " with invalid number of parameters (" + args.length + ") - expected (" + Object.keys(registeredClass.constructor_body).toString() + ") parameters instead!");
32203
+ }
32204
+ return body.apply(this, args);
32205
+ });
32206
+ var instancePrototype = Object.create(basePrototype, {
32207
+ constructor: {
32208
+ value: constructor
32209
+ }
32210
+ });
32211
+ constructor.prototype = instancePrototype;
32212
+ var registeredClass = new RegisteredClass(name, constructor, instancePrototype, rawDestructor, baseClass, getActualType, upcast, downcast);
32213
+ if (registeredClass.baseClass) {
32214
+ var _registeredClass$base, _registeredClass$base2;
32215
+ // Keep track of class hierarchy. Used to allow sub-classes to inherit class functions.
32216
+ (_registeredClass$base2 = (_registeredClass$base = registeredClass.baseClass).__derivedClasses) != null ? _registeredClass$base2 : _registeredClass$base.__derivedClasses = [];
32217
+ registeredClass.baseClass.__derivedClasses.push(registeredClass);
32218
+ }
32219
+ var referenceConverter = new RegisteredPointer(name, registeredClass, true, false, false);
32220
+ var pointerConverter = new RegisteredPointer(name + '*', registeredClass, false, false, false);
32221
+ var constPointerConverter = new RegisteredPointer(name + ' const*', registeredClass, false, true, false);
32222
+ registeredPointers[rawType] = {
32223
+ pointerType: pointerConverter,
32224
+ constPointerType: constPointerConverter
32225
+ };
32226
+ replacePublicSymbol(legalFunctionName, constructor);
32227
+ return [referenceConverter, pointerConverter, constPointerConverter];
32228
+ });
32229
+ };
32230
+ heap32VectorToArray = function heap32VectorToArray(count, firstElement) {
32231
+ var array = [];
32232
+ for (var i = 0; i < count; i++) {
32233
+ // TODO(https://github.com/emscripten-core/emscripten/issues/17310):
32234
+ // Find a way to hoist the `>> 2` or `>> 3` out of this loop.
32235
+ array.push(HEAPU32[firstElement + i * 4 >> 2]);
32236
+ }
32237
+ return array;
32238
+ };
32239
+ runDestructors = function runDestructors(destructors) {
32240
+ while (destructors.length) {
32241
+ var ptr = destructors.pop();
32242
+ var del = destructors.pop();
32243
+ del(ptr);
32244
+ }
32245
+ };
32246
+ __embind_register_class_constructor = function __embind_register_class_constructor(rawClassType, argCount, rawArgTypesAddr, invokerSignature, invoker, rawConstructor) {
32247
+ var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
32248
+ invoker = embind__requireFunction(invokerSignature, invoker);
32249
+ whenDependentTypesAreResolved([], [rawClassType], function (classType) {
32250
+ classType = classType[0];
32251
+ var humanName = "constructor " + classType.name;
32252
+ if (undefined === classType.registeredClass.constructor_body) {
32253
+ classType.registeredClass.constructor_body = [];
32254
+ }
32255
+ if (undefined !== classType.registeredClass.constructor_body[argCount - 1]) {
32256
+ throw new BindingError("Cannot register multiple constructors with identical number of parameters (" + (argCount - 1) + ") for class '" + classType.name + "'! Overload resolution is currently only performed using the parameter count, not actual type info!");
32257
+ }
32258
+ classType.registeredClass.constructor_body[argCount - 1] = function () {
32259
+ throwUnboundTypeError("Cannot construct " + classType.name + " due to unbound types", rawArgTypes);
32260
+ };
32261
+ whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) {
32262
+ // Insert empty slot for context type (argTypes[1]).
32263
+ argTypes.splice(1, 0, null);
32264
+ classType.registeredClass.constructor_body[argCount - 1] = craftInvokerFunction(humanName, argTypes, null, invoker, rawConstructor);
32265
+ return [];
32266
+ });
32267
+ return [];
32268
+ });
32269
+ };
32270
+ getFunctionName = function getFunctionName(signature) {
32271
+ signature = signature.trim();
32272
+ var argsIndex = signature.indexOf('(');
32273
+ if (argsIndex === -1) return signature;
32274
+ return signature.slice(0, argsIndex);
32275
+ };
32276
+ __embind_register_class_function = function __embind_register_class_function(rawClassType, methodName, argCount, rawArgTypesAddr,
32277
+ // [ReturnType, ThisType, Args...]
32278
+ invokerSignature, rawInvoker, context, isPureVirtual, isAsync, isNonnullReturn) {
32279
+ var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
32280
+ methodName = AsciiToString(methodName);
32281
+ methodName = getFunctionName(methodName);
32282
+ rawInvoker = embind__requireFunction(invokerSignature, rawInvoker, isAsync);
32283
+ whenDependentTypesAreResolved([], [rawClassType], function (classType) {
32284
+ classType = classType[0];
32285
+ var humanName = classType.name + "." + methodName;
32286
+ if (methodName.startsWith('@@')) {
32287
+ methodName = Symbol[methodName.substring(2)];
32288
+ }
32289
+ if (isPureVirtual) {
32290
+ classType.registeredClass.pureVirtualFunctions.push(methodName);
32291
+ }
32292
+ function unboundTypesHandler() {
32293
+ throwUnboundTypeError("Cannot call " + humanName + " due to unbound types", rawArgTypes);
32294
+ }
32295
+ var proto = classType.registeredClass.instancePrototype;
32296
+ var method = proto[methodName];
32297
+ if (undefined === method || undefined === method.overloadTable && method.className !== classType.name && method.argCount === argCount - 2) {
32298
+ // This is the first overload to be registered, OR we are replacing a
32299
+ // function in the base class with a function in the derived class.
32300
+ unboundTypesHandler.argCount = argCount - 2;
32301
+ unboundTypesHandler.className = classType.name;
32302
+ proto[methodName] = unboundTypesHandler;
32303
+ } else {
32304
+ // There was an existing function with the same name registered. Set up
32305
+ // a function overload routing table.
32306
+ ensureOverloadTable(proto, methodName, humanName);
32307
+ proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler;
32308
+ }
32309
+ whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) {
32310
+ var memberFunction = craftInvokerFunction(humanName, argTypes, classType, rawInvoker, context, isAsync);
32311
+
32312
+ // Replace the initial unbound-handler-stub function with the
32313
+ // appropriate member function, now that all types are resolved. If
32314
+ // multiple overloads are registered for this function, the function
32315
+ // goes into an overload table.
32316
+ if (undefined === proto[methodName].overloadTable) {
32317
+ // Set argCount in case an overload is registered later
32318
+ memberFunction.argCount = argCount - 2;
32319
+ proto[methodName] = memberFunction;
32320
+ } else {
32321
+ proto[methodName].overloadTable[argCount - 2] = memberFunction;
32322
+ }
32323
+ return [];
32324
+ });
32325
+ return [];
32326
+ });
32327
+ };
32328
+ emval_freelist = [];
32329
+ emval_handles = [0, 1,, 1, null, 1, true, 1, false, 1];
32330
+ __emval_decref = function __emval_decref(handle) {
32331
+ if (handle > 9 && 0 === --emval_handles[handle + 1]) {
32332
+ emval_handles[handle] = undefined;
32333
+ emval_freelist.push(handle);
32334
+ }
32335
+ };
32336
+ Emval = {
32337
+ toValue: function toValue(handle) {
32338
+ if (!handle) {
32339
+ throwBindingError("Cannot use deleted val. handle = " + handle);
32340
+ }
32341
+ return emval_handles[handle];
32342
+ },
32343
+ toHandle: function toHandle(value) {
32344
+ switch (value) {
32345
+ case undefined:
32346
+ return 2;
32347
+ case null:
32348
+ return 4;
32349
+ case true:
32350
+ return 6;
32351
+ case false:
32352
+ return 8;
32353
+ default:
32354
+ {
32355
+ var handle = emval_freelist.pop() || emval_handles.length;
32356
+ emval_handles[handle] = value;
32357
+ emval_handles[handle + 1] = 1;
32358
+ return handle;
32359
+ }
32360
+ }
32361
+ }
32362
+ };
32363
+ EmValType = {
32364
+ name: 'emscripten::val',
32365
+ fromWireType: function fromWireType(handle) {
32366
+ var rv = Emval.toValue(handle);
32367
+ __emval_decref(handle);
32368
+ return rv;
32369
+ },
32370
+ toWireType: function toWireType(destructors, value) {
32371
+ return Emval.toHandle(value);
32372
+ },
32373
+ readValueFromPointer: readPointer,
32374
+ destructorFunction: null // This type does not need a destructor
32375
+
32376
+ // TODO: do we need a deleteObject here? write a test where
32377
+ // emval is passed into JS via an interface
32378
+ };
32379
+ __embind_register_emval = function __embind_register_emval(rawType) {
32380
+ return registerType(rawType, EmValType);
32381
+ };
32382
+ floatReadValueFromPointer = function floatReadValueFromPointer(name, width) {
32383
+ switch (width) {
32384
+ case 4:
32385
+ return function (pointer) {
32386
+ return this.fromWireType(HEAPF32[pointer >> 2]);
32387
+ };
32388
+ case 8:
32389
+ return function (pointer) {
32390
+ return this.fromWireType(HEAPF64[pointer >> 3]);
32391
+ };
32392
+ default:
32393
+ throw new TypeError("invalid float width (" + width + "): " + name);
32394
+ }
32395
+ };
32396
+ __embind_register_float = function __embind_register_float(rawType, name, size) {
32397
+ name = AsciiToString(name);
32398
+ registerType(rawType, {
32399
+ name: name,
32400
+ fromWireType: function fromWireType(value) {
32401
+ return value;
32402
+ },
32403
+ toWireType: function toWireType(destructors, value) {
32404
+ // The VM will perform JS to Wasm value conversion, according to the spec:
32405
+ // https://www.w3.org/TR/wasm-js-api-1/#towebassemblyvalue
32406
+ return value;
32407
+ },
32408
+ readValueFromPointer: floatReadValueFromPointer(name, size),
32409
+ destructorFunction: null // This type does not need a destructor
32410
+ });
32411
+ };
32412
+ /** @suppress {globalThis} */
32413
+ __embind_register_integer = function __embind_register_integer(primitiveType, name, size, minRange, maxRange) {
32414
+ name = AsciiToString(name);
32415
+ var isUnsignedType = minRange === 0;
32416
+ var fromWireType = function fromWireType(value) {
32417
+ return value;
32418
+ };
32419
+ if (isUnsignedType) {
32420
+ var bitshift = 32 - 8 * size;
32421
+ fromWireType = function fromWireType(value) {
32422
+ return value << bitshift >>> bitshift;
32423
+ };
32424
+ maxRange = fromWireType(maxRange);
32425
+ }
32426
+ registerType(primitiveType, {
32427
+ name: name,
32428
+ fromWireType: fromWireType,
32429
+ toWireType: function toWireType(destructors, value) {
32430
+ // The VM will perform JS to Wasm value conversion, according to the spec:
32431
+ // https://www.w3.org/TR/wasm-js-api-1/#towebassemblyvalue
32432
+ return value;
32433
+ },
32434
+ readValueFromPointer: integerReadValueFromPointer(name, size, minRange !== 0),
32435
+ destructorFunction: null // This type does not need a destructor
32436
+ });
32437
+ };
32438
+ __embind_register_memory_view = function __embind_register_memory_view(rawType, dataTypeIndex, name) {
32439
+ var typeMapping = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array];
32440
+ var TA = typeMapping[dataTypeIndex];
32441
+ function decodeMemoryView(handle) {
32442
+ var size = HEAPU32[handle >> 2];
32443
+ var data = HEAPU32[handle + 4 >> 2];
32444
+ return new TA(HEAP8.buffer, data, size);
32445
+ }
32446
+ name = AsciiToString(name);
32447
+ registerType(rawType, {
32448
+ name: name,
32449
+ fromWireType: decodeMemoryView,
32450
+ readValueFromPointer: decodeMemoryView
32451
+ }, {
32452
+ ignoreDuplicateRegistrations: true
32453
+ });
32454
+ };
32455
+ __embind_register_smart_ptr = function __embind_register_smart_ptr(rawType, rawPointeeType, name, sharingPolicy, getPointeeSignature, rawGetPointee, constructorSignature, rawConstructor, shareSignature, rawShare, destructorSignature, rawDestructor) {
32456
+ name = AsciiToString(name);
32457
+ rawGetPointee = embind__requireFunction(getPointeeSignature, rawGetPointee);
32458
+ rawConstructor = embind__requireFunction(constructorSignature, rawConstructor);
32459
+ rawShare = embind__requireFunction(shareSignature, rawShare);
32460
+ rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);
32461
+ whenDependentTypesAreResolved([rawType], [rawPointeeType], function (pointeeType) {
32462
+ pointeeType = pointeeType[0];
32463
+ var registeredPointer = new RegisteredPointer(name, pointeeType.registeredClass, false, false,
32464
+ // smart pointer properties
32465
+ true, pointeeType, sharingPolicy, rawGetPointee, rawConstructor, rawShare, rawDestructor);
32466
+ return [registeredPointer];
32467
+ });
32468
+ };
32469
+ stringToUTF8Array = function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
32470
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
32471
+ // undefined and false each don't write out any bytes.
32472
+ if (!(maxBytesToWrite > 0)) return 0;
32473
+ var startIdx = outIdx;
32474
+ var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
32475
+ for (var i = 0; i < str.length; ++i) {
32476
+ // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
32477
+ // and https://www.ietf.org/rfc/rfc2279.txt
32478
+ // and https://tools.ietf.org/html/rfc3629
32479
+ var u = str.codePointAt(i);
32480
+ if (u <= 0x7f) {
32481
+ if (outIdx >= endIdx) break;
32482
+ heap[outIdx++] = u;
32483
+ } else if (u <= 0x7ff) {
32484
+ if (outIdx + 1 >= endIdx) break;
32485
+ heap[outIdx++] = 0xc0 | u >> 6;
32486
+ heap[outIdx++] = 0x80 | u & 63;
32487
+ } else if (u <= 0xffff) {
32488
+ if (outIdx + 2 >= endIdx) break;
32489
+ heap[outIdx++] = 0xe0 | u >> 12;
32490
+ heap[outIdx++] = 0x80 | u >> 6 & 63;
32491
+ heap[outIdx++] = 0x80 | u & 63;
32492
+ } else {
32493
+ if (outIdx + 3 >= endIdx) break;
32494
+ heap[outIdx++] = 0xf0 | u >> 18;
32495
+ heap[outIdx++] = 0x80 | u >> 12 & 63;
32496
+ heap[outIdx++] = 0x80 | u >> 6 & 63;
32497
+ heap[outIdx++] = 0x80 | u & 63;
32498
+ // Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
32499
+ // We need to manually skip over the second code unit for correct iteration.
32500
+ i++;
32501
+ }
32502
+ }
32503
+ // Null-terminate the pointer to the buffer.
32504
+ heap[outIdx] = 0;
32505
+ return outIdx - startIdx;
32506
+ };
32507
+ stringToUTF8 = function stringToUTF8(str, outPtr, maxBytesToWrite) {
32508
+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
32509
+ };
32510
+ lengthBytesUTF8 = function lengthBytesUTF8(str) {
32511
+ var len = 0;
32512
+ for (var i = 0; i < str.length; ++i) {
32513
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
32514
+ // unit, not a Unicode code point of the character! So decode
32515
+ // UTF16->UTF32->UTF8.
32516
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
32517
+ var c = str.charCodeAt(i); // possibly a lead surrogate
32518
+ if (c <= 0x7f) {
32519
+ len++;
32520
+ } else if (c <= 0x7ff) {
32521
+ len += 2;
32522
+ } else if (c >= 0xd800 && c <= 0xdfff) {
32523
+ len += 4;
32524
+ ++i;
32525
+ } else {
32526
+ len += 3;
32527
+ }
32528
+ }
32529
+ return len;
32530
+ };
32531
+ UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
32532
+ findStringEnd = function findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul) {
32533
+ var maxIdx = idx + maxBytesToRead;
32534
+ if (ignoreNul) return maxIdx;
32535
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
32536
+ // null terminator by itself.
32537
+ // As a tiny code save trick, compare idx against maxIdx using a negation,
32538
+ // so that maxBytesToRead=undefined/NaN means Infinity.
32539
+ while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
32540
+ return idx;
32541
+ };
32542
+ /**
32543
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
32544
+ * array that contains uint8 values, returns a copy of that string as a
32545
+ * Javascript String object.
32546
+ * heapOrArray is either a regular array, or a JavaScript typed array view.
32547
+ * @param {number=} idx
32548
+ * @param {number=} maxBytesToRead
32549
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
32550
+ * @return {string}
32551
+ */
32552
+ UTF8ArrayToString = function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead, ignoreNul) {
32553
+ if (idx === void 0) {
32554
+ idx = 0;
32555
+ }
32556
+ var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
32557
+
32558
+ // When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
32559
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
32560
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
32561
+ }
32562
+ var str = '';
32563
+ while (idx < endPtr) {
32564
+ // For UTF8 byte structure, see:
32565
+ // http://en.wikipedia.org/wiki/UTF-8#Description
32566
+ // https://www.ietf.org/rfc/rfc2279.txt
32567
+ // https://tools.ietf.org/html/rfc3629
32568
+ var u0 = heapOrArray[idx++];
32569
+ if (!(u0 & 0x80)) {
32570
+ str += String.fromCharCode(u0);
32571
+ continue;
32572
+ }
32573
+ var u1 = heapOrArray[idx++] & 63;
32574
+ if ((u0 & 0xe0) == 0xc0) {
32575
+ str += String.fromCharCode((u0 & 31) << 6 | u1);
32576
+ continue;
32577
+ }
32578
+ var u2 = heapOrArray[idx++] & 63;
32579
+ if ((u0 & 0xf0) == 0xe0) {
32580
+ u0 = (u0 & 15) << 12 | u1 << 6 | u2;
32581
+ } else {
32582
+ u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
32583
+ }
32584
+ if (u0 < 0x10000) {
32585
+ str += String.fromCharCode(u0);
32586
+ } else {
32587
+ var ch = u0 - 0x10000;
32588
+ str += String.fromCharCode(0xd800 | ch >> 10, 0xdc00 | ch & 0x3ff);
32589
+ }
32590
+ }
32591
+ return str;
32592
+ };
32593
+ /**
32594
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
32595
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
32596
+ *
32597
+ * @param {number} ptr
32598
+ * @param {number=} maxBytesToRead - An optional length that specifies the
32599
+ * maximum number of bytes to read. You can omit this parameter to scan the
32600
+ * string until the first 0 byte. If maxBytesToRead is passed, and the string
32601
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
32602
+ * string will cut short at that byte index.
32603
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
32604
+ * @return {string}
32605
+ */
32606
+ UTF8ToString = function UTF8ToString(ptr, maxBytesToRead, ignoreNul) {
32607
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : '';
32608
+ };
32609
+ __embind_register_std_string = function __embind_register_std_string(rawType, name) {
32610
+ name = AsciiToString(name);
32611
+ registerType(rawType, {
32612
+ name: name,
32613
+ // For some method names we use string keys here since they are part of
32614
+ // the public/external API and/or used by the runtime-generated code.
32615
+ fromWireType: function fromWireType(value) {
32616
+ var length = HEAPU32[value >> 2];
32617
+ var payload = value + 4;
32618
+ var str;
32619
+ {
32620
+ str = UTF8ToString(payload, length, true);
32621
+ }
32622
+ _free(value);
32623
+ return str;
32624
+ },
32625
+ toWireType: function toWireType(destructors, value) {
32626
+ if (value instanceof ArrayBuffer) {
32627
+ value = new Uint8Array(value);
32628
+ }
32629
+ var length;
32630
+ var valueIsOfTypeString = typeof value == 'string';
32631
+
32632
+ // We accept `string` or array views with single byte elements
32633
+ if (!(valueIsOfTypeString || ArrayBuffer.isView(value) && value.BYTES_PER_ELEMENT == 1)) {
32634
+ throwBindingError('Cannot pass non-string to std::string');
32635
+ }
32636
+ if (valueIsOfTypeString) {
32637
+ length = lengthBytesUTF8(value);
32638
+ } else {
32639
+ length = value.length;
32640
+ }
32641
+
32642
+ // assumes POINTER_SIZE alignment
32643
+ var base = _malloc(4 + length + 1);
32644
+ var ptr = base + 4;
32645
+ HEAPU32[base >> 2] = length;
32646
+ if (valueIsOfTypeString) {
32647
+ {
32648
+ stringToUTF8(value, ptr, length + 1);
32649
+ }
32650
+ } else {
32651
+ HEAPU8.set(value, ptr);
32652
+ }
32653
+ if (destructors !== null) {
32654
+ destructors.push(_free, base);
32655
+ }
32656
+ return base;
32657
+ },
32658
+ readValueFromPointer: readPointer,
32659
+ destructorFunction: function destructorFunction(ptr) {
32660
+ _free(ptr);
32661
+ }
32662
+ });
32663
+ };
32664
+ UTF16Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf-16le') : undefined;
32665
+ UTF16ToString = function UTF16ToString(ptr, maxBytesToRead, ignoreNul) {
32666
+ var idx = ptr >> 1;
32667
+ var endIdx = findStringEnd(HEAPU16, idx, maxBytesToRead / 2, ignoreNul);
32668
+
32669
+ // When using conditional TextDecoder, skip it for short strings as the overhead of the native call is not worth it.
32670
+ if (endIdx - idx > 16 && UTF16Decoder) return UTF16Decoder.decode(HEAPU16.subarray(idx, endIdx));
32671
+
32672
+ // Fallback: decode without UTF16Decoder
32673
+ var str = '';
32674
+
32675
+ // If maxBytesToRead is not passed explicitly, it will be undefined, and the
32676
+ // for-loop's condition will always evaluate to true. The loop is then
32677
+ // terminated on the first null char.
32678
+ for (var i = idx; i < endIdx; ++i) {
32679
+ var codeUnit = HEAPU16[i];
32680
+ // fromCharCode constructs a character from a UTF-16 code unit, so we can
32681
+ // pass the UTF16 string right through.
32682
+ str += String.fromCharCode(codeUnit);
32683
+ }
32684
+ return str;
32685
+ };
32686
+ stringToUTF16 = function stringToUTF16(str, outPtr, maxBytesToWrite) {
32687
+ var _maxBytesToWrite;
32688
+ // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed.
32689
+ (_maxBytesToWrite = maxBytesToWrite) != null ? _maxBytesToWrite : maxBytesToWrite = 0x7fffffff;
32690
+ if (maxBytesToWrite < 2) return 0;
32691
+ maxBytesToWrite -= 2; // Null terminator.
32692
+ var startPtr = outPtr;
32693
+ var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
32694
+ for (var i = 0; i < numCharsToWrite; ++i) {
32695
+ // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP.
32696
+ var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
32697
+ HEAP16[outPtr >> 1] = codeUnit;
32698
+ outPtr += 2;
32699
+ }
32700
+ // Null-terminate the pointer to the HEAP.
32701
+ HEAP16[outPtr >> 1] = 0;
32702
+ return outPtr - startPtr;
32703
+ };
32704
+ lengthBytesUTF16 = function lengthBytesUTF16(str) {
32705
+ return str.length * 2;
32706
+ };
32707
+ UTF32ToString = function UTF32ToString(ptr, maxBytesToRead, ignoreNul) {
32708
+ var str = '';
32709
+ var startIdx = ptr >> 2;
32710
+ // If maxBytesToRead is not passed explicitly, it will be undefined, and this
32711
+ // will always evaluate to true. This saves on code size.
32712
+ for (var i = 0; !(i >= maxBytesToRead / 4); i++) {
32713
+ var utf32 = HEAPU32[startIdx + i];
32714
+ if (!utf32 && !ignoreNul) break;
32715
+ str += String.fromCodePoint(utf32);
32716
+ }
32717
+ return str;
32718
+ };
32719
+ stringToUTF32 = function stringToUTF32(str, outPtr, maxBytesToWrite) {
32720
+ var _maxBytesToWrite2;
32721
+ // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed.
32722
+ (_maxBytesToWrite2 = maxBytesToWrite) != null ? _maxBytesToWrite2 : maxBytesToWrite = 0x7fffffff;
32723
+ if (maxBytesToWrite < 4) return 0;
32724
+ var startPtr = outPtr;
32725
+ var endPtr = startPtr + maxBytesToWrite - 4;
32726
+ for (var i = 0; i < str.length; ++i) {
32727
+ var codePoint = str.codePointAt(i);
32728
+ // Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
32729
+ // We need to manually skip over the second code unit for correct iteration.
32730
+ if (codePoint > 0xffff) {
32731
+ i++;
32732
+ }
32733
+ HEAP32[outPtr >> 2] = codePoint;
32734
+ outPtr += 4;
32735
+ if (outPtr + 4 > endPtr) break;
32736
+ }
32737
+ // Null-terminate the pointer to the HEAP.
32738
+ HEAP32[outPtr >> 2] = 0;
32739
+ return outPtr - startPtr;
32740
+ };
32741
+ lengthBytesUTF32 = function lengthBytesUTF32(str) {
32742
+ var len = 0;
32743
+ for (var i = 0; i < str.length; ++i) {
32744
+ var codePoint = str.codePointAt(i);
32745
+ // Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
32746
+ // We need to manually skip over the second code unit for correct iteration.
32747
+ if (codePoint > 0xffff) {
32748
+ i++;
32749
+ }
32750
+ len += 4;
32751
+ }
32752
+ return len;
32753
+ };
32754
+ __embind_register_std_wstring = function __embind_register_std_wstring(rawType, charSize, name) {
32755
+ name = AsciiToString(name);
32756
+ var decodeString, encodeString, lengthBytesUTF;
32757
+ if (charSize === 2) {
32758
+ decodeString = UTF16ToString;
32759
+ encodeString = stringToUTF16;
32760
+ lengthBytesUTF = lengthBytesUTF16;
32761
+ } else {
32762
+ decodeString = UTF32ToString;
32763
+ encodeString = stringToUTF32;
32764
+ lengthBytesUTF = lengthBytesUTF32;
32765
+ }
32766
+ registerType(rawType, {
32767
+ name: name,
32768
+ fromWireType: function fromWireType(value) {
32769
+ // Code mostly taken from _embind_register_std_string fromWireType
32770
+ var length = HEAPU32[value >> 2];
32771
+ var str = decodeString(value + 4, length * charSize, true);
32772
+ _free(value);
32773
+ return str;
32774
+ },
32775
+ toWireType: function toWireType(destructors, value) {
32776
+ if (!(typeof value == 'string')) {
32777
+ throwBindingError("Cannot pass non-string to C++ string type " + name);
32778
+ }
32779
+
32780
+ // assumes POINTER_SIZE alignment
32781
+ var length = lengthBytesUTF(value);
32782
+ var ptr = _malloc(4 + length + charSize);
32783
+ HEAPU32[ptr >> 2] = length / charSize;
32784
+ encodeString(value, ptr + 4, length + charSize);
32785
+ if (destructors !== null) {
32786
+ destructors.push(_free, ptr);
32787
+ }
32788
+ return ptr;
32789
+ },
32790
+ readValueFromPointer: readPointer,
32791
+ destructorFunction: function destructorFunction(ptr) {
32792
+ _free(ptr);
32793
+ }
32794
+ });
32795
+ };
32796
+ __embind_register_void = function __embind_register_void(rawType, name) {
32797
+ name = AsciiToString(name);
32798
+ registerType(rawType, {
32799
+ isVoid: true,
32800
+ // void return values can be optimized out sometimes
32801
+ name: name,
32802
+ fromWireType: function fromWireType() {
32803
+ return undefined;
32804
+ },
32805
+ // TODO: assert if anything else is given?
32806
+ toWireType: function toWireType(destructors, o) {
32807
+ return undefined;
32808
+ }
32809
+ });
32810
+ };
32811
+ emval_methodCallers = [];
32812
+ emval_addMethodCaller = function emval_addMethodCaller(caller) {
32813
+ var id = emval_methodCallers.length;
32814
+ emval_methodCallers.push(caller);
32815
+ return id;
32816
+ };
32817
+ requireRegisteredType = function requireRegisteredType(rawType, humanName) {
32818
+ var impl = registeredTypes[rawType];
32819
+ if (undefined === impl) {
32820
+ throwBindingError(humanName + " has unknown type " + getTypeName(rawType));
32821
+ }
32822
+ return impl;
32823
+ };
32824
+ emval_lookupTypes = function emval_lookupTypes(argCount, argTypes) {
32825
+ var a = new Array(argCount);
32826
+ for (var i = 0; i < argCount; ++i) {
32827
+ a[i] = requireRegisteredType(HEAPU32[argTypes + i * 4 >> 2], "parameter " + i);
32828
+ }
32829
+ return a;
32830
+ };
32831
+ emval_returnValue = function emval_returnValue(toReturnWire, destructorsRef, handle) {
32832
+ var destructors = [];
32833
+ var result = toReturnWire(destructors, handle);
32834
+ if (destructors.length) {
32835
+ // void, primitives and any other types w/o destructors don't need to allocate a handle
32836
+ HEAPU32[destructorsRef >> 2] = Emval.toHandle(destructors);
32837
+ }
32838
+ return result;
32839
+ };
32840
+ emval_symbols = {};
32841
+ getStringOrSymbol = function getStringOrSymbol(address) {
32842
+ var symbol = emval_symbols[address];
32843
+ if (symbol === undefined) {
32844
+ return AsciiToString(address);
32845
+ }
32846
+ return symbol;
32847
+ };
32848
+ __emval_create_invoker = function __emval_create_invoker(argCount, argTypesPtr, kind) {
32849
+ var GenericWireTypeSize = 8;
32850
+ var _emval_lookupTypes = emval_lookupTypes(argCount, argTypesPtr),
32851
+ retType = _emval_lookupTypes[0],
32852
+ argTypes = _emval_lookupTypes.slice(1);
32853
+ var toReturnWire = retType.toWireType.bind(retType);
32854
+ var argFromPtr = argTypes.map(function (type) {
32855
+ return type.readValueFromPointer.bind(type);
32856
+ });
32857
+ argCount--; // remove the extracted return type
32858
+
32859
+ var captures = {
32860
+ toValue: Emval.toValue
32861
+ };
32862
+ var args = argFromPtr.map(function (argFromPtr, i) {
32863
+ var captureName = "argFromPtr" + i;
32864
+ captures[captureName] = argFromPtr;
32865
+ return captureName + "(args" + (i ? '+' + i * GenericWireTypeSize : '') + ")";
32866
+ });
32867
+ var functionBody;
32868
+ switch (kind) {
32869
+ case 0:
32870
+ functionBody = 'toValue(handle)';
32871
+ break;
32872
+ case 2:
32873
+ functionBody = 'new (toValue(handle))';
32874
+ break;
32875
+ case 3:
32876
+ functionBody = '';
32877
+ break;
32878
+ case 1:
32879
+ captures['getStringOrSymbol'] = getStringOrSymbol;
32880
+ functionBody = 'toValue(handle)[getStringOrSymbol(methodName)]';
32881
+ break;
32882
+ }
32883
+ functionBody += "(" + args + ")";
32884
+ if (!retType.isVoid) {
32885
+ captures['toReturnWire'] = toReturnWire;
32886
+ captures['emval_returnValue'] = emval_returnValue;
32887
+ functionBody = "return emval_returnValue(toReturnWire, destructorsRef, " + functionBody + ")";
32888
+ }
32889
+ functionBody = "return function (handle, methodName, destructorsRef, args) {\n " + functionBody + "\n }";
32890
+ var invokerFunction = new Function(Object.keys(captures), functionBody).apply(void 0, Object.values(captures));
32891
+ var functionName = "methodCaller<(" + argTypes.map(function (t) {
32892
+ return t.name;
32893
+ }) + ") => " + retType.name + ">";
32894
+ return emval_addMethodCaller(createNamedFunction(functionName, invokerFunction));
32895
+ };
32896
+ __emval_incref = function __emval_incref(handle) {
32897
+ if (handle > 9) {
32898
+ emval_handles[handle + 1] += 1;
32899
+ }
32900
+ };
32901
+ __emval_invoke = function __emval_invoke(caller, handle, methodName, destructorsRef, args) {
32902
+ return emval_methodCallers[caller](handle, methodName, destructorsRef, args);
32903
+ };
32904
+ __emval_run_destructors = function __emval_run_destructors(handle) {
32905
+ var destructors = Emval.toValue(handle);
32906
+ runDestructors(destructors);
32907
+ __emval_decref(handle);
32908
+ };
32909
+ INT53_MAX = 9007199254740992;
32910
+ INT53_MIN = -9007199254740992;
32911
+ bigintToI53Checked = function bigintToI53Checked(num) {
32912
+ return num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
32913
+ };
32914
+ __tzset_js = function __tzset_js(timezone, daylight, std_name, dst_name) {
32915
+ // TODO: Use (malleable) environment variables instead of system settings.
32916
+ var currentYear = new Date().getFullYear();
32917
+ var winter = new Date(currentYear, 0, 1);
32918
+ var summer = new Date(currentYear, 6, 1);
32919
+ var winterOffset = winter.getTimezoneOffset();
32920
+ var summerOffset = summer.getTimezoneOffset();
32921
+
32922
+ // Local standard timezone offset. Local standard time is not adjusted for
32923
+ // daylight savings. This code uses the fact that getTimezoneOffset returns
32924
+ // a greater value during Standard Time versus Daylight Saving Time (DST).
32925
+ // Thus it determines the expected output during Standard Time, and it
32926
+ // compares whether the output of the given date the same (Standard) or less
32927
+ // (DST).
32928
+ var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
32929
+
32930
+ // timezone is specified as seconds west of UTC ("The external variable
32931
+ // `timezone` shall be set to the difference, in seconds, between
32932
+ // Coordinated Universal Time (UTC) and local standard time."), the same
32933
+ // as returned by stdTimezoneOffset.
32934
+ // See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
32935
+ HEAPU32[timezone >> 2] = stdTimezoneOffset * 60;
32936
+ HEAP32[daylight >> 2] = Number(winterOffset != summerOffset);
32937
+ var extractZone = function extractZone(timezoneOffset) {
32938
+ // Why inverse sign?
32939
+ // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
32940
+ var sign = timezoneOffset >= 0 ? '-' : '+';
32941
+ var absOffset = Math.abs(timezoneOffset);
32942
+ var hours = String(Math.floor(absOffset / 60)).padStart(2, '0');
32943
+ var minutes = String(absOffset % 60).padStart(2, '0');
32944
+ return "UTC" + sign + hours + minutes;
32945
+ };
32946
+ var winterName = extractZone(winterOffset);
32947
+ var summerName = extractZone(summerOffset);
32948
+ if (summerOffset < winterOffset) {
32949
+ // Northern hemisphere
32950
+ stringToUTF8(winterName, std_name, 17);
32951
+ stringToUTF8(summerName, dst_name, 17);
32952
+ } else {
32953
+ stringToUTF8(winterName, dst_name, 17);
32954
+ stringToUTF8(summerName, std_name, 17);
32955
+ }
32956
+ };
32957
+ _emscripten_date_now = function _emscripten_date_now() {
32958
+ return Date.now();
32959
+ };
32960
+ getHeapMax = function getHeapMax() {
32961
+ return (
32962
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
32963
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
32964
+ // for any code that deals with heap sizes, which would require special
32965
+ // casing all heap size related code to treat 0 specially.
32966
+ 2147483648
32967
+ );
32968
+ };
32969
+ alignMemory = function alignMemory(size, alignment) {
32970
+ return Math.ceil(size / alignment) * alignment;
32971
+ };
32972
+ growMemory = function growMemory(size) {
32973
+ var oldHeapSize = wasmMemory.buffer.byteLength;
32974
+ var pages = (size - oldHeapSize + 65535) / 65536 | 0;
32975
+ try {
32976
+ // round size grow request up to wasm page size (fixed 64KB per spec)
32977
+ wasmMemory.grow(pages); // .grow() takes a delta compared to the previous size
32978
+ updateMemoryViews();
32979
+ return 1; /*success*/
32980
+ } catch (e) {}
32981
+ // implicit 0 return to save code size (caller will cast "undefined" into 0
32982
+ // anyhow)
32983
+ };
32984
+ _emscripten_resize_heap = function _emscripten_resize_heap(requestedSize) {
32985
+ var oldSize = HEAPU8.length;
32986
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
32987
+ requestedSize >>>= 0;
32988
+ // With multithreaded builds, races can happen (another thread might increase the size
32989
+ // in between), so return a failure, and let the caller retry.
32990
+
32991
+ // Memory resize rules:
32992
+ // 1. Always increase heap size to at least the requested size, rounded up
32993
+ // to next page multiple.
32994
+ // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
32995
+ // geometrically: increase the heap size according to
32996
+ // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
32997
+ // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
32998
+ // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
32999
+ // linearly: increase the heap size by at least
33000
+ // MEMORY_GROWTH_LINEAR_STEP bytes.
33001
+ // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
33002
+ // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
33003
+ // 4. If we were unable to allocate as much memory, it may be due to
33004
+ // over-eager decision to excessively reserve due to (3) above.
33005
+ // Hence if an allocation fails, cut down on the amount of excess
33006
+ // growth, in an attempt to succeed to perform a smaller allocation.
33007
+
33008
+ // A limit is set for how much we can grow. We should not exceed that
33009
+ // (the wasm binary specifies it, so if we tried, we'd fail anyhow).
33010
+ var maxHeapSize = getHeapMax();
33011
+ if (requestedSize > maxHeapSize) {
33012
+ return false;
33013
+ }
33014
+
33015
+ // Loop through potential heap size increases. If we attempt a too eager
33016
+ // reservation that fails, cut down on the attempted size and reserve a
33017
+ // smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
33018
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
33019
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth
33020
+ // but limit overreserving (default to capping at +96MB overgrowth at most)
33021
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
33022
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
33023
+ var replacement = growMemory(newSize);
33024
+ if (replacement) {
33025
+ return true;
33026
+ }
33027
+ }
33028
+ return false;
33029
+ };
33030
+ ENV = {};
33031
+ getExecutableName = function getExecutableName() {
33032
+ return thisProgram;
33033
+ };
33034
+ _getEnvStrings = function getEnvStrings() {
33035
+ if (!_getEnvStrings.strings) {
33036
+ // Default values.
33037
+ // Browser language detection #8751
33038
+ var lang = (typeof navigator == 'object' && navigator.language || 'C').replace('-', '_') + '.UTF-8';
33039
+ var env = {
33040
+ USER: 'web_user',
33041
+ LOGNAME: 'web_user',
33042
+ PATH: '/',
33043
+ PWD: '/',
33044
+ HOME: '/home/web_user',
33045
+ LANG: lang,
33046
+ _: getExecutableName()
33047
+ };
33048
+ // Apply the user-provided values, if any.
33049
+ for (var x in ENV) {
33050
+ // x is a key in ENV; if ENV[x] is undefined, that means it was
33051
+ // explicitly set to be so. We allow user code to do that to
33052
+ // force variables with default values to remain unset.
33053
+ if (ENV[x] === undefined) delete env[x];else env[x] = ENV[x];
33054
+ }
33055
+ var strings = [];
33056
+ for (var x in env) {
33057
+ strings.push(x + "=" + env[x]);
33058
+ }
33059
+ _getEnvStrings.strings = strings;
33060
+ }
33061
+ return _getEnvStrings.strings;
33062
+ };
33063
+ _environ_get = function _environ_get(__environ, environ_buf) {
33064
+ var bufSize = 0;
33065
+ var envp = 0;
33066
+ for (var _iterator2 = _createForOfIteratorHelperLoose(_getEnvStrings()), _step2; !(_step2 = _iterator2()).done;) {
33067
+ var string = _step2.value;
33068
+ var ptr = environ_buf + bufSize;
33069
+ HEAPU32[__environ + envp >> 2] = ptr;
33070
+ bufSize += stringToUTF8(string, ptr, Infinity) + 1;
33071
+ envp += 4;
33072
+ }
33073
+ return 0;
33074
+ };
33075
+ _environ_sizes_get = function _environ_sizes_get(penviron_count, penviron_buf_size) {
33076
+ var strings = _getEnvStrings();
33077
+ HEAPU32[penviron_count >> 2] = strings.length;
33078
+ var bufSize = 0;
33079
+ for (var _iterator3 = _createForOfIteratorHelperLoose(strings), _step3; !(_step3 = _iterator3()).done;) {
33080
+ var string = _step3.value;
33081
+ bufSize += lengthBytesUTF8(string) + 1;
33082
+ }
33083
+ HEAPU32[penviron_buf_size >> 2] = bufSize;
33084
+ return 0;
33085
+ };
33086
+ _fd_close = function _fd_close(fd) {
33087
+ return 52;
33088
+ };
33089
+ printCharBuffers = [null, [], []];
33090
+ printChar = function printChar(stream, curr) {
33091
+ var buffer = printCharBuffers[stream];
33092
+ if (curr === 0 || curr === 10) {
33093
+ (stream === 1 ? out : err)(UTF8ArrayToString(buffer));
33094
+ buffer.length = 0;
33095
+ } else {
33096
+ buffer.push(curr);
33097
+ }
33098
+ };
33099
+ _fd_write = function _fd_write(fd, iov, iovcnt, pnum) {
33100
+ // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
33101
+ var num = 0;
33102
+ for (var i = 0; i < iovcnt; i++) {
33103
+ var ptr = HEAPU32[iov >> 2];
33104
+ var len = HEAPU32[iov + 4 >> 2];
33105
+ iov += 8;
33106
+ for (var j = 0; j < len; j++) {
33107
+ printChar(fd, HEAPU8[ptr + j]);
33108
+ }
33109
+ num += len;
33110
+ }
33111
+ HEAPU32[pnum >> 2] = num;
33112
+ return 0;
33113
+ };
33114
+ init_ClassHandle();
33115
+ init_RegisteredPointer();
33116
+
33117
+ // Begin runtime exports
33118
+ // End runtime exports
33119
+ // Begin JS library exports
33120
+ // End JS library exports
33121
+
33122
+ // end include: postlibrary.js
33123
+
33124
+ // Imports from the Wasm binary.
33125
+ wasmImports = {
33126
+ /** @export */
33127
+ _abort_js: __abort_js,
33128
+ /** @export */
33129
+ _embind_register_bigint: __embind_register_bigint,
33130
+ /** @export */
33131
+ _embind_register_bool: __embind_register_bool,
33132
+ /** @export */
33133
+ _embind_register_class: __embind_register_class,
33134
+ /** @export */
33135
+ _embind_register_class_constructor: __embind_register_class_constructor,
33136
+ /** @export */
33137
+ _embind_register_class_function: __embind_register_class_function,
33138
+ /** @export */
33139
+ _embind_register_emval: __embind_register_emval,
33140
+ /** @export */
33141
+ _embind_register_float: __embind_register_float,
33142
+ /** @export */
33143
+ _embind_register_integer: __embind_register_integer,
33144
+ /** @export */
33145
+ _embind_register_memory_view: __embind_register_memory_view,
33146
+ /** @export */
33147
+ _embind_register_smart_ptr: __embind_register_smart_ptr,
33148
+ /** @export */
33149
+ _embind_register_std_string: __embind_register_std_string,
33150
+ /** @export */
33151
+ _embind_register_std_wstring: __embind_register_std_wstring,
33152
+ /** @export */
33153
+ _embind_register_void: __embind_register_void,
33154
+ /** @export */
33155
+ _emval_create_invoker: __emval_create_invoker,
33156
+ /** @export */
33157
+ _emval_decref: __emval_decref,
33158
+ /** @export */
33159
+ _emval_incref: __emval_incref,
33160
+ /** @export */
33161
+ _emval_invoke: __emval_invoke,
33162
+ /** @export */
33163
+ _emval_run_destructors: __emval_run_destructors,
33164
+ /** @export */
33165
+ _gmtime_js: __gmtime_js,
33166
+ /** @export */
33167
+ _tzset_js: __tzset_js,
33168
+ /** @export */
33169
+ emscripten_date_now: _emscripten_date_now,
33170
+ /** @export */
33171
+ emscripten_resize_heap: _emscripten_resize_heap,
33172
+ /** @export */
33173
+ environ_get: _environ_get,
33174
+ /** @export */
33175
+ environ_sizes_get: _environ_sizes_get,
33176
+ /** @export */
33177
+ fd_close: _fd_close,
33178
+ /** @export */
33179
+ fd_seek: _fd_seek,
33180
+ /** @export */
33181
+ fd_write: _fd_write
33182
+ };
33183
+ _context6.next = 158;
33184
+ return createWasm();
33185
+ case 158:
33186
+ wasmExports = _context6.sent;
33187
+ run();
33188
+
33189
+ // end include: postamble.js
33190
+
33191
+ // include: postamble_modularize.js
33192
+ // In MODULARIZE mode we wrap the generated code in a factory function
33193
+ // and return either the Module itself, or a promise of the module.
33194
+ //
33195
+ // We assign to the `moduleRtn` global here and configure closure to see
33196
+ // this as and extern so it won't get minified.
33197
+
33198
+ if (runtimeInitialized) {
33199
+ moduleRtn = Module;
33200
+ } else {
33201
+ // Set up the promise that indicates the Module is initialized
33202
+ moduleRtn = new Promise(function (resolve, reject) {
33203
+ readyPromiseResolve = resolve;
33204
+ readyPromiseReject = reject;
33205
+ });
33206
+ }
33207
+
33208
+ // end include: postamble_modularize.js
33209
+ return _context6.abrupt("return", moduleRtn);
33210
+ case 162:
33211
+ case "end":
33212
+ return _context6.stop();
33213
+ }
33214
+ }, _callee6);
33215
+ }));
33216
+ return _Module.apply(this, arguments);
33217
+ }
33218
+ var noopPrint = function noopPrint() {
33219
+ // No-op
33220
+ };
33221
+ function defaultLocateFile(path, prefix) {
33222
+ try {
33223
+ var url = new URL(prefix);
33224
+ if (url.pathname === '/') {
33225
+ return prefix + "mediainfo.js/dist/" + path;
33226
+ }
33227
+ } catch (_unused) {
33228
+ // empty
33229
+ }
33230
+ return prefix + "../" + path;
33231
+ }
33232
+
33233
+ // TODO pass through more emscripten module options?
33234
+
33235
+ /**
33236
+ * Creates a {@link MediaInfo} instance with the specified options.
33237
+ *
33238
+ * @typeParam TFormat - The format type, defaults to `object`.
33239
+ * @param options - Configuration options for creating the {@link MediaInfo} instance.
33240
+ * @returns A promise that resolves to a {@link MediaInfo} instance when no callback is provided.
33241
+ */
33242
+
33243
+ /**
33244
+ * Creates a {@link MediaInfo} instance with the specified options and executes the callback.
33245
+ *
33246
+ * @typeParam TFormat - The format type, defaults to `object`.
33247
+ * @param options - Configuration options for creating the {@link MediaInfo} instance.
33248
+ * @param callback - Function to call with the {@link MediaInfo} instance.
33249
+ * @param errCallback - Optional function to call on error.
33250
+ */
33251
+
33252
+ function mediaInfoFactory() {
33253
+ var _options$format;
33254
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33255
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
33256
+ var errCallback = arguments.length > 2 ? arguments[2] : undefined;
33257
+ if (callback === undefined) {
33258
+ return new Promise(function (resolve, reject) {
33259
+ mediaInfoFactory(options, resolve, reject);
33260
+ });
33261
+ }
33262
+ var _DEFAULT_OPTIONS$opti = _extends({}, DEFAULT_OPTIONS, options, {
33263
+ format: (_options$format = options.format) != null ? _options$format : DEFAULT_OPTIONS.format
33264
+ }),
33265
+ locateFile = _DEFAULT_OPTIONS$opti.locateFile,
33266
+ mergedOptions = _objectWithoutPropertiesLoose(_DEFAULT_OPTIONS$opti, _excluded);
33267
+ var mediaInfoModuleFactoryOpts = {
33268
+ // Silence all print in module
33269
+ print: noopPrint,
33270
+ printErr: noopPrint,
33271
+ locateFile: locateFile != null ? locateFile : defaultLocateFile,
33272
+ onAbort: function onAbort(err) {
33273
+ if (errCallback) {
33274
+ errCallback(err);
33275
+ }
33276
+ }
33277
+ };
33278
+
33279
+ // Fetch and load WASM module
33280
+ Module(mediaInfoModuleFactoryOpts).then(function (wasmModule) {
33281
+ callback(new MediaInfo(wasmModule, mergedOptions));
33282
+ })["catch"](function (error) {
33283
+ if (errCallback) {
33284
+ errCallback(error);
33285
+ }
33286
+ });
33287
+ }
33288
+
33289
+ /**
33290
+ * Checks if a given object is of a specified track type.
33291
+ *
33292
+ * @template T - The type of track to check for.
33293
+ * @param thing - The object to check.
33294
+ * @param type - The track type to check against.
33295
+ * @returns A boolean indicating whether the object is of the specified track type.
33296
+ */
33297
+ function isTrackType(thing, type) {
33298
+ return thing !== null && typeof thing === 'object' && thing['@type'] === type;
33299
+ }
33300
+
33301
+ var index = /*#__PURE__*/Object.freeze({
33302
+ __proto__: null,
33303
+ default: mediaInfoFactory,
33304
+ isTrackType: isTrackType,
33305
+ mediaInfoFactory: mediaInfoFactory
33306
+ });
33307
+
30579
33308
  exports.CapturedDocumentImg = CapturedDocumentImg;
30580
33309
  exports.CustomerBiometricsEnrollment = CustomerBiometricsEnrollment;
30581
33310
  exports.CustomerIdAndBiometricsEnrollment = CustomerIdAndBiometricsEnrollment;