@jaak.ai/stamps 2.0.0-beta.2 → 2.0.0-dev.17
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.
- package/README.md +19 -101
- package/dist/cjs/jaak-stamps-webcomponent.cjs.js +1 -1
- package/dist/cjs/jaak-stamps.cjs.entry.js +36 -403
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/my-component/my-component.css +7 -10
- package/dist/collection/components/my-component/my-component.js +36 -478
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/components/jaak-stamps.js +36 -407
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps-webcomponent.js +1 -1
- package/dist/esm/jaak-stamps.entry.js +36 -403
- package/dist/esm/jaak-stamps.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/p-45dcdc80.entry.js +2 -0
- package/dist/jaak-stamps-webcomponent/p-45dcdc80.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +2 -20
- package/dist/types/components.d.ts +0 -26
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-f1172b06.entry.js +0 -2
- package/dist/jaak-stamps-webcomponent/p-f1172b06.entry.js.map +0 -1
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, a as getElement, h } from './index-DqoVMnc7.js';
|
|
2
2
|
|
|
3
|
-
const myComponentCss = ":host{display:block;
|
|
3
|
+
const myComponentCss = ":host{display:block;font-family:system-ui, -apple-system, sans-serif;color:#1a1a1a}.detector-container{display:flex;flex-direction:column;align-items:center}h1{font-size:24px;font-weight:500;color:#333;margin:0 0 24px 0}.video-container{position:relative;width:100%;max-width:640px;aspect-ratio:1;background:#fff;border:1px solid #e0e0e0;border-radius:8px;overflow:hidden}video,canvas{position:absolute;width:100%;height:100%;border-radius:8px}video.mirror,canvas.mirror{transform:rotateY(180deg)}canvas{z-index:1}video{z-index:0}.status{margin-top:16px;font-size:12px;color:#666}.overlay-mask{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;display:block;pointer-events:none}.card-outline{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:88%;height:55%;border:none;border-radius:4px;background:transparent;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7);opacity:0.8}.card-outline.perfect-match{box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7)}.side{position:absolute;background:#999;transition:background-color 0.3s ease}.side.aligned{background:#28a745}.side-top{top:0;left:0;width:100%;height:3px}.side-right{top:0;right:0;width:3px;height:100%}.side-bottom{bottom:0;left:0;width:100%;height:3px}.side-left{top:0;left:0;width:3px;height:100%}.corner{position:absolute;width:20px;height:20px;border:2px solid #999;z-index:12}.corner-tl{top:-10px;left:-10px;border-right:none;border-bottom:none}.corner-tr{top:-10px;right:-10px;border-left:none;border-bottom:none}.corner-bl{bottom:-10px;left:-10px;border-right:none;border-top:none}.corner-br{bottom:-10px;right:-10px;border-left:none;border-top:none}.corner.perfect-match{border-color:#28a745}.guide-text{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);color:#fff;font-size:14px;font-weight:600;text-align:center;white-space:normal;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;z-index:20}.capture-animation{position:absolute;top:0;left:0;width:100%;height:100%;background:#fff;opacity:0;z-index:30;pointer-events:none;animation:captureFlash 0.6s ease-out}@keyframes captureFlash{0%{opacity:0}15%{opacity:0.8}30%{opacity:0}45%{opacity:0.4}60%{opacity:0}100%{opacity:0}}.card-outline.capturing{animation:pulseGreen 0.6s ease-out}@keyframes pulseGreen{0%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}50%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 8px rgba(40, 167, 69, 0.6)}100%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}}.flip-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showFlipInstruction 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.id-card-icon{width:80px;height:50px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:8px;position:relative;animation:flipCard 2s ease-in-out infinite;box-shadow:0 4px 12px rgba(0, 0, 0, 0.3)}.id-card-icon::before{content:'';position:absolute;top:8px;left:8px;width:16px;height:12px;background:rgba(255, 255, 255, 0.9);border-radius:2px}.id-card-icon::after{content:'';position:absolute;top:25px;left:8px;width:64px;height:3px;background:rgba(255, 255, 255, 0.7);border-radius:1px;box-shadow:0 6px 0 rgba(255, 255, 255, 0.7), 0 12px 0 rgba(255, 255, 255, 0.7)}.flip-text{margin-top:12px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px}@keyframes showFlipInstruction{0%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}}@keyframes flipCard{0%{transform:rotateY(0deg)}50%{transform:rotateY(180deg)}100%{transform:rotateY(360deg)}}.success-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showSuccessMessage 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.check-icon{width:80px;height:80px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:50%;position:relative;animation:bounceSuccess 0.6s ease-out;box-shadow:0 4px 16px rgba(108, 117, 125, 0.4);display:flex;align-items:center;justify-content:center}.check-icon::before{content:'';position:absolute;width:20px;height:35px;border:4px solid #fff;border-top:none;border-left:none;transform:rotate(45deg);animation:drawCheck 0.4s ease-out 0.2s both}.success-text{margin-top:16px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;animation:fadeInUp 0.5s ease-out 0.4s both}@keyframes showSuccessMessage{0%{opacity:0;transform:translate(-50%, -50%) scale(0.5)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.9)}}@keyframes bounceSuccess{0%{transform:scale(0)}50%{transform:scale(1.1)}100%{transform:scale(1)}}@keyframes drawCheck{0%{width:0;height:0}50%{width:20px;height:0}100%{width:20px;height:35px}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}100%{opacity:1;transform:translateY(0)}}.skip-button{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);z-index:25;pointer-events:auto;background:#fff;color:#333;border:none;border-radius:25px;padding:12px 24px;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.3s ease}.skip-button:hover{background:#f8f9fa}.skip-button:active{background:#e9ecef;transform:translateX(-50%) translateY(0)}.watermark{position:absolute;bottom:12px;right:12px;z-index:15;pointer-events:none;opacity:0.7}.watermark img{height:24px;width:auto;filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3))}.loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.8);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:30;border-radius:20px}.loading-spinner{width:60px;height:60px;border:4px solid rgba(255, 255, 255, 0.2);border-top:4px solid #007bff;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:20px}.loading-text{color:white;font-size:16px;font-weight:500;text-align:center;opacity:0.9}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
|
|
4
4
|
|
|
5
5
|
const JaakStamps = class {
|
|
6
6
|
constructor(hostRef) {
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
this.captureCompleted = createEvent(this, "captureCompleted");
|
|
9
|
-
this.isReady = createEvent(this, "isReady");
|
|
10
9
|
}
|
|
11
10
|
get el() { return getElement(this); }
|
|
12
11
|
debug = false;
|
|
13
12
|
alignmentTolerance = 10; // Tolerancia en píxeles para considerar un lado alineado (escalado para 320x320)
|
|
14
|
-
maskSize = 90; // Porcentaje del video que ocupará la máscara (default 90%)
|
|
15
|
-
cropMargin = 0; // Margen en píxeles para el recorte del documento (default 0)
|
|
16
|
-
useDocumentClassification = false; // Habilita la clasificación automática de documentos para determinar si solicitar reverso
|
|
17
13
|
captureCompleted;
|
|
18
|
-
isReady;
|
|
19
14
|
isVideoActive = false;
|
|
20
15
|
statusMessage = 'Presione el botón para activar la cámara';
|
|
21
16
|
statusColor = '#aaa';
|
|
@@ -38,7 +33,6 @@ const JaakStamps = class {
|
|
|
38
33
|
isDetectionPaused = false;
|
|
39
34
|
isLoading = false;
|
|
40
35
|
isModelPreloaded = false;
|
|
41
|
-
isMaskReady = false;
|
|
42
36
|
videoRef;
|
|
43
37
|
canvasRef;
|
|
44
38
|
session;
|
|
@@ -47,8 +41,6 @@ const JaakStamps = class {
|
|
|
47
41
|
animationId;
|
|
48
42
|
hasScreenshotTaken = false;
|
|
49
43
|
lastDetectedBox;
|
|
50
|
-
mobileNetSession;
|
|
51
|
-
mobileNetClassMap;
|
|
52
44
|
// Performance optimization properties
|
|
53
45
|
frameSkipCounter = 0;
|
|
54
46
|
FRAME_SKIP = 2; // Process every 3rd frame (reduces CPU by ~66%)
|
|
@@ -61,35 +53,16 @@ const JaakStamps = class {
|
|
|
61
53
|
preprocessCtx;
|
|
62
54
|
captureCanvas;
|
|
63
55
|
captureCtx;
|
|
64
|
-
MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/
|
|
65
|
-
MOBILENET_MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.onnx";
|
|
66
|
-
MOBILENET_CLASSES_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.json";
|
|
56
|
+
MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/detector-nano.onnx";
|
|
67
57
|
INPUT_SIZE = 320;
|
|
68
58
|
CONFIDENCE_THRESHOLD = 0.6;
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
MASK_WIDTH = 280;
|
|
60
|
+
MASK_HEIGHT = 176;
|
|
71
61
|
debugLog(...args) {
|
|
72
62
|
if (this.debug) {
|
|
73
63
|
console.log(...args);
|
|
74
64
|
}
|
|
75
65
|
}
|
|
76
|
-
validateMaskSize() {
|
|
77
|
-
if (this.maskSize < 50 || this.maskSize > 100) {
|
|
78
|
-
console.warn(`maskSize debe estar entre 50 y 100. Valor actual: ${this.maskSize}. Usando valor por defecto: 90`);
|
|
79
|
-
this.maskSize = 90;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
validateCropMargin() {
|
|
83
|
-
if (this.cropMargin < 0 || this.cropMargin > 100) {
|
|
84
|
-
console.warn(`cropMargin debe estar entre 0 y 100. Valor actual: ${this.cropMargin}. Usando valor por defecto: 0`);
|
|
85
|
-
this.cropMargin = 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
emitReadyEvent() {
|
|
89
|
-
const isDocumentReady = !!window.ort && this.isModelPreloaded;
|
|
90
|
-
this.isReady.emit(isDocumentReady);
|
|
91
|
-
this.debugLog('🟢 isReady event emitted:', isDocumentReady);
|
|
92
|
-
}
|
|
93
66
|
isRearCamera(stream) {
|
|
94
67
|
const videoTrack = stream.getVideoTracks()[0];
|
|
95
68
|
if (!videoTrack)
|
|
@@ -98,109 +71,13 @@ const JaakStamps = class {
|
|
|
98
71
|
return settings.facingMode === 'environment';
|
|
99
72
|
}
|
|
100
73
|
async componentDidLoad() {
|
|
101
|
-
this.validateMaskSize();
|
|
102
|
-
this.validateCropMargin();
|
|
103
74
|
if (!window.ort) {
|
|
104
75
|
const script = document.createElement('script');
|
|
105
76
|
script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';
|
|
106
77
|
document.head.appendChild(script);
|
|
107
|
-
// Wait for ONNX runtime to load before emitting ready event
|
|
108
|
-
script.onload = () => {
|
|
109
|
-
this.emitReadyEvent();
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
// ONNX runtime already loaded
|
|
114
|
-
this.emitReadyEvent();
|
|
115
78
|
}
|
|
116
79
|
// Initialize canvas pool for better performance
|
|
117
80
|
this.initializeCanvasPool();
|
|
118
|
-
this.setupResizeObserver();
|
|
119
|
-
}
|
|
120
|
-
setupResizeObserver() {
|
|
121
|
-
if ('ResizeObserver' in window && this.canvasRef) {
|
|
122
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
123
|
-
this.handleResize();
|
|
124
|
-
});
|
|
125
|
-
resizeObserver.observe(this.canvasRef.parentElement);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
handleResize() {
|
|
129
|
-
if (this.canvasRef) {
|
|
130
|
-
const container = this.canvasRef.parentElement;
|
|
131
|
-
const rect = container.getBoundingClientRect();
|
|
132
|
-
// Set canvas size to match container
|
|
133
|
-
this.canvasRef.width = rect.width;
|
|
134
|
-
this.canvasRef.height = rect.height;
|
|
135
|
-
// Update mask positioning based on container and video dimensions
|
|
136
|
-
this.updateMaskDimensions(rect);
|
|
137
|
-
this.debugLog('📐 Canvas resized:', { width: rect.width, height: rect.height });
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
updateMaskDimensions(containerRect) {
|
|
141
|
-
if (!this.videoRef)
|
|
142
|
-
return;
|
|
143
|
-
const videoWidth = this.videoRef.videoWidth;
|
|
144
|
-
const videoHeight = this.videoRef.videoHeight;
|
|
145
|
-
if (videoWidth === 0 || videoHeight === 0)
|
|
146
|
-
return;
|
|
147
|
-
// Calculate video aspect ratio and container aspect ratio
|
|
148
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
149
|
-
const containerAspectRatio = containerRect.width / containerRect.height;
|
|
150
|
-
// Determine how video fits in container (letterboxed or pillarboxed)
|
|
151
|
-
let displayedVideoWidth, displayedVideoHeight;
|
|
152
|
-
let videoOffsetX = 0, videoOffsetY = 0;
|
|
153
|
-
if (videoAspectRatio > containerAspectRatio) {
|
|
154
|
-
// Video is wider - letterboxed (black bars top/bottom)
|
|
155
|
-
displayedVideoWidth = containerRect.width;
|
|
156
|
-
displayedVideoHeight = containerRect.width / videoAspectRatio;
|
|
157
|
-
videoOffsetY = (containerRect.height - displayedVideoHeight) / 2;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
// Video is taller - pillarboxed (black bars left/right)
|
|
161
|
-
displayedVideoHeight = containerRect.height;
|
|
162
|
-
displayedVideoWidth = containerRect.height * videoAspectRatio;
|
|
163
|
-
videoOffsetX = (containerRect.width - displayedVideoWidth) / 2;
|
|
164
|
-
}
|
|
165
|
-
// Calculate maximum possible mask size while preserving exact ID-1 aspect ratio
|
|
166
|
-
// Determine the limiting dimension based on video orientation and ID-1 proportions
|
|
167
|
-
// Calculate what would be the max width if limited by video height
|
|
168
|
-
const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;
|
|
169
|
-
let maskWidthInVideo, maskHeightInVideo;
|
|
170
|
-
const sizeRatio = this.maskSize / 100;
|
|
171
|
-
if (maxWidthByHeight <= displayedVideoWidth) {
|
|
172
|
-
// Video height is the limiting factor
|
|
173
|
-
maskHeightInVideo = displayedVideoHeight * sizeRatio;
|
|
174
|
-
maskWidthInVideo = maskHeightInVideo * this.ID1_ASPECT_RATIO;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
// Video width is the limiting factor
|
|
178
|
-
maskWidthInVideo = displayedVideoWidth * sizeRatio;
|
|
179
|
-
maskHeightInVideo = maskWidthInVideo / this.ID1_ASPECT_RATIO;
|
|
180
|
-
}
|
|
181
|
-
// Convert to percentages of the container
|
|
182
|
-
const maskWidthPercent = (maskWidthInVideo / containerRect.width) * 100;
|
|
183
|
-
const maskHeightPercent = (maskHeightInVideo / containerRect.height) * 100;
|
|
184
|
-
// Calculate the center position of the displayed video area
|
|
185
|
-
const videoCenterX = videoOffsetX + (displayedVideoWidth / 2);
|
|
186
|
-
const videoCenterY = videoOffsetY + (displayedVideoHeight / 2);
|
|
187
|
-
// Convert to percentages of the container
|
|
188
|
-
const videoCenterXPercent = (videoCenterX / containerRect.width) * 100;
|
|
189
|
-
const videoCenterYPercent = (videoCenterY / containerRect.height) * 100;
|
|
190
|
-
// Update CSS custom properties for mask sizing and positioning
|
|
191
|
-
this.el.style.setProperty('--mask-width', `${maskWidthPercent}%`);
|
|
192
|
-
this.el.style.setProperty('--mask-height', `${maskHeightPercent}%`);
|
|
193
|
-
this.el.style.setProperty('--mask-center-x', `${videoCenterXPercent}%`);
|
|
194
|
-
this.el.style.setProperty('--mask-center-y', `${videoCenterYPercent}%`);
|
|
195
|
-
// Mark mask as ready now that dimensions are calculated
|
|
196
|
-
this.isMaskReady = true;
|
|
197
|
-
this.debugLog('🎯 Mask dimensions updated:', {
|
|
198
|
-
video: { width: videoWidth, height: videoHeight },
|
|
199
|
-
displayed: { width: displayedVideoWidth, height: displayedVideoHeight },
|
|
200
|
-
mask: { widthPercent: maskWidthPercent, heightPercent: maskHeightPercent },
|
|
201
|
-
center: { x: videoCenterXPercent, y: videoCenterYPercent },
|
|
202
|
-
offset: { x: videoOffsetX, y: videoOffsetY }
|
|
203
|
-
});
|
|
204
81
|
}
|
|
205
82
|
initializeCanvasPool() {
|
|
206
83
|
// Preprocess canvas - reused for every inference
|
|
@@ -269,29 +146,24 @@ const JaakStamps = class {
|
|
|
269
146
|
}
|
|
270
147
|
try {
|
|
271
148
|
this.isLoading = true;
|
|
272
|
-
this.statusMessage = "Precargando
|
|
149
|
+
this.statusMessage = "Precargando modelo de detección...";
|
|
273
150
|
this.statusColor = "#007bff";
|
|
274
151
|
const modelPath = this.MODEL_PATH;
|
|
275
|
-
this.debugLog('🤖 Preloading
|
|
152
|
+
this.debugLog('🤖 Preloading model:', modelPath);
|
|
276
153
|
// Configure ONNX Runtime with device-specific optimizations
|
|
277
154
|
const sessionOptions = this.getSessionOptions();
|
|
278
155
|
this.session = await window.ort.InferenceSession.create(modelPath, sessionOptions);
|
|
279
|
-
// Preload MobileNet model and classes only if classification is enabled
|
|
280
|
-
if (this.useDocumentClassification) {
|
|
281
|
-
await this.loadMobileNetModel();
|
|
282
|
-
}
|
|
283
156
|
this.isModelPreloaded = true;
|
|
284
157
|
this.isLoading = false;
|
|
285
|
-
this.statusMessage = "
|
|
158
|
+
this.statusMessage = "Modelo precargado. Listo para comenzar detección";
|
|
286
159
|
this.statusColor = "#28a745";
|
|
287
|
-
this.
|
|
288
|
-
|
|
289
|
-
return { success: true, message: 'Models preloaded successfully' };
|
|
160
|
+
this.debugLog('✅ Model preloaded successfully');
|
|
161
|
+
return { success: true, message: 'Model preloaded successfully' };
|
|
290
162
|
}
|
|
291
163
|
catch (error) {
|
|
292
|
-
this.debugLog('❌ Error preloading
|
|
164
|
+
this.debugLog('❌ Error preloading model:', error);
|
|
293
165
|
this.isLoading = false;
|
|
294
|
-
this.statusMessage = "Error al precargar
|
|
166
|
+
this.statusMessage = "Error al precargar el modelo";
|
|
295
167
|
this.statusColor = "#ff6b6b";
|
|
296
168
|
return { success: false, error: error.message };
|
|
297
169
|
}
|
|
@@ -301,80 +173,6 @@ const JaakStamps = class {
|
|
|
301
173
|
this.completeProcess(true);
|
|
302
174
|
}
|
|
303
175
|
}
|
|
304
|
-
async loadMobileNetModel() {
|
|
305
|
-
try {
|
|
306
|
-
this.debugLog('🤖 Loading MobileNet model...');
|
|
307
|
-
// Load class map
|
|
308
|
-
const classResponse = await fetch(this.MOBILENET_CLASSES_PATH);
|
|
309
|
-
if (!classResponse.ok) {
|
|
310
|
-
throw new Error(`Failed to load class map: ${this.MOBILENET_CLASSES_PATH}`);
|
|
311
|
-
}
|
|
312
|
-
this.mobileNetClassMap = await classResponse.json();
|
|
313
|
-
this.debugLog('📋 MobileNet classes loaded:', this.mobileNetClassMap);
|
|
314
|
-
// Load model
|
|
315
|
-
const sessionOptions = this.getSessionOptions();
|
|
316
|
-
this.mobileNetSession = await window.ort.InferenceSession.create(this.MOBILENET_MODEL_PATH, sessionOptions);
|
|
317
|
-
this.debugLog('✅ MobileNet model loaded successfully');
|
|
318
|
-
}
|
|
319
|
-
catch (error) {
|
|
320
|
-
this.debugLog('❌ Error loading MobileNet model:', error);
|
|
321
|
-
throw error;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
preprocessMobileNet(canvas) {
|
|
325
|
-
// Create a temporary canvas for MobileNet preprocessing (224x224)
|
|
326
|
-
const tempCanvas = document.createElement('canvas');
|
|
327
|
-
tempCanvas.width = 224;
|
|
328
|
-
tempCanvas.height = 224;
|
|
329
|
-
const tempCtx = tempCanvas.getContext('2d');
|
|
330
|
-
// Draw the cropped image onto the 224x224 canvas
|
|
331
|
-
tempCtx.drawImage(canvas, 0, 0, 224, 224);
|
|
332
|
-
// Get image data and preprocess for MobileNet
|
|
333
|
-
const imageData = tempCtx.getImageData(0, 0, 224, 224);
|
|
334
|
-
const data = imageData.data;
|
|
335
|
-
const hw = 224 * 224;
|
|
336
|
-
const arr = new Float32Array(3 * hw);
|
|
337
|
-
// Normalize pixels: (pixel/255 - 0.5) / 0.5 = (pixel - 127.5) / 127.5
|
|
338
|
-
for (let i = 0; i < hw; i++) {
|
|
339
|
-
arr[i] = (data[i * 4 + 0] / 255 - 0.5) / 0.5; // R
|
|
340
|
-
arr[hw + i] = (data[i * 4 + 1] / 255 - 0.5) / 0.5; // G
|
|
341
|
-
arr[2 * hw + i] = (data[i * 4 + 2] / 255 - 0.5) / 0.5; // B
|
|
342
|
-
}
|
|
343
|
-
return new window.ort.Tensor('float32', arr, [1, 3, 224, 224]);
|
|
344
|
-
}
|
|
345
|
-
async classifyDocument(canvas) {
|
|
346
|
-
if (!this.mobileNetSession || !this.mobileNetClassMap) {
|
|
347
|
-
this.debugLog('⚠️ MobileNet model not loaded');
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
try {
|
|
351
|
-
this.debugLog('🔍 Classifying document...');
|
|
352
|
-
// Preprocess image for MobileNet
|
|
353
|
-
const inputTensor = this.preprocessMobileNet(canvas);
|
|
354
|
-
// Run inference
|
|
355
|
-
const feeds = { input: inputTensor };
|
|
356
|
-
const results = await this.mobileNetSession.run(feeds);
|
|
357
|
-
const output = results[Object.keys(results)[0]].data;
|
|
358
|
-
// Find the class with highest confidence
|
|
359
|
-
const maxIdx = output.reduce((bestIdx, val, idx, arr) => val > arr[bestIdx] ? idx : bestIdx, 0);
|
|
360
|
-
const confidence = output[maxIdx];
|
|
361
|
-
const className = this.mobileNetClassMap[maxIdx.toString()] || "unknown";
|
|
362
|
-
this.debugLog('📄 Document classification result:', {
|
|
363
|
-
class: className,
|
|
364
|
-
confidence: confidence.toFixed(3),
|
|
365
|
-
classIndex: maxIdx
|
|
366
|
-
});
|
|
367
|
-
return {
|
|
368
|
-
class: className,
|
|
369
|
-
confidence: confidence,
|
|
370
|
-
classIndex: maxIdx
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
catch (error) {
|
|
374
|
-
this.debugLog('❌ Error classifying document:', error);
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
176
|
cleanup() {
|
|
379
177
|
if (this.animationId) {
|
|
380
178
|
cancelAnimationFrame(this.animationId);
|
|
@@ -402,73 +200,22 @@ const JaakStamps = class {
|
|
|
402
200
|
this.captureCtx = undefined;
|
|
403
201
|
this.captureCanvas = undefined;
|
|
404
202
|
}
|
|
405
|
-
// Disposed ONNX
|
|
203
|
+
// Disposed ONNX session
|
|
406
204
|
if (this.session) {
|
|
407
205
|
this.session.release?.();
|
|
408
206
|
this.session = undefined;
|
|
409
207
|
}
|
|
410
|
-
if (this.mobileNetSession) {
|
|
411
|
-
this.mobileNetSession.release?.();
|
|
412
|
-
this.mobileNetSession = undefined;
|
|
413
|
-
}
|
|
414
|
-
this.mobileNetClassMap = undefined;
|
|
415
208
|
this.isModelPreloaded = false;
|
|
416
209
|
this.debugLog('🧹 Canvas pool cleaned up');
|
|
417
210
|
}
|
|
418
|
-
async getMaxResolution() {
|
|
419
|
-
try {
|
|
420
|
-
// Primero obtén un stream básico para acceder a las capacidades
|
|
421
|
-
const tempStream = await navigator.mediaDevices.getUserMedia({
|
|
422
|
-
video: { facingMode: "environment" }
|
|
423
|
-
});
|
|
424
|
-
const videoTrack = tempStream.getVideoTracks()[0];
|
|
425
|
-
const capabilities = videoTrack.getCapabilities();
|
|
426
|
-
// Detener el stream temporal
|
|
427
|
-
tempStream.getTracks().forEach(track => track.stop());
|
|
428
|
-
// Construir restricciones con resolución optimizada para tablets
|
|
429
|
-
const constraints = {
|
|
430
|
-
facingMode: "environment"
|
|
431
|
-
};
|
|
432
|
-
if (capabilities.width && capabilities.height) {
|
|
433
|
-
// Limitar resolución máxima para tablets para evitar problemas de rendimiento
|
|
434
|
-
const maxWidth = Math.min(capabilities.width.max, 1920);
|
|
435
|
-
const maxHeight = Math.min(capabilities.height.max, 1080);
|
|
436
|
-
// Para tablets, usar resolución moderada en lugar de máxima
|
|
437
|
-
const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;
|
|
438
|
-
if (isTablet) {
|
|
439
|
-
constraints.width = { ideal: Math.min(maxWidth, 1280) };
|
|
440
|
-
constraints.height = { ideal: Math.min(maxHeight, 720) };
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
constraints.width = { ideal: maxWidth };
|
|
444
|
-
constraints.height = { ideal: maxHeight };
|
|
445
|
-
}
|
|
446
|
-
this.debugLog('📐 Resolution capabilities:', {
|
|
447
|
-
maxWidth: capabilities.width.max,
|
|
448
|
-
maxHeight: capabilities.height.max,
|
|
449
|
-
selectedWidth: constraints.width.ideal,
|
|
450
|
-
selectedHeight: constraints.height.ideal,
|
|
451
|
-
isTablet
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
return constraints;
|
|
455
|
-
}
|
|
456
|
-
catch (err) {
|
|
457
|
-
this.debugLog('⚠️ Could not get capabilities, using fallback');
|
|
458
|
-
// Fallback optimizado para tablets
|
|
459
|
-
const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;
|
|
460
|
-
return {
|
|
461
|
-
facingMode: "environment",
|
|
462
|
-
width: { ideal: isTablet ? 1280 : 1920 },
|
|
463
|
-
height: { ideal: isTablet ? 720 : 1080 }
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
211
|
async setupCamera() {
|
|
468
212
|
try {
|
|
469
|
-
const constraints = await this.getMaxResolution();
|
|
470
213
|
const stream = await navigator.mediaDevices.getUserMedia({
|
|
471
|
-
video:
|
|
214
|
+
video: {
|
|
215
|
+
width: { exact: 640 },
|
|
216
|
+
height: { exact: 640 },
|
|
217
|
+
facingMode: "environment"
|
|
218
|
+
},
|
|
472
219
|
audio: false
|
|
473
220
|
});
|
|
474
221
|
if (this.videoRef) {
|
|
@@ -483,12 +230,6 @@ const JaakStamps = class {
|
|
|
483
230
|
this.videoRef.onloadedmetadata = async () => {
|
|
484
231
|
await this.videoRef.play();
|
|
485
232
|
this.isVideoActive = true;
|
|
486
|
-
// Update mask dimensions once video is loaded
|
|
487
|
-
if (this.canvasRef) {
|
|
488
|
-
const container = this.canvasRef.parentElement;
|
|
489
|
-
const rect = container.getBoundingClientRect();
|
|
490
|
-
this.updateMaskDimensions(rect);
|
|
491
|
-
}
|
|
492
233
|
resolve();
|
|
493
234
|
};
|
|
494
235
|
});
|
|
@@ -542,22 +283,17 @@ const JaakStamps = class {
|
|
|
542
283
|
// Check if model is already preloaded
|
|
543
284
|
if (!this.session) {
|
|
544
285
|
this.isLoading = true;
|
|
545
|
-
this.statusMessage = "Cargando
|
|
286
|
+
this.statusMessage = "Cargando modelo de detección...";
|
|
546
287
|
this.statusColor = "#007bff";
|
|
547
288
|
const modelPath = this.MODEL_PATH;
|
|
548
|
-
this.debugLog('🤖 Loading
|
|
289
|
+
this.debugLog('🤖 Loading model:', modelPath);
|
|
549
290
|
const sessionOptions = this.getSessionOptions();
|
|
550
291
|
this.session = await window.ort.InferenceSession.create(modelPath, sessionOptions);
|
|
551
|
-
// Load MobileNet model if classification is enabled and not already loaded
|
|
552
|
-
if (this.useDocumentClassification && !this.mobileNetSession) {
|
|
553
|
-
await this.loadMobileNetModel();
|
|
554
|
-
}
|
|
555
292
|
this.isModelPreloaded = true;
|
|
556
|
-
this.emitReadyEvent();
|
|
557
293
|
}
|
|
558
294
|
else {
|
|
559
|
-
this.debugLog('🚀 Using preloaded
|
|
560
|
-
this.statusMessage = "Usando
|
|
295
|
+
this.debugLog('🚀 Using preloaded model');
|
|
296
|
+
this.statusMessage = "Usando modelo precargado...";
|
|
561
297
|
this.statusColor = "#007bff";
|
|
562
298
|
}
|
|
563
299
|
this.statusMessage = "Configurando cámara...";
|
|
@@ -670,58 +406,13 @@ const JaakStamps = class {
|
|
|
670
406
|
return isCentered && isGoodSize;
|
|
671
407
|
}
|
|
672
408
|
checkSideAlignment(box) {
|
|
673
|
-
|
|
674
|
-
return { top: false, right: false, bottom: false, left: false };
|
|
675
|
-
// Get video dimensions to calculate actual mask boundaries in model space
|
|
676
|
-
const videoWidth = this.videoRef.videoWidth;
|
|
677
|
-
const videoHeight = this.videoRef.videoHeight;
|
|
678
|
-
if (videoWidth === 0 || videoHeight === 0) {
|
|
679
|
-
return { top: false, right: false, bottom: false, left: false };
|
|
680
|
-
}
|
|
681
|
-
// Calculate video aspect ratio
|
|
682
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
683
|
-
// The model sees video stretched to 320x320, but we need to calculate where
|
|
684
|
-
// the mask should be in this distorted space to match the visual mask
|
|
685
|
-
// In the visual display, we calculate mask size based on the limiting dimension
|
|
686
|
-
// We need to replicate this logic but account for the distortion in model space
|
|
687
|
-
// Calculate the "display" dimensions (what the visual mask calculations use)
|
|
688
|
-
const containerAspectRatio = 1; // Assume square container for simplicity
|
|
689
|
-
let displayedVideoWidth, displayedVideoHeight;
|
|
690
|
-
if (videoAspectRatio > containerAspectRatio) {
|
|
691
|
-
// Video is wider - letterboxed in display
|
|
692
|
-
displayedVideoWidth = this.INPUT_SIZE;
|
|
693
|
-
displayedVideoHeight = this.INPUT_SIZE / videoAspectRatio;
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
696
|
-
// Video is taller - pillarboxed in display
|
|
697
|
-
displayedVideoHeight = this.INPUT_SIZE;
|
|
698
|
-
displayedVideoWidth = this.INPUT_SIZE * videoAspectRatio;
|
|
699
|
-
}
|
|
700
|
-
// Calculate mask dimensions using the same logic as updateMaskDimensions
|
|
701
|
-
const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;
|
|
702
|
-
let visualMaskWidth, visualMaskHeight;
|
|
703
|
-
const sizeRatio = this.maskSize / 100;
|
|
704
|
-
if (maxWidthByHeight <= displayedVideoWidth) {
|
|
705
|
-
// Video height is the limiting factor
|
|
706
|
-
visualMaskHeight = displayedVideoHeight * sizeRatio;
|
|
707
|
-
visualMaskWidth = visualMaskHeight * this.ID1_ASPECT_RATIO;
|
|
708
|
-
}
|
|
709
|
-
else {
|
|
710
|
-
// Video width is the limiting factor
|
|
711
|
-
visualMaskWidth = displayedVideoWidth * sizeRatio;
|
|
712
|
-
visualMaskHeight = visualMaskWidth / this.ID1_ASPECT_RATIO;
|
|
713
|
-
}
|
|
714
|
-
// Now map these visual mask dimensions to the distorted model space
|
|
715
|
-
// The model stretches video to 320x320, so we need to apply the inverse transformation
|
|
716
|
-
const modelMaskWidth = visualMaskWidth * (this.INPUT_SIZE / displayedVideoWidth);
|
|
717
|
-
const modelMaskHeight = visualMaskHeight * (this.INPUT_SIZE / displayedVideoHeight);
|
|
718
|
-
// Calculate mask boundaries in model coordinate system (always centered in 320x320)
|
|
409
|
+
// Obtener las coordenadas del marco de referencia (máscara)
|
|
719
410
|
const maskCenterX = this.INPUT_SIZE / 2;
|
|
720
411
|
const maskCenterY = this.INPUT_SIZE / 2;
|
|
721
|
-
const maskLeft = maskCenterX - (
|
|
722
|
-
const maskRight = maskCenterX + (
|
|
723
|
-
const maskTop = maskCenterY - (
|
|
724
|
-
const maskBottom = maskCenterY + (
|
|
412
|
+
const maskLeft = maskCenterX - (this.MASK_WIDTH / 2);
|
|
413
|
+
const maskRight = maskCenterX + (this.MASK_WIDTH / 2);
|
|
414
|
+
const maskTop = maskCenterY - (this.MASK_HEIGHT / 2);
|
|
415
|
+
const maskBottom = maskCenterY + (this.MASK_HEIGHT / 2);
|
|
725
416
|
// Obtener las coordenadas del documento detectado
|
|
726
417
|
let docLeft = box.x;
|
|
727
418
|
let docRight = box.x + box.w;
|
|
@@ -776,9 +467,7 @@ const JaakStamps = class {
|
|
|
776
467
|
corners?.forEach(corner => corner.classList.add('perfect-match'));
|
|
777
468
|
if (!this.hasScreenshotTaken) {
|
|
778
469
|
this.lastDetectedBox = bestBox;
|
|
779
|
-
this.takeScreenshot()
|
|
780
|
-
this.debugLog('❌ Error taking screenshot:', error);
|
|
781
|
-
});
|
|
470
|
+
this.takeScreenshot();
|
|
782
471
|
this.hasScreenshotTaken = true;
|
|
783
472
|
// Reset para permitir segunda captura
|
|
784
473
|
setTimeout(() => {
|
|
@@ -820,48 +509,15 @@ const JaakStamps = class {
|
|
|
820
509
|
}
|
|
821
510
|
}
|
|
822
511
|
drawDetections(ctx, boxes) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
// Get video and container dimensions
|
|
826
|
-
const videoWidth = this.videoRef.videoWidth;
|
|
827
|
-
const videoHeight = this.videoRef.videoHeight;
|
|
828
|
-
const containerWidth = this.canvasRef.width;
|
|
829
|
-
const containerHeight = this.canvasRef.height;
|
|
830
|
-
if (videoWidth === 0 || videoHeight === 0)
|
|
831
|
-
return;
|
|
832
|
-
// Calculate video aspect ratio and container aspect ratio
|
|
833
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
834
|
-
const containerAspectRatio = containerWidth / containerHeight;
|
|
835
|
-
// Determine how video fits in container (same logic as updateMaskDimensions)
|
|
836
|
-
let displayedVideoWidth, displayedVideoHeight;
|
|
837
|
-
let videoOffsetX = 0, videoOffsetY = 0;
|
|
838
|
-
if (videoAspectRatio > containerAspectRatio) {
|
|
839
|
-
// Video is wider - letterboxed (black bars top/bottom)
|
|
840
|
-
displayedVideoWidth = containerWidth;
|
|
841
|
-
displayedVideoHeight = containerWidth / videoAspectRatio;
|
|
842
|
-
videoOffsetY = (containerHeight - displayedVideoHeight) / 2;
|
|
843
|
-
}
|
|
844
|
-
else {
|
|
845
|
-
// Video is taller - pillarboxed (black bars left/right)
|
|
846
|
-
displayedVideoHeight = containerHeight;
|
|
847
|
-
displayedVideoWidth = containerHeight * videoAspectRatio;
|
|
848
|
-
videoOffsetX = (containerWidth - displayedVideoWidth) / 2;
|
|
849
|
-
}
|
|
850
|
-
// Scale factor from model coordinates (320x320) to displayed video area
|
|
851
|
-
const scaleX = displayedVideoWidth / this.INPUT_SIZE;
|
|
852
|
-
const scaleY = displayedVideoHeight / this.INPUT_SIZE;
|
|
512
|
+
// Scale factor to convert from model coordinates (320x320) to canvas coordinates (640x640)
|
|
513
|
+
const scale = this.canvasRef.width / this.INPUT_SIZE;
|
|
853
514
|
boxes.forEach(det => {
|
|
854
|
-
// Convert model coordinates to displayed video coordinates
|
|
855
|
-
const x = det.x * scaleX + videoOffsetX;
|
|
856
|
-
const y = det.y * scaleY + videoOffsetY;
|
|
857
|
-
const w = det.w * scaleX;
|
|
858
|
-
const h = det.h * scaleY;
|
|
859
515
|
ctx.strokeStyle = "#32406C";
|
|
860
516
|
ctx.lineWidth = 2;
|
|
861
|
-
ctx.strokeRect(x, y, w, h);
|
|
517
|
+
ctx.strokeRect(det.x * scale, det.y * scale, det.w * scale, det.h * scale);
|
|
862
518
|
});
|
|
863
519
|
}
|
|
864
|
-
|
|
520
|
+
takeScreenshot() {
|
|
865
521
|
if (!this.videoRef || !this.lastDetectedBox)
|
|
866
522
|
return;
|
|
867
523
|
// Activar animación
|
|
@@ -877,10 +533,10 @@ const JaakStamps = class {
|
|
|
877
533
|
// Calcular las coordenadas de recorte basadas en la detección
|
|
878
534
|
const scaleX = this.videoRef.videoWidth / this.INPUT_SIZE;
|
|
879
535
|
const scaleY = this.videoRef.videoHeight / this.INPUT_SIZE;
|
|
880
|
-
const cropX = Math.max(0,
|
|
881
|
-
const cropY = Math.max(0,
|
|
882
|
-
const cropWidth = Math.min(
|
|
883
|
-
const cropHeight = Math.min(
|
|
536
|
+
const cropX = Math.max(0, this.lastDetectedBox.x * scaleX);
|
|
537
|
+
const cropY = Math.max(0, this.lastDetectedBox.y * scaleY);
|
|
538
|
+
const cropWidth = Math.min(this.lastDetectedBox.w * scaleX, this.videoRef.videoWidth - cropX);
|
|
539
|
+
const cropHeight = Math.min(this.lastDetectedBox.h * scaleY, this.videoRef.videoHeight - cropY);
|
|
884
540
|
// OPTIMIZATION: Create temporary canvas only for cropped version
|
|
885
541
|
// (We reuse main capture canvas for full frame)
|
|
886
542
|
const croppedCanvas = document.createElement('canvas');
|
|
@@ -895,29 +551,6 @@ const JaakStamps = class {
|
|
|
895
551
|
// Captura del frente usando canvas reutilizado
|
|
896
552
|
this.capturedFullFrame = this.captureCanvas.toDataURL('image/png');
|
|
897
553
|
this.capturedCroppedId = croppedCanvas.toDataURL('image/png');
|
|
898
|
-
// Check if document classification is enabled
|
|
899
|
-
if (this.useDocumentClassification) {
|
|
900
|
-
// Load MobileNet model if not loaded yet (lazy loading)
|
|
901
|
-
if (!this.mobileNetSession) {
|
|
902
|
-
try {
|
|
903
|
-
await this.loadMobileNetModel();
|
|
904
|
-
}
|
|
905
|
-
catch (error) {
|
|
906
|
-
this.debugLog('⚠️ Failed to load classification model, continuing without classification:', error);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
// Classify the cropped document if model is available
|
|
910
|
-
if (this.mobileNetSession) {
|
|
911
|
-
const classification = await this.classifyDocument(croppedCanvas);
|
|
912
|
-
if (classification && classification.class === 'passport') {
|
|
913
|
-
// If it's a passport, skip back capture since passports don't have a back side
|
|
914
|
-
this.debugLog('📄 Passport detected - skipping back capture');
|
|
915
|
-
this.completeProcess(true);
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
// For other IDs, continue with normal flow (back capture)
|
|
921
554
|
this.captureStep = 'back';
|
|
922
555
|
this.statusMessage = "Voltee la identificación y muestre la parte trasera";
|
|
923
556
|
this.statusColor = "#007bff";
|
|
@@ -1047,7 +680,7 @@ const JaakStamps = class {
|
|
|
1047
680
|
this.cleanup();
|
|
1048
681
|
}
|
|
1049
682
|
render() {
|
|
1050
|
-
return (h("div", { key: '
|
|
683
|
+
return (h("div", { key: 'a1036d3867a4f5c40a942e47a30992a6c56e5240', class: "detector-container" }, h("div", { key: 'dada4edb4cc690e4e73d616e8eb22fa8fb6b2817', class: "video-container" }, h("video", { key: '16b43f5efdd0c32dbfab49a86e6904baabfdc220', ref: el => this.videoRef = el, width: "640", height: "640", autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: 'e89cf0292df3bef51d9e9ed650b4f68493506314', ref: el => this.canvasRef = el, width: "640", height: "640", class: this.shouldMirrorVideo ? 'mirror' : '' }), h("div", { key: '3740295495466519be1b4b95891dd06d8272a7d6', class: "overlay-mask" }, h("div", { key: 'ac61b03420ae83d06ec8e5095a11665a8b5a4cd1', class: "card-outline" }, h("div", { key: '7190506e4803ccde1f6c95e6238b05271e7e01a5', class: "side side-top" }), h("div", { key: 'e383f023305021cdd5a02ccaf6a2bb2c775b28be', class: "side side-right" }), h("div", { key: '733f572b80c5f0050c21aa4cf5efd5b499859c23', class: "side side-bottom" }), h("div", { key: 'dbf175597a0d0790b9cc54f737693e418f1500f2', class: "side side-left" }), h("div", { key: '657375f468fc83444e6157c5308fca7237e85f22', class: "corner corner-tl" }), h("div", { key: '0491bf2ed49322cba5220a82016bb9a77c102386', class: "corner corner-tr" }), h("div", { key: 'eb7d153a47dfb1f0c98229752aabfe71181d6c3b', class: "corner corner-bl" }), h("div", { key: '7d57726a70864f9c2590395f6dc89918558fbc87', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '8deff6975766142bae69fb7596f0097b1319bc5f', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '471fae3b2c48302d474a7e7186cbe21e1260288f', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso"))), this.isCapturing && (h("div", { key: '83fa0133b072f982c9d861632525a64068271833', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: '0cdcabf20a263067a3fb120ec112a7c688eaece1', class: "flip-animation" }, h("div", { key: 'c7fd5c4211aa67cdc37be882617120cfb3afcfad', class: "id-card-icon" }), h("div", { key: '1c8e889d1de4867887fc25ac221b780154da59dd', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: '7fcf315cb26c2c860d06dcdb7da6f58524ef4474', class: "success-animation" }, h("div", { key: '5ea1a6aa4368cd154189db166af531abe2e0029e', class: "check-icon" }), h("div", { key: 'deb064b437a664ea5dfdb9b3883ee83bc85b939e', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: '7a28906555b0e5b891e1f8516a318ec540a83320', class: "loading-overlay" }, h("div", { key: '6f0778d156648405dd385f95c5e9bad0c4112eda', class: "loading-spinner" }), h("div", { key: 'b1cd4ddee0e282e8353bf8ed298fbd1c8498fb5e', class: "loading-text" }, this.statusMessage))), h("div", { key: '1e74b90a10ef2e2e71505160accb0ea83672c5de', class: "watermark" }, h("img", { key: '352fee0189ac25f59724e69e317b28859c86476e', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
|
|
1051
684
|
}
|
|
1052
685
|
};
|
|
1053
686
|
JaakStamps.style = myComponentCss;
|