@jaak.ai/stamps 2.0.0-dev.29 → 2.0.0-dev.30
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/dist/cjs/jaak-stamps.cjs.entry.js +35 -5
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +35 -5
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/components/jaak-stamps.js +35 -5
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps.entry.js +35 -5
- package/dist/esm/jaak-stamps.entry.js.map +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-28adb830.entry.js → p-b62b53f8.entry.js} +2 -2
- package/dist/jaak-stamps-webcomponent/p-b62b53f8.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +1 -0
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-28adb830.entry.js.map +0 -1
|
@@ -61,7 +61,7 @@ export class JaakStamps {
|
|
|
61
61
|
preprocessCtx;
|
|
62
62
|
captureCanvas;
|
|
63
63
|
captureCtx;
|
|
64
|
-
MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/ddmyp-
|
|
64
|
+
MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/ddmyp-v2.onnx";
|
|
65
65
|
MOBILENET_MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.onnx";
|
|
66
66
|
MOBILENET_CLASSES_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.json";
|
|
67
67
|
INPUT_SIZE = 320;
|
|
@@ -979,7 +979,37 @@ export class JaakStamps {
|
|
|
979
979
|
B.push(data[i + 2] / 255);
|
|
980
980
|
}
|
|
981
981
|
const transposedData = new Float32Array(R.concat(G, B));
|
|
982
|
-
|
|
982
|
+
// Convert to float16 for the lighter model
|
|
983
|
+
const float16Data = new Uint16Array(transposedData.length);
|
|
984
|
+
for (let i = 0; i < transposedData.length; i++) {
|
|
985
|
+
float16Data[i] = this.float32ToFloat16(transposedData[i]);
|
|
986
|
+
}
|
|
987
|
+
return new window.ort.Tensor("float16", float16Data, [1, 3, this.INPUT_SIZE, this.INPUT_SIZE]);
|
|
988
|
+
}
|
|
989
|
+
float32ToFloat16(value) {
|
|
990
|
+
// Convert float32 to float16 using IEEE 754 half precision format
|
|
991
|
+
const buffer = new ArrayBuffer(4);
|
|
992
|
+
const view = new DataView(buffer);
|
|
993
|
+
view.setFloat32(0, value, true);
|
|
994
|
+
const f = view.getUint32(0, true);
|
|
995
|
+
const sign = (f >> 31) & 0x1;
|
|
996
|
+
const exp = (f >> 23) & 0xFF;
|
|
997
|
+
const frac = f & 0x7FFFFF;
|
|
998
|
+
let newExp = exp - 127 + 15;
|
|
999
|
+
if (exp === 0) {
|
|
1000
|
+
newExp = 0;
|
|
1001
|
+
}
|
|
1002
|
+
else if (exp === 0xFF) {
|
|
1003
|
+
newExp = 0x1F;
|
|
1004
|
+
}
|
|
1005
|
+
else if (newExp >= 0x1F) {
|
|
1006
|
+
newExp = 0x1F;
|
|
1007
|
+
return (sign << 15) | (newExp << 10);
|
|
1008
|
+
}
|
|
1009
|
+
else if (newExp <= 0) {
|
|
1010
|
+
return (sign << 15);
|
|
1011
|
+
}
|
|
1012
|
+
return (sign << 15) | (newExp << 10) | (frac >> 13);
|
|
983
1013
|
}
|
|
984
1014
|
getDeviceMemoryInfo() {
|
|
985
1015
|
const nav = navigator;
|
|
@@ -1615,7 +1645,7 @@ export class JaakStamps {
|
|
|
1615
1645
|
this.cleanup();
|
|
1616
1646
|
}
|
|
1617
1647
|
render() {
|
|
1618
|
-
return (h("div", { key: '
|
|
1648
|
+
return (h("div", { key: 'a09694bc3b5f78bc792ea101d470ada1a438a57b', class: "detector-container" }, h("div", { key: 'c673c10d3311a44479d4462f3efbb4b6257ec6a9', class: "video-container" }, h("video", { key: 'c9faf3f111c50f945bce9d566fea2bd6b249fa78', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: 'bdc04a389f6b956f7ca138d9fe74db38a6c8812c', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (h("div", { key: '317156579b40924a7bb96c89dd247713f87f1aa9', class: "overlay-mask" }, h("div", { key: '71cfc3c3bbfdae49f05fd563e14f56181440fafa', class: "card-outline" }, h("div", { key: '3f940eeb59d783f47e2e2651ccf1a7be19f1d8b9', class: "side side-top" }), h("div", { key: 'f07e54e9542811897191e9a9a08f91b9e4785cc6', class: "side side-right" }), h("div", { key: '5b6a323213ddff52071b3469068cba0b31930ea0', class: "side side-bottom" }), h("div", { key: '44cf6567819855ab915fcee51cec7d08cb8654a8', class: "side side-left" }), h("div", { key: '8f866542b2d1a399418d1c8cb58ea856d5f3b9e7', class: "corner corner-tl" }), h("div", { key: 'a6567d410c755553d4be5b77dfc965e63b4ef07f', class: "corner corner-tr" }), h("div", { key: '255636461627f2deb61c9feacda3c9379abaaf29', class: "corner corner-bl" }), h("div", { key: 'dd029757b1ccc49c44bedee12c19b9485ef16545', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '37aef58019835eac5883042554c648b89cd305ac', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '541f6d35d0655093f767423fc6851b521a5b43cd', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")), this.isVideoActive && (h("div", { key: '73f2232b7c79f8b935cc78f2e5de1f064e4a3472', class: "camera-controls" }, this.isMultipleCamerasAvailable && (h("button", { key: '3c176f9848dc4bf3b7144e2d68225562ae3780c0', class: "flip-camera-button", onClick: () => this.flipCamera(), type: "button", title: "Cambiar c\u00E1mara" }, "Girar c\u00E1mara")), h("button", { key: '9460ad4c42872324141ab19b516e7fa026afdd37', class: "camera-selector-button", onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara" }, "C\u00E1maras"), this.debug && (h("div", { key: '961d825eaba6077189f32193d527fe98a6d4e1e1', style: {
|
|
1619
1649
|
position: 'absolute',
|
|
1620
1650
|
top: '50px',
|
|
1621
1651
|
right: '0',
|
|
@@ -1625,10 +1655,10 @@ export class JaakStamps {
|
|
|
1625
1655
|
fontSize: '10px',
|
|
1626
1656
|
borderRadius: '4px',
|
|
1627
1657
|
whiteSpace: 'nowrap'
|
|
1628
|
-
} }, "C\u00E1maras: ", this.availableCameras.length, h("br", { key: '
|
|
1658
|
+
} }, "C\u00E1maras: ", this.availableCameras.length, h("br", { key: 'f7e12d21177478d03f6df0490dfc91df12bd1225' }), "M\u00FAltiples: ", this.isMultipleCamerasAvailable ? 'Sí' : 'No', h("br", { key: '1f1cc8cf92e10b9b902fd981875621fa8dbe70f2' }), "Selector: ", this.showCameraSelector ? 'Visible' : 'Oculto', h("br", { key: 'c119c6567b28fc33e99b59f76e53e9359491ab77' }), "Video: ", this.isVideoActive ? 'Activo' : 'Inactivo')))), this.showCameraSelector && this.availableCameras.length > 0 && (h("div", { key: 'c230990e87f3b6133263c42fc1b568c0caf076e2', class: "camera-selector-dropdown" }, h("div", { key: '44c224e93c5832eea498e756a446e12ce8255e61', class: "camera-selector-header" }, h("span", { key: '64d951db4843164378424f2d8d2ed2802eb35170' }, "Seleccionar C\u00E1mara"), h("button", { key: '0575a7d0a9a99d665d42c6a7f7d8ceff53da9bd2', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '4aceed8bcf821710af343611f1b31efdfe61438e', class: "camera-list" }, this.availableCameras.map((camera) => (h("button", { key: camera.deviceId, class: `camera-option ${this.selectedCameraId === camera.deviceId ? 'selected' : ''}`, onClick: () => {
|
|
1629
1659
|
this.switchCamera(camera.deviceId);
|
|
1630
1660
|
this.toggleCameraSelector();
|
|
1631
|
-
}, 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: '
|
|
1661
|
+
}, 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: 'd6d691cc499a35f40e348cf61d8f81a380e6fe98', class: "device-info" }, h("small", { key: 'ed38304b9dcac5b99d7b32f5733c59b335433f61' }, "Dispositivo: ", this.deviceType)))))), this.isCapturing && (h("div", { key: 'ad19c6c3a2cb761a67b80e52761b2b9cb14d251d', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: '480615ac9b8ceb5cfc2d821d5777b213c2e86d83', class: "flip-animation" }, h("div", { key: '45e74e5ef254bce75f51d2d12a5961722fb0af03', class: "id-card-icon" }), h("div", { key: '38b9274a67fa8cf1f83bd4b06a3d4ef3d03cdb14', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: 'a6344502e3bbbe298dfb509b41354a54038826aa', class: "success-animation" }, h("div", { key: '579f89d7c8d0ff76e42af611286d96a35d3dbfb9', class: "check-icon" }), h("div", { key: '5bb5c155c70f4bf7a04a62d10142e413763fa1fa', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: '664113d7266be3c4171291faede143e736efadf0', class: "loading-overlay" }, h("div", { key: 'b699ad30f1784e1a92657391c080b91e017f7420', class: "loading-spinner" }), h("div", { key: '287f8e13229e4d14de31b0c5ad7d89a202eca5f9', class: "loading-text" }, this.statusMessage))), this.debug && (h("div", { key: 'ba649b0414153cb28b2c6e3c5451b324a990ec63', class: "status-bar" }, h("div", { key: '55b11462af7ef04d293757e2e45344f9206352ac', class: "status-message", style: { 'color': this.statusColor } }, this.statusMessage))), h("div", { key: '3b24a505519d8b483fad2b2f66ef8159d458e1b4', class: "watermark" }, h("img", { key: 'd61f9366631661835e1dd9500500c2b7a7334581', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
|
|
1632
1662
|
}
|
|
1633
1663
|
static get is() { return "jaak-stamps"; }
|
|
1634
1664
|
static get encapsulation() { return "shadow"; }
|