@jaak.ai/stamps 2.0.0-dev.20 → 2.0.0-dev.22
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 +6 -2
- package/dist/cjs/jaak-stamps-webcomponent.cjs.js +1 -1
- package/dist/cjs/jaak-stamps.cjs.entry.js +39 -14
- 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.js +59 -14
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/components/jaak-stamps.js +40 -14
- 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 +39 -14
- 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-5bdd3e25.entry.js +2 -0
- package/dist/jaak-stamps-webcomponent/p-5bdd3e25.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +2 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-25304323.entry.js +0 -2
- package/dist/jaak-stamps-webcomponent/p-25304323.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jaak-stamps.entry.js","sources":["src/components/my-component/my-component.css?tag=jaak-stamps&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":[":host {\n display: block;\n width: 100%;\n height: 100%;\n font-family: system-ui, -apple-system, sans-serif;\n color: #1a1a1a;\n}\n\n.detector-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n}\n\nh1 {\n font-size: 24px;\n font-weight: 500;\n color: #333;\n margin: 0 0 24px 0;\n}\n\n.video-container {\n position: relative;\n width: 100%;\n height: 100%;\n background: #333;\n border: 1px solid #e0e0e0;\n border-radius: 8px;\n overflow: hidden;\n}\n\nvideo, canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 8px;\n}\n\nvideo.mirror, canvas.mirror {\n transform: rotateY(180deg);\n}\n\ncanvas { \n z-index: 1; \n}\n\nvideo { \n z-index: 0; \n}\n\n\n.status {\n margin-top: 16px;\n font-size: 12px;\n color: #666;\n}\n\n/* Overlay mask for ID card guidance */\n.overlay-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n display: block;\n pointer-events: none;\n}\n\n.card-outline {\n position: absolute;\n top: var(--mask-center-y, 50%);\n left: var(--mask-center-x, 50%);\n transform: translate(-50%, -50%);\n width: var(--mask-width, 88%);\n height: var(--mask-height, 55%);\n border: none;\n border-radius: 4px;\n background: transparent;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);\n opacity: 0.8;\n}\n\n.card-outline.perfect-match {\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);\n}\n\n/* Lados individuales de la máscara */\n.side {\n position: absolute;\n background: #999;\n transition: background-color 0.3s ease;\n}\n\n.side.aligned {\n background: #28a745;\n}\n\n.side-top {\n top: 0;\n left: 0;\n width: 100%;\n height: 3px;\n}\n\n.side-right {\n top: 0;\n right: 0;\n width: 3px;\n height: 100%;\n}\n\n.side-bottom {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 3px;\n}\n\n.side-left {\n top: 0;\n left: 0;\n width: 3px;\n height: 100%;\n}\n\n.corner {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #999;\n z-index: 12;\n}\n\n.corner-tl {\n top: -10px;\n left: -10px;\n border-right: none;\n border-bottom: none;\n}\n\n.corner-tr {\n top: -10px;\n right: -10px;\n border-left: none;\n border-bottom: none;\n}\n\n.corner-bl {\n bottom: -10px;\n left: -10px;\n border-right: none;\n border-top: none;\n}\n\n.corner-br {\n bottom: -10px;\n right: -10px;\n border-left: none;\n border-top: none;\n}\n\n.corner.perfect-match {\n border-color: #28a745;\n}\n\n.guide-text {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n white-space: normal;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n z-index: 20;\n}\n\n\n/* Animación de captura */\n.capture-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n opacity: 0;\n z-index: 30;\n pointer-events: none;\n animation: captureFlash 0.6s ease-out;\n}\n\n@keyframes captureFlash {\n 0% {\n opacity: 0;\n }\n 15% {\n opacity: 0.8;\n }\n 30% {\n opacity: 0;\n }\n 45% {\n opacity: 0.4;\n }\n 60% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n\n/* Animación del marco durante captura */\n.card-outline.capturing {\n animation: pulseGreen 0.6s ease-out;\n}\n\n@keyframes pulseGreen {\n 0% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0);\n }\n 50% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 8px rgba(40, 167, 69, 0.6);\n }\n 100% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0);\n }\n}\n\n/* Animación de voltear identificación */\n.flip-animation {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 35;\n pointer-events: none;\n opacity: 0;\n animation: showFlipInstruction 3s ease-in-out;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.id-card-icon {\n width: 80px;\n height: 50px;\n background: linear-gradient(135deg, #6c757d 0%, #495057 100%);\n border-radius: 8px;\n position: relative;\n animation: flipCard 2s ease-in-out infinite;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n}\n\n.id-card-icon::before {\n content: '';\n position: absolute;\n top: 8px;\n left: 8px;\n width: 16px;\n height: 12px;\n background: rgba(255, 255, 255, 0.9);\n border-radius: 2px;\n}\n\n.id-card-icon::after {\n content: '';\n position: absolute;\n top: 25px;\n left: 8px;\n width: 64px;\n height: 3px;\n background: rgba(255, 255, 255, 0.7);\n border-radius: 1px;\n box-shadow: 0 6px 0 rgba(255, 255, 255, 0.7), 0 12px 0 rgba(255, 255, 255, 0.7);\n}\n\n.flip-text {\n margin-top: 12px;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n}\n\n@keyframes showFlipInstruction {\n 0% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.8);\n }\n 15% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 85% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n@keyframes flipCard {\n 0% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n 100% {\n transform: rotateY(360deg);\n }\n}\n\n/* Animación de éxito */\n.success-animation {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 35;\n pointer-events: none;\n opacity: 0;\n animation: showSuccessMessage 3s ease-in-out;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.check-icon {\n width: 80px;\n height: 80px;\n background: linear-gradient(135deg, #6c757d 0%, #495057 100%);\n border-radius: 50%;\n position: relative;\n animation: bounceSuccess 0.6s ease-out;\n box-shadow: 0 4px 16px rgba(108, 117, 125, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.check-icon::before {\n content: '';\n position: absolute;\n width: 20px;\n height: 35px;\n border: 4px solid #fff;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n animation: drawCheck 0.4s ease-out 0.2s both;\n}\n\n.success-text {\n margin-top: 16px;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n animation: fadeInUp 0.5s ease-out 0.4s both;\n}\n\n@keyframes showSuccessMessage {\n 0% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.5);\n }\n 15% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 85% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n}\n\n@keyframes bounceSuccess {\n 0% {\n transform: scale(0);\n }\n 50% {\n transform: scale(1.1);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes drawCheck {\n 0% {\n width: 0;\n height: 0;\n }\n 50% {\n width: 20px;\n height: 0;\n }\n 100% {\n width: 20px;\n height: 35px;\n }\n}\n\n@keyframes fadeInUp {\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Bot\\u00f3n para saltar reverso */\n.skip-button {\n position: absolute;\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 25;\n pointer-events: auto;\n background: #fff;\n color: #333;\n border: none;\n border-radius: 25px;\n padding: 12px 24px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s ease;\n}\n\n.skip-button:hover {\n background: #f8f9fa;\n}\n\n.skip-button:active {\n background: #e9ecef;\n transform: translateX(-50%) translateY(0);\n}\n\n/* Marca de agua */\n.watermark {\n position: absolute;\n bottom: 12px;\n right: 12px;\n z-index: 15;\n pointer-events: none;\n opacity: 0.7;\n}\n\n.watermark img {\n height: 24px;\n width: auto;\n filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));\n}\n\n/* Animación de carga */\n.loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 30;\n border-radius: 20px;\n}\n\n.loading-spinner {\n width: 60px;\n height: 60px;\n border: 4px solid rgba(255, 255, 255, 0.2);\n border-top: 4px solid #007bff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 20px;\n}\n\n.loading-text {\n color: white;\n font-size: 16px;\n font-weight: 500;\n text-align: center;\n opacity: 0.9;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}","import { Component, Element, State, Prop, Method, Event, EventEmitter, h } from '@stencil/core';\n\n@Component({\n tag: 'jaak-stamps',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class JaakStamps {\n @Element() el!: HTMLElement;\n @Prop() debug: boolean = false;\n @Prop() alignmentTolerance: number = 10; // Tolerancia en píxeles para considerar un lado alineado (escalado para 320x320)\n \n @Event() captureCompleted: EventEmitter<any>;\n @Event() isReady: EventEmitter<boolean>;\n \n @State() isVideoActive: boolean = false;\n @State() statusMessage: string = 'Presione el botón para activar la cámara';\n @State() statusColor: string = '#aaa';\n @State() bestScore: number = 0;\n @State() capturedFullFrame: string | null = null;\n @State() capturedCroppedId: string | null = null;\n @State() capturedBackFullFrame: string | null = null;\n @State() capturedBackCroppedId: string | null = null;\n @State() captureStep: 'front' | 'back' | 'completed' = 'front';\n @State() isCapturing: boolean = false;\n @State() showFlipAnimation: boolean = false;\n @State() showSuccessAnimation: boolean = false;\n @State() shouldMirrorVideo: boolean = true;\n @State() sideAlignment: { top: boolean; right: boolean; bottom: boolean; left: boolean } = {\n top: false,\n right: false,\n bottom: false,\n left: false\n };\n @State() isDetectionPaused: boolean = false;\n @State() isLoading: boolean = false;\n @State() isModelPreloaded: boolean = false;\n @State() isMaskReady: boolean = false;\n \n private videoRef?: HTMLVideoElement;\n private canvasRef?: HTMLCanvasElement;\n private session?: any;\n private startTime?: number;\n private videoStream?: MediaStream;\n private animationId?: number;\n private hasScreenshotTaken: boolean = false;\n private lastDetectedBox?: any;\n \n // Performance optimization properties\n private frameSkipCounter: number = 0;\n private readonly FRAME_SKIP: number = 2; // Process every 3rd frame (reduces CPU by ~66%)\n private consecutiveFailures: number = 0;\n private readonly MAX_FAILURES: number = 30; // 0.5 seconds without detection\n private lastInferenceTime: number = 0;\n private readonly MIN_INFERENCE_INTERVAL: number = 50; // Minimum 50ms between inferences\n \n // Canvas pooling for memory optimization\n private preprocessCanvas?: HTMLCanvasElement;\n private preprocessCtx?: CanvasRenderingContext2D;\n private captureCanvas?: HTMLCanvasElement;\n private captureCtx?: CanvasRenderingContext2D;\n \n private readonly MODEL_PATH = \"https://storage.googleapis.com/jaak-static/web/component/stamps/detector-nano.onnx\";\n private readonly INPUT_SIZE = 320;\n private readonly CONFIDENCE_THRESHOLD = 0.6;\n // ISO/IEC 7810 ID-1 standard dimensions (85.60mm x 53.98mm)\n private readonly ID1_ASPECT_RATIO = 85.60 / 53.98; // 1.5863320574...\n\n private debugLog(...args: any[]) {\n if (this.debug) {\n console.log(...args);\n }\n }\n\n private emitReadyEvent() {\n const isDocumentReady = !!(window as any).ort && this.isModelPreloaded;\n this.isReady.emit(isDocumentReady);\n this.debugLog('🟢 isReady event emitted:', isDocumentReady);\n }\n\n\n\n private isRearCamera(stream: MediaStream): boolean {\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) return false;\n \n const settings = videoTrack.getSettings();\n return settings.facingMode === 'environment';\n }\n\n async componentDidLoad() {\n if (!(window as any).ort) {\n const script = document.createElement('script');\n script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';\n document.head.appendChild(script);\n \n // Wait for ONNX runtime to load before emitting ready event\n script.onload = () => {\n this.emitReadyEvent();\n };\n } else {\n // ONNX runtime already loaded\n this.emitReadyEvent();\n }\n \n // Initialize canvas pool for better performance\n this.initializeCanvasPool();\n this.setupResizeObserver();\n }\n\n private setupResizeObserver() {\n if ('ResizeObserver' in window && this.canvasRef) {\n const resizeObserver = new ResizeObserver(() => {\n this.handleResize();\n });\n resizeObserver.observe(this.canvasRef.parentElement!);\n }\n }\n\n private handleResize() {\n if (this.canvasRef) {\n const container = this.canvasRef.parentElement!;\n const rect = container.getBoundingClientRect();\n \n // Set canvas size to match container\n this.canvasRef.width = rect.width;\n this.canvasRef.height = rect.height;\n \n // Update mask positioning based on container and video dimensions\n this.updateMaskDimensions(rect);\n \n this.debugLog('📐 Canvas resized:', { width: rect.width, height: rect.height });\n }\n }\n\n private updateMaskDimensions(containerRect: DOMRect) {\n if (!this.videoRef) return;\n \n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n \n if (videoWidth === 0 || videoHeight === 0) return;\n \n // Calculate video aspect ratio and container aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n const containerAspectRatio = containerRect.width / containerRect.height;\n \n // Determine how video fits in container (letterboxed or pillarboxed)\n let displayedVideoWidth, displayedVideoHeight;\n let videoOffsetX = 0, videoOffsetY = 0;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed (black bars top/bottom)\n displayedVideoWidth = containerRect.width;\n displayedVideoHeight = containerRect.width / videoAspectRatio;\n videoOffsetY = (containerRect.height - displayedVideoHeight) / 2;\n } else {\n // Video is taller - pillarboxed (black bars left/right)\n displayedVideoHeight = containerRect.height;\n displayedVideoWidth = containerRect.height * videoAspectRatio;\n videoOffsetX = (containerRect.width - displayedVideoWidth) / 2;\n }\n \n // Calculate maximum possible mask size while preserving exact ID-1 aspect ratio\n // Determine the limiting dimension based on video orientation and ID-1 proportions\n \n // Calculate what would be the max width if limited by video height\n const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;\n \n let maskWidthInVideo, maskHeightInVideo;\n \n if (maxWidthByHeight <= displayedVideoWidth) {\n // Video height is the limiting factor\n maskHeightInVideo = displayedVideoHeight * 0.9; // Use 90% of available height\n maskWidthInVideo = maskHeightInVideo * this.ID1_ASPECT_RATIO;\n } else {\n // Video width is the limiting factor\n maskWidthInVideo = displayedVideoWidth * 0.9; // Use 90% of available width\n maskHeightInVideo = maskWidthInVideo / this.ID1_ASPECT_RATIO;\n }\n \n // Convert to percentages of the container\n const maskWidthPercent = (maskWidthInVideo / containerRect.width) * 100;\n const maskHeightPercent = (maskHeightInVideo / containerRect.height) * 100;\n \n // Calculate the center position of the displayed video area\n const videoCenterX = videoOffsetX + (displayedVideoWidth / 2);\n const videoCenterY = videoOffsetY + (displayedVideoHeight / 2);\n \n // Convert to percentages of the container\n const videoCenterXPercent = (videoCenterX / containerRect.width) * 100;\n const videoCenterYPercent = (videoCenterY / containerRect.height) * 100;\n \n // Update CSS custom properties for mask sizing and positioning\n this.el.style.setProperty('--mask-width', `${maskWidthPercent}%`);\n this.el.style.setProperty('--mask-height', `${maskHeightPercent}%`);\n this.el.style.setProperty('--mask-center-x', `${videoCenterXPercent}%`);\n this.el.style.setProperty('--mask-center-y', `${videoCenterYPercent}%`);\n \n // Mark mask as ready now that dimensions are calculated\n this.isMaskReady = true;\n \n this.debugLog('🎯 Mask dimensions updated:', {\n video: { width: videoWidth, height: videoHeight },\n displayed: { width: displayedVideoWidth, height: displayedVideoHeight },\n mask: { widthPercent: maskWidthPercent, heightPercent: maskHeightPercent },\n center: { x: videoCenterXPercent, y: videoCenterYPercent },\n offset: { x: videoOffsetX, y: videoOffsetY }\n });\n }\n \n private initializeCanvasPool() {\n // Preprocess canvas - reused for every inference\n this.preprocessCanvas = document.createElement('canvas');\n this.preprocessCanvas.width = this.INPUT_SIZE;\n this.preprocessCanvas.height = this.INPUT_SIZE;\n this.preprocessCtx = this.preprocessCanvas.getContext('2d', {\n alpha: false, // No transparency needed\n willReadFrequently: true // Optimize for frequent getImageData calls\n })!;\n \n // Capture canvas - reused for screenshots\n this.captureCanvas = document.createElement('canvas');\n this.captureCtx = this.captureCanvas.getContext('2d', {\n alpha: false\n })!;\n \n this.debugLog('🎨 Canvas pool initialized for performance');\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n\n @Method()\n async getCapturedImages() {\n if (this.captureStep !== 'completed') {\n throw new Error('El proceso de captura no ha sido completado');\n }\n\n return {\n front: {\n fullFrame: this.capturedFullFrame,\n cropped: this.capturedCroppedId\n },\n back: {\n fullFrame: this.capturedBackFullFrame,\n cropped: this.capturedBackCroppedId\n },\n metadata: {\n hasBackCapture: !!(this.capturedBackFullFrame && this.capturedBackCroppedId),\n totalImages: (this.capturedBackFullFrame && this.capturedBackCroppedId) ? 4 : 2\n }\n };\n }\n\n @Method()\n async isProcessCompleted() {\n return this.captureStep === 'completed';\n }\n\n @Method()\n async startCapture() {\n await this.startDetection();\n }\n\n @Method()\n async stopCapture() {\n this.exitSession();\n }\n\n @Method()\n async resetCapture() {\n this.resetDetection();\n }\n\n @Method()\n async getStatus() {\n return {\n isVideoActive: this.isVideoActive,\n captureStep: this.captureStep,\n statusMessage: this.statusMessage,\n hasImages: !!(this.capturedFullFrame || this.capturedBackFullFrame),\n isProcessCompleted: this.captureStep === 'completed',\n isModelPreloaded: this.isModelPreloaded\n };\n }\n\n @Method()\n async preloadModel() {\n if (this.isModelPreloaded || this.session) {\n this.debugLog('🚀 Model already preloaded or session exists');\n return { success: true, message: 'Model already loaded' };\n }\n\n try {\n this.isLoading = true;\n this.statusMessage = \"Precargando modelo de detección...\";\n this.statusColor = \"#007bff\";\n \n const modelPath = this.MODEL_PATH;\n this.debugLog('🤖 Preloading model:', modelPath);\n \n // Configure ONNX Runtime with device-specific optimizations\n const sessionOptions = this.getSessionOptions();\n \n this.session = await (window as any).ort.InferenceSession.create(modelPath, sessionOptions);\n this.isModelPreloaded = true;\n this.isLoading = false;\n this.statusMessage = \"Modelo precargado. Listo para comenzar detección\";\n this.statusColor = \"#28a745\";\n \n this.emitReadyEvent();\n this.debugLog('✅ Model preloaded successfully');\n return { success: true, message: 'Model preloaded successfully' };\n } catch (error) {\n this.debugLog('❌ Error preloading model:', error);\n this.isLoading = false;\n this.statusMessage = \"Error al precargar el modelo\";\n this.statusColor = \"#ff6b6b\";\n return { success: false, error: error.message };\n }\n }\n\n @Method()\n async skipBackCapture() {\n if (this.captureStep === 'back' && this.capturedFullFrame) {\n this.completeProcess(true);\n }\n }\n\n private cleanup() {\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n }\n if (this.videoStream) {\n this.videoStream.getTracks().forEach(track => track.stop());\n }\n \n // Limpiar canvas en cleanup general\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\");\n if (ctx) {\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n }\n \n // OPTIMIZATION: Clean up canvas pool\n this.cleanupCanvasPool();\n }\n \n private cleanupCanvasPool() {\n // Release canvas references for garbage collection\n if (this.preprocessCanvas) {\n this.preprocessCtx = undefined;\n this.preprocessCanvas = undefined;\n }\n if (this.captureCanvas) {\n this.captureCtx = undefined;\n this.captureCanvas = undefined;\n }\n \n // Disposed ONNX session\n if (this.session) {\n this.session.release?.();\n this.session = undefined;\n }\n this.isModelPreloaded = false;\n \n this.debugLog('🧹 Canvas pool cleaned up');\n }\n\n private async getMaxResolution(): Promise<MediaTrackConstraints> {\n try {\n // Primero obtén un stream básico para acceder a las capacidades\n const tempStream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: \"environment\" }\n });\n \n const videoTrack = tempStream.getVideoTracks()[0];\n const capabilities = videoTrack.getCapabilities();\n \n // Detener el stream temporal\n tempStream.getTracks().forEach(track => track.stop());\n \n // Construir restricciones con la resolución máxima\n const constraints: MediaTrackConstraints = {\n facingMode: \"environment\"\n };\n \n if (capabilities.width && capabilities.height) {\n constraints.width = { ideal: capabilities.width.max };\n constraints.height = { ideal: capabilities.height.max };\n \n this.debugLog('📐 Max resolution capabilities:', {\n width: capabilities.width.max,\n height: capabilities.height.max\n });\n }\n \n return constraints;\n } catch (err) {\n this.debugLog('⚠️ Could not get capabilities, using fallback');\n // Fallback para dispositivos que no soportan getCapabilities\n return {\n facingMode: \"environment\",\n width: { ideal: 1920 },\n height: { ideal: 1080 }\n };\n }\n }\n\n private async setupCamera() {\n try {\n const constraints = await this.getMaxResolution();\n \n const stream = await navigator.mediaDevices.getUserMedia({\n video: constraints,\n audio: false\n });\n\n if (this.videoRef) {\n this.videoRef.srcObject = stream;\n this.videoStream = stream;\n \n // Determine if video should be mirrored\n const isRear = this.isRearCamera(stream);\n this.shouldMirrorVideo = !isRear;\n \n this.debugLog('📹 Rear camera:', isRear);\n this.debugLog('🪞 Should mirror video:', this.shouldMirrorVideo);\n \n return new Promise<void>((resolve) => {\n this.videoRef!.onloadedmetadata = async () => {\n await this.videoRef!.play();\n this.isVideoActive = true;\n \n // Update mask dimensions once video is loaded\n if (this.canvasRef) {\n const container = this.canvasRef.parentElement!;\n const rect = container.getBoundingClientRect();\n this.updateMaskDimensions(rect);\n }\n \n resolve();\n };\n });\n }\n } catch (err) {\n this.debugLog(\"❌ No se pudo acceder a la cámara:\", err);\n this.statusMessage = \"Error: No se pudo acceder a la cámara.\";\n this.statusColor = \"#ff6b6b\";\n }\n }\n\n private preprocess(video: HTMLVideoElement) {\n // OPTIMIZATION: Reuse canvas instead of creating new ones\n if (!this.preprocessCanvas || !this.preprocessCtx) {\n this.initializeCanvasPool();\n }\n \n // Clear and redraw on reused canvas\n this.preprocessCtx!.clearRect(0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n this.preprocessCtx!.drawImage(video, 0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n \n const imageData = this.preprocessCtx!.getImageData(0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n const [R, G, B] = [[], [], []] as number[][];\n const { data } = imageData;\n\n // Optimized pixel processing\n for (let i = 0; i < data.length; i += 4) {\n R.push(data[i] / 255);\n G.push(data[i + 1] / 255);\n B.push(data[i + 2] / 255);\n }\n\n const transposedData = new Float32Array(R.concat(G, B));\n return new (window as any).ort.Tensor(\"float32\", transposedData, [1, 3, this.INPUT_SIZE, this.INPUT_SIZE]);\n }\n\n private getSessionOptions() {\n return {\n executionProviders: [\n // Try WebGL first for GPU acceleration, fallback to WASM\n 'webgl',\n 'wasm'\n ],\n graphOptimizationLevel: 'all', // Maximum optimization\n logSeverityLevel: this.debug ? 2 : 4, // Reduce logging overhead in production\n logVerbosityLevel: 0,\n enableCpuMemArena: true,\n enableMemPattern: true,\n executionMode: 'parallel',\n interOpNumThreads: 2,\n intraOpNumThreads: 2,\n };\n }\n\n private async startDetection() {\n try {\n // Check if model is already preloaded\n if (!this.session) {\n this.isLoading = true;\n this.statusMessage = \"Cargando modelo de detección...\";\n this.statusColor = \"#007bff\";\n \n const modelPath = this.MODEL_PATH;\n this.debugLog('🤖 Loading model:', modelPath);\n \n const sessionOptions = this.getSessionOptions();\n this.session = await (window as any).ort.InferenceSession.create(modelPath, sessionOptions);\n this.isModelPreloaded = true;\n this.emitReadyEvent();\n } else {\n this.debugLog('🚀 Using preloaded model');\n this.statusMessage = \"Usando modelo precargado...\";\n this.statusColor = \"#007bff\";\n }\n \n this.statusMessage = \"Configurando cámara...\";\n await this.setupCamera();\n \n this.startTime = Date.now();\n this.isLoading = false;\n this.detectFrame();\n } catch (err) {\n this.debugLog(\"Error al inicializar:\", err);\n this.statusMessage = \"Error al inicializar el detector\";\n this.statusColor = \"#ff6b6b\";\n this.isLoading = false;\n }\n }\n\n private async detectFrame() {\n try {\n if (!this.videoRef || !this.canvasRef || !this.session) return;\n \n // Pausar detección si está marcado como pausado\n if (this.isDetectionPaused) {\n // Solo continuar el bucle sin procesar detección\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n \n // OPTIMIZATION 1: Frame skipping for performance\n this.frameSkipCounter++;\n if (this.frameSkipCounter <= this.FRAME_SKIP) {\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n this.frameSkipCounter = 0;\n \n // OPTIMIZATION 2: Throttle inference based on time\n const currentTime = Date.now();\n if (currentTime - this.lastInferenceTime < this.MIN_INFERENCE_INTERVAL) {\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n this.lastInferenceTime = currentTime;\n \n const ctx = this.canvasRef.getContext(\"2d\")!;\n const inputTensor = this.preprocess(this.videoRef);\n const feeds = { [this.session.inputNames[0]]: inputTensor };\n const results = await this.session.run(feeds);\n const output = results[this.session.outputNames[0]].data;\n\n const finalBoxes = [];\n for (let i = 0; i < output.length; i += 6) {\n const [x1, y1, x2, y2, score, classId] = output.slice(i, i + 6);\n if (score > this.CONFIDENCE_THRESHOLD) {\n finalBoxes.push({ x: x1, y: y1, w: x2 - x1, h: y2 - y1, score, classId });\n\n if (this.startTime && Date.now() - this.startTime < 5000) {\n const currentBox = { x: x1, y: y1, w: x2 - x1, h: y2 - y1, score };\n const isWellPositioned = this.isCardInFrame(currentBox);\n const effectiveScore = isWellPositioned ? score * 1.2 : score;\n \n if (effectiveScore > this.bestScore) {\n this.bestScore = effectiveScore;\n \n }\n }\n }\n }\n \n // OPTIMIZATION 3: Adaptive frame rate based on detection success\n if (finalBoxes.length === 0) {\n this.consecutiveFailures++;\n } else {\n this.consecutiveFailures = 0;\n }\n\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n if (this.debug) {\n this.drawDetections(ctx, finalBoxes);\n }\n this.updateGuidanceStatus(finalBoxes);\n this.updateMaskColor(finalBoxes);\n \n // Solo continuar si no hemos completado el proceso\n if (this.captureStep !== 'completed') {\n // OPTIMIZATION 4: Reduce frame rate when no detection for better battery life\n if (this.consecutiveFailures > this.MAX_FAILURES) {\n // Reduce to ~5fps when no detection for 0.5 seconds\n setTimeout(() => this.detectFrame(), 200);\n } else {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n }\n } catch (e) {\n this.debugLog(\"Error en inferencia:\", e);\n // Solo continuar si no hemos completado el proceso\n if (this.captureStep !== 'completed') {\n // On error, wait longer before retrying\n setTimeout(() => this.detectFrame(), 100);\n }\n }\n }\n\n private isCardInFrame(box: any) {\n const cardCenterX = box.x + box.w / 2;\n const cardCenterY = box.y + box.h / 2;\n const frameCenterX = this.INPUT_SIZE / 2;\n const frameCenterY = this.INPUT_SIZE / 2;\n const toleranceX = 40;\n const toleranceY = 30;\n \n const isCentered = Math.abs(cardCenterX - frameCenterX) < toleranceX && \n Math.abs(cardCenterY - frameCenterY) < toleranceY;\n const isGoodSize = box.w > 150 && box.w < 300 && box.h > 90 && box.h < 200;\n \n return isCentered && isGoodSize;\n }\n\n\n private checkSideAlignment(box: any) {\n if (!this.videoRef) return { top: false, right: false, bottom: false, left: false };\n \n // Get video dimensions to calculate actual mask boundaries in model space\n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n \n if (videoWidth === 0 || videoHeight === 0) {\n return { top: false, right: false, bottom: false, left: false };\n }\n \n // Calculate video aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n \n // The model sees video stretched to 320x320, but we need to calculate where\n // the mask should be in this distorted space to match the visual mask\n \n // In the visual display, we calculate mask size based on the limiting dimension\n // We need to replicate this logic but account for the distortion in model space\n \n // Calculate the \"display\" dimensions (what the visual mask calculations use)\n const containerAspectRatio = 1; // Assume square container for simplicity\n let displayedVideoWidth, displayedVideoHeight;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed in display\n displayedVideoWidth = this.INPUT_SIZE;\n displayedVideoHeight = this.INPUT_SIZE / videoAspectRatio;\n } else {\n // Video is taller - pillarboxed in display \n displayedVideoHeight = this.INPUT_SIZE;\n displayedVideoWidth = this.INPUT_SIZE * videoAspectRatio;\n }\n \n // Calculate mask dimensions using the same logic as updateMaskDimensions\n const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;\n \n let visualMaskWidth, visualMaskHeight;\n \n if (maxWidthByHeight <= displayedVideoWidth) {\n // Video height is the limiting factor\n visualMaskHeight = displayedVideoHeight * 0.9;\n visualMaskWidth = visualMaskHeight * this.ID1_ASPECT_RATIO;\n } else {\n // Video width is the limiting factor\n visualMaskWidth = displayedVideoWidth * 0.9;\n visualMaskHeight = visualMaskWidth / this.ID1_ASPECT_RATIO;\n }\n \n // Now map these visual mask dimensions to the distorted model space\n // The model stretches video to 320x320, so we need to apply the inverse transformation\n const modelMaskWidth = visualMaskWidth * (this.INPUT_SIZE / displayedVideoWidth);\n const modelMaskHeight = visualMaskHeight * (this.INPUT_SIZE / displayedVideoHeight);\n \n // Calculate mask boundaries in model coordinate system (always centered in 320x320)\n const maskCenterX = this.INPUT_SIZE / 2;\n const maskCenterY = this.INPUT_SIZE / 2;\n const maskLeft = maskCenterX - (modelMaskWidth / 2);\n const maskRight = maskCenterX + (modelMaskWidth / 2);\n const maskTop = maskCenterY - (modelMaskHeight / 2);\n const maskBottom = maskCenterY + (modelMaskHeight / 2);\n \n // Obtener las coordenadas del documento detectado\n let docLeft = box.x;\n let docRight = box.x + box.w;\n const docTop = box.y;\n const docBottom = box.y + box.h;\n \n // Si el video está en modo mirror, invertir las coordenadas horizontales\n if (this.shouldMirrorVideo) {\n const originalDocLeft = docLeft;\n const originalDocRight = docRight;\n docLeft = this.INPUT_SIZE - originalDocRight;\n docRight = this.INPUT_SIZE - originalDocLeft;\n }\n \n // Tolerancia para considerar que un lado está alineado (en píxeles)\n const tolerance = this.alignmentTolerance;\n \n return {\n top: Math.abs(docTop - maskTop) <= tolerance,\n right: Math.abs(docRight - maskRight) <= tolerance,\n bottom: Math.abs(docBottom - maskBottom) <= tolerance,\n left: Math.abs(docLeft - maskLeft) <= tolerance\n };\n }\n\n private areAllSidesAligned(alignment: { top: boolean; right: boolean; bottom: boolean; left: boolean }) {\n return alignment.top && alignment.right && alignment.bottom && alignment.left;\n }\n\n private updateMaskColor(boxes: any[]) {\n const cardOutline = this.el.shadowRoot?.querySelector('.card-outline');\n const corners = this.el.shadowRoot?.querySelectorAll('.corner');\n const topSide = this.el.shadowRoot?.querySelector('.side-top');\n const rightSide = this.el.shadowRoot?.querySelector('.side-right');\n const bottomSide = this.el.shadowRoot?.querySelector('.side-bottom');\n const leftSide = this.el.shadowRoot?.querySelector('.side-left');\n \n let bestBox = null;\n let currentAlignment = { top: false, right: false, bottom: false, left: false };\n \n if (boxes.length > 0) {\n bestBox = boxes.reduce((best, current) => \n current.score > best.score ? current : best\n );\n currentAlignment = this.checkSideAlignment(bestBox);\n this.sideAlignment = currentAlignment;\n } else {\n // Reset alignment when no detection\n this.sideAlignment = { top: false, right: false, bottom: false, left: false };\n }\n \n // Actualizar colores de cada lado individualmente\n topSide?.classList.toggle('aligned', currentAlignment.top);\n rightSide?.classList.toggle('aligned', currentAlignment.right);\n bottomSide?.classList.toggle('aligned', currentAlignment.bottom);\n leftSide?.classList.toggle('aligned', currentAlignment.left);\n \n // Verificar si todos los lados están alineados\n const allSidesAligned = this.areAllSidesAligned(currentAlignment);\n \n if (allSidesAligned && bestBox) {\n cardOutline?.classList.add('perfect-match');\n corners?.forEach(corner => corner.classList.add('perfect-match'));\n \n if (!this.hasScreenshotTaken) {\n this.lastDetectedBox = bestBox;\n this.takeScreenshot();\n this.hasScreenshotTaken = true;\n // Reset para permitir segunda captura\n setTimeout(() => {\n this.hasScreenshotTaken = false;\n }, 2000);\n }\n } else {\n cardOutline?.classList.remove('perfect-match');\n corners?.forEach(corner => corner.classList.remove('perfect-match'));\n }\n }\n\n private updateGuidanceStatus(boxes: any[]) {\n if (boxes.length === 0) {\n this.statusMessage = \"Posicione la identificación dentro del marco\";\n this.statusColor = \"#ff6b6b\";\n } else {\n const bestBox = boxes.reduce((best, current) => \n current.score > best.score ? current : best\n );\n \n const alignment = this.checkSideAlignment(bestBox);\n const alignedSides = [alignment.top, alignment.right, alignment.bottom, alignment.left].filter(Boolean).length;\n const allSidesAligned = this.areAllSidesAligned(alignment);\n \n if (allSidesAligned) {\n this.statusMessage = \"Identificación perfectamente alineada. Mantenga inmóvil\";\n this.statusColor = \"#00ff00\";\n } else if (alignedSides > 0) {\n this.statusMessage = `Alinee los lados restantes (${alignedSides}/4 lados correctos)`;\n this.statusColor = \"#ffb366\";\n } else if (bestBox.w < 150) {\n this.statusMessage = \"Identificación detectada. Acerque al marco\";\n this.statusColor = \"#ffb366\";\n } else {\n this.statusMessage = \"Identificación detectada. Alinee con el marco\";\n this.statusColor = \"#ffb366\";\n }\n }\n }\n\n private drawDetections(ctx: CanvasRenderingContext2D, boxes: any[]) {\n if (!this.videoRef) return;\n \n // Get video and container dimensions\n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n const containerWidth = this.canvasRef!.width;\n const containerHeight = this.canvasRef!.height;\n \n if (videoWidth === 0 || videoHeight === 0) return;\n \n // Calculate video aspect ratio and container aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n const containerAspectRatio = containerWidth / containerHeight;\n \n // Determine how video fits in container (same logic as updateMaskDimensions)\n let displayedVideoWidth, displayedVideoHeight;\n let videoOffsetX = 0, videoOffsetY = 0;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed (black bars top/bottom)\n displayedVideoWidth = containerWidth;\n displayedVideoHeight = containerWidth / videoAspectRatio;\n videoOffsetY = (containerHeight - displayedVideoHeight) / 2;\n } else {\n // Video is taller - pillarboxed (black bars left/right)\n displayedVideoHeight = containerHeight;\n displayedVideoWidth = containerHeight * videoAspectRatio;\n videoOffsetX = (containerWidth - displayedVideoWidth) / 2;\n }\n \n // Scale factor from model coordinates (320x320) to displayed video area\n const scaleX = displayedVideoWidth / this.INPUT_SIZE;\n const scaleY = displayedVideoHeight / this.INPUT_SIZE;\n \n boxes.forEach(det => {\n // Convert model coordinates to displayed video coordinates\n const x = det.x * scaleX + videoOffsetX;\n const y = det.y * scaleY + videoOffsetY;\n const w = det.w * scaleX;\n const h = det.h * scaleY;\n \n ctx.strokeStyle = \"#32406C\";\n ctx.lineWidth = 2;\n ctx.strokeRect(x, y, w, h);\n });\n }\n\n private takeScreenshot() {\n if (!this.videoRef || !this.lastDetectedBox) return;\n \n // Activar animación\n this.triggerCaptureAnimation();\n \n // OPTIMIZATION: Reuse capture canvas for full frame\n if (!this.captureCanvas || !this.captureCtx) {\n this.initializeCanvasPool();\n }\n \n // Resize reused canvas for full frame\n this.captureCanvas!.width = this.videoRef.videoWidth;\n this.captureCanvas!.height = this.videoRef.videoHeight;\n this.captureCtx!.drawImage(this.videoRef, 0, 0, this.captureCanvas!.width, this.captureCanvas!.height);\n \n // Calcular las coordenadas de recorte basadas en la detección\n const scaleX = this.videoRef.videoWidth / this.INPUT_SIZE;\n const scaleY = this.videoRef.videoHeight / this.INPUT_SIZE;\n \n const cropX = Math.max(0, this.lastDetectedBox.x * scaleX);\n const cropY = Math.max(0, this.lastDetectedBox.y * scaleY);\n const cropWidth = Math.min(this.lastDetectedBox.w * scaleX, this.videoRef.videoWidth - cropX);\n const cropHeight = Math.min(this.lastDetectedBox.h * scaleY, this.videoRef.videoHeight - cropY);\n \n // OPTIMIZATION: Create temporary canvas only for cropped version\n // (We reuse main capture canvas for full frame)\n const croppedCanvas = document.createElement('canvas');\n croppedCanvas.width = cropWidth;\n croppedCanvas.height = cropHeight;\n const croppedCtx = croppedCanvas.getContext('2d', { alpha: false })!;\n \n // Recortar la identificación del frame completo\n croppedCtx.drawImage(\n this.videoRef,\n cropX, cropY, cropWidth, cropHeight, // Área de origen\n 0, 0, cropWidth, cropHeight // Área de destino\n );\n \n if (this.captureStep === 'front') {\n // Captura del frente usando canvas reutilizado\n this.capturedFullFrame = this.captureCanvas!.toDataURL('image/png');\n this.capturedCroppedId = croppedCanvas.toDataURL('image/png');\n this.captureStep = 'back';\n this.statusMessage = \"Voltee la identificación y muestre la parte trasera\";\n this.statusColor = \"#007bff\";\n \n // Pausar detección durante la animación de giro\n this.isDetectionPaused = true;\n \n // Mostrar animación de giro después de la captura\n setTimeout(() => {\n this.showFlipAnimation = true;\n setTimeout(() => {\n this.showFlipAnimation = false;\n // Reanudar detección después de que termine la animación\n this.isDetectionPaused = false;\n }, 3000);\n }, 800);\n \n this.debugLog('📸 FRENTE capturado. Esperando trasera...');\n } else if (this.captureStep === 'back') {\n // Captura de la trasera usando canvas reutilizado\n this.capturedBackFullFrame = this.captureCanvas!.toDataURL('image/png');\n this.capturedBackCroppedId = croppedCanvas.toDataURL('image/png');\n this.completeProcess(false);\n \n this.debugLog('📸 TRASERA capturada. Proceso completado. Detector detenido. Imágenes emitidas.');\n }\n }\n\n private triggerCaptureAnimation() {\n this.isCapturing = true;\n \n // Agregar clase de animación al marco\n const cardOutline = this.el.shadowRoot?.querySelector('.card-outline');\n cardOutline?.classList.add('capturing');\n \n // Limpiar animación después de que termine\n setTimeout(() => {\n this.isCapturing = false;\n cardOutline?.classList.remove('capturing');\n }, 600);\n }\n\n private stopDetection() {\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationId = undefined;\n }\n \n // Limpiar canvas para eliminar cualquier detección visual residual\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n this.debugLog('🛑 Detector de identificación detenido');\n }\n\n private resetDetection() {\n this.bestScore = 0;\n this.startTime = Date.now();\n this.statusMessage = \"Sistema reiniciado. Posicione la identificación\";\n this.statusColor = \"#aaa\";\n this.hasScreenshotTaken = false;\n this.capturedFullFrame = null;\n this.capturedCroppedId = null;\n this.capturedBackFullFrame = null;\n this.capturedBackCroppedId = null;\n this.captureStep = 'front';\n this.isCapturing = false;\n this.showFlipAnimation = false;\n this.showSuccessAnimation = false;\n this.isDetectionPaused = false;\n this.isLoading = false;\n this.lastDetectedBox = undefined;\n this.isModelPreloaded = false;\n \n // Reset performance counters\n this.frameSkipCounter = 0;\n this.consecutiveFailures = 0;\n this.lastInferenceTime = 0;\n \n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n // Reiniciar el detector si estaba funcionando\n if (this.isVideoActive && this.session) {\n this.detectFrame();\n }\n }\n\n\n private completeProcess(skippedBack: boolean = false) {\n this.captureStep = 'completed';\n this.statusMessage = skippedBack ? \n \"Proceso completado (solo frente capturado)\" : \n \"Proceso de captura completado exitosamente\";\n this.statusColor = \"#28a745\";\n \n // Detener el detector\n this.stopDetection();\n \n // Emitir evento con las imágenes capturadas\n const capturedImages = {\n front: {\n fullFrame: this.capturedFullFrame,\n cropped: this.capturedCroppedId\n },\n back: {\n fullFrame: this.capturedBackFullFrame,\n cropped: this.capturedBackCroppedId\n },\n timestamp: new Date().toISOString(),\n metadata: {\n totalImages: skippedBack ? 2 : 4,\n processCompleted: true,\n backCaptureSkipped: skippedBack\n }\n };\n \n this.captureCompleted.emit(capturedImages);\n \n // Mostrar animación de éxito después de la captura\n setTimeout(() => {\n this.showSuccessAnimation = true;\n setTimeout(() => {\n this.showSuccessAnimation = false;\n }, 3000);\n }, 800);\n }\n\n private exitSession() {\n if (this.videoStream) {\n this.videoStream.getTracks().forEach(track => track.stop());\n this.videoStream = undefined;\n this.isVideoActive = false;\n this.statusMessage = \"Sesión finalizada.\";\n this.statusColor = \"#aaa\";\n }\n this.isLoading = false;\n \n // Limpiar canvas al finalizar sesión\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n this.cleanup();\n }\n\n render() {\n return (\n <div class=\"detector-container\">\n <div class=\"video-container\">\n <video \n ref={el => this.videoRef = el}\n autoplay \n muted \n playsinline\n class={this.shouldMirrorVideo ? 'mirror' : ''}\n style={{ display: this.isVideoActive ? 'block' : 'none' }}\n />\n <canvas \n ref={el => this.canvasRef = el}\n class={this.shouldMirrorVideo ? 'mirror' : ''}\n />\n {this.isMaskReady && (\n <div class=\"overlay-mask\">\n <div class=\"card-outline\">\n <div class=\"side side-top\"></div>\n <div class=\"side side-right\"></div>\n <div class=\"side side-bottom\"></div>\n <div class=\"side side-left\"></div>\n <div class=\"corner corner-tl\"></div>\n <div class=\"corner corner-tr\"></div>\n <div class=\"corner corner-bl\"></div>\n <div class=\"corner corner-br\"></div>\n {!this.showFlipAnimation && !this.showSuccessAnimation && (\n <div class=\"guide-text\">{this.statusMessage}</div>\n )}\n </div>\n {this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (\n <button \n class=\"skip-button\" \n onClick={() => this.skipBackCapture()}\n type=\"button\"\n >\n Saltar reverso\n </button>\n )}\n </div>\n )}\n \n {this.isCapturing && (\n <div class=\"capture-animation\"></div>\n )}\n \n {this.showFlipAnimation && (\n <div class=\"flip-animation\">\n <div class=\"id-card-icon\"></div>\n <div class=\"flip-text\">¡Voltea tu identificación!</div>\n </div>\n )}\n \n {this.showSuccessAnimation && (\n <div class=\"success-animation\">\n <div class=\"check-icon\"></div>\n <div class=\"success-text\">¡Proceso completado!</div>\n </div>\n )}\n \n {this.isLoading && (\n <div class=\"loading-overlay\">\n <div class=\"loading-spinner\"></div>\n <div class=\"loading-text\">{this.statusMessage}</div>\n </div>\n )}\n \n <div class=\"watermark\">\n <img src=\"https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png\" alt=\"Powered by Jaak\" />\n </div>\n </div>\n\n\n\n </div>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG,ihNAAihN;;MCO3hN,UAAU,GAAA,MAAA;;;;;;;IAEb,KAAK,GAAY,KAAK;AACtB,IAAA,kBAAkB,GAAW,EAAE,CAAC;AAE/B,IAAA,gBAAgB;AAChB,IAAA,OAAO;IAEP,aAAa,GAAY,KAAK;IAC9B,aAAa,GAAW,0CAA0C;IAClE,WAAW,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,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,GAAG,EAAC,wEAAwE,EAAC,GAAG,EAAC,iBAAiB,EAAA,CAAG,CACtG,CACF,CAIF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"jaak-stamps.entry.js","sources":["src/components/my-component/my-component.css?tag=jaak-stamps&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":[":host {\n display: block;\n width: 100%;\n height: 100%;\n font-family: system-ui, -apple-system, sans-serif;\n color: #1a1a1a;\n}\n\n.detector-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n}\n\nh1 {\n font-size: 24px;\n font-weight: 500;\n color: #333;\n margin: 0 0 24px 0;\n}\n\n.video-container {\n position: relative;\n width: 100%;\n height: 100%;\n background: #333;\n border: 1px solid #e0e0e0;\n border-radius: 8px;\n overflow: hidden;\n}\n\nvideo, canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 8px;\n}\n\nvideo.mirror, canvas.mirror {\n transform: rotateY(180deg);\n}\n\ncanvas { \n z-index: 1; \n}\n\nvideo { \n z-index: 0; \n}\n\n\n.status {\n margin-top: 16px;\n font-size: 12px;\n color: #666;\n}\n\n/* Overlay mask for ID card guidance */\n.overlay-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n display: block;\n pointer-events: none;\n}\n\n.card-outline {\n position: absolute;\n top: var(--mask-center-y, 50%);\n left: var(--mask-center-x, 50%);\n transform: translate(-50%, -50%);\n width: var(--mask-width, 88%);\n height: var(--mask-height, 55%);\n border: none;\n border-radius: 4px;\n background: transparent;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);\n opacity: 0.8;\n}\n\n.card-outline.perfect-match {\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);\n}\n\n/* Lados individuales de la máscara */\n.side {\n position: absolute;\n background: #999;\n transition: background-color 0.3s ease;\n}\n\n.side.aligned {\n background: #28a745;\n}\n\n.side-top {\n top: 0;\n left: 0;\n width: 100%;\n height: 3px;\n}\n\n.side-right {\n top: 0;\n right: 0;\n width: 3px;\n height: 100%;\n}\n\n.side-bottom {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 3px;\n}\n\n.side-left {\n top: 0;\n left: 0;\n width: 3px;\n height: 100%;\n}\n\n.corner {\n position: absolute;\n width: 20px;\n height: 20px;\n border: 2px solid #999;\n z-index: 12;\n}\n\n.corner-tl {\n top: -10px;\n left: -10px;\n border-right: none;\n border-bottom: none;\n}\n\n.corner-tr {\n top: -10px;\n right: -10px;\n border-left: none;\n border-bottom: none;\n}\n\n.corner-bl {\n bottom: -10px;\n left: -10px;\n border-right: none;\n border-top: none;\n}\n\n.corner-br {\n bottom: -10px;\n right: -10px;\n border-left: none;\n border-top: none;\n}\n\n.corner.perfect-match {\n border-color: #28a745;\n}\n\n.guide-text {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n white-space: normal;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n z-index: 20;\n}\n\n\n/* Animación de captura */\n.capture-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n opacity: 0;\n z-index: 30;\n pointer-events: none;\n animation: captureFlash 0.6s ease-out;\n}\n\n@keyframes captureFlash {\n 0% {\n opacity: 0;\n }\n 15% {\n opacity: 0.8;\n }\n 30% {\n opacity: 0;\n }\n 45% {\n opacity: 0.4;\n }\n 60% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n\n/* Animación del marco durante captura */\n.card-outline.capturing {\n animation: pulseGreen 0.6s ease-out;\n}\n\n@keyframes pulseGreen {\n 0% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0);\n }\n 50% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 8px rgba(40, 167, 69, 0.6);\n }\n 100% {\n border-color: #28a745;\n box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0);\n }\n}\n\n/* Animación de voltear identificación */\n.flip-animation {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 35;\n pointer-events: none;\n opacity: 0;\n animation: showFlipInstruction 3s ease-in-out;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.id-card-icon {\n width: 80px;\n height: 50px;\n background: linear-gradient(135deg, #6c757d 0%, #495057 100%);\n border-radius: 8px;\n position: relative;\n animation: flipCard 2s ease-in-out infinite;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n}\n\n.id-card-icon::before {\n content: '';\n position: absolute;\n top: 8px;\n left: 8px;\n width: 16px;\n height: 12px;\n background: rgba(255, 255, 255, 0.9);\n border-radius: 2px;\n}\n\n.id-card-icon::after {\n content: '';\n position: absolute;\n top: 25px;\n left: 8px;\n width: 64px;\n height: 3px;\n background: rgba(255, 255, 255, 0.7);\n border-radius: 1px;\n box-shadow: 0 6px 0 rgba(255, 255, 255, 0.7), 0 12px 0 rgba(255, 255, 255, 0.7);\n}\n\n.flip-text {\n margin-top: 12px;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n}\n\n@keyframes showFlipInstruction {\n 0% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.8);\n }\n 15% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 85% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n@keyframes flipCard {\n 0% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n 100% {\n transform: rotateY(360deg);\n }\n}\n\n/* Animación de éxito */\n.success-animation {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 35;\n pointer-events: none;\n opacity: 0;\n animation: showSuccessMessage 3s ease-in-out;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.check-icon {\n width: 80px;\n height: 80px;\n background: linear-gradient(135deg, #6c757d 0%, #495057 100%);\n border-radius: 50%;\n position: relative;\n animation: bounceSuccess 0.6s ease-out;\n box-shadow: 0 4px 16px rgba(108, 117, 125, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.check-icon::before {\n content: '';\n position: absolute;\n width: 20px;\n height: 35px;\n border: 4px solid #fff;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n animation: drawCheck 0.4s ease-out 0.2s both;\n}\n\n.success-text {\n margin-top: 16px;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n background: rgba(128, 128, 128, 0.8);\n padding: 12px 20px;\n border-radius: 20px;\n max-width: 300px;\n animation: fadeInUp 0.5s ease-out 0.4s both;\n}\n\n@keyframes showSuccessMessage {\n 0% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.5);\n }\n 15% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 85% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n}\n\n@keyframes bounceSuccess {\n 0% {\n transform: scale(0);\n }\n 50% {\n transform: scale(1.1);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes drawCheck {\n 0% {\n width: 0;\n height: 0;\n }\n 50% {\n width: 20px;\n height: 0;\n }\n 100% {\n width: 20px;\n height: 35px;\n }\n}\n\n@keyframes fadeInUp {\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Bot\\u00f3n para saltar reverso */\n.skip-button {\n position: absolute;\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 25;\n pointer-events: auto;\n background: #fff;\n color: #333;\n border: none;\n border-radius: 25px;\n padding: 12px 24px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s ease;\n}\n\n.skip-button:hover {\n background: #f8f9fa;\n}\n\n.skip-button:active {\n background: #e9ecef;\n transform: translateX(-50%) translateY(0);\n}\n\n/* Marca de agua */\n.watermark {\n position: absolute;\n bottom: 12px;\n right: 12px;\n z-index: 15;\n pointer-events: none;\n opacity: 0.7;\n}\n\n.watermark img {\n height: 24px;\n width: auto;\n filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));\n}\n\n/* Animación de carga */\n.loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 30;\n border-radius: 20px;\n}\n\n.loading-spinner {\n width: 60px;\n height: 60px;\n border: 4px solid rgba(255, 255, 255, 0.2);\n border-top: 4px solid #007bff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 20px;\n}\n\n.loading-text {\n color: white;\n font-size: 16px;\n font-weight: 500;\n text-align: center;\n opacity: 0.9;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}","import { Component, Element, State, Prop, Method, Event, EventEmitter, h } from '@stencil/core';\n\n@Component({\n tag: 'jaak-stamps',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class JaakStamps {\n @Element() el!: HTMLElement;\n @Prop() debug: boolean = false;\n @Prop() alignmentTolerance: number = 10; // Tolerancia en píxeles para considerar un lado alineado (escalado para 320x320)\n @Prop() maskSize: number = 90; // Porcentaje del video que ocupará la máscara (default 90%)\n \n @Event() captureCompleted: EventEmitter<any>;\n @Event() isReady: EventEmitter<boolean>;\n \n @State() isVideoActive: boolean = false;\n @State() statusMessage: string = 'Presione el botón para activar la cámara';\n @State() statusColor: string = '#aaa';\n @State() bestScore: number = 0;\n @State() capturedFullFrame: string | null = null;\n @State() capturedCroppedId: string | null = null;\n @State() capturedBackFullFrame: string | null = null;\n @State() capturedBackCroppedId: string | null = null;\n @State() captureStep: 'front' | 'back' | 'completed' = 'front';\n @State() isCapturing: boolean = false;\n @State() showFlipAnimation: boolean = false;\n @State() showSuccessAnimation: boolean = false;\n @State() shouldMirrorVideo: boolean = true;\n @State() sideAlignment: { top: boolean; right: boolean; bottom: boolean; left: boolean } = {\n top: false,\n right: false,\n bottom: false,\n left: false\n };\n @State() isDetectionPaused: boolean = false;\n @State() isLoading: boolean = false;\n @State() isModelPreloaded: boolean = false;\n @State() isMaskReady: boolean = false;\n \n private videoRef?: HTMLVideoElement;\n private canvasRef?: HTMLCanvasElement;\n private session?: any;\n private startTime?: number;\n private videoStream?: MediaStream;\n private animationId?: number;\n private hasScreenshotTaken: boolean = false;\n private lastDetectedBox?: any;\n \n // Performance optimization properties\n private frameSkipCounter: number = 0;\n private readonly FRAME_SKIP: number = 2; // Process every 3rd frame (reduces CPU by ~66%)\n private consecutiveFailures: number = 0;\n private readonly MAX_FAILURES: number = 30; // 0.5 seconds without detection\n private lastInferenceTime: number = 0;\n private readonly MIN_INFERENCE_INTERVAL: number = 50; // Minimum 50ms between inferences\n \n // Canvas pooling for memory optimization\n private preprocessCanvas?: HTMLCanvasElement;\n private preprocessCtx?: CanvasRenderingContext2D;\n private captureCanvas?: HTMLCanvasElement;\n private captureCtx?: CanvasRenderingContext2D;\n \n private readonly MODEL_PATH = \"https://storage.googleapis.com/jaak-static/web/component/stamps/detector-nano.onnx\";\n private readonly INPUT_SIZE = 320;\n private readonly CONFIDENCE_THRESHOLD = 0.6;\n // ISO/IEC 7810 ID-1 standard dimensions (85.60mm x 53.98mm)\n private readonly ID1_ASPECT_RATIO = 85.60 / 53.98; // 1.5863320574...\n\n private debugLog(...args: any[]) {\n if (this.debug) {\n console.log(...args);\n }\n }\n\n private validateMaskSize() {\n if (this.maskSize < 50 || this.maskSize > 100) {\n console.warn(`maskSize debe estar entre 50 y 100. Valor actual: ${this.maskSize}. Usando valor por defecto: 90`);\n this.maskSize = 90;\n }\n }\n\n private emitReadyEvent() {\n const isDocumentReady = !!(window as any).ort && this.isModelPreloaded;\n this.isReady.emit(isDocumentReady);\n this.debugLog('🟢 isReady event emitted:', isDocumentReady);\n }\n\n\n\n private isRearCamera(stream: MediaStream): boolean {\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) return false;\n \n const settings = videoTrack.getSettings();\n return settings.facingMode === 'environment';\n }\n\n async componentDidLoad() {\n this.validateMaskSize();\n if (!(window as any).ort) {\n const script = document.createElement('script');\n script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';\n document.head.appendChild(script);\n \n // Wait for ONNX runtime to load before emitting ready event\n script.onload = () => {\n this.emitReadyEvent();\n };\n } else {\n // ONNX runtime already loaded\n this.emitReadyEvent();\n }\n \n // Initialize canvas pool for better performance\n this.initializeCanvasPool();\n this.setupResizeObserver();\n }\n\n private setupResizeObserver() {\n if ('ResizeObserver' in window && this.canvasRef) {\n const resizeObserver = new ResizeObserver(() => {\n this.handleResize();\n });\n resizeObserver.observe(this.canvasRef.parentElement!);\n }\n }\n\n private handleResize() {\n if (this.canvasRef) {\n const container = this.canvasRef.parentElement!;\n const rect = container.getBoundingClientRect();\n \n // Set canvas size to match container\n this.canvasRef.width = rect.width;\n this.canvasRef.height = rect.height;\n \n // Update mask positioning based on container and video dimensions\n this.updateMaskDimensions(rect);\n \n this.debugLog('📐 Canvas resized:', { width: rect.width, height: rect.height });\n }\n }\n\n private updateMaskDimensions(containerRect: DOMRect) {\n if (!this.videoRef) return;\n \n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n \n if (videoWidth === 0 || videoHeight === 0) return;\n \n // Calculate video aspect ratio and container aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n const containerAspectRatio = containerRect.width / containerRect.height;\n \n // Determine how video fits in container (letterboxed or pillarboxed)\n let displayedVideoWidth, displayedVideoHeight;\n let videoOffsetX = 0, videoOffsetY = 0;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed (black bars top/bottom)\n displayedVideoWidth = containerRect.width;\n displayedVideoHeight = containerRect.width / videoAspectRatio;\n videoOffsetY = (containerRect.height - displayedVideoHeight) / 2;\n } else {\n // Video is taller - pillarboxed (black bars left/right)\n displayedVideoHeight = containerRect.height;\n displayedVideoWidth = containerRect.height * videoAspectRatio;\n videoOffsetX = (containerRect.width - displayedVideoWidth) / 2;\n }\n \n // Calculate maximum possible mask size while preserving exact ID-1 aspect ratio\n // Determine the limiting dimension based on video orientation and ID-1 proportions\n \n // Calculate what would be the max width if limited by video height\n const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;\n \n let maskWidthInVideo, maskHeightInVideo;\n \n const sizeRatio = this.maskSize / 100;\n \n if (maxWidthByHeight <= displayedVideoWidth) {\n // Video height is the limiting factor\n maskHeightInVideo = displayedVideoHeight * sizeRatio;\n maskWidthInVideo = maskHeightInVideo * this.ID1_ASPECT_RATIO;\n } else {\n // Video width is the limiting factor\n maskWidthInVideo = displayedVideoWidth * sizeRatio;\n maskHeightInVideo = maskWidthInVideo / this.ID1_ASPECT_RATIO;\n }\n \n // Convert to percentages of the container\n const maskWidthPercent = (maskWidthInVideo / containerRect.width) * 100;\n const maskHeightPercent = (maskHeightInVideo / containerRect.height) * 100;\n \n // Calculate the center position of the displayed video area\n const videoCenterX = videoOffsetX + (displayedVideoWidth / 2);\n const videoCenterY = videoOffsetY + (displayedVideoHeight / 2);\n \n // Convert to percentages of the container\n const videoCenterXPercent = (videoCenterX / containerRect.width) * 100;\n const videoCenterYPercent = (videoCenterY / containerRect.height) * 100;\n \n // Update CSS custom properties for mask sizing and positioning\n this.el.style.setProperty('--mask-width', `${maskWidthPercent}%`);\n this.el.style.setProperty('--mask-height', `${maskHeightPercent}%`);\n this.el.style.setProperty('--mask-center-x', `${videoCenterXPercent}%`);\n this.el.style.setProperty('--mask-center-y', `${videoCenterYPercent}%`);\n \n // Mark mask as ready now that dimensions are calculated\n this.isMaskReady = true;\n \n this.debugLog('🎯 Mask dimensions updated:', {\n video: { width: videoWidth, height: videoHeight },\n displayed: { width: displayedVideoWidth, height: displayedVideoHeight },\n mask: { widthPercent: maskWidthPercent, heightPercent: maskHeightPercent },\n center: { x: videoCenterXPercent, y: videoCenterYPercent },\n offset: { x: videoOffsetX, y: videoOffsetY }\n });\n }\n \n private initializeCanvasPool() {\n // Preprocess canvas - reused for every inference\n this.preprocessCanvas = document.createElement('canvas');\n this.preprocessCanvas.width = this.INPUT_SIZE;\n this.preprocessCanvas.height = this.INPUT_SIZE;\n this.preprocessCtx = this.preprocessCanvas.getContext('2d', {\n alpha: false, // No transparency needed\n willReadFrequently: true // Optimize for frequent getImageData calls\n })!;\n \n // Capture canvas - reused for screenshots\n this.captureCanvas = document.createElement('canvas');\n this.captureCtx = this.captureCanvas.getContext('2d', {\n alpha: false\n })!;\n \n this.debugLog('🎨 Canvas pool initialized for performance');\n }\n\n disconnectedCallback() {\n this.cleanup();\n }\n\n @Method()\n async getCapturedImages() {\n if (this.captureStep !== 'completed') {\n throw new Error('El proceso de captura no ha sido completado');\n }\n\n return {\n front: {\n fullFrame: this.capturedFullFrame,\n cropped: this.capturedCroppedId\n },\n back: {\n fullFrame: this.capturedBackFullFrame,\n cropped: this.capturedBackCroppedId\n },\n metadata: {\n hasBackCapture: !!(this.capturedBackFullFrame && this.capturedBackCroppedId),\n totalImages: (this.capturedBackFullFrame && this.capturedBackCroppedId) ? 4 : 2\n }\n };\n }\n\n @Method()\n async isProcessCompleted() {\n return this.captureStep === 'completed';\n }\n\n @Method()\n async startCapture() {\n await this.startDetection();\n }\n\n @Method()\n async stopCapture() {\n this.exitSession();\n }\n\n @Method()\n async resetCapture() {\n this.resetDetection();\n }\n\n @Method()\n async getStatus() {\n return {\n isVideoActive: this.isVideoActive,\n captureStep: this.captureStep,\n statusMessage: this.statusMessage,\n hasImages: !!(this.capturedFullFrame || this.capturedBackFullFrame),\n isProcessCompleted: this.captureStep === 'completed',\n isModelPreloaded: this.isModelPreloaded\n };\n }\n\n @Method()\n async preloadModel() {\n if (this.isModelPreloaded || this.session) {\n this.debugLog('🚀 Model already preloaded or session exists');\n return { success: true, message: 'Model already loaded' };\n }\n\n try {\n this.isLoading = true;\n this.statusMessage = \"Precargando modelo de detección...\";\n this.statusColor = \"#007bff\";\n \n const modelPath = this.MODEL_PATH;\n this.debugLog('🤖 Preloading model:', modelPath);\n \n // Configure ONNX Runtime with device-specific optimizations\n const sessionOptions = this.getSessionOptions();\n \n this.session = await (window as any).ort.InferenceSession.create(modelPath, sessionOptions);\n this.isModelPreloaded = true;\n this.isLoading = false;\n this.statusMessage = \"Modelo precargado. Listo para comenzar detección\";\n this.statusColor = \"#28a745\";\n \n this.emitReadyEvent();\n this.debugLog('✅ Model preloaded successfully');\n return { success: true, message: 'Model preloaded successfully' };\n } catch (error) {\n this.debugLog('❌ Error preloading model:', error);\n this.isLoading = false;\n this.statusMessage = \"Error al precargar el modelo\";\n this.statusColor = \"#ff6b6b\";\n return { success: false, error: error.message };\n }\n }\n\n @Method()\n async skipBackCapture() {\n if (this.captureStep === 'back' && this.capturedFullFrame) {\n this.completeProcess(true);\n }\n }\n\n private cleanup() {\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n }\n if (this.videoStream) {\n this.videoStream.getTracks().forEach(track => track.stop());\n }\n \n // Limpiar canvas en cleanup general\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\");\n if (ctx) {\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n }\n \n // OPTIMIZATION: Clean up canvas pool\n this.cleanupCanvasPool();\n }\n \n private cleanupCanvasPool() {\n // Release canvas references for garbage collection\n if (this.preprocessCanvas) {\n this.preprocessCtx = undefined;\n this.preprocessCanvas = undefined;\n }\n if (this.captureCanvas) {\n this.captureCtx = undefined;\n this.captureCanvas = undefined;\n }\n \n // Disposed ONNX session\n if (this.session) {\n this.session.release?.();\n this.session = undefined;\n }\n this.isModelPreloaded = false;\n \n this.debugLog('🧹 Canvas pool cleaned up');\n }\n\n private async getMaxResolution(): Promise<MediaTrackConstraints> {\n try {\n // Primero obtén un stream básico para acceder a las capacidades\n const tempStream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: \"environment\" }\n });\n \n const videoTrack = tempStream.getVideoTracks()[0];\n const capabilities = videoTrack.getCapabilities();\n \n // Detener el stream temporal\n tempStream.getTracks().forEach(track => track.stop());\n \n // Construir restricciones con resolución optimizada para tablets\n const constraints: MediaTrackConstraints = {\n facingMode: \"environment\"\n };\n \n if (capabilities.width && capabilities.height) {\n // Limitar resolución máxima para tablets para evitar problemas de rendimiento\n const maxWidth = Math.min(capabilities.width.max, 1920);\n const maxHeight = Math.min(capabilities.height.max, 1080);\n \n // Para tablets, usar resolución moderada en lugar de máxima\n const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;\n \n if (isTablet) {\n constraints.width = { ideal: Math.min(maxWidth, 1280) };\n constraints.height = { ideal: Math.min(maxHeight, 720) };\n } else {\n constraints.width = { ideal: maxWidth };\n constraints.height = { ideal: maxHeight };\n }\n \n this.debugLog('📐 Resolution capabilities:', {\n maxWidth: capabilities.width.max,\n maxHeight: capabilities.height.max,\n selectedWidth: constraints.width.ideal,\n selectedHeight: constraints.height.ideal,\n isTablet\n });\n }\n \n return constraints;\n } catch (err) {\n this.debugLog('⚠️ Could not get capabilities, using fallback');\n // Fallback optimizado para tablets\n const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;\n \n return {\n facingMode: \"environment\",\n width: { ideal: isTablet ? 1280 : 1920 },\n height: { ideal: isTablet ? 720 : 1080 }\n };\n }\n }\n\n private async setupCamera() {\n try {\n const constraints = await this.getMaxResolution();\n \n const stream = await navigator.mediaDevices.getUserMedia({\n video: constraints,\n audio: false\n });\n\n if (this.videoRef) {\n this.videoRef.srcObject = stream;\n this.videoStream = stream;\n \n // Determine if video should be mirrored\n const isRear = this.isRearCamera(stream);\n this.shouldMirrorVideo = !isRear;\n \n this.debugLog('📹 Rear camera:', isRear);\n this.debugLog('🪞 Should mirror video:', this.shouldMirrorVideo);\n \n return new Promise<void>((resolve) => {\n this.videoRef!.onloadedmetadata = async () => {\n await this.videoRef!.play();\n this.isVideoActive = true;\n \n // Update mask dimensions once video is loaded\n if (this.canvasRef) {\n const container = this.canvasRef.parentElement!;\n const rect = container.getBoundingClientRect();\n this.updateMaskDimensions(rect);\n }\n \n resolve();\n };\n });\n }\n } catch (err) {\n this.debugLog(\"❌ No se pudo acceder a la cámara:\", err);\n this.statusMessage = \"Error: No se pudo acceder a la cámara.\";\n this.statusColor = \"#ff6b6b\";\n }\n }\n\n private preprocess(video: HTMLVideoElement) {\n // OPTIMIZATION: Reuse canvas instead of creating new ones\n if (!this.preprocessCanvas || !this.preprocessCtx) {\n this.initializeCanvasPool();\n }\n \n // Clear and redraw on reused canvas\n this.preprocessCtx!.clearRect(0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n this.preprocessCtx!.drawImage(video, 0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n \n const imageData = this.preprocessCtx!.getImageData(0, 0, this.INPUT_SIZE, this.INPUT_SIZE);\n const [R, G, B] = [[], [], []] as number[][];\n const { data } = imageData;\n\n // Optimized pixel processing\n for (let i = 0; i < data.length; i += 4) {\n R.push(data[i] / 255);\n G.push(data[i + 1] / 255);\n B.push(data[i + 2] / 255);\n }\n\n const transposedData = new Float32Array(R.concat(G, B));\n return new (window as any).ort.Tensor(\"float32\", transposedData, [1, 3, this.INPUT_SIZE, this.INPUT_SIZE]);\n }\n\n private getSessionOptions() {\n return {\n executionProviders: [\n // Try WebGL first for GPU acceleration, fallback to WASM\n 'webgl',\n 'wasm'\n ],\n graphOptimizationLevel: 'all', // Maximum optimization\n logSeverityLevel: this.debug ? 2 : 4, // Reduce logging overhead in production\n logVerbosityLevel: 0,\n enableCpuMemArena: true,\n enableMemPattern: true,\n executionMode: 'parallel',\n interOpNumThreads: 2,\n intraOpNumThreads: 2,\n };\n }\n\n private async startDetection() {\n try {\n // Check if model is already preloaded\n if (!this.session) {\n this.isLoading = true;\n this.statusMessage = \"Cargando modelo de detección...\";\n this.statusColor = \"#007bff\";\n \n const modelPath = this.MODEL_PATH;\n this.debugLog('🤖 Loading model:', modelPath);\n \n const sessionOptions = this.getSessionOptions();\n this.session = await (window as any).ort.InferenceSession.create(modelPath, sessionOptions);\n this.isModelPreloaded = true;\n this.emitReadyEvent();\n } else {\n this.debugLog('🚀 Using preloaded model');\n this.statusMessage = \"Usando modelo precargado...\";\n this.statusColor = \"#007bff\";\n }\n \n this.statusMessage = \"Configurando cámara...\";\n await this.setupCamera();\n \n this.startTime = Date.now();\n this.isLoading = false;\n this.detectFrame();\n } catch (err) {\n this.debugLog(\"Error al inicializar:\", err);\n this.statusMessage = \"Error al inicializar el detector\";\n this.statusColor = \"#ff6b6b\";\n this.isLoading = false;\n }\n }\n\n private async detectFrame() {\n try {\n if (!this.videoRef || !this.canvasRef || !this.session) return;\n \n // Pausar detección si está marcado como pausado\n if (this.isDetectionPaused) {\n // Solo continuar el bucle sin procesar detección\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n \n // OPTIMIZATION 1: Frame skipping for performance\n this.frameSkipCounter++;\n if (this.frameSkipCounter <= this.FRAME_SKIP) {\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n this.frameSkipCounter = 0;\n \n // OPTIMIZATION 2: Throttle inference based on time\n const currentTime = Date.now();\n if (currentTime - this.lastInferenceTime < this.MIN_INFERENCE_INTERVAL) {\n if (this.captureStep !== 'completed') {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n return;\n }\n this.lastInferenceTime = currentTime;\n \n const ctx = this.canvasRef.getContext(\"2d\")!;\n const inputTensor = this.preprocess(this.videoRef);\n const feeds = { [this.session.inputNames[0]]: inputTensor };\n const results = await this.session.run(feeds);\n const output = results[this.session.outputNames[0]].data;\n\n const finalBoxes = [];\n for (let i = 0; i < output.length; i += 6) {\n const [x1, y1, x2, y2, score, classId] = output.slice(i, i + 6);\n if (score > this.CONFIDENCE_THRESHOLD) {\n finalBoxes.push({ x: x1, y: y1, w: x2 - x1, h: y2 - y1, score, classId });\n\n if (this.startTime && Date.now() - this.startTime < 5000) {\n const currentBox = { x: x1, y: y1, w: x2 - x1, h: y2 - y1, score };\n const isWellPositioned = this.isCardInFrame(currentBox);\n const effectiveScore = isWellPositioned ? score * 1.2 : score;\n \n if (effectiveScore > this.bestScore) {\n this.bestScore = effectiveScore;\n \n }\n }\n }\n }\n \n // OPTIMIZATION 3: Adaptive frame rate based on detection success\n if (finalBoxes.length === 0) {\n this.consecutiveFailures++;\n } else {\n this.consecutiveFailures = 0;\n }\n\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n if (this.debug) {\n this.drawDetections(ctx, finalBoxes);\n }\n this.updateGuidanceStatus(finalBoxes);\n this.updateMaskColor(finalBoxes);\n \n // Solo continuar si no hemos completado el proceso\n if (this.captureStep !== 'completed') {\n // OPTIMIZATION 4: Reduce frame rate when no detection for better battery life\n if (this.consecutiveFailures > this.MAX_FAILURES) {\n // Reduce to ~5fps when no detection for 0.5 seconds\n setTimeout(() => this.detectFrame(), 200);\n } else {\n this.animationId = requestAnimationFrame(() => this.detectFrame());\n }\n }\n } catch (e) {\n this.debugLog(\"Error en inferencia:\", e);\n // Solo continuar si no hemos completado el proceso\n if (this.captureStep !== 'completed') {\n // On error, wait longer before retrying\n setTimeout(() => this.detectFrame(), 100);\n }\n }\n }\n\n private isCardInFrame(box: any) {\n const cardCenterX = box.x + box.w / 2;\n const cardCenterY = box.y + box.h / 2;\n const frameCenterX = this.INPUT_SIZE / 2;\n const frameCenterY = this.INPUT_SIZE / 2;\n const toleranceX = 40;\n const toleranceY = 30;\n \n const isCentered = Math.abs(cardCenterX - frameCenterX) < toleranceX && \n Math.abs(cardCenterY - frameCenterY) < toleranceY;\n const isGoodSize = box.w > 150 && box.w < 300 && box.h > 90 && box.h < 200;\n \n return isCentered && isGoodSize;\n }\n\n\n private checkSideAlignment(box: any) {\n if (!this.videoRef) return { top: false, right: false, bottom: false, left: false };\n \n // Get video dimensions to calculate actual mask boundaries in model space\n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n \n if (videoWidth === 0 || videoHeight === 0) {\n return { top: false, right: false, bottom: false, left: false };\n }\n \n // Calculate video aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n \n // The model sees video stretched to 320x320, but we need to calculate where\n // the mask should be in this distorted space to match the visual mask\n \n // In the visual display, we calculate mask size based on the limiting dimension\n // We need to replicate this logic but account for the distortion in model space\n \n // Calculate the \"display\" dimensions (what the visual mask calculations use)\n const containerAspectRatio = 1; // Assume square container for simplicity\n let displayedVideoWidth, displayedVideoHeight;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed in display\n displayedVideoWidth = this.INPUT_SIZE;\n displayedVideoHeight = this.INPUT_SIZE / videoAspectRatio;\n } else {\n // Video is taller - pillarboxed in display \n displayedVideoHeight = this.INPUT_SIZE;\n displayedVideoWidth = this.INPUT_SIZE * videoAspectRatio;\n }\n \n // Calculate mask dimensions using the same logic as updateMaskDimensions\n const maxWidthByHeight = displayedVideoHeight * this.ID1_ASPECT_RATIO;\n \n let visualMaskWidth, visualMaskHeight;\n const sizeRatio = this.maskSize / 100;\n \n if (maxWidthByHeight <= displayedVideoWidth) {\n // Video height is the limiting factor\n visualMaskHeight = displayedVideoHeight * sizeRatio;\n visualMaskWidth = visualMaskHeight * this.ID1_ASPECT_RATIO;\n } else {\n // Video width is the limiting factor\n visualMaskWidth = displayedVideoWidth * sizeRatio;\n visualMaskHeight = visualMaskWidth / this.ID1_ASPECT_RATIO;\n }\n \n // Now map these visual mask dimensions to the distorted model space\n // The model stretches video to 320x320, so we need to apply the inverse transformation\n const modelMaskWidth = visualMaskWidth * (this.INPUT_SIZE / displayedVideoWidth);\n const modelMaskHeight = visualMaskHeight * (this.INPUT_SIZE / displayedVideoHeight);\n \n // Calculate mask boundaries in model coordinate system (always centered in 320x320)\n const maskCenterX = this.INPUT_SIZE / 2;\n const maskCenterY = this.INPUT_SIZE / 2;\n const maskLeft = maskCenterX - (modelMaskWidth / 2);\n const maskRight = maskCenterX + (modelMaskWidth / 2);\n const maskTop = maskCenterY - (modelMaskHeight / 2);\n const maskBottom = maskCenterY + (modelMaskHeight / 2);\n \n // Obtener las coordenadas del documento detectado\n let docLeft = box.x;\n let docRight = box.x + box.w;\n const docTop = box.y;\n const docBottom = box.y + box.h;\n \n // Si el video está en modo mirror, invertir las coordenadas horizontales\n if (this.shouldMirrorVideo) {\n const originalDocLeft = docLeft;\n const originalDocRight = docRight;\n docLeft = this.INPUT_SIZE - originalDocRight;\n docRight = this.INPUT_SIZE - originalDocLeft;\n }\n \n // Tolerancia para considerar que un lado está alineado (en píxeles)\n const tolerance = this.alignmentTolerance;\n \n return {\n top: Math.abs(docTop - maskTop) <= tolerance,\n right: Math.abs(docRight - maskRight) <= tolerance,\n bottom: Math.abs(docBottom - maskBottom) <= tolerance,\n left: Math.abs(docLeft - maskLeft) <= tolerance\n };\n }\n\n private areAllSidesAligned(alignment: { top: boolean; right: boolean; bottom: boolean; left: boolean }) {\n return alignment.top && alignment.right && alignment.bottom && alignment.left;\n }\n\n private updateMaskColor(boxes: any[]) {\n const cardOutline = this.el.shadowRoot?.querySelector('.card-outline');\n const corners = this.el.shadowRoot?.querySelectorAll('.corner');\n const topSide = this.el.shadowRoot?.querySelector('.side-top');\n const rightSide = this.el.shadowRoot?.querySelector('.side-right');\n const bottomSide = this.el.shadowRoot?.querySelector('.side-bottom');\n const leftSide = this.el.shadowRoot?.querySelector('.side-left');\n \n let bestBox = null;\n let currentAlignment = { top: false, right: false, bottom: false, left: false };\n \n if (boxes.length > 0) {\n bestBox = boxes.reduce((best, current) => \n current.score > best.score ? current : best\n );\n currentAlignment = this.checkSideAlignment(bestBox);\n this.sideAlignment = currentAlignment;\n } else {\n // Reset alignment when no detection\n this.sideAlignment = { top: false, right: false, bottom: false, left: false };\n }\n \n // Actualizar colores de cada lado individualmente\n topSide?.classList.toggle('aligned', currentAlignment.top);\n rightSide?.classList.toggle('aligned', currentAlignment.right);\n bottomSide?.classList.toggle('aligned', currentAlignment.bottom);\n leftSide?.classList.toggle('aligned', currentAlignment.left);\n \n // Verificar si todos los lados están alineados\n const allSidesAligned = this.areAllSidesAligned(currentAlignment);\n \n if (allSidesAligned && bestBox) {\n cardOutline?.classList.add('perfect-match');\n corners?.forEach(corner => corner.classList.add('perfect-match'));\n \n if (!this.hasScreenshotTaken) {\n this.lastDetectedBox = bestBox;\n this.takeScreenshot();\n this.hasScreenshotTaken = true;\n // Reset para permitir segunda captura\n setTimeout(() => {\n this.hasScreenshotTaken = false;\n }, 2000);\n }\n } else {\n cardOutline?.classList.remove('perfect-match');\n corners?.forEach(corner => corner.classList.remove('perfect-match'));\n }\n }\n\n private updateGuidanceStatus(boxes: any[]) {\n if (boxes.length === 0) {\n this.statusMessage = \"Posicione la identificación dentro del marco\";\n this.statusColor = \"#ff6b6b\";\n } else {\n const bestBox = boxes.reduce((best, current) => \n current.score > best.score ? current : best\n );\n \n const alignment = this.checkSideAlignment(bestBox);\n const alignedSides = [alignment.top, alignment.right, alignment.bottom, alignment.left].filter(Boolean).length;\n const allSidesAligned = this.areAllSidesAligned(alignment);\n \n if (allSidesAligned) {\n this.statusMessage = \"Identificación perfectamente alineada. Mantenga inmóvil\";\n this.statusColor = \"#00ff00\";\n } else if (alignedSides > 0) {\n this.statusMessage = `Alinee los lados restantes (${alignedSides}/4 lados correctos)`;\n this.statusColor = \"#ffb366\";\n } else if (bestBox.w < 150) {\n this.statusMessage = \"Identificación detectada. Acerque al marco\";\n this.statusColor = \"#ffb366\";\n } else {\n this.statusMessage = \"Identificación detectada. Alinee con el marco\";\n this.statusColor = \"#ffb366\";\n }\n }\n }\n\n private drawDetections(ctx: CanvasRenderingContext2D, boxes: any[]) {\n if (!this.videoRef) return;\n \n // Get video and container dimensions\n const videoWidth = this.videoRef.videoWidth;\n const videoHeight = this.videoRef.videoHeight;\n const containerWidth = this.canvasRef!.width;\n const containerHeight = this.canvasRef!.height;\n \n if (videoWidth === 0 || videoHeight === 0) return;\n \n // Calculate video aspect ratio and container aspect ratio\n const videoAspectRatio = videoWidth / videoHeight;\n const containerAspectRatio = containerWidth / containerHeight;\n \n // Determine how video fits in container (same logic as updateMaskDimensions)\n let displayedVideoWidth, displayedVideoHeight;\n let videoOffsetX = 0, videoOffsetY = 0;\n \n if (videoAspectRatio > containerAspectRatio) {\n // Video is wider - letterboxed (black bars top/bottom)\n displayedVideoWidth = containerWidth;\n displayedVideoHeight = containerWidth / videoAspectRatio;\n videoOffsetY = (containerHeight - displayedVideoHeight) / 2;\n } else {\n // Video is taller - pillarboxed (black bars left/right)\n displayedVideoHeight = containerHeight;\n displayedVideoWidth = containerHeight * videoAspectRatio;\n videoOffsetX = (containerWidth - displayedVideoWidth) / 2;\n }\n \n // Scale factor from model coordinates (320x320) to displayed video area\n const scaleX = displayedVideoWidth / this.INPUT_SIZE;\n const scaleY = displayedVideoHeight / this.INPUT_SIZE;\n \n boxes.forEach(det => {\n // Convert model coordinates to displayed video coordinates\n const x = det.x * scaleX + videoOffsetX;\n const y = det.y * scaleY + videoOffsetY;\n const w = det.w * scaleX;\n const h = det.h * scaleY;\n \n ctx.strokeStyle = \"#32406C\";\n ctx.lineWidth = 2;\n ctx.strokeRect(x, y, w, h);\n });\n }\n\n private takeScreenshot() {\n if (!this.videoRef || !this.lastDetectedBox) return;\n \n // Activar animación\n this.triggerCaptureAnimation();\n \n // OPTIMIZATION: Reuse capture canvas for full frame\n if (!this.captureCanvas || !this.captureCtx) {\n this.initializeCanvasPool();\n }\n \n // Resize reused canvas for full frame\n this.captureCanvas!.width = this.videoRef.videoWidth;\n this.captureCanvas!.height = this.videoRef.videoHeight;\n this.captureCtx!.drawImage(this.videoRef, 0, 0, this.captureCanvas!.width, this.captureCanvas!.height);\n \n // Calcular las coordenadas de recorte basadas en la detección\n const scaleX = this.videoRef.videoWidth / this.INPUT_SIZE;\n const scaleY = this.videoRef.videoHeight / this.INPUT_SIZE;\n \n const cropX = Math.max(0, this.lastDetectedBox.x * scaleX);\n const cropY = Math.max(0, this.lastDetectedBox.y * scaleY);\n const cropWidth = Math.min(this.lastDetectedBox.w * scaleX, this.videoRef.videoWidth - cropX);\n const cropHeight = Math.min(this.lastDetectedBox.h * scaleY, this.videoRef.videoHeight - cropY);\n \n // OPTIMIZATION: Create temporary canvas only for cropped version\n // (We reuse main capture canvas for full frame)\n const croppedCanvas = document.createElement('canvas');\n croppedCanvas.width = cropWidth;\n croppedCanvas.height = cropHeight;\n const croppedCtx = croppedCanvas.getContext('2d', { alpha: false })!;\n \n // Recortar la identificación del frame completo\n croppedCtx.drawImage(\n this.videoRef,\n cropX, cropY, cropWidth, cropHeight, // Área de origen\n 0, 0, cropWidth, cropHeight // Área de destino\n );\n \n if (this.captureStep === 'front') {\n // Captura del frente usando canvas reutilizado\n this.capturedFullFrame = this.captureCanvas!.toDataURL('image/png');\n this.capturedCroppedId = croppedCanvas.toDataURL('image/png');\n this.captureStep = 'back';\n this.statusMessage = \"Voltee la identificación y muestre la parte trasera\";\n this.statusColor = \"#007bff\";\n \n // Pausar detección durante la animación de giro\n this.isDetectionPaused = true;\n \n // Mostrar animación de giro después de la captura\n setTimeout(() => {\n this.showFlipAnimation = true;\n setTimeout(() => {\n this.showFlipAnimation = false;\n // Reanudar detección después de que termine la animación\n this.isDetectionPaused = false;\n }, 3000);\n }, 800);\n \n this.debugLog('📸 FRENTE capturado. Esperando trasera...');\n } else if (this.captureStep === 'back') {\n // Captura de la trasera usando canvas reutilizado\n this.capturedBackFullFrame = this.captureCanvas!.toDataURL('image/png');\n this.capturedBackCroppedId = croppedCanvas.toDataURL('image/png');\n this.completeProcess(false);\n \n this.debugLog('📸 TRASERA capturada. Proceso completado. Detector detenido. Imágenes emitidas.');\n }\n }\n\n private triggerCaptureAnimation() {\n this.isCapturing = true;\n \n // Agregar clase de animación al marco\n const cardOutline = this.el.shadowRoot?.querySelector('.card-outline');\n cardOutline?.classList.add('capturing');\n \n // Limpiar animación después de que termine\n setTimeout(() => {\n this.isCapturing = false;\n cardOutline?.classList.remove('capturing');\n }, 600);\n }\n\n private stopDetection() {\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationId = undefined;\n }\n \n // Limpiar canvas para eliminar cualquier detección visual residual\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n this.debugLog('🛑 Detector de identificación detenido');\n }\n\n private resetDetection() {\n this.bestScore = 0;\n this.startTime = Date.now();\n this.statusMessage = \"Sistema reiniciado. Posicione la identificación\";\n this.statusColor = \"#aaa\";\n this.hasScreenshotTaken = false;\n this.capturedFullFrame = null;\n this.capturedCroppedId = null;\n this.capturedBackFullFrame = null;\n this.capturedBackCroppedId = null;\n this.captureStep = 'front';\n this.isCapturing = false;\n this.showFlipAnimation = false;\n this.showSuccessAnimation = false;\n this.isDetectionPaused = false;\n this.isLoading = false;\n this.lastDetectedBox = undefined;\n this.isModelPreloaded = false;\n \n // Reset performance counters\n this.frameSkipCounter = 0;\n this.consecutiveFailures = 0;\n this.lastInferenceTime = 0;\n \n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n // Reiniciar el detector si estaba funcionando\n if (this.isVideoActive && this.session) {\n this.detectFrame();\n }\n }\n\n\n private completeProcess(skippedBack: boolean = false) {\n this.captureStep = 'completed';\n this.statusMessage = skippedBack ? \n \"Proceso completado (solo frente capturado)\" : \n \"Proceso de captura completado exitosamente\";\n this.statusColor = \"#28a745\";\n \n // Detener el detector\n this.stopDetection();\n \n // Emitir evento con las imágenes capturadas\n const capturedImages = {\n front: {\n fullFrame: this.capturedFullFrame,\n cropped: this.capturedCroppedId\n },\n back: {\n fullFrame: this.capturedBackFullFrame,\n cropped: this.capturedBackCroppedId\n },\n timestamp: new Date().toISOString(),\n metadata: {\n totalImages: skippedBack ? 2 : 4,\n processCompleted: true,\n backCaptureSkipped: skippedBack\n }\n };\n \n this.captureCompleted.emit(capturedImages);\n \n // Mostrar animación de éxito después de la captura\n setTimeout(() => {\n this.showSuccessAnimation = true;\n setTimeout(() => {\n this.showSuccessAnimation = false;\n }, 3000);\n }, 800);\n }\n\n private exitSession() {\n if (this.videoStream) {\n this.videoStream.getTracks().forEach(track => track.stop());\n this.videoStream = undefined;\n this.isVideoActive = false;\n this.statusMessage = \"Sesión finalizada.\";\n this.statusColor = \"#aaa\";\n }\n this.isLoading = false;\n \n // Limpiar canvas al finalizar sesión\n if (this.canvasRef) {\n const ctx = this.canvasRef.getContext(\"2d\")!;\n ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);\n }\n \n this.cleanup();\n }\n\n render() {\n return (\n <div class=\"detector-container\">\n <div class=\"video-container\">\n <video \n ref={el => this.videoRef = el}\n autoplay \n muted \n playsinline\n class={this.shouldMirrorVideo ? 'mirror' : ''}\n style={{ display: this.isVideoActive ? 'block' : 'none' }}\n />\n <canvas \n ref={el => this.canvasRef = el}\n class={this.shouldMirrorVideo ? 'mirror' : ''}\n />\n {this.isMaskReady && (\n <div class=\"overlay-mask\">\n <div class=\"card-outline\">\n <div class=\"side side-top\"></div>\n <div class=\"side side-right\"></div>\n <div class=\"side side-bottom\"></div>\n <div class=\"side side-left\"></div>\n <div class=\"corner corner-tl\"></div>\n <div class=\"corner corner-tr\"></div>\n <div class=\"corner corner-bl\"></div>\n <div class=\"corner corner-br\"></div>\n {!this.showFlipAnimation && !this.showSuccessAnimation && (\n <div class=\"guide-text\">{this.statusMessage}</div>\n )}\n </div>\n {this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (\n <button \n class=\"skip-button\" \n onClick={() => this.skipBackCapture()}\n type=\"button\"\n >\n Saltar reverso\n </button>\n )}\n </div>\n )}\n \n {this.isCapturing && (\n <div class=\"capture-animation\"></div>\n )}\n \n {this.showFlipAnimation && (\n <div class=\"flip-animation\">\n <div class=\"id-card-icon\"></div>\n <div class=\"flip-text\">¡Voltea tu identificación!</div>\n </div>\n )}\n \n {this.showSuccessAnimation && (\n <div class=\"success-animation\">\n <div class=\"check-icon\"></div>\n <div class=\"success-text\">¡Proceso completado!</div>\n </div>\n )}\n \n {this.isLoading && (\n <div class=\"loading-overlay\">\n <div class=\"loading-spinner\"></div>\n <div class=\"loading-text\">{this.statusMessage}</div>\n </div>\n )}\n \n <div class=\"watermark\">\n <img src=\"https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png\" alt=\"Powered by Jaak\" />\n </div>\n </div>\n\n\n\n </div>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG,ihNAAihN;;MCO3hN,UAAU,GAAA,MAAA;;;;;;;IAEb,KAAK,GAAY,KAAK;AACtB,IAAA,kBAAkB,GAAW,EAAE,CAAC;AAChC,IAAA,QAAQ,GAAW,EAAE,CAAC;AAErB,IAAA,gBAAgB;AAChB,IAAA,OAAO;IAEP,aAAa,GAAY,KAAK;IAC9B,aAAa,GAAW,0CAA0C;IAClE,WAAW,GAAW,MAAM;IAC5B,SAAS,GAAW,CAAC;IACrB,iBAAiB,GAAkB,IAAI;IACvC,iBAAiB,GAAkB,IAAI;IACvC,qBAAqB,GAAkB,IAAI;IAC3C,qBAAqB,GAAkB,IAAI;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 +4,7 @@ export { s as setNonce } from './index-DqoVMnc7.js';
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy([["jaak-stamps",[[1,"jaak-stamps",{"debug":[4],"alignmentTolerance":[2,"alignment-tolerance"],"isVideoActive":[32],"statusMessage":[32],"statusColor":[32],"bestScore":[32],"capturedFullFrame":[32],"capturedCroppedId":[32],"capturedBackFullFrame":[32],"capturedBackCroppedId":[32],"captureStep":[32],"isCapturing":[32],"showFlipAnimation":[32],"showSuccessAnimation":[32],"shouldMirrorVideo":[32],"sideAlignment":[32],"isDetectionPaused":[32],"isLoading":[32],"isModelPreloaded":[32],"isMaskReady":[32],"getCapturedImages":[64],"isProcessCompleted":[64],"startCapture":[64],"stopCapture":[64],"resetCapture":[64],"getStatus":[64],"preloadModel":[64],"skipBackCapture":[64]}]]]], options);
|
|
7
|
+
return bootstrapLazy([["jaak-stamps",[[1,"jaak-stamps",{"debug":[4],"alignmentTolerance":[2,"alignment-tolerance"],"maskSize":[2,"mask-size"],"isVideoActive":[32],"statusMessage":[32],"statusColor":[32],"bestScore":[32],"capturedFullFrame":[32],"capturedCroppedId":[32],"capturedBackFullFrame":[32],"capturedBackCroppedId":[32],"captureStep":[32],"isCapturing":[32],"showFlipAnimation":[32],"showSuccessAnimation":[32],"shouldMirrorVideo":[32],"sideAlignment":[32],"isDetectionPaused":[32],"isLoading":[32],"isModelPreloaded":[32],"isMaskReady":[32],"getCapturedImages":[64],"isProcessCompleted":[64],"startCapture":[64],"stopCapture":[64],"resetCapture":[64],"getStatus":[64],"preloadModel":[64],"skipBackCapture":[64]}]]]], options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,g as a,b as t}from"./p-DqoVMnc7.js";export{s as setNonce}from"./p-DqoVMnc7.js";var r=()=>{const a=import.meta.url;const
|
|
1
|
+
import{p as e,g as a,b as t}from"./p-DqoVMnc7.js";export{s as setNonce}from"./p-DqoVMnc7.js";var r=()=>{const a=import.meta.url;const s={};if(a!==""){s.resourcesUrl=new URL(".",a).href}return e(s)};r().then((async e=>{await a();return t([["p-5bdd3e25",[[1,"jaak-stamps",{debug:[4],alignmentTolerance:[2,"alignment-tolerance"],maskSize:[2,"mask-size"],isVideoActive:[32],statusMessage:[32],statusColor:[32],bestScore:[32],capturedFullFrame:[32],capturedCroppedId:[32],capturedBackFullFrame:[32],capturedBackCroppedId:[32],captureStep:[32],isCapturing:[32],showFlipAnimation:[32],showSuccessAnimation:[32],shouldMirrorVideo:[32],sideAlignment:[32],isDetectionPaused:[32],isLoading:[32],isModelPreloaded:[32],isMaskReady:[32],getCapturedImages:[64],isProcessCompleted:[64],startCapture:[64],stopCapture:[64],resetCapture:[64],getStatus:[64],preloadModel:[64],skipBackCapture:[64]}]]]],e)}));
|
|
2
2
|
//# sourceMappingURL=jaak-stamps-webcomponent.esm.js.map
|