@sekyro/web 0.1.0-rc.37 → 0.1.0-rc.38
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/CHANGELOG.md +9 -0
- package/dist/{capture-session-doc-6MUKGUJ3.js → capture-session-doc-MGDYUASI.js} +1 -1
- package/dist/{capture-session-v3-BdpUe0ht.d.cts → capture-session-v3-Dz-AQW52.d.cts} +1 -1
- package/dist/{capture-session-v3-Q4otwuve.d.ts → capture-session-v3-Z2KI_2p9.d.ts} +1 -1
- package/dist/chunk-5AR5GTEJ.js +1 -0
- package/dist/{chunk-DTQTSZAX.js → chunk-C4XDRRU5.js} +1 -1
- package/dist/{chunk-KORZGQLS.js → chunk-COZXZAD5.js} +1 -1
- package/dist/chunk-IAKYKPL6.js +1 -0
- package/dist/chunk-IOCOIZKE.js +3 -0
- package/dist/chunk-MQHTFHSN.js +1 -0
- package/dist/chunk-PBWIMNSN.js +1 -0
- package/dist/{chunk-7GUHA2NM.js → chunk-QTOMWAS6.js} +1 -1
- package/dist/{chunk-LTGRPMMY.js → chunk-TOISWBOX.js} +1 -1
- package/dist/chunk-TQQK7464.js +1 -0
- package/dist/chunk-U5TL63CG.js +1 -0
- package/dist/chunk-VMHFHHPP.js +1 -0
- package/dist/{chunk-ISMVEF7H.js → chunk-WNBEOK5Q.js} +1 -1
- package/dist/chunk-XDB7L5KS.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +1 -1
- package/dist/core/ocr/worker.bundle.js +12 -12
- package/dist/core/ocr/worker.cjs +12 -12
- package/dist/core/ocr/worker.js +9 -9
- package/dist/create-document-capture-KISF6XD3.js +1 -0
- package/dist/{create-verification-CCCvsDdp.d.ts → create-verification-2Qm_K28Y.d.ts} +5 -4
- package/dist/{create-verification-BJGWTzCS.d.cts → create-verification-BG6A2iyO.d.cts} +5 -4
- package/dist/{detector-scanic-LYXXX77M.js → detector-scanic-JC25DD3A.js} +1 -1
- package/dist/{icao-gate-C2B9Yyz0.d.cts → icao-gate-Dyb0wGO3.d.cts} +8 -1
- package/dist/{icao-gate-toRhhMow.d.ts → icao-gate-QqtNED0V.d.ts} +8 -1
- package/dist/{icao-policy-xp26r3lv.d.ts → icao-policy-DsaRylAQ.d.ts} +2 -2
- package/dist/{icao-policy-CFoaL76l.d.cts → icao-policy-iIBtqhbf.d.cts} +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +3 -3
- package/dist/internal/index.d.cts +6 -6
- package/dist/internal/index.d.ts +6 -6
- package/dist/internal/index.js +1 -1
- package/dist/plan-runner-NWK4LZFI.js +1 -0
- package/dist/{types-BUvxjU5V.d.cts → types-Cy_SJtPf.d.cts} +30 -3
- package/dist/{types-BUvxjU5V.d.ts → types-Cy_SJtPf.d.ts} +30 -3
- package/package.json +1 -1
- package/sbom.cdx.json +19 -19
- package/dist/chunk-2DBOZDYR.js +0 -1
- package/dist/chunk-5QUJHFOH.js +0 -1
- package/dist/chunk-AYWS6XTB.js +0 -1
- package/dist/chunk-EP6FVAR4.js +0 -3
- package/dist/chunk-GVAN773O.js +0 -1
- package/dist/chunk-JULJQOVT.js +0 -1
- package/dist/chunk-PW2HWXBJ.js +0 -1
- package/dist/chunk-QPO6LOYB.js +0 -1
- package/dist/create-document-capture-EK7EDLTD.js +0 -1
- package/dist/plan-runner-7XZH4SBZ.js +0 -1
package/dist/core/ocr/worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as Oe,b as Te,c as Le}from"../../chunk-BD4KIQQD.js";import{b as _e}from"../../chunk-JLVZ35QK.js";import{a as ue}from"../../chunk-QB62OPX5.js";import{c as Ne,
|
|
2
|
-
`)," "]}function we(e,n,t,r,s){if(t<2||e.length===0||e.length!==n.length||r.length<t-1)throw new S("OCR_INFERENCE_FAILED");let i="",o=-1,u=0,a=0;for(let f=0;f<e.length;f++){let g=e[f];if(!Number.isInteger(g)||g<0||g>=t)throw new S("OCR_INFERENCE_FAILED");g!==0&&g!==o&&(i+=r[g-1],u+=Math.fround(n[f]),a++),o=g}return{text:s?Array.from(i).reverse().join(""):i,score:a===0?0:u/a}}var ge="latin",
|
|
1
|
+
import{a as Oe,b as Te,c as Le}from"../../chunk-BD4KIQQD.js";import{b as _e}from"../../chunk-JLVZ35QK.js";import{a as ue}from"../../chunk-QB62OPX5.js";import{c as Ne,h as Ce}from"../../chunk-WNBEOK5Q.js";var S=class extends Error{constructor(n){super(n),this.name="OcrFailure",this.code=n}};function le(e){return[...e.split(`
|
|
2
|
+
`)," "]}function we(e,n,t,r,s){if(t<2||e.length===0||e.length!==n.length||r.length<t-1)throw new S("OCR_INFERENCE_FAILED");let i="",o=-1,u=0,a=0;for(let f=0;f<e.length;f++){let g=e[f];if(!Number.isInteger(g)||g<0||g>=t)throw new S("OCR_INFERENCE_FAILED");g!==0&&g!==o&&(i+=r[g-1],u+=Math.fround(n[f]),a++),o=g}return{text:s?Array.from(i).reverse().join(""):i,score:a===0?0:u/a}}var ge="latin",st=Object.keys(ue.scripts);function De(e){return Object.prototype.hasOwnProperty.call(ue.scripts,e)}function Be(e){let n=ue.scripts[e];return{script:e,classes:n.classes,rtl:n.rtl,param:n.param,bin:n.bin,dict:n.dict}}function Pe(e,n){let t=le(e);if(e.endsWith(`
|
|
3
3
|
`)||t.length!==n-1)throw new S("OCR_ASSET_INVALID");return t}var ve=e=>e.reduce((n,t)=>n+t,0)/e.length;function ke(e){let n=e.filter(s=>s.score>=.5);if(n.length===0)return[];if(n.some(s=>s.box.length!==4||!Number.isFinite(s.score)||s.box.some(i=>!Number.isFinite(i.x)||!Number.isFinite(i.y))))throw new S("OCR_INFERENCE_FAILED");let t=ve(n.map(s=>s.box[2].y-s.box[0].y)),r=[];for(let s of n){let i=(s.box[0].y+s.box[2].y)/2,o=r.find(u=>Math.abs((u[0].box[0].y+u[0].box[2].y)/2-i)<t/2);o===void 0?r.push([s]):o.push(s)}for(let s of r)s.sort((i,o)=>i.box[0].x-o.box[0].x);return r.sort((s,i)=>s[0].box[0].y-i[0].box[0].y),r.map(s=>{let i=s[0].box,o=s[s.length-1].box,u=[i[0],o[1],o[2],i[3]];return{text:s.map(a=>a.text).join(" "),x:Math.min(...u.map(a=>a.x)),y:Math.min(...u.map(a=>a.y)),x2:Math.max(...u.map(a=>a.x)),y2:Math.max(...u.map(a=>a.y)),score:ve(s.map(a=>a.score))}})}var $={of(e,n,t){return!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(t)||n<1||n>12||t<1||t>new Date(Date.UTC(e,n,0)).getUTCDate()?null:{year:e,month:n,day:t}},iso(e){return`${String(e.year).padStart(4,"0")}-${String(e.month).padStart(2,"0")}-${String(e.day).padStart(2,"0")}`},parse(e){let[n,t,r]=e.split("-").map(Number);return{year:n,month:t,day:r}},today(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}},Fe=30,Ke=36,He=44,pe="MRT",pn=[7,3,1],bn=/^[0-9]{6}$/,ye=/^[0-9]{10}$/,We=e=>e!==void 0&&e.length===1&&e>="0"&&e<="9";function yn(e){return e>="0"&&e<="9"?e.charCodeAt(0)-48:e>="A"&&e<="Z"?e.charCodeAt(0)-55:0}function de(e){let n=0;for(let t=0;t<e.length;t++)n+=yn(e[t])*pn[t%3];return String(n%10)}function B(e,n){return n==="<"?null:We(n)?de(e)===n:!1}function ce(e){return e.trim().toUpperCase().replaceAll(" ","")}function An(e,n){return(ce(e)+"<".repeat(n)).slice(0,n)}function P(e){return e.replace(/^<+|<+$/g,"")}var hn=new Set(`ABW AFG AGO AIA ALA ALB AND ARE ARG ARM ASM ATA ATF ATG AUS AUT AZE BDI BEL BEN BES BFA BGD BGR BHR
|
|
4
4
|
BHS BIH BLM BLR BLZ BMU BOL BRA BRB BRN BTN BVT BWA CAF CAN CCK CHE CHL CHN CIV CMR COD COG COK COL
|
|
5
5
|
COM CPV CRI CUB CUW CXR CYM CYP CZE DEU DJI DMA DNK DOM DZA ECU EGY ERI ESH ESP EST ETH FIN FJI FLK
|
|
@@ -10,7 +10,7 @@ import{a as Oe,b as Te,c as Le}from"../../chunk-BD4KIQQD.js";import{b as _e}from
|
|
|
10
10
|
PER PHL PLW PNG POL PRI PRK PRT PRY PSE PYF QAT REU ROU RUS RWA SAU SDN SEN SGP SGS SHN SJM SLB SLE
|
|
11
11
|
SLV SMR SOM SPM SRB SSD STP SUR SVK SVN SWE SWZ SXM SYC SYR TCA TCD TGO THA TJK TKL TKM TLS TON TTO
|
|
12
12
|
TUN TUR TUV TWN TZA UGA UKR UMI URY USA UZB VAT VCT VEN VGB VIR VNM VUT WLF WSM XKK YEM ZAF ZMB ZWE`.trim().split(/\s+/)),xn=new Set(`D GBD GBN GBO GBP GBS RKS UNK UNO UNA EUE XBA XIM XCC XCE XCO XDC XEC XES XMP XOM XPO XXA XXB XXC
|
|
13
|
-
XXX ANT NTZ UTO`.trim().split(/\s+/));function Mn(e){return hn.has(e)||xn.has(e)}var Rn="012568",In="OIZSGB",Sn="OQDILZSGB",En="000112568";function be(e){let n=Rn.indexOf(e);return e.length!==1||n<0?e:In[n]}function Nn(e){let n=Sn.indexOf(e);return e.length!==1||n<0?e:En[n]}var Cn=[["\xAB","<<"],["\u2039","<"],["\uFF1C","<"],["\u3008","<"],["\xD7","X"]],ze=[`aaccc${"x".repeat(9)}n${"x".repeat(15)}`,`${"n".repeat(7)}x${"n".repeat(7)}ccc${"x".repeat(11)}n`,"a".repeat(30)],Ve=[`aaccc${"a".repeat(31)}`,`${"x".repeat(9)}nccc${"n".repeat(7)}x${"n".repeat(7)}${"x".repeat(7)}n`],Ze=[`aaccc${"a".repeat(39)}`,`${"x".repeat(9)}nccc${"n".repeat(7)}x${"n".repeat(7)}${"x".repeat(14)}nn`];function _n(e,n){let t="",r=0;for(;r<n.length;){let s=n[r];if(s==="c"){let o=e.substring(r,r+3),u=Array.from(o,be).join("");t+=u!==o&&Mn(u.replaceAll("<",""))?u:o,r+=3;continue}let i=e[r];t+=s==="a"?be(i):s==="n"?Nn(i):i,r++}return t}function j(e,n,t){return t.slice(0,e.length).map((r,s)=>{let i=Cn.reduce((o,[u,a])=>o.replaceAll(u,a),ce(e[s]));return _n(An(i,n),r)})}function Ye(e,n){let t=e.filter(r=>r.trim().length>0);return n==="TD1"?j(t.slice(0,3),Fe,ze):n==="TD2"?j(t.slice(0,2),Ke,Ve):j(t.slice(0,2),He,Ze)}function Ae(e){let n=`${e.toUpperCase()}<<`.slice(0,2);return n==="AC"?"unknown":n==="IR"||n==="AR"||
|
|
13
|
+
XXX ANT NTZ UTO`.trim().split(/\s+/));function Mn(e){return hn.has(e)||xn.has(e)}var Rn="012568",In="OIZSGB",Sn="OQDILZSGB",En="000112568";function be(e){let n=Rn.indexOf(e);return e.length!==1||n<0?e:In[n]}function Nn(e){let n=Sn.indexOf(e);return e.length!==1||n<0?e:En[n]}var Cn=[["\xAB","<<"],["\u2039","<"],["\uFF1C","<"],["\u3008","<"],["\xD7","X"]],ze=[`aaccc${"x".repeat(9)}n${"x".repeat(15)}`,`${"n".repeat(7)}x${"n".repeat(7)}ccc${"x".repeat(11)}n`,"a".repeat(30)],Ve=[`aaccc${"a".repeat(31)}`,`${"x".repeat(9)}nccc${"n".repeat(7)}x${"n".repeat(7)}${"x".repeat(7)}n`],Ze=[`aaccc${"a".repeat(39)}`,`${"x".repeat(9)}nccc${"n".repeat(7)}x${"n".repeat(7)}${"x".repeat(14)}nn`];function _n(e,n){let t="",r=0;for(;r<n.length;){let s=n[r];if(s==="c"){let o=e.substring(r,r+3),u=Array.from(o,be).join("");t+=u!==o&&Mn(u.replaceAll("<",""))?u:o,r+=3;continue}let i=e[r];t+=s==="a"?be(i):s==="n"?Nn(i):i,r++}return t}function j(e,n,t){return t.slice(0,e.length).map((r,s)=>{let i=Cn.reduce((o,[u,a])=>o.replaceAll(u,a),ce(e[s]));return _n(An(i,n),r)})}function Ye(e,n){let t=e.filter(r=>r.trim().length>0);return n==="TD1"?j(t.slice(0,3),Fe,ze):n==="TD2"?j(t.slice(0,2),Ke,Ve):j(t.slice(0,2),He,Ze)}function Ae(e){let n=`${e.toUpperCase()}<<`.slice(0,2);return n==="AC"?"unknown":n==="IR"||n==="AR"||"ACRT".includes(n[0])?"residence_permit":n[0]==="P"?"passport":n[0]==="I"?"carte_identite":"unknown"}function On(e){return ye.test(e)&&Number(e)%97===1}function Tn(e,n,t){if(!bn.test(e))return null;let r=Number(e.slice(0,2)),s=n?2e3+r:r>t.year%100?1900+r:2e3+r;return $.of(s,Number(e.slice(2,4)),Number(e.slice(4,6)))}function q(e,n,t){let r=Tn(e,n,t);return r?$.iso(r):""}function he(e){let n=e.split("<<").filter(t=>P(t).length>0);return[(n[0]??"").replaceAll("<"," ").trim(),(n[1]??"").replaceAll("<"," ").trim()]}var xe=e=>e==="M"||e==="F"?e:"",Ln=e=>e.substring(0,2).replaceAll("<",""),re=e=>e.substring(2,5).replaceAll("<","");function Xe(e,n,t){if(n==="<"&&P(t).length>0){let r=t.indexOf("<"),s=r<0?t:t.slice(0,r);if(s.length>=2){let i=e+s.slice(0,-1);if(B(i,s[s.length-1])===!0)return{value:P(i),ok:!0,warn:null}}return{value:P(e),ok:!1,warn:"docnum_cd_mismatch"}}return{value:P(e),ok:B(e,n),warn:null}}var F=(e,n)=>({success:!1,error:e,fields:{},checkDigits:{},hardCdFail:!1,warns:[],...n===void 0?{}:{linesCount:n}});function Me(e,n,t,r,s,i,o){return{success:!0,documentType:e,format:n,documentCode:Ln(t),fields:r,checkDigits:s,hardCdFail:i,warns:o}}function wn(e,n){if(e.length<3)return F("mrz_incomplete");let[t,r,s]=j(e.slice(0,3),Fe,ze),i=re(t)===pe||r.substring(15,18)===pe||On(t.substring(15,25)),o=[],u={},a,m,f=!1;if(i){a=P(t.substring(5,14));let h=t[14];We(h)?(m=de(t.substring(5,14))===h,m||o.push("td1_docnum_cd_mismatch")):m=null}else{let h=Xe(t.substring(5,14),t[14],t.substring(15,30));if(h.ok===null)return F("mrz_incomplete");a=h.value,m=h.ok,f=h.ok===!1&&h.warn===null,h.warn!==null&&o.push(h.warn)}u.document_number=m;let g=B(r.substring(0,6),r[6]),y=B(r.substring(8,14),r[14]);if(u.birth_date=g,u.expiry_date=y,g===null||y===null)return F("mrz_incomplete");let b=B(t.substring(5,30)+r.substring(0,7)+r.substring(8,15)+r.substring(18,29),r[29]);u.composite=b,b===!1&&o.push("composite_cd_mismatch");let d=i?t.substring(15,25):"",[l,R]=he(s),I=g===!1||y===!1||f;return Me(Ae(t.substring(0,2)),"TD1",t,{issuing_state:re(t),document_number:a,nni:ye.test(d)?d:"",birth_date:q(r.substring(0,6),!1,n),expiry_date:q(r.substring(8,14),!0,n),sex:xe(r[7]),nationality:P(r.substring(15,18)),surname:l,given_names:R},u,I,o)}function Dn(e,n){if(e.length<2)return F("mrz_incomplete");let[t,r]=j(e.slice(0,2),Ke,Ve),s=[],i=Xe(r.substring(0,9),r[9],r.substring(28,35));i.warn!==null&&s.push(i.warn);let o=B(r.substring(13,19),r[19]),u=B(r.substring(21,27),r[27]),a={document_number:i.ok,birth_date:o,expiry_date:u};if(i.ok===null||o===null||u===null)return F("mrz_incomplete");let m=B(r.substring(0,10)+r.substring(13,20)+r.substring(21,35),r[35]);a.composite=m,m===!1&&s.push("composite_cd_mismatch");let[f,g]=he(t.substring(5,36)),y=i.ok===!1&&i.warn===null||o===!1||u===!1;return Me(Ae(t.substring(0,2)),"TD2",t,{issuing_state:re(t),document_number:i.value,nni:"",birth_date:q(r.substring(13,19),!1,n),expiry_date:q(r.substring(21,27),!0,n),sex:xe(r[20]),nationality:P(r.substring(10,13)),surname:f,given_names:g},a,y,s)}function Ue(e,n){if(e.length<2)return F("mrz_incomplete");let[t,r]=j(e.slice(0,2),He,Ze),s=re(t)===pe,i=[],o={},u=r.substring(0,9),a=B(u,r[9]),m=B(r.substring(13,19),r[19]),f=B(r.substring(21,27),r[27]);if(o.document_number=a,o.birth_date=m,o.expiry_date=f,a===null||m===null||f===null)return F("mrz_incomplete");let g=r.substring(28,42),y="";if(P(g).length>0){let I=B(g,r[42]);o.personal_number=I;let h=P(g);s&&I!==!1&&ye.test(h)&&(y=h)}let b=B(r.substring(0,10)+r.substring(13,20)+r.substring(21,43),r[43]);o.composite=b,b===!1&&i.push("composite_cd_mismatch");let[d,l]=he(t.substring(5,44)),R=a===!1||m===!1||f===!1;return Me(Ae(t.substring(0,2)),"TD3",t,{issuing_state:re(t),document_number:P(u),nni_candidate:y,birth_date:q(r.substring(13,19),!1,n),expiry_date:q(r.substring(21,27),!0,n),sex:xe(r[20]),nationality:P(r.substring(10,13)),surname:d,given_names:l},o,R,i)}var Ge=new Set(["A","C","I"]),Bn=new Set(["R","T"]);function $e(e,n=$.today()){let t=e.filter(s=>s.trim().length>0);if(t.length===0)return F("mrz_unrecognized",0);let r=Array.from(ce(t[0]).slice(0,1),be).join("");return t.length===3&&(Ge.has(r)||Bn.has(r))?wn(t,n):t.length===2&&r==="P"?Ue(t,n):t.length===2&&Ge.has(r)?Math.max(...t.map(s=>ce(s).length))>40?Ue(t,n):Dn(t,n):F("mrz_unrecognized",t.length)}var Pn=new Map([...(`ABWAW AFGAF AGOAO AIAAI ALAAX ALBAL ANDAD AREAE ARGAR ARMAM ASMAS ATAAQ
|
|
14
14
|
ATFTF ATGAG AUSAU AUTAT AZEAZ BDIBI BELBE BENBJ BESBQ BFABF BGDBD BGRBG
|
|
15
15
|
BHRBH BHSBS BIHBA BLMBL BLRBY BLZBZ BMUBM BOLBO BRABR BRBBB BRNBN BTNBT
|
|
16
16
|
BVTBV BWABW CAFCF CANCA CCKCC CHECH CHLCL CHNCN CIVCI CMRCM CODCD COGCG
|
|
@@ -30,11 +30,11 @@ import{a as Oe,b as Te,c as Le}from"../../chunk-BD4KIQQD.js";import{b as _e}from
|
|
|
30
30
|
SRBRS SSDSS STPST SURSR SVKSK SVNSI SWESE SWZSZ SXMSX SYCSC SYRSY TCATC
|
|
31
31
|
TCDTD TGOTG THATH TJKTJ TKLTK TKMTM TLSTL TONTO TTOTT TUNTN TURTR TUVTV
|
|
32
32
|
TWNTW TZATZ UGAUG UKRUA UMIUM URYUY USAUS UZBUZ VATVA VCTVC VENVE VGBVG
|
|
33
|
-
VIRVI VNMVN VUTVU WLFWF WSMWS YEMYE ZAFZA ZMBZM ZWEZW`.match(/[A-Z]{5}/g)??[]).map(e=>[e.slice(0,3),e.slice(3)]),["D","DE"]]),Je={of(e){return
|
|
34
|
-
`));let f="",g=0;for(;g<6&&s+g<n.length&&(f+=n[s+g],f.length===u*a&&t.push(f),!(f.length>=u*a));)g++}}let r=new Map;for(let s of t){let i=
|
|
33
|
+
VIRVI VNMVN VUTVU WLFWF WSMWS YEMYE ZAFZA ZMBZM ZWEZW`.match(/[A-Z]{5}/g)??[]).map(e=>[e.slice(0,3),e.slice(3)]),["D","DE"]]),Je={of(e){return Pn.get(e.replaceAll("<",""))??null}};var Ie=e=>de(e);function tn(e){return e.slice(0,5e4).split(/\r?\n/).slice(0,200).map(n=>n.toUpperCase().replace(/[«‹〈]/g,"<").replace(/[^A-Z0-9<]/g,"")).filter(n=>n.length>0)}var Qe=e=>e.replace(/[OQ]/g,"0").replace(/[IL]/g,"1").replaceAll("Z","2").replaceAll("S","5").replaceAll("B","8");function je(e,n){let t=Qe(e),r=Qe(n);if(!/^\d{6}$/.test(t)||Ie(t)!==r)return null;let s=2e3+Number(t.slice(0,2)),i=Number(t.slice(2,4)),o=Number(t.slice(4,6));return i>=1&&i<=12&&o>=1&&o<=new Date(Date.UTC(s,i,0)).getUTCDate()?t:null}function Re(e,n){let t=e.replace(/<+$/,"");return/^[A-Z0-9]+$/.test(t)&&Ie(e)===n?t:null}function vn(e){if(e.length<15)return null;if(e[14]!=="<")return Re(e.substring(5,14),e[14]);let n=/^([A-Z0-9]+)</.exec(e.substring(15,Math.min(30,e.length)))?.[1];return n===void 0||n.length<2?null:Re(e.substring(5,14)+n.slice(0,-1),n[n.length-1])}var x=(e,n,t)=>n>=e.length?"":e.substring(n,Math.min(t,e.length)),V=(e,n)=>n<e.length?e[n]:"",qe=/^[IAC][A-Z<][A-Z<]{3}/,kn=/^P[A-Z<][A-Z<]{3}/,rn=/^[PIAC][A-Z<][A-Z<]{3}/;function Un(e){let n=tn(e),t=[],r=[];for(let i=0;i<n.length;i++){let o="",u=0;for(;u<6&&i+u<n.length&&(o+=n[i+u],!(o.length>300));)r.push(o),u++}let s=(i,o,u)=>{if(o.length<(u?15:28))return;let a=new Map,m=u?vn(i):Re(x(o,0,9),V(o,9)),f=je(u?x(o,0,6):x(o,13,19),u?V(o,6):V(o,19)),g=je(u?x(o,8,14):x(o,21,27),u?V(o,14):V(o,27));m!==null&&a.set("docNumber",m),f!==null&&a.set("dob6",f),g!==null&&a.set("expiry6",g),a.size>0&&t.push({fields:a,country:Je.of(x(i,2,5))})};for(let i of r)qe.test(i)&&(i.length>=45&&s(i.substring(0,30),i.substring(30),!0),i.length>=64&&s(i.substring(0,36),i.substring(36),!1)),kn.test(i)&&i.length>=72&&s(i.substring(0,44),i.substring(44),!1);for(let i=0;i<n.length-1;i++){let o=n[i],u=n[i+1];qe.test(o)&&o.length>=15&&o.length<=30&&s(o,u,!0),rn.test(o)&&o.length>=5&&o.length<=44&&s(o,u,!1)}return t}function Gn(e){let n=Un(e);if(n.length===0)return{};let t=Math.max(...n.map(i=>i.fields.size)),r=n.filter(i=>i.fields.size===t),s={};for(let i of["docNumber","dob6","expiry6"]){let o=new Set(r.map(u=>u.fields.get(i)).filter(u=>u!==void 0));o.size===1&&r.every(u=>u.fields.has(i))&&(s[i]=[...o][0])}return s}function Fn(e){let n=Gn(e),t=n.docNumber,r=n.dob6,s=n.expiry6;return t!==void 0&&r!==void 0&&s!==void 0?{docNumber:t,dob6:r,expiry6:s}:null}function sn(e){let n=Hn(e);return n.length===1?n[0]:null}var Kn=e=>JSON.stringify([e.documentNumber,e.nationality,e.dob,e.sex,e.expiry,e.primaryIdentifier,e.secondaryIdentifier,e.optional]);function Hn(e){let n=tn(e),t=[];for(let s=0;s<n.length;s++){let i=n[s];if(!rn.test(i))continue;let o=i.startsWith("P")?[44]:[30,36];for(let u of o){let a=u===30?3:2,m=n.slice(s,Math.min(n.length,s+a));m.length===a&&m.every(y=>y.length<=u)&&t.push(m.map(y=>y.padEnd(u,"<")).join(`
|
|
34
|
+
`));let f="",g=0;for(;g<6&&s+g<n.length&&(f+=n[s+g],f.length===u*a&&t.push(f),!(f.length>=u*a));)g++}}let r=new Map;for(let s of t){let i=Fn(s);if(i===null)continue;let o=s.includes(`
|
|
35
35
|
`)?s.split(`
|
|
36
|
-
`):s.match(s.length===90?/.{30}/g:s.length===88?/.{44}/g:/.{36}/g)??[],u=o[0]??"",a=o[1]??"",m=o.length===3,f=m?x(u,5,30)+x(a,0,7)+x(a,8,15)+x(a,18,29):x(a,0,10)+x(a,13,20)+x(a,21,a.length-1),g=m?V(a,29):V(a,a.length-1);if(!/^[0-9]$/.test(g)||Ie(f)!==g)continue;let y=
|
|
37
|
-
`))?.mrzLines??an(f)],y=m.map(l=>[Z(l.x/t),Z(l.y/r),Z((l.x2-l.x)/t),Z((l.y2-l.y)/r)]),b={kind:"band",ms:0,lineBoxes:y,lineCount:g.length,valid:!1},d=
|
|
36
|
+
`):s.match(s.length===90?/.{30}/g:s.length===88?/.{44}/g:/.{36}/g)??[],u=o[0]??"",a=o[1]??"",m=o.length===3,f=m?x(u,5,30)+x(a,0,7)+x(a,8,15)+x(a,18,29):x(a,0,10)+x(a,13,20)+x(a,21,a.length-1),g=m?V(a,29):V(a,a.length-1);if(!/^[0-9]$/.test(g)||Ie(f)!==g)continue;let y=Wn(s);if(y===null||y.primaryIdentifier.length===0&&y.secondaryIdentifier.length===0||!/^[MFX]?$/.test(y.sex))continue;let b={...y,documentNumber:i.docNumber,dob:i.dob6,expiry:i.expiry6};r.set(Kn(b),{fields:b,mrzLines:o})}return[...r.values()]}var U=e=>e.replaceAll("<"," ").replace(/\s+/g," ").trim();function en(e){let n=e.split("<<");return[U(n[0]??""),U(n.slice(1).join("<<"))]}var nn=e=>e.length===0?null:e;function Wn(e){let n=e.split(/\r?\n/).map(r=>r.replace(/\s+$/,"")).filter(r=>r.length>0),t=e.replace(/[\r\n]/g,"");if(n.length===1&&(t.length===90?n=[t.substring(0,30),t.substring(30,60),t.substring(60,90)]:t.length===72?n=[t.substring(0,36),t.substring(36,72)]:t.length===88&&(n=[t.substring(0,44),t.substring(44,88)])),n.length===3){let[r,s,i]=n,o=V(r,14)==="<"?/^([A-Z0-9]+)</.exec(x(r,15,30))?.[1]:void 0,u=U(x(r,5,14)+(o!==void 0&&o.length>1?o.slice(0,-1):"")),[a,m]=en(i),f=U(`${x(r,15,30)}<${x(s,18,29)}`);return{documentNumber:u,nationality:U(x(s,15,18)),dob:x(s,0,6),sex:U(x(s,7,8)),expiry:x(s,8,14),primaryIdentifier:a,secondaryIdentifier:m,optional:nn(f)}}if(n.length===2){let[r,s]=n,i=r.length>=44,[o,u]=en(x(r,5,i?44:36));return{documentNumber:U(x(s,0,9)),nationality:U(x(s,10,13)),dob:x(s,13,19),sex:U(x(s,20,21)),expiry:x(s,21,27),primaryIdentifier:o,secondaryIdentifier:u,optional:nn(U(i?x(s,28,42):x(s,28,35)))}}return null}function on(e,n=$.today()){let t=$e(e,n),r=t.format??null,s=r==="TD1"||r==="TD2"||r==="TD3"?Ye(e,r):[...e];return{format:r,documentCode:t.documentCode??null,lines:s,valid:t.success&&!t.hardCdFail}}var zn=/^[A-Z0-9<]{25,}$/;function Vn(e){return e.toUpperCase().replaceAll(" ","").replaceAll("\xAB","<").replaceAll("\u2039","<")}var Se=(e,n,t)=>e.length>=n&&e.length<=t;function an(e){let n=e.map(Vn).filter(t=>zn.test(t));for(let t=0;t+3<=n.length;t++){let r=n.slice(t,t+3);if(r.every(s=>Se(s,28,32))&&"IAC".includes(r[0][0]))return r}for(let t=0;t+2<=n.length;t++){let r=n.slice(t,t+2);if(r.every(s=>Se(s,40,46))&&r[0].startsWith("P")||r.every(s=>Se(s,34,38))&&"IACPV".includes(r[0][0]))return r}return[]}var ee={SIZE:80,SCRIPT:64,OFFSET:68,STEPS:72},_={DETECTOR:0,LATIN:1,ARABIC:2},k={NONE:0,LATIN:1,ARABIC:2,BOTH:3},se=3;var Z=e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4;async function ln(e,n,t,r,s){let i=s.now??(()=>performance.now()),o=i(),a=e.read(n,t,r,s.region??[0,0,1,1],1,se,k.LATIN,s.detectorLimit).map(l=>({text:l.latin.text,score:l.latin.score,box:[0,1,2,3].map(R=>({x:l.box[2*R],y:l.box[2*R+1]}))})),m=ke([...a].reverse()),f=m.map(l=>l.text),g=[...sn(f.join(`
|
|
37
|
+
`))?.mrzLines??an(f)],y=m.map(l=>[Z(l.x/t),Z(l.y/r),Z((l.x2-l.x)/t),Z((l.y2-l.y)/r)]),b={kind:"band",ms:0,lineBoxes:y,lineCount:g.length,valid:!1},d=Yn(m.map(l=>l.text),y,g);if(d!==null&&(b.mrzBox=d),g.length>0){let l=on(g,s.today??$.today());l.format&&(b.format=l.format),l.documentCode&&/^[A-Z<]{1,2}$/.test(l.documentCode)&&(b.documentCode=l.documentCode),l.valid&&(b.valid=!0,b.digest=await _e(s.salt,l.lines))}return b.ms=Math.round(i()-o),b}var un=e=>e.toUpperCase().replace(/\s+/g,"");function Zn(e,n){let t=Math.max(e.length,n.length);if(t===0)return 0;let r=0;for(let s=0;s<Math.min(e.length,n.length);s++)e[s]===n[s]&&r++;return r/t}function Yn(e,n,t){if(t.length===0||e.length===0)return null;let r=new Set,s=[];for(let m of t){let f=-1,g=.5;if(e.forEach((y,b)=>{let d=r.has(b)?0:Zn(un(y),un(m));d>g&&(g=d,f=b)}),f<0)return null;r.add(f),s.push(n[f])}let i=Math.min(...s.map(m=>m[0])),o=Math.min(...s.map(m=>m[1])),u=Math.max(...s.map(m=>m[0]+m[2])),a=Math.max(...s.map(m=>m[1]+m[3]));return[Z(i),Z(o),Z(u-i),Z(a-o)]}async function Xn(e={}){var n,t=e,r=import.meta.url,s="",i,o;try{s=new URL(".",r).href}catch{}o=c=>{var A=new XMLHttpRequest;return A.open("GET",c,!1),A.responseType="arraybuffer",A.send(null),new Uint8Array(A.response)},i=async c=>{if(c=await fetch(c,{credentials:"same-origin"}),c.ok)return c.arrayBuffer();throw Error(c.status+" : "+c.url)};var u=console.log.bind(console),a=console.error.bind(console),m=!1,f,g,y,b,d,l=!1;function R(){var c=oe.buffer;new Int8Array(c),new Int16Array(c),t.HEAPU8=y=new Uint8Array(c),new Uint16Array(c),new Int32Array(c),b=new Uint32Array(c),new Float32Array(c),new Float64Array(c),d=new BigInt64Array(c),new BigUint64Array(c)}function I(c){throw c="Aborted("+c+")",a(c),m=!0,c+=". Build with -sASSERTIONS for more info.",l&&J(),c=new WebAssembly.RuntimeError(c),g?.(c),c}var h;async function L(c){try{var A=await i(c);return new Uint8Array(A)}catch{}if(o)c=o(c);else throw"both async and sync fetching of the wasm failed";return c}async function w(c,A){try{var p=await L(c);return await WebAssembly.instantiate(p,A)}catch(E){a(`failed to asynchronously prepare wasm: ${E}`),I(E)}}async function K(c){var A=h;try{var p=fetch(A,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(p,c)}catch(E){a(`wasm streaming compile failed: ${E}`),a("falling back to ArrayBuffer instantiation")}return w(A,c)}var H={},W=()=>{if(!Y){var c={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:"./this.program"},A;for(A in H)H[A]===void 0?delete c[A]:c[A]=H[A];var p=[];for(A in c)p.push(`${A}=${c[A]}`);Y=p}return Y},Y,X=[null,[],[]],ie=globalThis.TextDecoder&&new TextDecoder,J,oe,gn={i:()=>I(""),b:function(c,A,p){return 0<=c&&3>=c?(d[p>>3]=BigInt(Math.round(1e6*(c===0?Date.now():performance.now()))),0):28},d:()=>1073741824,c:c=>{var A=y.length;if(c>>>=0,1073741824<c)return!1;for(var p=1;4>=p;p*=2){var E=A*(1+.2/p);E=Math.min(E,c+100663296);e:{E=(Math.min(1073741824,65536*Math.ceil(Math.max(c,E)/65536))-oe.buffer.byteLength+65535)/65536|0;try{oe.grow(E),R();var O=1;break e}catch{}O=void 0}if(O)return!0}return!1},f:(c,A)=>{var p=0,E=0,O;for(O of W()){var M=A+p;b[c+E>>2]=M;for(var Q=O,D=y,ne=M,G=M+1/0-1,N=0;N<Q.length;++N){var C=Q.codePointAt(N);if(127>=C){if(M>=G)break;D[M++]=C}else if(2047>=C){if(M+1>=G)break;D[M++]=192|C>>6,D[M++]=128|C&63}else if(65535>=C){if(M+2>=G)break;D[M++]=224|C>>12,D[M++]=128|C>>6&63,D[M++]=128|C&63}else{if(M+3>=G)break;D[M++]=240|C>>18,D[M++]=128|C>>12&63,D[M++]=128|C>>6&63,D[M++]=128|C&63,N++}}D[M]=0,Q=M-ne,p+=Q+1,E+=4}return 0},g:(c,A)=>{var p=W();b[c>>2]=p.length,c=0;for(var E of p){for(var O=p=0;O<E.length;++O){var M=E.charCodeAt(O);127>=M?p++:2047>=M?p+=2:55296<=M&&57343>=M?(p+=4,++O):p+=3}c+=p+1}return b[A>>2]=c,0},j:()=>52,h:()=>52,e:function(){return 70},a:(c,A,p,E)=>{for(var O=0,M=0;M<p;M++){var Q=b[A>>2],D=b[A+4>>2];A+=8;for(var ne=0;ne<D;ne++){var G=c,N=y[Q+ne],C=X[G];if(N===0||N===10){G=G===1?u:a,N=C;for(var z=0,te=N,v=z,T=v+void 0;te[v]&&!(v>=T);)++v;if(te=v,16<te-z&&N.buffer&&ie)N=ie.decode(N.subarray(z,te));else{for(v="";z<te;)if(T=N[z++],T&128){var fe=N[z++]&63;if((T&224)==192)v+=String.fromCharCode((T&31)<<6|fe);else{var Ee=N[z++]&63;T=(T&240)==224?(T&15)<<12|fe<<6|Ee:(T&7)<<18|fe<<12|Ee<<6|N[z++]&63,65536>T?v+=String.fromCharCode(T):(T-=65536,v+=String.fromCharCode(55296|T>>10,56320|T&1023))}}else v+=String.fromCharCode(T);N=v}G(N),C.length=0}else C.push(N)}O+=D}return b[E>>2]=O,0}},ae;return ae=await(async function(){function c(p){return p=ae=p.exports,t._skw_engine_id=p.m,t._skw_load=p.n,t._skw_unload=p.o,t._skw_set_detector_limit=p.p,t._skw_read=p.q,t._skw_line_count=p.r,t._skw_lines=p.s,t._skw_best=p.t,t._skw_values=p.u,t._skw_sharpness=p.v,t._free=p.w,t._malloc=p.x,J=p.y,oe=p.k,R(),ae}var A={a:gn};return t.instantiateWasm?new Promise(p=>{t.instantiateWasm(A,(E,O)=>{p(c(E,O))})}):(h??(h=t.locateFile?t.locateFile?t.locateFile("sekyro-ocr.wasm",s):s+"sekyro-ocr.wasm":new URL("sekyro-ocr.wasm",import.meta.url).href),c((await K(A)).instance))})(),t.calledRun=!0,m||(l=!0,ae.l(),f?.(t)),l?n=t:n=new Promise((c,A)=>{f=c,g=A}),n}var cn=Xn;function dn(e){return e===1||e===5?new S("OCR_IMAGE_INVALID"):e===2?new S("OCR_ASSET_INVALID"):e===4?new S("OCR_CANCELLED"):e===6?new S("OCR_BUSY"):e===7?new S("OCR_UNAVAILABLE"):new S("OCR_INFERENCE_FAILED")}var me=class{constructor(n){this.m=n;this.px=0;this.pxBytes=0;this.dicts=[null,null,null];this.classes=[0,0,0];this.held=[[],[],[]];this.latinKind="latin";this.scripts=[null,null,null]}engineId(){let n=this.m._skw_engine_id(),t="";for(let r=n;this.m.HEAPU8[r]!==0&&r<n+64;r++)t+=String.fromCharCode(this.m.HEAPU8[r]);return t}put(n){let t=this.m._malloc(n.length);if(!t)throw new S("OCR_UNAVAILABLE");return this.m.HEAPU8.set(n,t),t}load(n,t,r,s,i={}){this.unload(n);let o=new Uint8Array(t),u=new Uint8Array(o.byteLength+1);u.set(o);let a=null,m=0,f=null;if(i.mrz===!0){if(n!==_.LATIN||s===void 0||!Qn(s)||i.script!==void 0)throw new S("OCR_ASSET_INVALID");a=le(s),m=mn(s)}else if(n!==_.DETECTOR){if(f=i.script??(n===_.LATIN?ge:"arabic"),s===void 0||!De(f)||n===_.LATIN!=(f===ge))throw new S("OCR_ASSET_INVALID");m=Be(f).classes,a=Pe(s,m)}else if(s!==void 0||i.script!==void 0)throw new S("OCR_ASSET_INVALID");let g=new Uint8Array(r),y=this.put(u),b=this.put(g);this.held[n]=[y,b];let d=this.m._skw_load(n,y,u.length,b,g.byteLength,m);if(d!==0)throw this.unload(n),dn(d);this.dicts[n]=a,this.classes[n]=m,this.scripts[n]=f,n===_.LATIN&&(this.latinKind=i.mrz===!0?"mrz":"latin")}recognizer(){return this.loaded(_.LATIN)?this.latinKind:null}secondScript(){return this.loaded(_.ARABIC)?this.scripts[_.ARABIC]:null}unload(n){this.held[n].length&&this.m._skw_unload(n);for(let t of this.held[n])this.m._free(t);this.held[n]=[],this.dicts[n]=null,this.scripts[n]=null}loaded(n){return this.held[n].length>0}pixels(n){if(n.length>this.pxBytes){if(this.px&&this.m._free(this.px),this.px=this.m._malloc(n.length),!this.px)throw new S("OCR_UNAVAILABLE");this.pxBytes=n.length}return this.m.HEAPU8.set(n,this.px),this.px}sharpness(n,t,r){let s=this.m._skw_sharpness(this.pixels(n),t,r);return s>=0&&Number.isFinite(s)?s:null}read(n,t,r,s,i,o,u,a){if(!$n(u))throw new S("OCR_IMAGE_INVALID");if(u&k.LATIN&&!this.dicts[_.LATIN]||u&k.ARABIC&&!this.dicts[_.ARABIC]||!this.loaded(0))throw new S("OCR_UNAVAILABLE");let m=this.pixels(n);this.m._skw_set_detector_limit(a);let f=this.m._skw_read(m,t,r,s[0],s[1],s[2],s[3],i,o,u);if(f!==0)throw dn(f);let g=this.m._skw_line_count(),y=this.m.HEAPU8.buffer,b=new DataView(y,this.m._skw_lines(),g*ee.SIZE),d=new Int32Array(y,this.m._skw_best()),l=new Float32Array(y,this.m._skw_values()),R=[];for(let I=0;I<g;I++){let h=I*ee.SIZE,L=b.getInt32(h+ee.SCRIPT,!0),w=b.getInt32(h+ee.OFFSET,!0),K=b.getInt32(h+ee.STEPS,!0);if(u===k.NONE){R.push({box:Array.from({length:8},(ie,J)=>b.getFloat64(h+8*J,!0))});continue}let H=this.dicts[L];if(!H)throw new S("OCR_INFERENCE_FAILED");let W=we(d.subarray(w,w+K),l.subarray(w,w+K),this.classes[L],H,!1),Y=Array.from({length:8},(ie,J)=>b.getFloat64(h+8*J,!0)),X=R[R.length-1];L===_.ARABIC&&X&&X.arabic===void 0&&X.latin!==void 0&&Jn(X.box,Y)?X.arabic=W:R.push(L===_.ARABIC?{box:Y,arabic:W}:{box:Y,latin:W})}return R}heapBytes(){return this.m.HEAPU8.length}dispose(){for(let n of[0,1,2])this.unload(n);this.px&&this.m._free(this.px),this.px=0,this.pxBytes=0}};function mn(e){return(e.endsWith(`
|
|
38
38
|
`)?e.slice(0,-1):e).split(`
|
|
39
|
-
`).length+2}var
|
|
40
|
-
`);return n.length===37&&new Set(n).size===37&&n.every(t=>/^[0-9A-Z<]$/.test(t))&&mn(e)===39}async function fn(e){let n=await cn({instantiateWasm:(t,r)=>(WebAssembly.instantiate(e,t).then(s=>r(s,e)),{})});return new me(n)}function
|
|
39
|
+
`).length+2}var $n=e=>Number.isInteger(e)&&e>=k.NONE&&e<=k.BOTH,Jn=(e,n)=>e.every((t,r)=>t===n[r]);function Qn(e){let n=e.split(`
|
|
40
|
+
`);return n.length===37&&new Set(n).size===37&&n.every(t=>/^[0-9A-Z<]$/.test(t))&&mn(e)===39}async function fn(e){let n=await cn({instantiateWasm:(t,r)=>(WebAssembly.instantiate(e,t).then(s=>r(s,e)),{})});return new me(n)}function jn(){let e=null,n=null;return(t,r)=>{if(typeof OffscreenCanvas!="function"||(e||(e=new OffscreenCanvas(t,r),n=e.getContext("2d",{willReadFrequently:!0})),!n))return null;(e.width!==t||e.height!==r)&&(e.width=t,e.height=r);let s=n;return{draw(i){return s.clearRect(0,0,t,r),s.drawImage(i,0,0),s.getImageData(0,0,t,r).data}}}}function qn(){return{fetch:(...e)=>fetch(...e),now:()=>performance.now(),canvas:jn(),instantiate:fn}}function et(e,n=qn()){let t=null,r="",s=960,i=0,o=!1,u=Promise.resolve(),a=d=>e.postMessage(d);async function m(d){if(n.canvas(1,1)===null)return a({id:d.id,kind:"failed",reason:"unsupported"});r=d.salt,s=d.detectorLimit;try{let l=await Le(d.baseUrl,Te,d.maxDownloadMs,n.fetch,n.now);i=l.downloadMs,o=l.cached;let R=await WebAssembly.compile(l.files.get("sekyro-ocr.wasm")),I=await n.instantiate(R),h=new TextDecoder("utf-8",{fatal:!0}).decode(l.files.get("mrz_dict.txt"));I.load(_.DETECTOR,l.files.get("det.param"),l.files.get("det.bin")),I.load(_.LATIN,l.files.get("mrz-rec.param"),l.files.get("mrz-rec.bin"),h,{mrz:!0}),l.files.clear(),t=I,a({id:d.id,kind:"ready",warmupMs:0,downloadMs:i,cached:o})}catch(l){a({id:d.id,kind:"failed",reason:l instanceof Oe?l.reason:"error"})}}async function f(d,l,R,I){if(!t)return l.close(),a({id:d,kind:"error",code:"not_ready"});let h=l.width,L=l.height,w=n.canvas(h,L);if(!w)return l.close(),a({id:d,kind:"failed",reason:"unsupported"});let K=w.draw(l);l.close();try{a({id:d,...await ln(t,K,h,L,{detectorLimit:I,salt:r,region:R,now:n.now})})}catch{a({id:d,kind:"error",code:"OCR_INFERENCE_FAILED"})}}async function g(d,l,R){if(!t)return l.close(),a({id:d,kind:"error",code:"not_ready"});let I=l.width,h=l.height,L=n.canvas(I,h);if(!L)return l.close(),a({id:d,kind:"failed",reason:"unsupported"});let w=L.draw(l);l.close();try{let K=n.now(),H=t.read(w,I,h,[0,0,1,1],1,se,k.NONE,R);a({id:d,kind:"layout",ms:Math.round(n.now()-K),lineBoxes:Ne(H.map(W=>W.box),I,h)})}catch{a({id:d,kind:"error",code:"OCR_INFERENCE_FAILED"})}}async function y(d){if(!t)return a({id:d,kind:"error",code:"not_ready"});let l=Ce(),R=()=>t.read(l.rgba,l.width,l.height,[0,0,1,1],1,se,k.LATIN,960),I,h;try{let L=n.now();R();let w=n.now();R(),I=Math.round(w-L),h=Math.round(n.now()-w)}catch{return a({id:d,kind:"error",code:"OCR_INFERENCE_FAILED"})}a({id:d,kind:"ready",warmupMs:I,benchMs:h,downloadMs:i,cached:o})}async function b(d){switch(d.kind){case"init":return m(d);case"warmup":return y(d.id);case"band":return f(d.id,d.bitmap,void 0,d.detectorLimit);case"still":return f(d.id,d.bitmap,d.region,d.detectorLimit);case"layout":return g(d.id,d.bitmap,d.detectorLimit);case"dispose":t?.dispose(),t=null,e.close();return}}e.onmessage=d=>{let l=d.data;u=u.then(()=>b(l)).catch(()=>a({id:l.id,kind:"error",code:"OCR_INFERENCE_FAILED"}))}}typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&et(self);export{qn as defaultDeps,et as installOcrWorkerHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as a,v as b,w as c,x as d,y as e}from"./chunk-XDB7L5KS.js";import"./chunk-MQHTFHSN.js";import"./chunk-5AR5GTEJ.js";import"./chunk-QTOMWAS6.js";import"./chunk-7QZWBDI5.js";import"./chunk-PBWIMNSN.js";import"./chunk-SX7TUC3V.js";import"./chunk-W357WDNU.js";import"./chunk-POIQGEZM.js";import"./chunk-CPUECYAJ.js";import"./chunk-FPXL63KZ.js";import"./chunk-U5TL63CG.js";import"./chunk-TSA6GHUG.js";import"./chunk-COZXZAD5.js";import"./chunk-FSSMUAKC.js";import"./chunk-WNBEOK5Q.js";export{b as BARCODE_BUDGET_MS,a as SAME_FACE_MAX_DROPS,d as createDocumentCapture,e as createDocumentCaptureInternal,c as warmDocumentCapture};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as Detector } from './detect-worker-CHqsPJoM.js';
|
|
2
|
-
import { A as AcceptedDocumentType,
|
|
3
|
-
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, q as DeviceClass, b as CaptureArtifacts, ad as EngineErrorDetail, W as V3GateQuality, _ as V3TelemetryEvent } from './capture-session-v3-
|
|
4
|
-
import { f as IcaoGateSummary, g as IcaoGateUpdate, H as HostedClient, P as Point, p as IcaoGateScores, h as Box, m as IcaoFrameObservation, n as IcaoGate } from './icao-gate-
|
|
2
|
+
import { A as AcceptedDocumentType, as as NationalEidOption, b9 as StepSection, bl as HostedBranding, aG as PlanSectionView, aD as PlanChoiceKind, ab as HostedSimulationView, m as ContactChannel, g as CheckReason, bp as RetakeHint, aA as PhotoSource, aB as PhotoSourcePick, aj as IdentityMethod, E as EidAfterPass, Y as HostedFormView, ak as IdentitySummarySource, Z as HostedIcaoPolicy, a0 as HostedNativeAppView, aw as PhoneCountryRule, ah as IcaoReportEntry, bo as IcaoCaptureTuning, a7 as HostedPortraitPendingFix, c as CaptureMode, a6 as HostedPoaRuleView, aM as PoaNameMatchMode, b3 as SessionReason, b1 as SessionDecidingStep, aa as HostedSessionView, ac as HostedStepView, aH as PlanStepView, a_ as ResolvedCaptureMode, J as FormIssueCode, bt as ScreenRampReport, bk as CaptureProvenance, I as FormInput, br as ScreenRampPaint, b2 as SessionFailureReason, bg as AgeEstimationReason, be as VerificationLevel, bd as VerificationAssurance, b0 as SandboxSimulation, ar as MethodChoiceView, bh as CameraUnavailableCause, bj as CaptureIssueReport, af as HostedVoiceView, bq as ScreenRampChallenge, b as AttestationInput, i as CheckType, by as PersonMask, aU as PortraitIcaoInput, Q as HostedChallengeView } from './types-Cy_SJtPf.js';
|
|
3
|
+
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, q as DeviceClass, b as CaptureArtifacts, ad as EngineErrorDetail, W as V3GateQuality, _ as V3TelemetryEvent } from './capture-session-v3-Z2KI_2p9.js';
|
|
4
|
+
import { f as IcaoGateSummary, g as IcaoGateUpdate, H as HostedClient, P as Point, p as IcaoGateScores, h as Box, m as IcaoFrameObservation, n as IcaoGate } from './icao-gate-QqtNED0V.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Why a challenge produced no token (spec §4.5). `clock_wrong` (2026-11-15): the check refused the device's clock
|
|
@@ -2022,7 +2022,7 @@ interface UploadFileInternals {
|
|
|
2022
2022
|
* live-camera capture proof methods are optional (a fake / an older bridge
|
|
2023
2023
|
* without them presigns without a proof).
|
|
2024
2024
|
*/
|
|
2025
|
-
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">> & Partial<Pick<HostedClient, "reportCameraUnavailable">> & Partial<Pick<HostedClient, "reportCaptureIssue">> & Partial<Pick<HostedClient, "testerGate">>;
|
|
2025
|
+
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture" | "armRamp">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">> & Partial<Pick<HostedClient, "reportCameraUnavailable">> & Partial<Pick<HostedClient, "reportCaptureIssue">> & Partial<Pick<HostedClient, "testerGate">>;
|
|
2026
2026
|
/** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
|
|
2027
2027
|
declare const CLIP_MIME_ALLOWLIST: readonly string[];
|
|
2028
2028
|
/** Same-key transport replays AFTER the first try, and the pause between them. */
|
|
@@ -3520,6 +3520,7 @@ interface DocumentCaptureInternals {
|
|
|
3520
3520
|
side?: ScanSide;
|
|
3521
3521
|
assetBaseUrl?: string;
|
|
3522
3522
|
seen?: (still: Blob) => Promise<boolean>;
|
|
3523
|
+
budgetMs?: number;
|
|
3523
3524
|
};
|
|
3524
3525
|
/**
|
|
3525
3526
|
* Photo sharpness for the blur gate (default: blur-gate.ts on the card region
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as Detector } from './detect-worker-CHqsPJoM.cjs';
|
|
2
|
-
import { A as AcceptedDocumentType,
|
|
3
|
-
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, q as DeviceClass, b as CaptureArtifacts, ad as EngineErrorDetail, W as V3GateQuality, _ as V3TelemetryEvent } from './capture-session-v3-
|
|
4
|
-
import { f as IcaoGateSummary, g as IcaoGateUpdate, H as HostedClient, P as Point, p as IcaoGateScores, h as Box, m as IcaoFrameObservation, n as IcaoGate } from './icao-gate-
|
|
2
|
+
import { A as AcceptedDocumentType, as as NationalEidOption, b9 as StepSection, bl as HostedBranding, aG as PlanSectionView, aD as PlanChoiceKind, ab as HostedSimulationView, m as ContactChannel, g as CheckReason, bp as RetakeHint, aA as PhotoSource, aB as PhotoSourcePick, aj as IdentityMethod, E as EidAfterPass, Y as HostedFormView, ak as IdentitySummarySource, Z as HostedIcaoPolicy, a0 as HostedNativeAppView, aw as PhoneCountryRule, ah as IcaoReportEntry, bo as IcaoCaptureTuning, a7 as HostedPortraitPendingFix, c as CaptureMode, a6 as HostedPoaRuleView, aM as PoaNameMatchMode, b3 as SessionReason, b1 as SessionDecidingStep, aa as HostedSessionView, ac as HostedStepView, aH as PlanStepView, a_ as ResolvedCaptureMode, J as FormIssueCode, bt as ScreenRampReport, bk as CaptureProvenance, I as FormInput, br as ScreenRampPaint, b2 as SessionFailureReason, bg as AgeEstimationReason, be as VerificationLevel, bd as VerificationAssurance, b0 as SandboxSimulation, ar as MethodChoiceView, bh as CameraUnavailableCause, bj as CaptureIssueReport, af as HostedVoiceView, bq as ScreenRampChallenge, b as AttestationInput, i as CheckType, by as PersonMask, aU as PortraitIcaoInput, Q as HostedChallengeView } from './types-Cy_SJtPf.cjs';
|
|
3
|
+
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, q as DeviceClass, b as CaptureArtifacts, ad as EngineErrorDetail, W as V3GateQuality, _ as V3TelemetryEvent } from './capture-session-v3-Dz-AQW52.cjs';
|
|
4
|
+
import { f as IcaoGateSummary, g as IcaoGateUpdate, H as HostedClient, P as Point, p as IcaoGateScores, h as Box, m as IcaoFrameObservation, n as IcaoGate } from './icao-gate-Dyb0wGO3.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Why a challenge produced no token (spec §4.5). `clock_wrong` (2026-11-15): the check refused the device's clock
|
|
@@ -2022,7 +2022,7 @@ interface UploadFileInternals {
|
|
|
2022
2022
|
* live-camera capture proof methods are optional (a fake / an older bridge
|
|
2023
2023
|
* without them presigns without a proof).
|
|
2024
2024
|
*/
|
|
2025
|
-
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">> & Partial<Pick<HostedClient, "reportCameraUnavailable">> & Partial<Pick<HostedClient, "reportCaptureIssue">> & Partial<Pick<HostedClient, "testerGate">>;
|
|
2025
|
+
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture" | "armRamp">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">> & Partial<Pick<HostedClient, "reportCameraUnavailable">> & Partial<Pick<HostedClient, "reportCaptureIssue">> & Partial<Pick<HostedClient, "testerGate">>;
|
|
2026
2026
|
/** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
|
|
2027
2027
|
declare const CLIP_MIME_ALLOWLIST: readonly string[];
|
|
2028
2028
|
/** Same-key transport replays AFTER the first try, and the pause between them. */
|
|
@@ -3520,6 +3520,7 @@ interface DocumentCaptureInternals {
|
|
|
3520
3520
|
side?: ScanSide;
|
|
3521
3521
|
assetBaseUrl?: string;
|
|
3522
3522
|
seen?: (still: Blob) => Promise<boolean>;
|
|
3523
|
+
budgetMs?: number;
|
|
3523
3524
|
};
|
|
3524
3525
|
/**
|
|
3525
3526
|
* Photo sharpness for the blur gate (default: blur-gate.ts on the card region
|