@jaak.ai/stamps 2.2.0 → 2.3.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,15 @@
1
1
  import { LowMemoryDeviceStrategy } from "../strategies/LowMemoryDeviceStrategy";
2
2
  import { HighPerformanceDeviceStrategy } from "../strategies/HighPerformanceDeviceStrategy";
3
+ import { IOSSafariStrategy } from "../strategies/IOSSafariStrategy";
3
4
  export class DeviceStrategyFactory {
4
5
  static createStrategy() {
5
6
  const nav = navigator;
7
+ const ua = navigator.userAgent;
8
+ // All iOS browsers use WebKit, which has memory constraints
9
+ const isIOS = /iPad|iPhone|iPod/.test(ua);
10
+ if (isIOS) {
11
+ return new IOSSafariStrategy();
12
+ }
6
13
  const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;
7
14
  const isLowMemory = memory <= 4;
8
15
  if (isLowMemory) {
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceStrategyFactory.js","sourceRoot":"","sources":["../../../src/services/factories/DeviceStrategyFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,cAAc;QACnB,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,CAAC;QAEhC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,IAAI,uBAAuB,EAAE,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,6BAA6B,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;CACF","sourcesContent":["import { IDeviceStrategy } from '../strategies/IDeviceStrategy';\nimport { LowMemoryDeviceStrategy } from '../strategies/LowMemoryDeviceStrategy';\nimport { HighPerformanceDeviceStrategy } from '../strategies/HighPerformanceDeviceStrategy';\n\nexport class DeviceStrategyFactory {\n static createStrategy(): IDeviceStrategy {\n const nav = navigator as any;\n const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;\n const isLowMemory = memory <= 4;\n \n if (isLowMemory) {\n return new LowMemoryDeviceStrategy();\n } else {\n return new HighPerformanceDeviceStrategy();\n }\n }\n}"]}
1
+ {"version":3,"file":"DeviceStrategyFactory.js","sourceRoot":"","sources":["../../../src/services/factories/DeviceStrategyFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,cAAc;QACnB,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;QAE/B,4DAA4D;QAC5D,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,CAAC;QAEhC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,IAAI,uBAAuB,EAAE,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,6BAA6B,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;CACF","sourcesContent":["import { IDeviceStrategy } from '../strategies/IDeviceStrategy';\nimport { LowMemoryDeviceStrategy } from '../strategies/LowMemoryDeviceStrategy';\nimport { HighPerformanceDeviceStrategy } from '../strategies/HighPerformanceDeviceStrategy';\nimport { IOSSafariStrategy } from '../strategies/IOSSafariStrategy';\n\nexport class DeviceStrategyFactory {\n static createStrategy(): IDeviceStrategy {\n const nav = navigator as any;\n const ua = navigator.userAgent;\n\n // All iOS browsers use WebKit, which has memory constraints\n const isIOS = /iPad|iPhone|iPod/.test(ua);\n\n if (isIOS) {\n return new IOSSafariStrategy();\n }\n\n const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;\n const isLowMemory = memory <= 4;\n\n if (isLowMemory) {\n return new LowMemoryDeviceStrategy();\n } else {\n return new HighPerformanceDeviceStrategy();\n }\n }\n}"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Strategy for iOS Safari to prevent jetsam memory kills.
3
+ * WebKit 26+ has a known bug with ONNX Runtime JSEP mode that causes memory exhaustion.
4
+ * This strategy forces pure WASM execution without GPU acceleration.
5
+ * See: https://github.com/microsoft/onnxruntime/issues/26827
6
+ */
7
+ export class IOSSafariStrategy {
8
+ getDeviceInfo() {
9
+ return {
10
+ estimatedRAM: 3,
11
+ isLowMemory: true,
12
+ isSlowConnection: false
13
+ };
14
+ }
15
+ getSessionOptions(_debug) {
16
+ return {
17
+ // Force pure WASM - no WebGL, no WebGPU, no JSEP
18
+ executionProviders: ['wasm'],
19
+ graphOptimizationLevel: 'disabled', // Disable graph optimization to reduce memory
20
+ logSeverityLevel: 4,
21
+ logVerbosityLevel: 0,
22
+ enableCpuMemArena: false, // Don't use CPU memory arena
23
+ enableMemPattern: false, // Don't use memory pattern optimization
24
+ executionMode: 'sequential', // Sequential execution uses less memory
25
+ interOpNumThreads: 1, // Single thread
26
+ intraOpNumThreads: 1, // Single thread
27
+ };
28
+ }
29
+ shouldUseSequentialLoading() {
30
+ return true;
31
+ }
32
+ }
33
+ //# sourceMappingURL=IOSSafariStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IOSSafariStrategy.js","sourceRoot":"","sources":["../../../src/services/strategies/IOSSafariStrategy.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAC5B,aAAa;QACX,OAAO;YACL,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,IAAI;YACjB,gBAAgB,EAAE,KAAK;SACxB,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,MAAe;QAC/B,OAAO;YACL,iDAAiD;YACjD,kBAAkB,EAAE,CAAC,MAAM,CAAC;YAC5B,sBAAsB,EAAE,UAAU,EAAE,8CAA8C;YAClF,gBAAgB,EAAE,CAAC;YACnB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK,EAAE,6BAA6B;YACvD,gBAAgB,EAAE,KAAK,EAAE,wCAAwC;YACjE,aAAa,EAAE,YAAY,EAAE,wCAAwC;YACrE,iBAAiB,EAAE,CAAC,EAAE,gBAAgB;YACtC,iBAAiB,EAAE,CAAC,EAAE,gBAAgB;SACvC,CAAC;IACJ,CAAC;IAED,0BAA0B;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { IDeviceStrategy, DeviceInfo, SessionOptions } from './IDeviceStrategy';\n\n/**\n * Strategy for iOS Safari to prevent jetsam memory kills.\n * WebKit 26+ has a known bug with ONNX Runtime JSEP mode that causes memory exhaustion.\n * This strategy forces pure WASM execution without GPU acceleration.\n * See: https://github.com/microsoft/onnxruntime/issues/26827\n */\nexport class IOSSafariStrategy implements IDeviceStrategy {\n getDeviceInfo(): DeviceInfo {\n return {\n estimatedRAM: 3,\n isLowMemory: true,\n isSlowConnection: false\n };\n }\n\n getSessionOptions(_debug: boolean): SessionOptions {\n return {\n // Force pure WASM - no WebGL, no WebGPU, no JSEP\n executionProviders: ['wasm'],\n graphOptimizationLevel: 'disabled', // Disable graph optimization to reduce memory\n logSeverityLevel: 4,\n logVerbosityLevel: 0,\n enableCpuMemArena: false, // Don't use CPU memory arena\n enableMemPattern: false, // Don't use memory pattern optimization\n executionMode: 'sequential', // Sequential execution uses less memory\n interOpNumThreads: 1, // Single thread\n intraOpNumThreads: 1, // Single thread\n };\n }\n\n shouldUseSequentialLoading(): boolean {\n return true;\n }\n}\n"]}
@@ -727,9 +727,48 @@ class HighPerformanceDeviceStrategy {
727
727
  }
728
728
  }
729
729
 
730
+ /**
731
+ * Strategy for iOS Safari to prevent jetsam memory kills.
732
+ * WebKit 26+ has a known bug with ONNX Runtime JSEP mode that causes memory exhaustion.
733
+ * This strategy forces pure WASM execution without GPU acceleration.
734
+ * See: https://github.com/microsoft/onnxruntime/issues/26827
735
+ */
736
+ class IOSSafariStrategy {
737
+ getDeviceInfo() {
738
+ return {
739
+ estimatedRAM: 3,
740
+ isLowMemory: true,
741
+ isSlowConnection: false
742
+ };
743
+ }
744
+ getSessionOptions(_debug) {
745
+ return {
746
+ // Force pure WASM - no WebGL, no WebGPU, no JSEP
747
+ executionProviders: ['wasm'],
748
+ graphOptimizationLevel: 'disabled', // Disable graph optimization to reduce memory
749
+ logSeverityLevel: 4,
750
+ logVerbosityLevel: 0,
751
+ enableCpuMemArena: false, // Don't use CPU memory arena
752
+ enableMemPattern: false, // Don't use memory pattern optimization
753
+ executionMode: 'sequential', // Sequential execution uses less memory
754
+ interOpNumThreads: 1, // Single thread
755
+ intraOpNumThreads: 1, // Single thread
756
+ };
757
+ }
758
+ shouldUseSequentialLoading() {
759
+ return true;
760
+ }
761
+ }
762
+
730
763
  class DeviceStrategyFactory {
731
764
  static createStrategy() {
732
765
  const nav = navigator;
766
+ const ua = navigator.userAgent;
767
+ // All iOS browsers use WebKit, which has memory constraints
768
+ const isIOS = /iPad|iPhone|iPod/.test(ua);
769
+ if (isIOS) {
770
+ return new IOSSafariStrategy();
771
+ }
733
772
  const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;
734
773
  const isLowMemory = memory <= 4;
735
774
  if (isLowMemory) {
@@ -18876,10 +18915,26 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
18876
18915
  if (!window.ort) {
18877
18916
  this.updateStatus('Preparando herramientas...', 'Configurando funciones de captura', 'initializing');
18878
18917
  const script = document.createElement('script');
18879
- script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.min.js';
18918
+ // iOS devices use WASM-only build to prevent memory issues (WebKit 26+ bug)
18919
+ // All iOS browsers use WebKit, so this applies to Safari, Chrome, Firefox, etc.
18920
+ const ua = navigator.userAgent;
18921
+ const isIOS = /iPad|iPhone|iPod/.test(ua);
18922
+ if (isIOS) {
18923
+ script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.wasm.min.js';
18924
+ }
18925
+ else {
18926
+ script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.min.js';
18927
+ }
18880
18928
  document.head.appendChild(script);
18881
18929
  await new Promise((resolve) => {
18882
18930
  script.onload = () => {
18931
+ // Configure ONNX for iOS low memory mode
18932
+ if (isIOS && window.ort?.env) {
18933
+ const ort = window.ort;
18934
+ ort.env.wasm.simd = false;
18935
+ ort.env.wasm.numThreads = 1;
18936
+ ort.env.wasm.proxy = false;
18937
+ }
18883
18938
  setTimeout(async () => {
18884
18939
  await this.finalizeInitialization();
18885
18940
  resolve(undefined);
@@ -19736,7 +19791,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
19736
19791
  isCapturing: false
19737
19792
  };
19738
19793
  const cameraInfo = this.cameraInfoWithAutofocus;
19739
- return (h("div", { key: 'df70f4fa13b2997a19312125c8b236651cb2b81e', class: "detector-container" }, !this.licenseValid && this.licenseError && (h("div", { key: 'c4f7b51515843177bc3063dd7cf9383e3a4c6c73', class: "license-error-container" }, h("div", { key: 'a4a7e95a23690f9f59c971dd2af9bd096ae13ef0', class: "license-error-card" }, h("svg", { key: '6489a82c60fc9c1a7d89c2b3a537c04c1766cbd4', class: "license-error-icon", width: "64", height: "64", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'b90b16b0ee155c8baeee321237470de7b6fa1ff5', d: "M12 22C12 22 20 18 20 12V5L12 2L4 5V12C4 18 12 22 12 22Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { key: 'c90ec519befb073208dbc5e30e1237dda7f0a18f', d: "M12 8V12", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }), h("circle", { key: 'b926e97a83e19c7ca9b66472fedd53b12d22b7d8', cx: "12", cy: "16", r: "0.5", fill: "currentColor", stroke: "currentColor", "stroke-width": "1" })), h("h2", { key: '1f1fce48179331b0150e0c55a6d5efcd0bf95762', class: "license-error-title" }, "Licencia Requerida"), h("p", { key: '1f28787cea92c5160664bd8e445fb514ac55eff4', class: "license-error-message" }, this.licenseError), h("p", { key: '552aecf92fd34fbdd802fc80cdba46596edb115b', class: "license-error-help" }, "Contacte a soporte: ", h("a", { key: '8c44e1e33fbd22a2319acd6c6b27766bec4355f0', href: "mailto:support@jaak.ai" }, "support@jaak.ai")), h("div", { key: 'c2e139fdedcb8e8922f37e915caa7ae3a1b09cb9', class: "license-error-footer" }, "JAAK Stamps")))), this.licenseValid && (h("div", { key: 'c7876bbe35cd28b52433aab6e97de4a0282e25d5', class: "video-container" }, h("video", { key: 'a5fa99c086eb3730ceee7750ece0842539defa3d', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: '2c7923dfa706f65cfc3fe71a6ec626cb2ccce7d4', ref: el => this.detectionContainer = el, class: `detection-overlay ${this.shouldMirrorVideo ? 'mirror' : ''}` }, this.debug && this.detectionBoxes.map((box, index) => (h("div", { key: index, class: "detection-box", style: {
19794
+ return (h("div", { key: 'c5af80713fb108ab73d086f2acbdd11277d7d52c', class: "detector-container" }, !this.licenseValid && this.licenseError && (h("div", { key: '99c886b52f58e667f76dce00f09828b9962b3606', class: "license-error-container" }, h("div", { key: 'ffd643ef41b3a4b1aa8f40075232a1d70695d566', class: "license-error-card" }, h("svg", { key: '90e628f4e6e20ac8b27560833ada7486aac1c9fb', class: "license-error-icon", width: "64", height: "64", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'cb442fe342c6c0ffb50dfcda42d0af43adedf143', d: "M12 22C12 22 20 18 20 12V5L12 2L4 5V12C4 18 12 22 12 22Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { key: '6b29651b70273f585d9870e71811c0cdb57ea659', d: "M12 8V12", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }), h("circle", { key: '9ec1e61c3bc9e6f7046a49e45e7ef87880d8a443', cx: "12", cy: "16", r: "0.5", fill: "currentColor", stroke: "currentColor", "stroke-width": "1" })), h("h2", { key: '56de8037a70da2c0b185029d4a9da0c935fd8c2b', class: "license-error-title" }, "Licencia Requerida"), h("p", { key: 'b6634818db630b62c8a5aa6152adc8e6da5f329f', class: "license-error-message" }, this.licenseError), h("p", { key: '8c0b404805c2515912416b9a62d66680e6d4b411', class: "license-error-help" }, "Contacte a soporte: ", h("a", { key: '1cd69e09c282353548ad9b14985054e47b6ff218', href: "mailto:support@jaak.ai" }, "support@jaak.ai")), h("div", { key: 'c2d13002c8f91a35b647199c77eb78b5643316df', class: "license-error-footer" }, "JAAK Stamps")))), this.licenseValid && (h("div", { key: '094f1c85b06758399520cb85a461e1af755e3d45', class: "video-container" }, h("video", { key: 'e7973937fa0d77c9793e984d063ec29a80d464eb', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: 'fb86b9eb362e13902d31803c187f5d2b6c5ac664', ref: el => this.detectionContainer = el, class: `detection-overlay ${this.shouldMirrorVideo ? 'mirror' : ''}` }, this.debug && this.detectionBoxes.map((box, index) => (h("div", { key: index, class: "detection-box", style: {
19740
19795
  position: 'absolute',
19741
19796
  left: `${box.x}px`,
19742
19797
  top: `${box.y}px`,
@@ -19745,9 +19800,9 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
19745
19800
  border: '2px solid #32406C',
19746
19801
  pointerEvents: 'none',
19747
19802
  boxSizing: 'border-box'
19748
- } })))), this.isMaskReady && (h("div", { key: '3e1f77d89a00e4ad1519875cacd5c541c9b16f91', class: "overlay-mask" }, h("div", { key: '3c717afa809ef2fa102fdaab3418915602516d39', class: "card-outline" }, h("div", { key: 'd3dcd1a85290f3fb2216b1182dce9a4b62cc59c6', class: "side side-top" }), h("div", { key: '4280c1e0f0900ec69b905a6226c1afe9a0a993ad', class: "side side-right" }), h("div", { key: '9b88c21f5eb28d74872409335cd6ca83a284bd9b', class: "side side-bottom" }), h("div", { key: '46b4ef3fca60fcf807da8f574a43cba7f148165b', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '2222975293bebfd04fa2d4ac4878bce48fd35880', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '836fbeadb849cb9df66e03ef0cb791dd0e179df8', class: "back-capture-section" }, h("div", { key: 'f0e8119b79f30ffd40ae206783a83869196757ac', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode || this.showManualCaptureButton) && (h("button", { key: 'e245e800e2378989bfa011524cca66026ace52d9', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-back' && (h("span", { key: 'd98a692f9ff883d05e24122b54c4e36f5f96e82f', class: "button-spinner" })), "Capturar Reverso")), h("button", { key: 'c32b7784e2bbb89947219f0d458d0a4d62b5352a', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'skip-back' && (h("span", { key: 'bb935e91f07c4c1052576c52aa2a82a726877217', class: "button-spinner" })), this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
19803
+ } })))), this.isMaskReady && (h("div", { key: '28a8d52ace75ee2dc3f4cd31275f2feae0db31e3', class: "overlay-mask" }, h("div", { key: '16c956f26a514c67ae178da5db2c0d19b53acdac', class: "card-outline" }, h("div", { key: '578f111f358c0b66968b389f99235d1361ff035c', class: "side side-top" }), h("div", { key: 'e7854fd3363f340fd2c832815e7c8aaf8935e5f4', class: "side side-right" }), h("div", { key: 'c6f58f1c03506ec8920b914b76679730d1944b0e', class: "side side-bottom" }), h("div", { key: 'a1af9d6777819d2c941ff99b985c3430d673e534', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: 'fc9ec8cf13eb9b25140ebb9cfddd6636dc3b6e99', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '078ce12f5f2d24928d3f66eedac97f8c4bae3717', class: "back-capture-section" }, h("div", { key: '9bf0528cc9fc691c212cf413bafdfeb999b47682', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode || this.showManualCaptureButton) && (h("button", { key: '8d5613bda9e823293181f4551dfc5a49683a0e3e', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-back' && (h("span", { key: '19909120ab9576d4b820e528c1456f8ba5f17fb9', class: "button-spinner" })), "Capturar Reverso")), h("button", { key: '6e1cfac4e73ace6a2e59ed601e82c3f5b2770681', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'skip-back' && (h("span", { key: '4aa6846d76295a428185ef3a83d15554eb2d9d00', class: "button-spinner" })), this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
19749
19804
  ? `Saltar reverso (${this.backDocumentTimerRemaining}s)`
19750
- : 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '471a1292e9d093cce0a0d3fa7f96f3665de749fb', class: "camera-controls" }, h("button", { key: '406911235a06723310ff577c27e3858912e522c4', class: `camera-selector-button ${this.isSwitchingCamera ? 'loading' : ''}`, onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara", disabled: this.isSwitchingCamera }, this.isSwitchingCamera ? (h("div", { class: "button-spinner" })) : ('Cámaras')))), this.showCameraSelector && cameraInfo.availableCameras.length > 0 && (h("div", { key: 'b8fd729b78a3c5cb52b7f17d031bb12b894aaf41', class: "camera-selector-dropdown" }, h("div", { key: '2b9b451440d6b6be4103419694ff6a53c92e68ad', class: "camera-selector-header" }, h("span", { key: '2271f4694aa6c0b32ab23a02a7a8d6d4c1bd4144' }, "Seleccionar C\u00E1mara"), h("button", { key: 'ccfc02eb031da17a4907cd835642785bc2ef5e77', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '073d6e9e09cde8523e926850dfa73704b579c899', class: "camera-list" }, cameraInfo.availableCameras.map((camera) => (h("button", { key: camera.id, class: `camera-option ${cameraInfo.selectedCameraId === camera.id ? 'selected' : ''}`, onClick: () => this.handleCameraSwitch(camera.id), type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${cameraInfo.availableCameras.indexOf(camera) + 1}`, camera.hasAutofocus && (h("span", { class: "autofocus-icon", title: "Autofoco disponible" }, "\u29BF"))), cameraInfo.selectedCameraId === camera.id && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: '8f914f855727a6ab02a2941fee91283bf3882df2', class: "device-info" }, h("small", { key: '295433a43a539034992f04a29355deed12082092' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: 'cc780583a636e7d4910851789710837c9e188d40', class: "manual-capture-section" }, h("button", { key: '40c5e212a3a4eab4d2edf44e29e6b4fe0e4c5e37', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-front' && (h("span", { key: '1245a13523250b5959a1c303ca20662c2d6750c7', class: "button-spinner" })), "Capturar Frente"))))), captureState.isCapturing && (h("div", { key: '10a0a26b346ecf0945688f82292720871f8dc0b7', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: '68dc7effe82d2f043d778239e2aecb847d159818', class: "flip-animation" }, h("div", { key: '153e0c2229c39c5b9402b9610eaee586d98f84c1', class: "id-card-icon" }), h("div", { key: 'b60b249c43ac5f8417c15b8ce46f60d2cb3134d5', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: 'fefa7bf80546a463a54a275e425241545ace5c77', class: "success-animation" }, h("div", { key: 'cda9d64b3b30cc636d976c2c644a927a8ebe341e', class: "check-icon" }), h("div", { key: 'fd00554df841cdb6e1a167b7e6cc4a6b9b60957a', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: 'cd5fa1fbfa5e3a4e362281553dde2c37601b1078', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: 'cb0d76938d8ccab99632920ffc9d73a1fa7dec79', class: "status-spinner" })), h("div", { key: 'bcfdc2a24e12dc0bcc19ae0d647be5ce810994d5', class: "status-content" }, h("div", { key: 'a4b6dad22b40aed65a9c81e9581e61a9ca064e40', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: '236084444d4d156b672f823349f95b462a8a9bba', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: '7423d6c8c7e37b7baffc27fc243536e2659475cc', class: "performance-monitor" }, h("div", { key: '892736f4be3d1cd563ec919c5a504ca8e0d55db0', class: "performance-expanded" }, h("div", { key: 'aa0464f739f838ac4c9e553c79f4c7815f7f65cf', class: "metrics-row" }, h("div", { key: '5dca0c5fe0f91ecfaa25c5775c18a99d53eb8f73', class: "metric-compact" }, h("span", { key: '8e498b185cdefb97286356b56e45dc7b514f667e', class: "metric-label" }, "FPS"), h("span", { key: '3a90611c84b338314ae1503aef6208c67d1282ff', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: '568e492ef7dad971f1613132028999a81f38f457', class: "metric-compact" }, h("span", { key: '222fd2b522dd9f7172ad9adb442b10c1ce4c6455', class: "metric-label" }, "MEM"), h("span", { key: '8cbe2cf9fd7dd9e22e9a0df6f214165a09e03045', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: 'e5d946afd1cc80a15a52c9ba1cb252e6e146e929', class: "metrics-row" }, h("div", { key: '65aaaa92e3ce7b5567560d94f98e16226ecf9fd5', class: "metric-compact" }, h("span", { key: '80c6ad0923e729912274a05fffca039e88aa5719', class: "metric-label" }, "INF"), h("span", { key: '4a87270ebdad3be718b86d1382b2a54092e53a16', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '41ddc923cdfab0012a2f5d3e19aee33dad6116fe', class: "metric-compact" }, h("span", { key: '84e9f4fb3d5bf60235d71d61dc1d6a8ad429293c', class: "metric-label" }, "FRAME"), h("span", { key: '88fd6964307399ac1547c7086f489af90a92a925', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '22409e8dfb349e66ac54c20c6043b414b7ddba34', class: "metrics-row" }, h("div", { key: 'bbe72cb477f4bc313e7978d98c217a4789765df1', class: "metric-compact" }, h("span", { key: '56df43d72df8d3549fa42b2bc32fa5491c3cdb41', class: "metric-label" }, "DET"), h("span", { key: '7ceedb73086eccaed0e25177d76218e9bae1262d', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: '9407541b4f975b20843c19e7081d1c26bb3f4fd4', class: "metric-compact" }, h("span", { key: '511ffc66436ffe2f14300122213de11f50fbbc30', class: "metric-label" }, "RATE"), h("span", { key: '6a0c864b46314937043831be7646fbfa3d994c86', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '72f26e4248c87e428a10bbd7b67bd77a9a32f321', class: "watermark" }, h("img", { key: '32e3f23ca1ff81699dd2a4922f8f7d4aeaa3cc2b', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" }))))));
19805
+ : 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '1c2ca195f159238c1b234e97dd3871d0a1caa3c8', class: "camera-controls" }, h("button", { key: '085795c9083606fde64aeb211c242c031ebaf66a', class: `camera-selector-button ${this.isSwitchingCamera ? 'loading' : ''}`, onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara", disabled: this.isSwitchingCamera }, this.isSwitchingCamera ? (h("div", { class: "button-spinner" })) : ('Cámaras')))), this.showCameraSelector && cameraInfo.availableCameras.length > 0 && (h("div", { key: 'e153c9e786afc0e911c32056351fa358eca45d21', class: "camera-selector-dropdown" }, h("div", { key: 'cb611c0d0b3170da382cb54895888d465ac4bd0a', class: "camera-selector-header" }, h("span", { key: '200f7cdf43ec10163e573fbc00b077d75cc703ae' }, "Seleccionar C\u00E1mara"), h("button", { key: '86cd2942c5a499053e64d2432dfbaa2bf9612777', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '1085775e191c43105ac4c645bb8fa227f1a230f5', class: "camera-list" }, cameraInfo.availableCameras.map((camera) => (h("button", { key: camera.id, class: `camera-option ${cameraInfo.selectedCameraId === camera.id ? 'selected' : ''}`, onClick: () => this.handleCameraSwitch(camera.id), type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${cameraInfo.availableCameras.indexOf(camera) + 1}`, camera.hasAutofocus && (h("span", { class: "autofocus-icon", title: "Autofoco disponible" }, "\u29BF"))), cameraInfo.selectedCameraId === camera.id && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: 'b7465daa8357fce5192ba4800b03fc200e065145', class: "device-info" }, h("small", { key: '2c824e7585afd324cefd071cdda380f3df5ada1b' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '703f54145582191eaddcecd22a718dd72e16f977', class: "manual-capture-section" }, h("button", { key: 'dcbaa7e780c4bdb0703653e25146b17248a2d8c9', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-front' && (h("span", { key: 'cb989324a41f502ae740941ad75e6240051d8273', class: "button-spinner" })), "Capturar Frente"))))), captureState.isCapturing && (h("div", { key: 'c3567ccbd287c39f72cbca897e5f643c68624b5e', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: 'b16f56f7fc7c710a4b41760515b2b8054d2aad4c', class: "flip-animation" }, h("div", { key: 'df905809f04bece3856545f8a6a1dcce89377377', class: "id-card-icon" }), h("div", { key: 'daa09f264bf3708e535a3be580b86145568d4f66', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: '1be7277ef588b42060808b575670872a6aa08925', class: "success-animation" }, h("div", { key: 'ce18848121423499a4bc7b2e95586f3a01bc6ceb', class: "check-icon" }), h("div", { key: '2e2ae20c3e4bffbf3ec45f2fd7016a485ea380c1', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: '951f37ba2b6366aa44e15c1dcf17b2ec6975131d', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: '1718aa68ed5db592183696bc212c7066f35bf789', class: "status-spinner" })), h("div", { key: '45bf0d9ee7786578b34d25623667ee8336720270', class: "status-content" }, h("div", { key: '4fa2c1f9ddc62981cefbd63c19e04d14a503a406', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: '7f38fb0096a15467a63362979137981e84df55f9', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: '692e49518f3f78960b74f47741f2051e95ce9280', class: "performance-monitor" }, h("div", { key: 'be9f96048e16510203d8abc3b2b09ea9a0e91fe1', class: "performance-expanded" }, h("div", { key: 'ca19a5467a8bba02be34e3515af3f92839a4397a', class: "metrics-row" }, h("div", { key: '54a6b187da25a3a6af0c8fbfc023fb16b45bb606', class: "metric-compact" }, h("span", { key: '52b9bd1bbb8542011139b4556af213f64cc62c1f', class: "metric-label" }, "FPS"), h("span", { key: 'eff3acd45c407866e9c67205a4b4f0727b47afc8', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: 'fad4f7c5603ba7c2a95544d37f9d4b61c1840dca', class: "metric-compact" }, h("span", { key: 'e01386e6898c3f036f66795e71e65dad4d11366a', class: "metric-label" }, "MEM"), h("span", { key: '71cb13b49656c869be920080f7b53ce2e709a4c0', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: '61fa2c277a2226f68d9dc036450dc086a1409b62', class: "metrics-row" }, h("div", { key: '752052d1cdc68a5d65c3ec3f0b85241527d251ae', class: "metric-compact" }, h("span", { key: 'de5fae8f627df6347e5569d31433a96476bba22d', class: "metric-label" }, "INF"), h("span", { key: '841c1a1b42e63e9fc4c56c72b54e07e47997f8be', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '194d01303155cda7b58a3bca1bd34795eac31556', class: "metric-compact" }, h("span", { key: '73f023e1de8b6fbc8976bc3fe1d9655d3d5f3c92', class: "metric-label" }, "FRAME"), h("span", { key: 'ddb8d7fa99b83f477bd8cbfe4ca856d2baa7a493', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '37eb5780cd09e3c056e7094b6b028789529112e3', class: "metrics-row" }, h("div", { key: '236828977e1a634fddda1fef079c7780e469b815', class: "metric-compact" }, h("span", { key: 'd704dd8ba1e2080159a932c87208d2747feeb030', class: "metric-label" }, "DET"), h("span", { key: 'e0ceaf4cc91c00835bf92fdd3744a26958f39105', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: '96ad9e60657306f20efc285fd6eb5a83c3b8ee32', class: "metric-compact" }, h("span", { key: '25e0ea0b4f16118b0bf7b9b974997b9bf832d2f8', class: "metric-label" }, "RATE"), h("span", { key: '3f6f5370611d6fa6a927bc8ec1e03d0c262a3466', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '429a70ff02a2a2de127cb6cfe3426df1fdc4bbae', class: "watermark" }, h("img", { key: 'cc4174740e58367b2e66b6029dcca8404a3dccee', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" }))))));
19751
19806
  }
19752
19807
  // Utility methods
19753
19808
  updateDetectionBoxes(boxes) {