@jaak.ai/stamps 2.0.0-dev.25 → 2.0.0-dev.26

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.
Files changed (36) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/{index-DGM9-FNg.js → index-BfhtOB0D.js} +5 -2
  3. package/dist/cjs/index-BfhtOB0D.js.map +1 -0
  4. package/dist/cjs/jaak-stamps-webcomponent.cjs.js +2 -2
  5. package/dist/cjs/jaak-stamps.cjs.entry.js +357 -14
  6. package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
  7. package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/collection/components/my-component/my-component.css +227 -0
  10. package/dist/collection/components/my-component/my-component.js +419 -13
  11. package/dist/collection/components/my-component/my-component.js.map +1 -1
  12. package/dist/components/index.js +3 -0
  13. package/dist/components/index.js.map +1 -1
  14. package/dist/components/jaak-stamps.js +364 -14
  15. package/dist/components/jaak-stamps.js.map +1 -1
  16. package/dist/esm/{index-DqoVMnc7.js → index-BP1Q4KOg.js} +5 -2
  17. package/dist/esm/index-BP1Q4KOg.js.map +1 -0
  18. package/dist/esm/jaak-stamps-webcomponent.js +3 -3
  19. package/dist/esm/jaak-stamps.entry.js +357 -14
  20. package/dist/esm/jaak-stamps.entry.js.map +1 -1
  21. package/dist/esm/loader.js +3 -3
  22. package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
  23. package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
  24. package/dist/jaak-stamps-webcomponent/p-14eb13d8.entry.js +2 -0
  25. package/dist/jaak-stamps-webcomponent/p-14eb13d8.entry.js.map +1 -0
  26. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js +3 -0
  27. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js.map +1 -0
  28. package/dist/types/components/my-component/my-component.d.ts +36 -0
  29. package/dist/types/components.d.ts +10 -0
  30. package/package.json +1 -1
  31. package/dist/cjs/index-DGM9-FNg.js.map +0 -1
  32. package/dist/esm/index-DqoVMnc7.js.map +0 -1
  33. package/dist/jaak-stamps-webcomponent/p-DqoVMnc7.js +0 -3
  34. package/dist/jaak-stamps-webcomponent/p-DqoVMnc7.js.map +0 -1
  35. package/dist/jaak-stamps-webcomponent/p-f1172b06.entry.js +0 -2
  36. package/dist/jaak-stamps-webcomponent/p-f1172b06.entry.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, c as createEvent, a as getElement, h } from './index-DqoVMnc7.js';
1
+ import { r as registerInstance, c as createEvent, a as getElement, h } from './index-BP1Q4KOg.js';
2
2
 
3
- const myComponentCss = ":host{display:block;width:100%;height:100%;font-family:system-ui, -apple-system, sans-serif;color:#1a1a1a}.detector-container{display:flex;flex-direction:column;align-items:center;width:100%;height:100%}h1{font-size:24px;font-weight:500;color:#333;margin:0 0 24px 0}.video-container{position:relative;width:100%;height:100%;background:#333;border:1px solid #e0e0e0;border-radius:8px;overflow:hidden}video,canvas{position:absolute;width:100%;height:100%;border-radius:8px}video.mirror,canvas.mirror{transform:rotateY(180deg)}canvas{z-index:1}video{z-index:0}.status{margin-top:16px;font-size:12px;color:#666}.overlay-mask{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;display:block;pointer-events:none}.card-outline{position:absolute;top:var(--mask-center-y, 50%);left:var(--mask-center-x, 50%);transform:translate(-50%, -50%);width:var(--mask-width, 88%);height:var(--mask-height, 55%);border:none;border-radius:4px;background:transparent;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7);opacity:0.8}.card-outline.perfect-match{box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7)}.side{position:absolute;background:#999;transition:background-color 0.3s ease}.side.aligned{background:#28a745}.side-top{top:0;left:0;width:100%;height:3px}.side-right{top:0;right:0;width:3px;height:100%}.side-bottom{bottom:0;left:0;width:100%;height:3px}.side-left{top:0;left:0;width:3px;height:100%}.corner{position:absolute;width:20px;height:20px;border:2px solid #999;z-index:12}.corner-tl{top:-10px;left:-10px;border-right:none;border-bottom:none}.corner-tr{top:-10px;right:-10px;border-left:none;border-bottom:none}.corner-bl{bottom:-10px;left:-10px;border-right:none;border-top:none}.corner-br{bottom:-10px;right:-10px;border-left:none;border-top:none}.corner.perfect-match{border-color:#28a745}.guide-text{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);color:#fff;font-size:14px;font-weight:600;text-align:center;white-space:normal;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;z-index:20}.capture-animation{position:absolute;top:0;left:0;width:100%;height:100%;background:#fff;opacity:0;z-index:30;pointer-events:none;animation:captureFlash 0.6s ease-out}@keyframes captureFlash{0%{opacity:0}15%{opacity:0.8}30%{opacity:0}45%{opacity:0.4}60%{opacity:0}100%{opacity:0}}.card-outline.capturing{animation:pulseGreen 0.6s ease-out}@keyframes pulseGreen{0%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}50%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 8px rgba(40, 167, 69, 0.6)}100%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}}.flip-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showFlipInstruction 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.id-card-icon{width:80px;height:50px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:8px;position:relative;animation:flipCard 2s ease-in-out infinite;box-shadow:0 4px 12px rgba(0, 0, 0, 0.3)}.id-card-icon::before{content:'';position:absolute;top:8px;left:8px;width:16px;height:12px;background:rgba(255, 255, 255, 0.9);border-radius:2px}.id-card-icon::after{content:'';position:absolute;top:25px;left:8px;width:64px;height:3px;background:rgba(255, 255, 255, 0.7);border-radius:1px;box-shadow:0 6px 0 rgba(255, 255, 255, 0.7), 0 12px 0 rgba(255, 255, 255, 0.7)}.flip-text{margin-top:12px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px}@keyframes showFlipInstruction{0%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}}@keyframes flipCard{0%{transform:rotateY(0deg)}50%{transform:rotateY(180deg)}100%{transform:rotateY(360deg)}}.success-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showSuccessMessage 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.check-icon{width:80px;height:80px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:50%;position:relative;animation:bounceSuccess 0.6s ease-out;box-shadow:0 4px 16px rgba(108, 117, 125, 0.4);display:flex;align-items:center;justify-content:center}.check-icon::before{content:'';position:absolute;width:20px;height:35px;border:4px solid #fff;border-top:none;border-left:none;transform:rotate(45deg);animation:drawCheck 0.4s ease-out 0.2s both}.success-text{margin-top:16px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;animation:fadeInUp 0.5s ease-out 0.4s both}@keyframes showSuccessMessage{0%{opacity:0;transform:translate(-50%, -50%) scale(0.5)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.9)}}@keyframes bounceSuccess{0%{transform:scale(0)}50%{transform:scale(1.1)}100%{transform:scale(1)}}@keyframes drawCheck{0%{width:0;height:0}50%{width:20px;height:0}100%{width:20px;height:35px}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}100%{opacity:1;transform:translateY(0)}}.skip-button{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);z-index:25;pointer-events:auto;background:#fff;color:#333;border:none;border-radius:25px;padding:12px 24px;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.3s ease}.skip-button:hover{background:#f8f9fa}.skip-button:active{background:#e9ecef;transform:translateX(-50%) translateY(0)}.watermark{position:absolute;bottom:12px;right:12px;z-index:15;pointer-events:none;opacity:0.7}.watermark img{height:24px;width:auto;filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3))}.loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.8);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:30;border-radius:20px}.loading-spinner{width:60px;height:60px;border:4px solid rgba(255, 255, 255, 0.2);border-top:4px solid #007bff;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:20px}.loading-text{color:white;font-size:16px;font-weight:500;text-align:center;opacity:0.9}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
3
+ const myComponentCss = ":host{display:block;width:100%;height:100%;font-family:system-ui, -apple-system, sans-serif;color:#1a1a1a}.detector-container{display:flex;flex-direction:column;align-items:center;width:100%;height:100%}h1{font-size:24px;font-weight:500;color:#333;margin:0 0 24px 0}.video-container{position:relative;width:100%;height:100%;background:#333;border:1px solid #e0e0e0;border-radius:8px;overflow:hidden}video,canvas{position:absolute;width:100%;height:100%;border-radius:8px}video.mirror,canvas.mirror{transform:rotateY(180deg)}canvas{z-index:1}video{z-index:0}.status{margin-top:16px;font-size:12px;color:#666}.overlay-mask{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;display:block;pointer-events:none}.card-outline{position:absolute;top:var(--mask-center-y, 50%);left:var(--mask-center-x, 50%);transform:translate(-50%, -50%);width:var(--mask-width, 88%);height:var(--mask-height, 55%);border:none;border-radius:4px;background:transparent;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7);opacity:0.8}.card-outline.perfect-match{box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7)}.side{position:absolute;background:#999;transition:background-color 0.3s ease}.side.aligned{background:#28a745}.side-top{top:0;left:0;width:100%;height:3px}.side-right{top:0;right:0;width:3px;height:100%}.side-bottom{bottom:0;left:0;width:100%;height:3px}.side-left{top:0;left:0;width:3px;height:100%}.corner{position:absolute;width:20px;height:20px;border:2px solid #999;z-index:12}.corner-tl{top:-10px;left:-10px;border-right:none;border-bottom:none}.corner-tr{top:-10px;right:-10px;border-left:none;border-bottom:none}.corner-bl{bottom:-10px;left:-10px;border-right:none;border-top:none}.corner-br{bottom:-10px;right:-10px;border-left:none;border-top:none}.corner.perfect-match{border-color:#28a745}.guide-text{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);color:#fff;font-size:14px;font-weight:600;text-align:center;white-space:normal;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;z-index:20}.capture-animation{position:absolute;top:0;left:0;width:100%;height:100%;background:#fff;opacity:0;z-index:30;pointer-events:none;animation:captureFlash 0.6s ease-out}@keyframes captureFlash{0%{opacity:0}15%{opacity:0.8}30%{opacity:0}45%{opacity:0.4}60%{opacity:0}100%{opacity:0}}.card-outline.capturing{animation:pulseGreen 0.6s ease-out}@keyframes pulseGreen{0%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}50%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 8px rgba(40, 167, 69, 0.6)}100%{border-color:#28a745;box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 0 4px rgba(40, 167, 69, 0)}}.flip-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showFlipInstruction 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.id-card-icon{width:80px;height:50px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:8px;position:relative;animation:flipCard 2s ease-in-out infinite;box-shadow:0 4px 12px rgba(0, 0, 0, 0.3)}.id-card-icon::before{content:'';position:absolute;top:8px;left:8px;width:16px;height:12px;background:rgba(255, 255, 255, 0.9);border-radius:2px}.id-card-icon::after{content:'';position:absolute;top:25px;left:8px;width:64px;height:3px;background:rgba(255, 255, 255, 0.7);border-radius:1px;box-shadow:0 6px 0 rgba(255, 255, 255, 0.7), 0 12px 0 rgba(255, 255, 255, 0.7)}.flip-text{margin-top:12px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px}@keyframes showFlipInstruction{0%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.8)}}@keyframes flipCard{0%{transform:rotateY(0deg)}50%{transform:rotateY(180deg)}100%{transform:rotateY(360deg)}}.success-animation{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:35;pointer-events:none;opacity:0;animation:showSuccessMessage 3s ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center}.check-icon{width:80px;height:80px;background:linear-gradient(135deg, #6c757d 0%, #495057 100%);border-radius:50%;position:relative;animation:bounceSuccess 0.6s ease-out;box-shadow:0 4px 16px rgba(108, 117, 125, 0.4);display:flex;align-items:center;justify-content:center}.check-icon::before{content:'';position:absolute;width:20px;height:35px;border:4px solid #fff;border-top:none;border-left:none;transform:rotate(45deg);animation:drawCheck 0.4s ease-out 0.2s both}.success-text{margin-top:16px;color:#fff;font-size:14px;font-weight:600;text-align:center;background:rgba(128, 128, 128, 0.8);padding:12px 20px;border-radius:20px;max-width:300px;animation:fadeInUp 0.5s ease-out 0.4s both}@keyframes showSuccessMessage{0%{opacity:0;transform:translate(-50%, -50%) scale(0.5)}15%{opacity:1;transform:translate(-50%, -50%) scale(1)}85%{opacity:1;transform:translate(-50%, -50%) scale(1)}100%{opacity:0;transform:translate(-50%, -50%) scale(0.9)}}@keyframes bounceSuccess{0%{transform:scale(0)}50%{transform:scale(1.1)}100%{transform:scale(1)}}@keyframes drawCheck{0%{width:0;height:0}50%{width:20px;height:0}100%{width:20px;height:35px}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}100%{opacity:1;transform:translateY(0)}}.skip-button{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);z-index:25;pointer-events:auto;background:#fff;color:#333;border:none;border-radius:25px;padding:12px 24px;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.3s ease}.skip-button:hover{background:#f8f9fa}.skip-button:active{background:#e9ecef;transform:translateX(-50%) translateY(0)}.camera-controls{position:absolute;top:16px;right:16px;z-index:25;display:flex;gap:8px;pointer-events:auto}.flip-camera-button{height:40px;padding:0 16px;border:none;border-radius:8px;background:rgba(0, 0, 0, 0.6);backdrop-filter:blur(12px);color:#ffffff;font-size:12px;font-weight:500;cursor:pointer;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;border:1px solid rgba(255, 255, 255, 0.1);white-space:nowrap;min-width:fit-content}.camera-selector-button{height:40px;padding:0 16px;border:none;border-radius:8px;background:rgba(0, 0, 0, 0.6);backdrop-filter:blur(12px);color:#ffffff;font-size:12px;font-weight:500;cursor:pointer;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;border:1px solid rgba(255, 255, 255, 0.1);white-space:nowrap;min-width:fit-content}.flip-camera-button:hover,.camera-selector-button:hover{background:rgba(0, 0, 0, 0.8);border-color:rgba(255, 255, 255, 0.2);transform:translateY(-1px)}.flip-camera-button:active,.camera-selector-button:active{transform:translateY(0);background:rgba(0, 0, 0, 0.9)}.camera-selector-dropdown{position:absolute;top:56px;right:16px;z-index:30;background:rgba(0, 0, 0, 0.85);backdrop-filter:blur(20px);border-radius:12px;min-width:260px;max-width:300px;border:1px solid rgba(255, 255, 255, 0.1);overflow:hidden;pointer-events:auto;animation:slideInFromTop 0.3s ease-out}@keyframes slideInFromTop{0%{opacity:0;transform:translateY(-8px) scale(0.95)}100%{opacity:1;transform:translateY(0) scale(1)}}.camera-selector-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid rgba(255, 255, 255, 0.1)}.camera-selector-header span{font-weight:500;color:#ffffff;font-size:13px;opacity:0.9}.close-selector{width:20px;height:20px;border:none;background:none;color:rgba(255, 255, 255, 0.7);font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all 0.2s ease}.close-selector:hover{background:rgba(255, 255, 255, 0.1);color:#ffffff}.camera-list{padding:4px 0;max-height:240px;overflow-y:auto}.camera-option{width:100%;padding:10px 16px;border:none;background:none;text-align:left;cursor:pointer;transition:all 0.2s ease;display:flex;justify-content:space-between;align-items:center;color:rgba(255, 255, 255, 0.9)}.camera-option:hover{background:rgba(255, 255, 255, 0.08)}.camera-option.selected{background:rgba(255, 255, 255, 0.12);color:#ffffff}.camera-label{font-size:13px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:8px;font-weight:400}.selected-indicator{font-size:14px;color:#ffffff;opacity:0.9}.device-info{padding:8px 16px;border-top:1px solid rgba(255, 255, 255, 0.1);background:rgba(255, 255, 255, 0.05)}.device-info small{color:rgba(255, 255, 255, 0.6);font-size:11px;text-transform:capitalize;font-weight:400}@media (max-width: 480px){.camera-controls{top:12px;right:12px;gap:6px}.flip-camera-button{height:36px;padding:0 12px;font-size:11px;border-radius:6px}.camera-selector-button{height:36px;padding:0 12px;font-size:11px;border-radius:6px}.camera-selector-dropdown{right:12px;top:48px;min-width:240px;max-width:calc(100vw - 24px)}.camera-selector-header{padding:10px 14px}.camera-option{padding:8px 14px}.device-info{padding:6px 14px}}.watermark{position:absolute;bottom:12px;right:12px;z-index:15;pointer-events:none;opacity:0.7}.watermark img{height:24px;width:auto;filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3))}.loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.8);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:30;border-radius:20px}.loading-spinner{width:60px;height:60px;border:4px solid rgba(255, 255, 255, 0.2);border-top:4px solid #007bff;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:20px}.loading-text{color:white;font-size:16px;font-weight:500;text-align:center;opacity:0.9}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
4
4
 
5
5
  const JaakStamps = class {
6
6
  constructor(hostRef) {
@@ -14,6 +14,7 @@ const JaakStamps = class {
14
14
  maskSize = 90; // Porcentaje del video que ocupará la máscara (default 90%)
15
15
  cropMargin = 0; // Margen en píxeles para el recorte del documento (default 0)
16
16
  useDocumentClassification = false; // Habilita la clasificación automática de documentos para determinar si solicitar reverso
17
+ preferredCamera = 'auto'; // Define qué cámara usar: 'auto' (automático según dispositivo), 'front' (frontal), 'back' (trasera)
17
18
  captureCompleted;
18
19
  isReady;
19
20
  isVideoActive = false;
@@ -39,6 +40,10 @@ const JaakStamps = class {
39
40
  isLoading = false;
40
41
  isModelPreloaded = false;
41
42
  isMaskReady = false;
43
+ availableCameras = [];
44
+ selectedCameraId = null;
45
+ showCameraSelector = false;
46
+ isMultipleCamerasAvailable = false;
42
47
  videoRef;
43
48
  canvasRef;
44
49
  session;
@@ -49,6 +54,9 @@ const JaakStamps = class {
49
54
  lastDetectedBox;
50
55
  mobileNetSession;
51
56
  mobileNetClassMap;
57
+ // Camera management properties
58
+ deviceType = 'desktop';
59
+ preferredCameraFacing = null;
52
60
  // Performance optimization properties
53
61
  frameSkipCounter = 0;
54
62
  FRAME_SKIP = 2; // Process every 3rd frame (reduces CPU by ~66%)
@@ -85,6 +93,13 @@ const JaakStamps = class {
85
93
  this.cropMargin = 0;
86
94
  }
87
95
  }
96
+ validatePreferredCamera() {
97
+ const validOptions = ['auto', 'front', 'back'];
98
+ if (!validOptions.includes(this.preferredCamera)) {
99
+ console.warn(`preferredCamera debe ser uno de: ${validOptions.join(', ')}. Valor actual: ${this.preferredCamera}. Usando valor por defecto: 'auto'`);
100
+ this.preferredCamera = 'auto';
101
+ }
102
+ }
88
103
  emitReadyEvent() {
89
104
  const isDocumentReady = !!window.ort && this.isModelPreloaded;
90
105
  this.isReady.emit(isDocumentReady);
@@ -97,9 +112,267 @@ const JaakStamps = class {
97
112
  const settings = videoTrack.getSettings();
98
113
  return settings.facingMode === 'environment';
99
114
  }
115
+ async detectDeviceTypeAndCameras() {
116
+ // Detect device type
117
+ const userAgent = navigator.userAgent;
118
+ const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
119
+ const isTablet = /iPad|Android/i.test(userAgent) && window.innerWidth >= 768;
120
+ if (isTablet) {
121
+ this.deviceType = 'tablet';
122
+ }
123
+ else if (isMobile) {
124
+ this.deviceType = 'mobile';
125
+ }
126
+ else {
127
+ this.deviceType = 'desktop';
128
+ }
129
+ this.debugLog('📱 Device type detected:', this.deviceType);
130
+ // Enumerate available cameras
131
+ await this.enumerateAndDetectCameras();
132
+ // Load user preference
133
+ this.loadCameraPreference();
134
+ }
135
+ async enumerateAndDetectCameras() {
136
+ try {
137
+ // First, check if we have permission to enumerate devices
138
+ const permissionStatus = await this.checkCameraPermission();
139
+ if (permissionStatus === 'denied') {
140
+ this.debugLog('❌ Camera permission denied');
141
+ this.statusMessage = "Permiso de cámara denegado";
142
+ this.statusColor = "#ff6b6b";
143
+ return;
144
+ }
145
+ // Request minimal permission to get device labels
146
+ if (permissionStatus === 'prompt') {
147
+ const tempStream = await navigator.mediaDevices.getUserMedia({ video: true });
148
+ tempStream.getTracks().forEach(track => track.stop());
149
+ }
150
+ // Now enumerate devices with labels
151
+ const devices = await navigator.mediaDevices.enumerateDevices();
152
+ this.availableCameras = devices.filter(device => device.kind === 'videoinput');
153
+ this.isMultipleCamerasAvailable = this.availableCameras.length > 1;
154
+ this.debugLog('📹 Available cameras:', {
155
+ count: this.availableCameras.length,
156
+ isMultipleCamerasAvailable: this.isMultipleCamerasAvailable,
157
+ cameras: this.availableCameras.map(cam => ({
158
+ id: cam.deviceId,
159
+ label: cam.label || 'Unknown Camera'
160
+ }))
161
+ });
162
+ // Set initial camera preference based on device type
163
+ this.setInitialCameraPreference();
164
+ }
165
+ catch (error) {
166
+ this.debugLog('❌ Error enumerating cameras:', error);
167
+ this.handleCameraPermissionError(error);
168
+ }
169
+ }
170
+ async checkCameraPermission() {
171
+ try {
172
+ if (!navigator.permissions) {
173
+ return 'prompt'; // Assume we need to prompt on older browsers
174
+ }
175
+ const permission = await navigator.permissions.query({ name: 'camera' });
176
+ return permission.state;
177
+ }
178
+ catch (error) {
179
+ this.debugLog('⚠️ Could not check camera permission:', error);
180
+ return 'prompt';
181
+ }
182
+ }
183
+ handleCameraPermissionError(error) {
184
+ if (error.name === 'NotAllowedError') {
185
+ this.statusMessage = "Permiso de cámara denegado. Active el permiso en configuración.";
186
+ this.statusColor = "#ff6b6b";
187
+ this.availableCameras = [];
188
+ this.isMultipleCamerasAvailable = false;
189
+ }
190
+ else if (error.name === 'NotFoundError') {
191
+ this.statusMessage = "No se encontraron cámaras disponibles.";
192
+ this.statusColor = "#ff6b6b";
193
+ this.availableCameras = [];
194
+ this.isMultipleCamerasAvailable = false;
195
+ }
196
+ else if (error.name === 'NotReadableError') {
197
+ this.statusMessage = "Cámara en uso por otra aplicación.";
198
+ this.statusColor = "#ff6b6b";
199
+ this.availableCameras = [];
200
+ this.isMultipleCamerasAvailable = false;
201
+ }
202
+ else {
203
+ this.statusMessage = "Error al acceder a las cámaras.";
204
+ this.statusColor = "#ff6b6b";
205
+ this.availableCameras = [];
206
+ this.isMultipleCamerasAvailable = false;
207
+ }
208
+ }
209
+ setInitialCameraPreference() {
210
+ if (this.availableCameras.length === 0)
211
+ return;
212
+ // Apply user preference for camera selection
213
+ if (this.preferredCamera === 'front') {
214
+ // User explicitly wants front camera
215
+ this.preferredCameraFacing = 'user';
216
+ const frontCamera = this.availableCameras.find(camera => camera.label.toLowerCase().includes('front') ||
217
+ camera.label.toLowerCase().includes('user') ||
218
+ camera.label.toLowerCase().includes('selfie') ||
219
+ !camera.label.toLowerCase().includes('back') && !camera.label.toLowerCase().includes('rear'));
220
+ if (frontCamera) {
221
+ this.selectedCameraId = frontCamera.deviceId;
222
+ this.debugLog('👤 User selected front camera:', frontCamera.label);
223
+ }
224
+ else {
225
+ this.selectedCameraId = this.availableCameras[0].deviceId;
226
+ this.debugLog('⚠️ Front camera not found, using first available:', this.availableCameras[0].label);
227
+ }
228
+ }
229
+ else if (this.preferredCamera === 'back') {
230
+ // User explicitly wants back camera
231
+ this.preferredCameraFacing = 'environment';
232
+ const backCamera = this.availableCameras.find(camera => camera.label.toLowerCase().includes('back') ||
233
+ camera.label.toLowerCase().includes('rear') ||
234
+ camera.label.toLowerCase().includes('environment'));
235
+ if (backCamera) {
236
+ this.selectedCameraId = backCamera.deviceId;
237
+ this.debugLog('📷 User selected back camera:', backCamera.label);
238
+ }
239
+ else {
240
+ this.selectedCameraId = this.availableCameras[0].deviceId;
241
+ this.debugLog('⚠️ Back camera not found, using first available:', this.availableCameras[0].label);
242
+ }
243
+ }
244
+ else {
245
+ // Auto mode - use device type to determine best camera
246
+ if (this.deviceType === 'mobile' || this.deviceType === 'tablet') {
247
+ // For mobile/tablet, prefer rear camera for document scanning
248
+ this.preferredCameraFacing = 'environment';
249
+ const rearCamera = this.availableCameras.find(camera => camera.label.toLowerCase().includes('back') ||
250
+ camera.label.toLowerCase().includes('rear') ||
251
+ camera.label.toLowerCase().includes('environment'));
252
+ if (rearCamera) {
253
+ this.selectedCameraId = rearCamera.deviceId;
254
+ this.debugLog('📱 Auto-selected rear camera for mobile:', rearCamera.label);
255
+ }
256
+ else {
257
+ this.selectedCameraId = this.availableCameras[0].deviceId;
258
+ this.debugLog('📱 Rear camera not found, using first available:', this.availableCameras[0].label);
259
+ }
260
+ }
261
+ else {
262
+ // For desktop, use first available camera (usually the only one)
263
+ this.selectedCameraId = this.availableCameras[0].deviceId;
264
+ this.debugLog('💻 Auto-selected desktop camera:', this.availableCameras[0].label);
265
+ }
266
+ }
267
+ }
268
+ loadCameraPreference() {
269
+ try {
270
+ const saved = localStorage.getItem('jaak-stamps-camera-preference');
271
+ if (saved) {
272
+ const preference = JSON.parse(saved);
273
+ // Validate that the saved camera is still available
274
+ const isStillAvailable = this.availableCameras.some(camera => camera.deviceId === preference.cameraId);
275
+ if (isStillAvailable) {
276
+ this.selectedCameraId = preference.cameraId;
277
+ this.preferredCameraFacing = preference.facing;
278
+ this.debugLog('💾 Loaded camera preference:', preference);
279
+ }
280
+ }
281
+ }
282
+ catch (error) {
283
+ this.debugLog('⚠️ Error loading camera preference:', error);
284
+ }
285
+ }
286
+ saveCameraPreference() {
287
+ try {
288
+ const preference = {
289
+ cameraId: this.selectedCameraId,
290
+ facing: this.preferredCameraFacing,
291
+ timestamp: Date.now()
292
+ };
293
+ localStorage.setItem('jaak-stamps-camera-preference', JSON.stringify(preference));
294
+ this.debugLog('💾 Saved camera preference:', preference);
295
+ }
296
+ catch (error) {
297
+ this.debugLog('⚠️ Error saving camera preference:', error);
298
+ }
299
+ }
300
+ async switchCamera(cameraId) {
301
+ if (!this.isVideoActive || this.selectedCameraId === cameraId)
302
+ return;
303
+ try {
304
+ // Check if the selected camera is still available
305
+ const selectedCamera = this.availableCameras.find(cam => cam.deviceId === cameraId);
306
+ if (!selectedCamera) {
307
+ this.debugLog('❌ Selected camera not found, re-enumerating...');
308
+ await this.enumerateAndDetectCameras();
309
+ return;
310
+ }
311
+ // Show loading state
312
+ this.statusMessage = "Cambiando cámara...";
313
+ this.statusColor = "#007bff";
314
+ // Stop current stream
315
+ if (this.videoStream) {
316
+ this.videoStream.getTracks().forEach(track => track.stop());
317
+ }
318
+ // Update selected camera
319
+ this.selectedCameraId = cameraId;
320
+ // Update facing mode preference
321
+ const isRearCamera = selectedCamera.label.toLowerCase().includes('back') ||
322
+ selectedCamera.label.toLowerCase().includes('rear') ||
323
+ selectedCamera.label.toLowerCase().includes('environment');
324
+ this.preferredCameraFacing = isRearCamera ? 'environment' : 'user';
325
+ // Save preference
326
+ this.saveCameraPreference();
327
+ // Setup new camera with error handling
328
+ await this.setupCameraWithRetry();
329
+ this.debugLog('🔄 Switched to camera:', selectedCamera.label);
330
+ }
331
+ catch (error) {
332
+ this.debugLog('❌ Error switching camera:', error);
333
+ this.handleCameraPermissionError(error);
334
+ }
335
+ }
336
+ async setupCameraWithRetry(maxRetries = 3) {
337
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
338
+ try {
339
+ await this.setupCamera();
340
+ return; // Success
341
+ }
342
+ catch (error) {
343
+ this.debugLog(`❌ Camera setup attempt ${attempt} failed:`, error);
344
+ if (attempt === maxRetries) {
345
+ // Last attempt failed, handle the error
346
+ this.handleCameraPermissionError(error);
347
+ throw error;
348
+ }
349
+ // Wait before retrying
350
+ await new Promise(resolve => setTimeout(resolve, 500 * attempt));
351
+ }
352
+ }
353
+ }
354
+ toggleCameraSelector() {
355
+ this.showCameraSelector = !this.showCameraSelector;
356
+ this.debugLog('📹 Camera selector toggled:', {
357
+ showCameraSelector: this.showCameraSelector,
358
+ isMultipleCamerasAvailable: this.isMultipleCamerasAvailable,
359
+ availableCameras: this.availableCameras.length,
360
+ isVideoActive: this.isVideoActive
361
+ });
362
+ }
363
+ async flipCamera() {
364
+ if (!this.isMultipleCamerasAvailable)
365
+ return;
366
+ const currentIndex = this.availableCameras.findIndex(camera => camera.deviceId === this.selectedCameraId);
367
+ const nextIndex = (currentIndex + 1) % this.availableCameras.length;
368
+ const nextCamera = this.availableCameras[nextIndex];
369
+ await this.switchCamera(nextCamera.deviceId);
370
+ }
100
371
  async componentDidLoad() {
101
372
  this.validateMaskSize();
102
373
  this.validateCropMargin();
374
+ this.validatePreferredCamera();
375
+ await this.detectDeviceTypeAndCameras();
103
376
  if (!window.ort) {
104
377
  const script = document.createElement('script');
105
378
  script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';
@@ -301,6 +574,35 @@ const JaakStamps = class {
301
574
  this.completeProcess(true);
302
575
  }
303
576
  }
577
+ async getCameraInfo() {
578
+ return {
579
+ availableCameras: this.availableCameras.map(camera => ({
580
+ id: camera.deviceId,
581
+ label: camera.label || 'Unknown Camera',
582
+ selected: camera.deviceId === this.selectedCameraId
583
+ })),
584
+ selectedCameraId: this.selectedCameraId,
585
+ deviceType: this.deviceType,
586
+ isMultipleCamerasAvailable: this.isMultipleCamerasAvailable,
587
+ preferredFacing: this.preferredCameraFacing,
588
+ userPreferredCamera: this.preferredCamera
589
+ };
590
+ }
591
+ async setPreferredCamera(camera) {
592
+ this.preferredCamera = camera;
593
+ this.debugLog('🎯 Camera preference changed to:', camera);
594
+ // Re-detect and apply new camera preference
595
+ await this.enumerateAndDetectCameras();
596
+ // If video is active, switch to the new preferred camera
597
+ if (this.isVideoActive && this.selectedCameraId) {
598
+ await this.switchCamera(this.selectedCameraId);
599
+ }
600
+ return {
601
+ success: true,
602
+ selectedCamera: this.selectedCameraId,
603
+ availableCameras: this.availableCameras.length
604
+ };
605
+ }
304
606
  async loadMobileNetModel() {
305
607
  try {
306
608
  this.debugLog('🤖 Loading MobileNet model...');
@@ -417,18 +719,37 @@ const JaakStamps = class {
417
719
  }
418
720
  async getMaxResolution() {
419
721
  try {
420
- // Primero obtén un stream básico para acceder a las capacidades
722
+ // Build constraints with selected camera if available
723
+ const videoConstraints = {};
724
+ if (this.selectedCameraId) {
725
+ videoConstraints.deviceId = { exact: this.selectedCameraId };
726
+ }
727
+ else if (this.preferredCameraFacing) {
728
+ videoConstraints.facingMode = this.preferredCameraFacing;
729
+ }
730
+ else {
731
+ videoConstraints.facingMode = "environment";
732
+ }
733
+ // Get temporary stream to access capabilities
421
734
  const tempStream = await navigator.mediaDevices.getUserMedia({
422
- video: { facingMode: "environment" }
735
+ video: videoConstraints
423
736
  });
424
737
  const videoTrack = tempStream.getVideoTracks()[0];
425
738
  const capabilities = videoTrack.getCapabilities();
426
739
  // Detener el stream temporal
427
740
  tempStream.getTracks().forEach(track => track.stop());
428
- // Construir restricciones con resolución optimizada para tablets
429
- const constraints = {
430
- facingMode: "environment"
431
- };
741
+ // Build constraints with resolution optimized for tablets
742
+ const constraints = {};
743
+ // Set camera selection constraints
744
+ if (this.selectedCameraId) {
745
+ constraints.deviceId = { exact: this.selectedCameraId };
746
+ }
747
+ else if (this.preferredCameraFacing) {
748
+ constraints.facingMode = this.preferredCameraFacing;
749
+ }
750
+ else {
751
+ constraints.facingMode = "environment";
752
+ }
432
753
  if (capabilities.width && capabilities.height) {
433
754
  // Limitar resolución máxima para tablets para evitar problemas de rendimiento
434
755
  const maxWidth = Math.min(capabilities.width.max, 1920);
@@ -455,13 +776,23 @@ const JaakStamps = class {
455
776
  }
456
777
  catch (err) {
457
778
  this.debugLog('⚠️ Could not get capabilities, using fallback');
458
- // Fallback optimizado para tablets
779
+ // Optimized fallback for tablets
459
780
  const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;
460
- return {
461
- facingMode: "environment",
781
+ const fallbackConstraints = {
462
782
  width: { ideal: isTablet ? 1280 : 1920 },
463
783
  height: { ideal: isTablet ? 720 : 1080 }
464
784
  };
785
+ // Add camera selection to fallback
786
+ if (this.selectedCameraId) {
787
+ fallbackConstraints.deviceId = { exact: this.selectedCameraId };
788
+ }
789
+ else if (this.preferredCameraFacing) {
790
+ fallbackConstraints.facingMode = this.preferredCameraFacing;
791
+ }
792
+ else {
793
+ fallbackConstraints.facingMode = "environment";
794
+ }
795
+ return fallbackConstraints;
465
796
  }
466
797
  }
467
798
  async setupCamera() {
@@ -496,8 +827,7 @@ const JaakStamps = class {
496
827
  }
497
828
  catch (err) {
498
829
  this.debugLog("❌ No se pudo acceder a la cámara:", err);
499
- this.statusMessage = "Error: No se pudo acceder a la cámara.";
500
- this.statusColor = "#ff6b6b";
830
+ this.handleCameraPermissionError(err);
501
831
  }
502
832
  }
503
833
  preprocess(video) {
@@ -1047,7 +1377,20 @@ const JaakStamps = class {
1047
1377
  this.cleanup();
1048
1378
  }
1049
1379
  render() {
1050
- return (h("div", { key: '42591479495df221b101555198a23288d7d765b0', class: "detector-container" }, h("div", { key: '2b9ab48572aa2fb5542b8a8dc1b70a0f2a6eca89', class: "video-container" }, h("video", { key: 'b9e84f2eb67fa6f7f158e19b90871a1eebee624b', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: 'a82fc4826e220e696799b07b3510456f174a6628', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (h("div", { key: '9b3b838f99030e3dfa760fa0dd7c89ff24f26ed9', class: "overlay-mask" }, h("div", { key: 'f6a3b1ac2f12c1fb081f6b5eb853e627040396f4', class: "card-outline" }, h("div", { key: '6626259249ac5e0fd6ba665ab802af1ac2f9fc17', class: "side side-top" }), h("div", { key: '7a3195c96b2406b40b122f4267c2a251614cdede', class: "side side-right" }), h("div", { key: 'ece78305cfb083ada1d44de1d7d5226730879cc3', class: "side side-bottom" }), h("div", { key: '107468c583bbb01dd46c36c096e49be8e0b574ba', class: "side side-left" }), h("div", { key: 'c590f13b80c5e37c0ac0c68cfc2e2904b4345ebc', class: "corner corner-tl" }), h("div", { key: 'ab1e5aab179068ad1bc7b58ef3628d9618a877a8', class: "corner corner-tr" }), h("div", { key: '3a1db6cf1105bd3a2dfe7d4b998e79f6e40625ec', class: "corner corner-bl" }), h("div", { key: '5f9bc4e4557e5539335894160dccbaa2a6d6ac2d', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '8226d6721b0ae800f935e978a93113bd3b99656a', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '16cec7ca4a80ba0db1ace768826da17063eddb3e', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")))), this.isCapturing && (h("div", { key: 'bfdca0059eb50d37a77e8e43ef963ba7ed953edf', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: 'a1ad4b4f884d7d9f6090f148ddd6df19250073dd', class: "flip-animation" }, h("div", { key: 'e159ce385824dc049a6e9409d3747105c6f0a08e', class: "id-card-icon" }), h("div", { key: '6fcff650a3c7fdb16f8d327750e06055b9a93d0d', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: 'c4b76ecb19c65969676e5156689c2c0b1c9a584e', class: "success-animation" }, h("div", { key: '12203a8fe7ee878089b3dda1d1142cde5489eed0', class: "check-icon" }), h("div", { key: 'a2d41c8944873d33106994b8d56c3ee1ee1ae9fc', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: 'a155cd999fa40c35fa7b391cde7c1026edb250a7', class: "loading-overlay" }, h("div", { key: 'ccba76c5d4a472158c28bc564ba95bd65829b58d', class: "loading-spinner" }), h("div", { key: '23168f9bdcf4e993539288ff5703acaed13bb16a', class: "loading-text" }, this.statusMessage))), h("div", { key: '0107b82ad19726c1bab131e17892a46b04e08cfd', class: "watermark" }, h("img", { key: 'ad8831a6f77fa61805f22e3a27f5c5619ac1cc0e', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
1380
+ return (h("div", { key: 'b90673f523dbf112786eb7184f56415055765c0c', class: "detector-container" }, h("div", { key: '925c5c886e9af53b460281244958e722de670a70', class: "video-container" }, h("video", { key: '4a0074e33a81b4694c6c99e3ece256c1ac8fe1d5', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: 'a7b7f3b35c0535c11f6a4a155502dbe016f590b7', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (h("div", { key: '695b6a2f97e29b0b9c5b9d43682a951caff376a1', class: "overlay-mask" }, h("div", { key: '768875c39d5917c6a04306037d03d9e1aed114bd', class: "card-outline" }, h("div", { key: 'a56536deb7b8c99145d1bef6fee84e5801798644', class: "side side-top" }), h("div", { key: 'df413058c7e787f9c8a95a429a4f7186de07f5f6', class: "side side-right" }), h("div", { key: '37e074e3d4c914457f97720f9ab1f1ac2c70c4f1', class: "side side-bottom" }), h("div", { key: '772d3d40925c75ba5d39e2e7dd6405f7cc88d292', class: "side side-left" }), h("div", { key: 'd4e624782b3f4b4b8dbb8286b3acf003e433928c', class: "corner corner-tl" }), h("div", { key: '63f0ccfbbe3c1d413ca6912f36cab4afa6334bb2', class: "corner corner-tr" }), h("div", { key: '20012a50fe3d98ddfa669f5283a871c757522797', class: "corner corner-bl" }), h("div", { key: '9d82646bd08a6ca2b8c5782629fc68fd93cf1287', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '79fcbdb52e434a45aa6f2748d6d84500beb2e844', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '16e587d645e2489a3410fe80bfc014738f08f02f', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")), this.isVideoActive && (h("div", { key: 'd46d6881a9e1b63bdd849f5a8c6e96a2caefdefb', class: "camera-controls" }, this.isMultipleCamerasAvailable && (h("button", { key: 'afb4b44d691471f8af6e894e061aecb6c82259da', class: "flip-camera-button", onClick: () => this.flipCamera(), type: "button", title: "Cambiar c\u00E1mara" }, "Girar c\u00E1mara")), h("button", { key: '4e0680c2da9e6cc70b5880e8f5db9830c080acf9', class: "camera-selector-button", onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara" }, "C\u00E1maras"), this.debug && (h("div", { key: 'fc59922452a216273f742d3158559f6b2a1da43e', style: {
1381
+ position: 'absolute',
1382
+ top: '50px',
1383
+ right: '0',
1384
+ background: 'rgba(0,0,0,0.8)',
1385
+ color: 'white',
1386
+ padding: '8px',
1387
+ fontSize: '10px',
1388
+ borderRadius: '4px',
1389
+ whiteSpace: 'nowrap'
1390
+ } }, "C\u00E1maras: ", this.availableCameras.length, h("br", { key: '8f112283d1e0518a395dc6d94e1caa46fee0a86b' }), "M\u00FAltiples: ", this.isMultipleCamerasAvailable ? 'Sí' : 'No', h("br", { key: 'aacfd3ee868ee5d0819ce5ef693e3ef384867332' }), "Selector: ", this.showCameraSelector ? 'Visible' : 'Oculto', h("br", { key: '9927df7f56583c7388cee25e13526efc7e032eb1' }), "Video: ", this.isVideoActive ? 'Activo' : 'Inactivo')))), this.showCameraSelector && this.availableCameras.length > 0 && (h("div", { key: 'c2914bf7f3175b8f0ddab977abbdefe3022d7d29', class: "camera-selector-dropdown" }, h("div", { key: '0b5397e77ff33944f3620d78b1ab41275dffd7ac', class: "camera-selector-header" }, h("span", { key: '78f0fb8e34a0cf2d16138522a98cbdb9eefd671f' }, "Seleccionar C\u00E1mara"), h("button", { key: '0d4ea7b191d61d1d9b9c35462ce336148be73fcb', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: 'c16c7a106493ef7633a4cd35b06a4f45327a2e23', class: "camera-list" }, this.availableCameras.map((camera) => (h("button", { key: camera.deviceId, class: `camera-option ${this.selectedCameraId === camera.deviceId ? 'selected' : ''}`, onClick: () => {
1391
+ this.switchCamera(camera.deviceId);
1392
+ this.toggleCameraSelector();
1393
+ }, type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${this.availableCameras.indexOf(camera) + 1}`), this.selectedCameraId === camera.deviceId && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: '11d6f980c3995a8414da5f7e6921f963ca72aed4', class: "device-info" }, h("small", { key: '78f5ff030f9e6e5021234a246599eb459b05d9f7' }, "Dispositivo: ", this.deviceType)))))), this.isCapturing && (h("div", { key: 'ef7d32491d8bdb94b2d6456420c2ddbc80f03d81', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: 'cfb5868ee75a9d1d1604c52f6fce1241090e4ac2', class: "flip-animation" }, h("div", { key: '1b41035e63f88434aba6699d4e68e06bea2c1529', class: "id-card-icon" }), h("div", { key: '4e83af9d0d39ce37b7448c4a0783b60b42b858e2', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: 'c7911e8be74b0fc7d7d18d7dcb52374645ca5f12', class: "success-animation" }, h("div", { key: '18e5ea5cfa3eb35fe3b99c12e6fab8e27e09e85e', class: "check-icon" }), h("div", { key: '490d8fcd6540c3b4fdc95f7fb5e6f6697722c9ac', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: 'f7fbfec6be2d8e0dc4e522b85b7d67897575cf0e', class: "loading-overlay" }, h("div", { key: '8282b92f19da6a9c7d22a64a0929b2b4d67c46be', class: "loading-spinner" }), h("div", { key: '7880b689297eb9d80a9b0023ba7933148fd8710a', class: "loading-text" }, this.statusMessage))), h("div", { key: '887c951fb03097171d9bd466fe24e36d11a49954', class: "watermark" }, h("img", { key: '314c9c172a4c6795c825741ea6f02b0e1186e93d', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
1051
1394
  }
1052
1395
  };
1053
1396
  JaakStamps.style = myComponentCss;