@sekyro/elements 0.1.0-rc.18 → 0.1.0-rc.19
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 +8 -0
- package/dist/cdn/chunks/{capture-session-doc-J4MIDQOS-DYA3TI2D.js → capture-session-doc-DFLSX6BB-3ULMTYJH.js} +1 -1
- package/dist/cdn/chunks/{chunk-QWBHA4YX.js → chunk-3PBU4237.js} +2 -2
- package/dist/cdn/chunks/{chunk-CH3JN7FV.js → chunk-4VHWJD57.js} +1 -1
- package/dist/cdn/chunks/{chunk-4QPD5ZMB.js → chunk-6H2SLOEK.js} +1 -1
- package/dist/cdn/chunks/{chunk-NPEJKEWK.js → chunk-AC45ZP53.js} +1 -1
- package/dist/cdn/chunks/{chunk-WVDCPIC3.js → chunk-CGOCWIXM.js} +1 -1
- package/dist/cdn/chunks/chunk-D7YINY2U.js +3 -0
- package/dist/cdn/chunks/{chunk-ZF7TAXXU.js → chunk-EPMGZQHF.js} +1 -1
- package/dist/cdn/chunks/{chunk-ECAWI75T.js → chunk-EXMVZUHU.js} +1 -1
- package/dist/cdn/chunks/{chunk-TODKCK6A.js → chunk-HXD7VO3F.js} +1 -1
- package/dist/cdn/chunks/{chunk-Y6VKSYVY.js → chunk-IXRKOBFA.js} +1 -1
- package/dist/cdn/chunks/{chunk-KOTLQOUY.js → chunk-JR4AQLJ2.js} +1 -1
- package/dist/cdn/chunks/{chunk-C5LJ5ZHE.js → chunk-K2JDLIFO.js} +1 -1
- package/dist/cdn/chunks/{chunk-EHIN4Z6H.js → chunk-L66SWMJ5.js} +1 -1
- package/dist/cdn/chunks/{chunk-YZE7YZVV.js → chunk-LUO3AZFS.js} +1 -1
- package/dist/cdn/chunks/{chunk-3XCA56FW.js → chunk-PAU2BFT7.js} +1 -1
- package/dist/cdn/chunks/{chunk-VYFRJNC5.js → chunk-PLWGAXYM.js} +1 -1
- package/dist/cdn/chunks/{chunk-UE6IZTZA.js → chunk-RTCZJKYC.js} +1 -1
- package/dist/cdn/chunks/{chunk-WZFFQZE2.js → chunk-WANVL25H.js} +1 -1
- package/dist/cdn/chunks/{chunk-SYZUFSPK.js → chunk-WCEIXBIS.js} +1 -1
- package/dist/cdn/chunks/{chunk-MK5WGJZO.js → chunk-YULJCSQ3.js} +1 -1
- package/dist/cdn/chunks/{chunk-62FWEZDF.js → chunk-ZWP6MDIC.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-SMEKDBGF-DISVYLXM.js → create-document-capture-4ZOSBL3Y-KLZDMWOQ.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-TV2VKLPV-6ZFRPTO3.js → document-capture-view-25EASYV7-EUEYS55L.js} +1 -1
- package/dist/cdn/chunks/{eid-view-VC3DHQWV-IBAI3YPF.js → eid-view-6DXZ5ELB-ZX35JGDS.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-QCELBL7U-XSYVFDW7.js → email-otp-view-3UJPJOQ6-MIOPWSME.js} +1 -1
- package/dist/cdn/chunks/flow-views-ZVDXJZWH-C5ZVKCB6.js +1 -0
- package/dist/cdn/chunks/{form-view-P2GVOYAC-ZWBQXCK3.js → form-view-4NKEHYNF-I25LMP47.js} +1 -1
- package/dist/cdn/chunks/{overlay-de-EMTSLK3M-LA7EI7SW.js → overlay-de-64ABPD3N-KIBBQI36.js} +1 -1
- package/dist/cdn/chunks/{overlay-es-6WMAHH33-66DPI2L6.js → overlay-es-VIMXYK2Q-KTLONTNF.js} +1 -1
- package/dist/cdn/chunks/{overlay-pt-WBGMJQTQ-IOBB3HFB.js → overlay-pt-3IBDZBAW-DQTJHDLG.js} +1 -1
- package/dist/cdn/chunks/{plan-runner-ZVYJ3UI3-PDRZPFOE.js → plan-runner-3BLEJWHF-3K3RBXJU.js} +1 -1
- package/dist/cdn/chunks/{portrait-capture-view-QYEEV2D6-XMKA6YZR.js → portrait-capture-view-QDUJ36UH-GRTZTYTJ.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-E3SBOU4F-QVDIDUCS.js → portrait-review-view-LW5DBF3L-K7WAOPAG.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-NIAKWB6B-43ZQX5T6.js → proof-of-address-view-E6WJTTIV-7ISFWEEZ.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-SBLFJ2MR.js → chunk-57MVUXQ6.js} +1 -1
- package/dist/{chunk-46JFMIK7.js → chunk-5QJOJLKJ.js} +1 -1
- package/dist/{chunk-JKDI3DQD.js → chunk-6FAODASF.js} +1 -1
- package/dist/{chunk-IBMR3ZXU.js → chunk-7XJHQ3NM.js} +1 -1
- package/dist/{chunk-77AEILD6.js → chunk-BRS7YLGB.js} +1 -1
- package/dist/{chunk-ELSYMAAW.js → chunk-CY66YE6F.js} +1 -1
- package/dist/{chunk-FKGVTX2Y.js → chunk-KYDIB6KR.js} +1 -1
- package/dist/{chunk-C3WB5BAA.js → chunk-M7HNWDQD.js} +1 -1
- package/dist/{chunk-5S5OC2EE.js → chunk-PKK72TVJ.js} +1 -1
- package/dist/{chunk-N5JOXWJJ.js → chunk-QNK7OBIW.js} +1 -1
- package/dist/{chunk-BMRETLHG.js → chunk-RPA5QQVH.js} +2 -2
- package/dist/{chunk-ENXYUW3S.js → chunk-SVGBNMXK.js} +1 -1
- package/dist/{chunk-VFLMBXU5.js → chunk-VBJ4CJHE.js} +1 -1
- package/dist/{chunk-X2RZOTUB.js → chunk-XQPY6G2B.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-TV2VKLPV-7EOLXSFW.js → document-capture-view-25EASYV7-MOFQVGV6.js} +1 -1
- package/dist/{eid-view-VC3DHQWV-IB3JCWRI.js → eid-view-6DXZ5ELB-XDQVFDXS.js} +1 -1
- package/dist/{email-otp-view-QCELBL7U-K6OU6CWG.js → email-otp-view-3UJPJOQ6-5PQM7LNW.js} +1 -1
- package/dist/flow-views-ZVDXJZWH-LOGNCRIA.js +1 -0
- package/dist/{form-view-P2GVOYAC-R5HGNTAJ.js → form-view-4NKEHYNF-VFMN6QFW.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/{overlay-de-EMTSLK3M-KNNEJ2DR.js → overlay-de-64ABPD3N-ARJE63WR.js} +1 -1
- package/dist/{overlay-es-6WMAHH33-YZN2JC7A.js → overlay-es-VIMXYK2Q-JRHIX3OT.js} +1 -1
- package/dist/{overlay-pt-WBGMJQTQ-Y6AG6QUZ.js → overlay-pt-3IBDZBAW-JXQE6BVY.js} +1 -1
- package/dist/{portrait-capture-view-QYEEV2D6-OD3VHIKE.js → portrait-capture-view-QDUJ36UH-QZR4O3YW.js} +1 -1
- package/dist/{portrait-review-view-E3SBOU4F-DJAWJV6V.js → portrait-review-view-LW5DBF3L-QVERJXKH.js} +1 -1
- package/dist/{proof-of-address-view-NIAKWB6B-4ZP6SD46.js → proof-of-address-view-E6WJTTIV-4SHZIQ3O.js} +1 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-PP4PZVFR.js +0 -3
- package/dist/cdn/chunks/flow-views-VCE6CEBN-Y6VVTJPN.js +0 -1
- package/dist/flow-views-VCE6CEBN-EYXMVPZI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ae,b as Le,c as ne,d as Pe,e as Re,f as ze,h as De}from"./chunk-2TFK736S.js";import{a as le,d as Ee,e as qe}from"./chunk-F4Q2Q4OC.js";import{f as Z}from"./chunk-WZFFQZE2.js";import{e as Te,k as Ce}from"./chunk-6MYG4HWP.js";import{g as oe}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";function We(e,t){let r=new Set(e.flatMap(i=>i.sides.filter(l=>l[t]!==null).map(l=>l.side)));return r.size===1?[...r][0]:null}o(We,"Fe");function $e(e){let t=Ee.find(i=>i.docType===e),r=t.mrz==="none"?null:t.mrz==="td3"?"single":"verso";return{sides:t.sides,format:qe(e),mrz:t.mrz==="none"?"none":"required",mrzSide:r,barcodeSide:null,portraitSide:t.portraitSide,scripts:null}}o($e,"pt");function et(e){let t=[];for(let r of e)for(let i of r.sides){if(!Array.isArray(i.scripts))return null;for(let l of i.scripts)t.includes(l)||t.push(l)}return t}o(et,"ft");function tt(e,t){if(t.length===0)return $e(e);let r=t.some(d=>d.sides.length>1),i=new Set(t.map(d=>d.format)),l=i.size===1?[...i][0]:"card",u=t.filter(d=>d.sides.some(p=>p.mrz!==null)).length,s=t.find(d=>d.sides.length>1===r)?.sides.find(d=>d.portrait)?.side;return{sides:r?["recto","verso"]:["single"],format:l,mrz:u===t.length?"required":u===0?"none":"optional",mrzSide:We(t,"mrz"),barcodeSide:We(t,"barcode"),portraitSide:s??(r?"recto":"single"),scripts:et(t)}}o(tt,"We");function rt(e,t){if(e===void 0)return[];let r=e.toUpperCase();return Object.prototype.hasOwnProperty.call(le,r)?le[r]?.[t]??[]:[]}o(rt,"ze");async function at(e,t,r){return await e(t)?r:r==="recto"?"verso":"recto"}o(at,"Ue");function it(e,t,r){return e!==t&&t==="verso"&&r.recto!==void 0&&r.verso===void 0?"verso":e}o(it,"Ne");var ot={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function nt(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,s=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,d=t!=null&&t<=2,p=r==="4g"||l!=null&&l>=5,c=t!=null&&t>=6,M;s||d?M="low":p&&c?M="good":M="mid";let f=ot[M],P=u&&u>0?Math.min(f.maxLongEdge,u):f.maxLongEdge;return{tier:M,...f,maxLongEdge:P}}o(nt,"ht");function lt(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),nt(t)}o(lt,"Ge");function st(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}o(st,"bt");function dt(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}o(dt,"St");async function ut(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}o(ut,"yt");async function ct(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=dt(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let p=d.getContext("2d");if(!p)return null;p.drawImage(e,0,0,u,s);let c=o(x=>new Promise((y,h)=>{d.toBlob(g=>g?y(g):h(new Error("canvas toBlob returned null")),"image/jpeg",x)}),"c"),M=st(l,i.qMin,i.qMax),{blob:f,quality:P}=await ut(c,{startQ:M,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(f.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:f,quality:P,width:u,height:s}}o(ct,"qe");async function mt(e){let t=lt(Math.max(e.width,e.height)),r=await ct(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}o(mt,"ie");function je(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}o(je,"ue");var Ne=o(e=>e==="recto"?"verso":"recto","Xe"),Ve=o(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Ye"),me=o(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"le");function se(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}o(se,"se");function pt(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let s=e.flipTimeoutSpent&&!(l&&!e.flipped),d=e.notice==="same_face"&&l&&!e.flipped?void 0:e.notice,p={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,notice:d,lastArea:t.areaFrac};if(!Ve(e))return p;if(e.needFlip&&!l){if(!t.ready)return{...p,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...p,goodSince:void 0,phase:e.restPhase};let M=e.goodSince??r;return r-M>=1800?{...p,goodSince:M,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...p,goodSince:M,phase:e.restPhase}}return t.ready?{...p,phase:"capturing",goodSince:e.goodSince??r}:{...p,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}o(pt,"Mt");function ht(e,t){if(!Ve(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}o(ht,"Dt");function ft(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],s={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||me({captured:l,pending:u})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}o(ft,"wt");function He(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Ne(r),needFlip:!0,flipTimeoutSpent:!1,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}o(He,"Ve");function gt(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return He(e,t,r);let i=e.pending.filter(p=>p!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(me(l)!==1||e.layout==="singlePage")return l;let u=Ne(r),s=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",d=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:s,current:u,phase:d?s:e.phase}}o(gt,"kt");function vt(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(c=>c!==r),u=e.layout==="twoSided"&&me({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,p=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(c=>c!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:p,restPhase:p,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}o(vt,"Ct");function yt(e,t){switch(t.type){case"report":return pt(se(e,t.at),t.report,t.at);case"tick":return ht(se(e,t.at),t.at);case"captured":return ft(se(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return gt(e,t.id,t.side);case"duplicate":return He(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return vt(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...je(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}o(yt,"Qe");function wt(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}o(wt,"xt");async function Mt(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return wt(r,e,t)}o(Mt,"vt");async function Fe(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),s=document.createElement("canvas");s.width=t,s.height=u;try{let d=s.getContext("2d");return d===null?"recto":(d.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await Mt(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}o(Fe,"ce");var de=o((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"de"),$=o(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Z");async function bt(e,t,r,i){let l=i.decode??(p=>createImageBitmap(p)),u=o(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"l"),s;try{s=await u()}catch{try{await new Promise(p=>setTimeout(p,i.retryMs??300)),s=await u()}catch{return null}}let d=s.mrzBox;return d===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:de(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[$(d[0]),$(d[1]),$(Math.min(d[2],1-d[0])),$(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:de(r.framesToValid,1,1e3),msToValid:de(r.msToValid,0,12e4)}}o(bt,"Ke");var kt=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),St=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function xt(e=globalThis){let t=e.WebAssembly?.validate;if(typeof t!="function")return{ok:!1,reason:"simd"};try{if(!t.call(e.WebAssembly,kt)||!t.call(e.WebAssembly,St))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}return typeof e.Worker!="function"?{ok:!1,reason:"worker"}:typeof e.createImageBitmap!="function"?{ok:!1,reason:"bitmap"}:{ok:!0}}o(xt,"je");function Tt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}o(Tt,"$e");var H,W=(H=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},o(H,"E"),H);function Ie(){let e=o(t=>(t.close(),Promise.reject(new W("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:o(()=>{},"dispose")}}o(Ie,"Je");function Ct(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Ie()}catch{return Ie()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",h=>{let g=h.data,w=r.get(g.id);w&&(r.delete(g.id),w.resolve(g))});let d=o(()=>{for(let h of r.values())h.reject(new W("error"));r.clear(),c()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function p(h,g=[]){if(l)return Promise.reject(new W("disposed"));let w=++i;return new Promise((E,U)=>{r.set(w,{resolve:E,reject:U});try{t.postMessage({...h,id:w},g)}catch{r.delete(w),U(new W("error"))}})}o(p,"m");function c(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let h of r.values())h.reject(new W("disposed"));r.clear()}}o(c,"c");let M=(async()=>{let h=await p({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(h.kind==="failed")return h.reason;if(h.kind!=="ready")return"error";let g=await p({kind:"warmup"});if(g.kind!=="ready")return"error";let w=g.benchMs??g.warmupMs,E=e.deviceMemoryGb===void 0?Le():e.deviceMemoryGb;return{warmupMs:g.warmupMs,downloadMs:h.downloadMs,cached:h.cached,benchMs:w,tier:Ae(w,E)}})().catch(()=>"error"),f,P=new Promise(h=>{f=setTimeout(()=>h("timeout"),e.tuning.loadTimeoutMs)}),x=Promise.race([M,P]).then(h=>(clearTimeout(f),typeof h=="string"?c():s=!0,l&&typeof h!="string"?"error":h));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",c,{once:!0});async function y(h,g,w){if(l)throw g.close(),new W("disposed");if(!s)throw g.close(),new W("not_ready");if(u)throw g.close(),new W("busy");u=!0;let E;try{let U=new Promise((_,B)=>{E=setTimeout(()=>{B(new W("timeout")),c()},e.tuning.readTimeoutMs??1e4)}),F=await Promise.race([p(h,[g]),U]);if(F.kind===w){let{id:_,...B}=F;return B}throw new W(F.kind==="error"?F.code:F.kind==="failed"?F.reason:"error")}finally{clearTimeout(E),u=!1}}return o(y,"v"),{ready:x,get busy(){return u},bandRead:o((h,g=e.tuning.detectorLimit)=>y({kind:"band",bitmap:h,detectorLimit:g},h,"band"),"bandRead"),stillRead:o((h,g,w=e.tuning.detectorLimit)=>y({kind:"still",bitmap:h,region:g,detectorLimit:w},h,"band"),"stillRead"),layoutRead:o((h,g)=>y({kind:"layout",bitmap:h,detectorLimit:g},h,"layout"),"layoutRead"),dispose:c}}o(Ct,"Ze");var ee="sekyro-ocr-1",ue=o(e=>e!==null&&typeof e=="object"?e:{},"me"),D=o((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"O"),Be=o((e,t)=>typeof e=="boolean"?e:t,"et"),Oe=o(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"tt");function At(e,t={}){let r=ue(e),i=ue(r.liveMrz),l=ue(r.frontLock),u=Oe(t.engine??ee),s=t.mode==="off",d=o(g=>g.enabled===!0?g.arm==="live"?"live":"control":null,"u"),p=d(i),c=d(l),M=o((g,w)=>!s&&w==="live"&&Oe(g.minEngine??ee)<=u,"b"),f=ze,P=M(i,p)?{detectorLimit:D(i.detectorLimit,320,1600,f.detectorLimit),bandMaxWidthPx:D(i.bandMaxWidthPx,320,4096,f.bandMaxWidthPx),minBandWidthPx:D(i.minBandWidthPx,0,4096,f.minBandWidthPx),bandTop:D(i.bandTop,0,.95,f.bandTop),minIntervalMs:D(i.minIntervalMs,0,5e3,f.minIntervalMs),stableReads:Math.round(D(i.stableReads,1,10,f.stableReads)),profileReads:Math.round(D(i.profileReads,1,100,f.profileReads)),maxReadMs:D(i.maxReadMs,50,6e4,f.maxReadMs),searchTimeoutMs:D(i.searchTimeoutMs,1e3,12e4,f.searchTimeoutMs),hint:Be(i.hint,!0),stillConfirm:Be(i.stillConfirm,!0)}:null,x=Re,y=o((g,w,E)=>D(l[g],w,E,x[g]),"S"),h=M(l,c)?{minLines:Math.round(y("minLines",1,50)),fillMin:y("fillMin",0,1),fillMax:y("fillMax",0,2),offsetMax:y("offsetMax",0,1),steadyFillDelta:y("steadyFillDelta",0,1),steadyOffsetDelta:y("steadyOffsetDelta",0,1),layoutShiftMax:y("layoutShiftMax",0,1),lineCountDelta:Math.round(y("lineCountDelta",0,50)),lockMs:y("lockMs",0,3e4),steadyMs:y("steadyMs",0,3e4),minFrames:Math.round(y("minFrames",1,100)),minIntervalMs:y("minIntervalMs",0,5e3),maxWidthPx:y("maxWidthPx",160,2048),detectorLimit:y("detectorLimit",320,1600),searchTimeoutMs:y("searchTimeoutMs",1e3,12e4)}:null;return{enabled:P!==null||h!==null,liveMrz:P,textLock:h,liveMrzArm:p,frontLockArm:c,load:{detectorLimit:P?.detectorLimit??h?.detectorLimit??f.detectorLimit,loadTimeoutMs:D(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:D(i.maxDownloadMs,1e3,12e4,2e4)},reportSampleRate:D(i.reportSampleRate,0,1,1)}}o(At,"nt");function Lt(e,t){return e.enabled?!(t.probe??xt)().ok||(t.slow??Tt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ct({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{},...t.deviceMemoryGb!==void 0?{deviceMemoryGb:t.deviceMemoryGb}:{}})}:{ok:!1,reason:"off"}}o(Lt,"rt");function Pt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}o(Pt,"Tt");var O=o(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"W"),ce=o((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"pe");function Rt(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??ee,arm:e.arm,capture:e.capture,outcome:l,reads:ce(t?.reads??0,0,1e4)??0,browser:e.browser??Pt()},s=o((d,p)=>{p!==void 0&&(u[d]=p)},"s");return s("format",t?.format),s("framesToValid",ce(t?.framesToValid,1,1e4)),s("msToValid",O(t?.msToValid)),s("framesToLock",ce(t?.framesToLock,1,1e4)),s("msToLock",O(t?.msToLock)),s("msToCapture",O(e.msToCapture)),s("readP50Ms",O(t?.readP50Ms)),s("readP90Ms",O(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",O(r.warmupMs)),s("downloadMs",O(r.downloadMs)),s("cached",r.cached),s("tier",r.tier),s("benchMs",O(r.benchMs))),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}o(Rt,"ot");function Ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}o(Ue,"fe");var zt=2,Dt=1500;async function Et(e){let t=await import("./capture-session-doc-J4MIDQOS-DYA3TI2D.js");return new t.CaptureSessionDoc(e)}o(Et,"Ot");function qt(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}o(qt,"Et");function Wt(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let s=i[u],d=i[(u+1)%i.length];l+=s.x*d.y-d.x*s.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}o(Wt,"At");function Vt(){import("./capture-session-doc-J4MIDQOS-DYA3TI2D.js").then(e=>e.warmDocDetector()).catch(()=>{})}o(Vt,"kn");function Ht(e){return Ft(e,{}).handle}o(Ht,"Cn");function Ft(e,t){let r=Te(),i=Ce({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=tt(e.documentType,t.catalogCapture===!0?t.captureSeries??rt(e.issuer,e.documentType):[]),p=d.sides.length===1||e.side==="single",c=je(p?"singlePage":"twoSided",s());if(!p&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let M="idle",f=null,P=null,x=!0,y=0,h=0,g=null,w=!1,E=!1,U="",F=null,_,B=null,pe=[],he=d.mrz==="none",_e=d.barcodeSide==="recto"||d.barcodeSide==="verso"?d.barcodeSide:null,N=he&&!p?t.barcode?.side??_e:null,fe=e.barcodeAssetBaseUrl??t.barcode?.assetBaseUrl,te=null,ge=o(()=>N===null||fe===void 0||t.barcode?.seen!==void 0?Promise.resolve(null):(te??(te=import("./barcode-detect-C5IOXMKI-ZOZ2WOWU.js").then(a=>a.loadBarcodeDetect(fe)).catch(()=>null)),te),"Se"),Ge=o((a,n)=>{if(N===null)return Promise.resolve(null);let m,v=new Promise(k=>{m=setTimeout(()=>k(null),t.barcode?.budgetMs??Dt)});return Promise.race([Ye(a,n,N),v]).finally(()=>clearTimeout(m))},"it"),Ye=o(async(a,n,m)=>{let v=m==="recto"?"verso":"recto";try{let k=t.barcode?.seen;if(k!==void 0)return await k(a)?m:v;let[z,C]=await Promise.all([ge(),n()]);if(z===null||C===null)return null;let b=Math.min(1600,C.width),S=document.createElement("canvas");S.width=b,S.height=Math.max(1,Math.round(C.height/C.width*b));try{let q=S.getContext("2d");return q===null?null:(q.drawImage(C,0,0,S.width,S.height),await at(z,q.getImageData(0,0,S.width,S.height),m))}finally{S.width=0,S.height=0}}catch{return null}},"st"),T=t.webOcr!==void 0&&!he?At(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,G=null,I=T===null||!T.enabled?"off":null,J=null,Q=null,ve=new WeakMap,re="";if(T!==null&&T.enabled&&t.webOcr!==void 0){let a=t.webOcr,n=Lt(T,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(n.ok){G=n.engine;let m=new De({textLock:T.textLock,liveMrz:T.liveMrz});J=m;let v=n.engine;v.ready.then(k=>{I=k,typeof k!="string"&&x&&m.setEngine(v,k.tier)})}else I=n.reason}let V=o(a=>{let n=JSON.stringify(a);n!==re&&(re=n,r.emit("mrz",a))},"H"),ye=o((a,n)=>{let m=t.webOcr?.reports;if(m===void 0||T===null||a===void 0)return;let v=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",k=v!=="recto"?T.liveMrzArm??T.frontLockArm:T.frontLockArm;if(k===null||Math.random()>=T.reportSampleRate)return;let z=a.via==="live_mrz"?Q:null,C=o(()=>{let b=z?.value??null;m([Rt({arm:k,capture:v,assist:a.ocr??null,load:k==="control"?"off":I,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...b!==null&&b.stillConfirmed!==void 0?{stillConfirmed:b.stillConfirmed}:{},...n!==void 0?{typeMismatch:Ue(n.format,d.format==="ID-3"?"passport":"card")}:{}})])},"x");z!==null&&z.value===null?Promise.race([z.promise,new Promise(b=>setTimeout(b,3e3))]).then(C):C()},"Me"),j=o(a=>{!x||a===M||(M=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"U"),Je=o((a,n)=>n===void 0?null:p?"single":a.captured.recto===n?"recto":a.captured.verso===n?"verso":null,"ut"),Qe=o(a=>({phase:a.phase,captured:p?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(n=>a.captured[n]!==void 0),expected:p?null:a.current??null,notice:a.notice??null,lastShot:Je(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:E}),"lt"),we=o(()=>{let a=f;a!==null&&a.captureNow().catch(()=>A({type:"captureFailed",at:s()}))},"De");function A(a){if(!x)return;let n=c;c=yt(c,a),c.phase==="capturing"&&n.phase!=="capturing"&&Promise.resolve().then(we),c.phase==="result"&&n.phase!=="result"&&(j("done"),Me());let m=Qe(c),v=JSON.stringify(m);v!==U&&(U=v,r.emit("scan",m))}o(A,"R");function Me(){B!==null&&clearInterval(B),B=null;for(let a of pe.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}o(Me,"we");let be=o(()=>f?.captureReport?.(),"ke"),ae=!1,ke=o((a,n)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,n)}catch{}},"Ce"),X=o(a=>{re="",!(f===null||c.phase==="reading"||c.phase==="result")&&(ae=!1,g=p?"single":c.current??a,f.rearm(g))},"j"),Xe=o(async(a,n,m,v)=>{Q=null;let k=I!==null&&typeof I=="object"&&I.tier==="low";if(v!==void 0&&G!==null&&T?.liveMrz?.hint===!0&&!k){let q={promise:bt(G,a,v,{engine:ee,detectorLimit:T.liveMrz.detectorLimit}).catch(()=>null),value:null};q.promise.then(L=>{q.value=L}),Q=q}v!==void 0&&Ue(v.format,d.format==="ID-3"?"passport":"card")&&V({state:"mismatch",format:v.format});let z=be();ke(z,"captured"),ae=!0,ye(z,v);let C=m===void 0?F:m===null?null:{quad:qt(m),frameWidth:0,frameHeight:0,inStill:!0},b={decoded:null},S=o(()=>(b.decoded??(b.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),b.decoded),"w");try{await Ke(a,n,C,S,Q,v)}finally{b.decoded!==null&&(await b.decoded)?.close()}},"ct"),Ke=o(async(a,n,m,v,k,z)=>{let C=`shot-${y+=1}`,b=c.current;if(A({type:"captured",id:C,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&u>0){let L=await(t.measureSharpness!==void 0?t.measureSharpness(a,m):v().then(R=>R===null?-1:Pe(R,ne(m?.quad??null,m?.inStill===!0?R:{width:m?.frameWidth??0,height:m?.frameHeight??0},R)))).catch(()=>-1);if(!x)return;if(Number.isFinite(L)&&L>=0&&L<u){w=!0;let R=p?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");A({type:"readFailed",side:R,id:C,issue:"blurry"}),X(R);return}}w=!1;let S;if(p)S="single";else{let L=z!==void 0&&z.format!=="TD3"&&(d.mrzSide==="recto"||d.mrzSide==="verso")?d.mrzSide:null,R=L===null&&t.classify===void 0?await Ge(a,v):null,Se=R===null||N===null?R:it(R,N,c.captured),Y=L??Se??(Se===null&&N!==null&&b!==void 0?b:null)??await(t.classify!==void 0?t.classify(a):v().then(K=>K===null?b??"recto":m?.inStill===!0?Fe(K,480,null,!0):Fe(K,480,ne(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},K)))).catch(()=>b??"recto");if(!x)return;if(c.captured[Y]!==void 0&&h<zt){h+=1,A({type:"duplicate",id:C,side:Y}),X(Y==="recto"?"verso":"recto");return}let xe=c.captured.recto===void 0?"recto":c.captured.verso===void 0?"verso":void 0;S=c.captured[Y]!==void 0&&xe!==void 0?xe:Y,h=0,A({type:"classified",id:C,side:S})}let q=S==="verso"?"verso":"recto";try{let L=t.encode!==void 0?await t.encode(a):await v().then(R=>{if(R===null)throw new Error("the still could not be decoded");return mt(R)});if(!x)return;k!==null&&ve.set(L.blob,k),r.emit("captured",{image:L.blob,side:S,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:L.width,height:L.height,previewDataUrl:n}),t.deferRead!==!0&&A({type:"readOk",side:q})}catch(L){A({type:"readFailed",side:q,id:C,issue:"technical"}),r.emit("error",Z("generic",!0,{phase:"keyframes",name:oe(L)}))}X(q==="recto"?"verso":"recto")},"dt"),Ze=o(a=>{pe.push(a.on("statechange",({state:n})=>{n==="preflight"||n==="acquiring"?j("starting"):n==="positioning"?j("scanning"):n==="captured"?j("captured"):n==="error"&&j("error")}),a.on("feedback",({key:n,reticle:m})=>r.emit("feedback",{key:n,reticle:m})),a.on("checks",n=>{r.emit("gate",{progress:n.p,quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight,...n.guide!==void 0?{guide:{detected:n.guide.detected,fill:n.guide.fill,offsetX:n.guide.offsetX??0,offsetY:n.guide.offsetY??0}}:{}});let m=n.ocr?.mrz;m!==void 0&&(m.state==="fallback"?V({state:"fallback",reason:m.reason}):m.state==="valid"?V({state:"valid",format:m.format}):m.state==="reading"?V({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):V({state:"searching"}));let v=n.quad===null?0:Wt(n.quad,n.frameWidth,n.frameHeight);F=n.quad===null?null:{quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight},A({type:"report",report:{present:n.quad!==null&&n.plausible||n.guide?.detected===!0,ready:n.ready===!0,locking:n.p>=.5,areaFrac:v},at:s()})}),a.on("error",({kind:n,retryable:m,detail:v})=>r.emit("error",Z(n,m,v))),a.on("artifacts",n=>{Xe(n.keyframe,n.previewDataUrl,n.docRegion,n.liveMrz)}))},"mt"),ie=o(()=>(P??(P=(async()=>{if(x){if(ge(),f===null){let a;try{a=await(t.createEngine??Et)({...t.engineOptions??{},..._!==void 0?{guide:_}:{},video:e.video,format:d.format,side:p?"single":e.side??"recto",autoCapture:!1,...J!==null?{ocr:J}:{}})}catch(m){j("error"),r.emit("error",Z("models",!0,{phase:"models",name:oe(m)}));return}if(!x){a.destroy();return}f=a,g=p?"single":e.side??"recto",Ze(a);let n=t.tickMs??500;n>0&&(B=setInterval(()=>A({type:"tick",at:s()}),n))}A({type:"clockRestart"}),T!==null&&T.liveMrzArm==="live"&&(I==="unsupported"||I==="off")&&V({state:"fallback",reason:I}),await f.start()}})().finally(()=>{P=null})),P),"ne");return{handle:{get state(){return M},on:o((a,n)=>r.on(a,n),"on"),start:ie,retry:o(()=>{if(f===null&&c.phase==="result"){A({type:"retake"}),h=0,w=!1,ie();return}if(f!==null&&M!=="error"){A({type:"retake"}),h=0,w=!1,g=p?"single":null,f.rearm(p?"single":void 0);return}ie()},"retry"),setSide:o(a=>{p||a==="single"||f!==null&&c.current===a&&g===a&&c.phase!=="reading"&&c.phase!=="result"||(c.current!==a&&(c={...c,current:a}),A({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f!==null&&(g=a,f.rearm(a)))},"setSide"),shutter:we,focusAt:o((a,n)=>{f?.focusAt?.(a,n)},"focusAt"),setGuide:o(a=>{_=a,f?.setGuide?.(a)},"setGuide"),setTorch:o(a=>{E=a,f?.setTorch(a),A({type:"tick",at:s()})},"setTorch"),destroy:o(()=>{if(x&&f!==null&&M!=="done"){let a=be();!ae&&a!==void 0&&a.ticks>0&&ke(a,"abandoned"),ye(a,void 0)}x=!1,Me(),J?.setEngine(null),G?.dispose(),G=null,r.clear()},"destroy")},plan:d,setFlowState:o(a=>{(c.phase==="reading"||c.phase==="result")&&j(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:o((a,n)=>{let m=a==="verso"?"verso":"recto";A(n.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:n.issue}),n.ok||X(m)},"settle"),takeDeviceRead:o(a=>ve.get(a.image)?.value??null,"takeDeviceRead")}}o(Ft,"Bt");export{zt as a,Dt as b,Vt as c,Ht as d,Ft as e};
|
|
1
|
+
import{a as Ae,b as Le,c as ne,d as Pe,e as Re,f as ze,h as De}from"./chunk-2TFK736S.js";import{a as le,d as Ee,e as qe}from"./chunk-F4Q2Q4OC.js";import{f as Z}from"./chunk-WANVL25H.js";import{e as Te,k as Ce}from"./chunk-6MYG4HWP.js";import{g as oe}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";function We(e,t){let r=new Set(e.flatMap(i=>i.sides.filter(l=>l[t]!==null).map(l=>l.side)));return r.size===1?[...r][0]:null}o(We,"Fe");function $e(e){let t=Ee.find(i=>i.docType===e),r=t.mrz==="none"?null:t.mrz==="td3"?"single":"verso";return{sides:t.sides,format:qe(e),mrz:t.mrz==="none"?"none":"required",mrzSide:r,barcodeSide:null,portraitSide:t.portraitSide,scripts:null}}o($e,"pt");function et(e){let t=[];for(let r of e)for(let i of r.sides){if(!Array.isArray(i.scripts))return null;for(let l of i.scripts)t.includes(l)||t.push(l)}return t}o(et,"ft");function tt(e,t){if(t.length===0)return $e(e);let r=t.some(d=>d.sides.length>1),i=new Set(t.map(d=>d.format)),l=i.size===1?[...i][0]:"card",u=t.filter(d=>d.sides.some(p=>p.mrz!==null)).length,s=t.find(d=>d.sides.length>1===r)?.sides.find(d=>d.portrait)?.side;return{sides:r?["recto","verso"]:["single"],format:l,mrz:u===t.length?"required":u===0?"none":"optional",mrzSide:We(t,"mrz"),barcodeSide:We(t,"barcode"),portraitSide:s??(r?"recto":"single"),scripts:et(t)}}o(tt,"We");function rt(e,t){if(e===void 0)return[];let r=e.toUpperCase();return Object.prototype.hasOwnProperty.call(le,r)?le[r]?.[t]??[]:[]}o(rt,"ze");async function at(e,t,r){return await e(t)?r:r==="recto"?"verso":"recto"}o(at,"Ue");function it(e,t,r){return e!==t&&t==="verso"&&r.recto!==void 0&&r.verso===void 0?"verso":e}o(it,"Ne");var ot={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function nt(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,s=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,d=t!=null&&t<=2,p=r==="4g"||l!=null&&l>=5,c=t!=null&&t>=6,M;s||d?M="low":p&&c?M="good":M="mid";let f=ot[M],P=u&&u>0?Math.min(f.maxLongEdge,u):f.maxLongEdge;return{tier:M,...f,maxLongEdge:P}}o(nt,"ht");function lt(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),nt(t)}o(lt,"Ge");function st(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}o(st,"bt");function dt(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}o(dt,"St");async function ut(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}o(ut,"yt");async function ct(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=dt(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let p=d.getContext("2d");if(!p)return null;p.drawImage(e,0,0,u,s);let c=o(x=>new Promise((y,h)=>{d.toBlob(g=>g?y(g):h(new Error("canvas toBlob returned null")),"image/jpeg",x)}),"c"),M=st(l,i.qMin,i.qMax),{blob:f,quality:P}=await ut(c,{startQ:M,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(f.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:f,quality:P,width:u,height:s}}o(ct,"qe");async function mt(e){let t=lt(Math.max(e.width,e.height)),r=await ct(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}o(mt,"ie");function je(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}o(je,"ue");var Ne=o(e=>e==="recto"?"verso":"recto","Xe"),Ve=o(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Ye"),me=o(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"le");function se(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}o(se,"se");function pt(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let s=e.flipTimeoutSpent&&!(l&&!e.flipped),d=e.notice==="same_face"&&l&&!e.flipped?void 0:e.notice,p={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,notice:d,lastArea:t.areaFrac};if(!Ve(e))return p;if(e.needFlip&&!l){if(!t.ready)return{...p,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...p,goodSince:void 0,phase:e.restPhase};let M=e.goodSince??r;return r-M>=1800?{...p,goodSince:M,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...p,goodSince:M,phase:e.restPhase}}return t.ready?{...p,phase:"capturing",goodSince:e.goodSince??r}:{...p,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}o(pt,"Mt");function ht(e,t){if(!Ve(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}o(ht,"Dt");function ft(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],s={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||me({captured:l,pending:u})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}o(ft,"wt");function He(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Ne(r),needFlip:!0,flipTimeoutSpent:!1,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}o(He,"Ve");function gt(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return He(e,t,r);let i=e.pending.filter(p=>p!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(me(l)!==1||e.layout==="singlePage")return l;let u=Ne(r),s=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",d=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:s,current:u,phase:d?s:e.phase}}o(gt,"kt");function vt(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(c=>c!==r),u=e.layout==="twoSided"&&me({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,p=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(c=>c!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:p,restPhase:p,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}o(vt,"Ct");function yt(e,t){switch(t.type){case"report":return pt(se(e,t.at),t.report,t.at);case"tick":return ht(se(e,t.at),t.at);case"captured":return ft(se(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return gt(e,t.id,t.side);case"duplicate":return He(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return vt(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...je(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}o(yt,"Qe");function wt(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}o(wt,"xt");async function Mt(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return wt(r,e,t)}o(Mt,"vt");async function Fe(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),s=document.createElement("canvas");s.width=t,s.height=u;try{let d=s.getContext("2d");return d===null?"recto":(d.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await Mt(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}o(Fe,"ce");var de=o((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"de"),$=o(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Z");async function bt(e,t,r,i){let l=i.decode??(p=>createImageBitmap(p)),u=o(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"l"),s;try{s=await u()}catch{try{await new Promise(p=>setTimeout(p,i.retryMs??300)),s=await u()}catch{return null}}let d=s.mrzBox;return d===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:de(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[$(d[0]),$(d[1]),$(Math.min(d[2],1-d[0])),$(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:de(r.framesToValid,1,1e3),msToValid:de(r.msToValid,0,12e4)}}o(bt,"Ke");var kt=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),St=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function xt(e=globalThis){let t=e.WebAssembly?.validate;if(typeof t!="function")return{ok:!1,reason:"simd"};try{if(!t.call(e.WebAssembly,kt)||!t.call(e.WebAssembly,St))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}return typeof e.Worker!="function"?{ok:!1,reason:"worker"}:typeof e.createImageBitmap!="function"?{ok:!1,reason:"bitmap"}:{ok:!0}}o(xt,"je");function Tt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}o(Tt,"$e");var H,W=(H=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},o(H,"E"),H);function Ie(){let e=o(t=>(t.close(),Promise.reject(new W("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:o(()=>{},"dispose")}}o(Ie,"Je");function Ct(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Ie()}catch{return Ie()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",h=>{let g=h.data,w=r.get(g.id);w&&(r.delete(g.id),w.resolve(g))});let d=o(()=>{for(let h of r.values())h.reject(new W("error"));r.clear(),c()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function p(h,g=[]){if(l)return Promise.reject(new W("disposed"));let w=++i;return new Promise((E,U)=>{r.set(w,{resolve:E,reject:U});try{t.postMessage({...h,id:w},g)}catch{r.delete(w),U(new W("error"))}})}o(p,"m");function c(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let h of r.values())h.reject(new W("disposed"));r.clear()}}o(c,"c");let M=(async()=>{let h=await p({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(h.kind==="failed")return h.reason;if(h.kind!=="ready")return"error";let g=await p({kind:"warmup"});if(g.kind!=="ready")return"error";let w=g.benchMs??g.warmupMs,E=e.deviceMemoryGb===void 0?Le():e.deviceMemoryGb;return{warmupMs:g.warmupMs,downloadMs:h.downloadMs,cached:h.cached,benchMs:w,tier:Ae(w,E)}})().catch(()=>"error"),f,P=new Promise(h=>{f=setTimeout(()=>h("timeout"),e.tuning.loadTimeoutMs)}),x=Promise.race([M,P]).then(h=>(clearTimeout(f),typeof h=="string"?c():s=!0,l&&typeof h!="string"?"error":h));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",c,{once:!0});async function y(h,g,w){if(l)throw g.close(),new W("disposed");if(!s)throw g.close(),new W("not_ready");if(u)throw g.close(),new W("busy");u=!0;let E;try{let U=new Promise((_,B)=>{E=setTimeout(()=>{B(new W("timeout")),c()},e.tuning.readTimeoutMs??1e4)}),F=await Promise.race([p(h,[g]),U]);if(F.kind===w){let{id:_,...B}=F;return B}throw new W(F.kind==="error"?F.code:F.kind==="failed"?F.reason:"error")}finally{clearTimeout(E),u=!1}}return o(y,"v"),{ready:x,get busy(){return u},bandRead:o((h,g=e.tuning.detectorLimit)=>y({kind:"band",bitmap:h,detectorLimit:g},h,"band"),"bandRead"),stillRead:o((h,g,w=e.tuning.detectorLimit)=>y({kind:"still",bitmap:h,region:g,detectorLimit:w},h,"band"),"stillRead"),layoutRead:o((h,g)=>y({kind:"layout",bitmap:h,detectorLimit:g},h,"layout"),"layoutRead"),dispose:c}}o(Ct,"Ze");var ee="sekyro-ocr-1",ue=o(e=>e!==null&&typeof e=="object"?e:{},"me"),D=o((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"O"),Be=o((e,t)=>typeof e=="boolean"?e:t,"et"),Oe=o(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"tt");function At(e,t={}){let r=ue(e),i=ue(r.liveMrz),l=ue(r.frontLock),u=Oe(t.engine??ee),s=t.mode==="off",d=o(g=>g.enabled===!0?g.arm==="live"?"live":"control":null,"u"),p=d(i),c=d(l),M=o((g,w)=>!s&&w==="live"&&Oe(g.minEngine??ee)<=u,"b"),f=ze,P=M(i,p)?{detectorLimit:D(i.detectorLimit,320,1600,f.detectorLimit),bandMaxWidthPx:D(i.bandMaxWidthPx,320,4096,f.bandMaxWidthPx),minBandWidthPx:D(i.minBandWidthPx,0,4096,f.minBandWidthPx),bandTop:D(i.bandTop,0,.95,f.bandTop),minIntervalMs:D(i.minIntervalMs,0,5e3,f.minIntervalMs),stableReads:Math.round(D(i.stableReads,1,10,f.stableReads)),profileReads:Math.round(D(i.profileReads,1,100,f.profileReads)),maxReadMs:D(i.maxReadMs,50,6e4,f.maxReadMs),searchTimeoutMs:D(i.searchTimeoutMs,1e3,12e4,f.searchTimeoutMs),hint:Be(i.hint,!0),stillConfirm:Be(i.stillConfirm,!0)}:null,x=Re,y=o((g,w,E)=>D(l[g],w,E,x[g]),"S"),h=M(l,c)?{minLines:Math.round(y("minLines",1,50)),fillMin:y("fillMin",0,1),fillMax:y("fillMax",0,2),offsetMax:y("offsetMax",0,1),steadyFillDelta:y("steadyFillDelta",0,1),steadyOffsetDelta:y("steadyOffsetDelta",0,1),layoutShiftMax:y("layoutShiftMax",0,1),lineCountDelta:Math.round(y("lineCountDelta",0,50)),lockMs:y("lockMs",0,3e4),steadyMs:y("steadyMs",0,3e4),minFrames:Math.round(y("minFrames",1,100)),minIntervalMs:y("minIntervalMs",0,5e3),maxWidthPx:y("maxWidthPx",160,2048),detectorLimit:y("detectorLimit",320,1600),searchTimeoutMs:y("searchTimeoutMs",1e3,12e4)}:null;return{enabled:P!==null||h!==null,liveMrz:P,textLock:h,liveMrzArm:p,frontLockArm:c,load:{detectorLimit:P?.detectorLimit??h?.detectorLimit??f.detectorLimit,loadTimeoutMs:D(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:D(i.maxDownloadMs,1e3,12e4,2e4)},reportSampleRate:D(i.reportSampleRate,0,1,1)}}o(At,"nt");function Lt(e,t){return e.enabled?!(t.probe??xt)().ok||(t.slow??Tt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ct({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{},...t.deviceMemoryGb!==void 0?{deviceMemoryGb:t.deviceMemoryGb}:{}})}:{ok:!1,reason:"off"}}o(Lt,"rt");function Pt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}o(Pt,"Tt");var O=o(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"W"),ce=o((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"pe");function Rt(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??ee,arm:e.arm,capture:e.capture,outcome:l,reads:ce(t?.reads??0,0,1e4)??0,browser:e.browser??Pt()},s=o((d,p)=>{p!==void 0&&(u[d]=p)},"s");return s("format",t?.format),s("framesToValid",ce(t?.framesToValid,1,1e4)),s("msToValid",O(t?.msToValid)),s("framesToLock",ce(t?.framesToLock,1,1e4)),s("msToLock",O(t?.msToLock)),s("msToCapture",O(e.msToCapture)),s("readP50Ms",O(t?.readP50Ms)),s("readP90Ms",O(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",O(r.warmupMs)),s("downloadMs",O(r.downloadMs)),s("cached",r.cached),s("tier",r.tier),s("benchMs",O(r.benchMs))),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}o(Rt,"ot");function Ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}o(Ue,"fe");var zt=2,Dt=1500;async function Et(e){let t=await import("./capture-session-doc-DFLSX6BB-3ULMTYJH.js");return new t.CaptureSessionDoc(e)}o(Et,"Ot");function qt(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}o(qt,"Et");function Wt(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let s=i[u],d=i[(u+1)%i.length];l+=s.x*d.y-d.x*s.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}o(Wt,"At");function Vt(){import("./capture-session-doc-DFLSX6BB-3ULMTYJH.js").then(e=>e.warmDocDetector()).catch(()=>{})}o(Vt,"kn");function Ht(e){return Ft(e,{}).handle}o(Ht,"Cn");function Ft(e,t){let r=Te(),i=Ce({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=tt(e.documentType,t.catalogCapture===!0?t.captureSeries??rt(e.issuer,e.documentType):[]),p=d.sides.length===1||e.side==="single",c=je(p?"singlePage":"twoSided",s());if(!p&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let M="idle",f=null,P=null,x=!0,y=0,h=0,g=null,w=!1,E=!1,U="",F=null,_,B=null,pe=[],he=d.mrz==="none",_e=d.barcodeSide==="recto"||d.barcodeSide==="verso"?d.barcodeSide:null,N=he&&!p?t.barcode?.side??_e:null,fe=e.barcodeAssetBaseUrl??t.barcode?.assetBaseUrl,te=null,ge=o(()=>N===null||fe===void 0||t.barcode?.seen!==void 0?Promise.resolve(null):(te??(te=import("./barcode-detect-C5IOXMKI-ZOZ2WOWU.js").then(a=>a.loadBarcodeDetect(fe)).catch(()=>null)),te),"Se"),Ge=o((a,n)=>{if(N===null)return Promise.resolve(null);let m,v=new Promise(k=>{m=setTimeout(()=>k(null),t.barcode?.budgetMs??Dt)});return Promise.race([Ye(a,n,N),v]).finally(()=>clearTimeout(m))},"it"),Ye=o(async(a,n,m)=>{let v=m==="recto"?"verso":"recto";try{let k=t.barcode?.seen;if(k!==void 0)return await k(a)?m:v;let[z,C]=await Promise.all([ge(),n()]);if(z===null||C===null)return null;let b=Math.min(1600,C.width),S=document.createElement("canvas");S.width=b,S.height=Math.max(1,Math.round(C.height/C.width*b));try{let q=S.getContext("2d");return q===null?null:(q.drawImage(C,0,0,S.width,S.height),await at(z,q.getImageData(0,0,S.width,S.height),m))}finally{S.width=0,S.height=0}}catch{return null}},"st"),T=t.webOcr!==void 0&&!he?At(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,G=null,I=T===null||!T.enabled?"off":null,J=null,Q=null,ve=new WeakMap,re="";if(T!==null&&T.enabled&&t.webOcr!==void 0){let a=t.webOcr,n=Lt(T,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(n.ok){G=n.engine;let m=new De({textLock:T.textLock,liveMrz:T.liveMrz});J=m;let v=n.engine;v.ready.then(k=>{I=k,typeof k!="string"&&x&&m.setEngine(v,k.tier)})}else I=n.reason}let V=o(a=>{let n=JSON.stringify(a);n!==re&&(re=n,r.emit("mrz",a))},"H"),ye=o((a,n)=>{let m=t.webOcr?.reports;if(m===void 0||T===null||a===void 0)return;let v=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",k=v!=="recto"?T.liveMrzArm??T.frontLockArm:T.frontLockArm;if(k===null||Math.random()>=T.reportSampleRate)return;let z=a.via==="live_mrz"?Q:null,C=o(()=>{let b=z?.value??null;m([Rt({arm:k,capture:v,assist:a.ocr??null,load:k==="control"?"off":I,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...b!==null&&b.stillConfirmed!==void 0?{stillConfirmed:b.stillConfirmed}:{},...n!==void 0?{typeMismatch:Ue(n.format,d.format==="ID-3"?"passport":"card")}:{}})])},"x");z!==null&&z.value===null?Promise.race([z.promise,new Promise(b=>setTimeout(b,3e3))]).then(C):C()},"Me"),j=o(a=>{!x||a===M||(M=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"U"),Je=o((a,n)=>n===void 0?null:p?"single":a.captured.recto===n?"recto":a.captured.verso===n?"verso":null,"ut"),Qe=o(a=>({phase:a.phase,captured:p?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(n=>a.captured[n]!==void 0),expected:p?null:a.current??null,notice:a.notice??null,lastShot:Je(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:E}),"lt"),we=o(()=>{let a=f;a!==null&&a.captureNow().catch(()=>A({type:"captureFailed",at:s()}))},"De");function A(a){if(!x)return;let n=c;c=yt(c,a),c.phase==="capturing"&&n.phase!=="capturing"&&Promise.resolve().then(we),c.phase==="result"&&n.phase!=="result"&&(j("done"),Me());let m=Qe(c),v=JSON.stringify(m);v!==U&&(U=v,r.emit("scan",m))}o(A,"R");function Me(){B!==null&&clearInterval(B),B=null;for(let a of pe.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}o(Me,"we");let be=o(()=>f?.captureReport?.(),"ke"),ae=!1,ke=o((a,n)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,n)}catch{}},"Ce"),X=o(a=>{re="",!(f===null||c.phase==="reading"||c.phase==="result")&&(ae=!1,g=p?"single":c.current??a,f.rearm(g))},"j"),Xe=o(async(a,n,m,v)=>{Q=null;let k=I!==null&&typeof I=="object"&&I.tier==="low";if(v!==void 0&&G!==null&&T?.liveMrz?.hint===!0&&!k){let q={promise:bt(G,a,v,{engine:ee,detectorLimit:T.liveMrz.detectorLimit}).catch(()=>null),value:null};q.promise.then(L=>{q.value=L}),Q=q}v!==void 0&&Ue(v.format,d.format==="ID-3"?"passport":"card")&&V({state:"mismatch",format:v.format});let z=be();ke(z,"captured"),ae=!0,ye(z,v);let C=m===void 0?F:m===null?null:{quad:qt(m),frameWidth:0,frameHeight:0,inStill:!0},b={decoded:null},S=o(()=>(b.decoded??(b.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),b.decoded),"w");try{await Ke(a,n,C,S,Q,v)}finally{b.decoded!==null&&(await b.decoded)?.close()}},"ct"),Ke=o(async(a,n,m,v,k,z)=>{let C=`shot-${y+=1}`,b=c.current;if(A({type:"captured",id:C,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&u>0){let L=await(t.measureSharpness!==void 0?t.measureSharpness(a,m):v().then(R=>R===null?-1:Pe(R,ne(m?.quad??null,m?.inStill===!0?R:{width:m?.frameWidth??0,height:m?.frameHeight??0},R)))).catch(()=>-1);if(!x)return;if(Number.isFinite(L)&&L>=0&&L<u){w=!0;let R=p?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");A({type:"readFailed",side:R,id:C,issue:"blurry"}),X(R);return}}w=!1;let S;if(p)S="single";else{let L=z!==void 0&&z.format!=="TD3"&&(d.mrzSide==="recto"||d.mrzSide==="verso")?d.mrzSide:null,R=L===null&&t.classify===void 0?await Ge(a,v):null,Se=R===null||N===null?R:it(R,N,c.captured),Y=L??Se??(Se===null&&N!==null&&b!==void 0?b:null)??await(t.classify!==void 0?t.classify(a):v().then(K=>K===null?b??"recto":m?.inStill===!0?Fe(K,480,null,!0):Fe(K,480,ne(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},K)))).catch(()=>b??"recto");if(!x)return;if(c.captured[Y]!==void 0&&h<zt){h+=1,A({type:"duplicate",id:C,side:Y}),X(Y==="recto"?"verso":"recto");return}let xe=c.captured.recto===void 0?"recto":c.captured.verso===void 0?"verso":void 0;S=c.captured[Y]!==void 0&&xe!==void 0?xe:Y,h=0,A({type:"classified",id:C,side:S})}let q=S==="verso"?"verso":"recto";try{let L=t.encode!==void 0?await t.encode(a):await v().then(R=>{if(R===null)throw new Error("the still could not be decoded");return mt(R)});if(!x)return;k!==null&&ve.set(L.blob,k),r.emit("captured",{image:L.blob,side:S,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:L.width,height:L.height,previewDataUrl:n}),t.deferRead!==!0&&A({type:"readOk",side:q})}catch(L){A({type:"readFailed",side:q,id:C,issue:"technical"}),r.emit("error",Z("generic",!0,{phase:"keyframes",name:oe(L)}))}X(q==="recto"?"verso":"recto")},"dt"),Ze=o(a=>{pe.push(a.on("statechange",({state:n})=>{n==="preflight"||n==="acquiring"?j("starting"):n==="positioning"?j("scanning"):n==="captured"?j("captured"):n==="error"&&j("error")}),a.on("feedback",({key:n,reticle:m})=>r.emit("feedback",{key:n,reticle:m})),a.on("checks",n=>{r.emit("gate",{progress:n.p,quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight,...n.guide!==void 0?{guide:{detected:n.guide.detected,fill:n.guide.fill,offsetX:n.guide.offsetX??0,offsetY:n.guide.offsetY??0}}:{}});let m=n.ocr?.mrz;m!==void 0&&(m.state==="fallback"?V({state:"fallback",reason:m.reason}):m.state==="valid"?V({state:"valid",format:m.format}):m.state==="reading"?V({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):V({state:"searching"}));let v=n.quad===null?0:Wt(n.quad,n.frameWidth,n.frameHeight);F=n.quad===null?null:{quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight},A({type:"report",report:{present:n.quad!==null&&n.plausible||n.guide?.detected===!0,ready:n.ready===!0,locking:n.p>=.5,areaFrac:v},at:s()})}),a.on("error",({kind:n,retryable:m,detail:v})=>r.emit("error",Z(n,m,v))),a.on("artifacts",n=>{Xe(n.keyframe,n.previewDataUrl,n.docRegion,n.liveMrz)}))},"mt"),ie=o(()=>(P??(P=(async()=>{if(x){if(ge(),f===null){let a;try{a=await(t.createEngine??Et)({...t.engineOptions??{},..._!==void 0?{guide:_}:{},video:e.video,format:d.format,side:p?"single":e.side??"recto",autoCapture:!1,...J!==null?{ocr:J}:{}})}catch(m){j("error"),r.emit("error",Z("models",!0,{phase:"models",name:oe(m)}));return}if(!x){a.destroy();return}f=a,g=p?"single":e.side??"recto",Ze(a);let n=t.tickMs??500;n>0&&(B=setInterval(()=>A({type:"tick",at:s()}),n))}A({type:"clockRestart"}),T!==null&&T.liveMrzArm==="live"&&(I==="unsupported"||I==="off")&&V({state:"fallback",reason:I}),await f.start()}})().finally(()=>{P=null})),P),"ne");return{handle:{get state(){return M},on:o((a,n)=>r.on(a,n),"on"),start:ie,retry:o(()=>{if(f===null&&c.phase==="result"){A({type:"retake"}),h=0,w=!1,ie();return}if(f!==null&&M!=="error"){A({type:"retake"}),h=0,w=!1,g=p?"single":null,f.rearm(p?"single":void 0);return}ie()},"retry"),setSide:o(a=>{p||a==="single"||f!==null&&c.current===a&&g===a&&c.phase!=="reading"&&c.phase!=="result"||(c.current!==a&&(c={...c,current:a}),A({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f!==null&&(g=a,f.rearm(a)))},"setSide"),shutter:we,focusAt:o((a,n)=>{f?.focusAt?.(a,n)},"focusAt"),setGuide:o(a=>{_=a,f?.setGuide?.(a)},"setGuide"),setTorch:o(a=>{E=a,f?.setTorch(a),A({type:"tick",at:s()})},"setTorch"),destroy:o(()=>{if(x&&f!==null&&M!=="done"){let a=be();!ae&&a!==void 0&&a.ticks>0&&ke(a,"abandoned"),ye(a,void 0)}x=!1,Me(),J?.setEngine(null),G?.dispose(),G=null,r.clear()},"destroy")},plan:d,setFlowState:o(a=>{(c.phase==="reading"||c.phase==="result")&&j(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:o((a,n)=>{let m=a==="verso"?"verso":"recto";A(n.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:n.issue}),n.ok||X(m)},"settle"),takeDeviceRead:o(a=>ve.get(a.image)?.value??null,"takeDeviceRead")}}o(Ft,"Bt");export{zt as a,Dt as b,Vt as c,Ht as d,Ft as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as v}from"./chunk-
|
|
1
|
+
import{g as v}from"./chunk-D7YINY2U.js";import{a as y,b as C}from"./chunk-PLWGAXYM.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var r=p(y(),1),o=p(C(),1),m=p(y(),1);function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[k,f]=(0,r.useState)(!1),[h,N]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&N(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let b=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${k&&u===b?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(v(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{A as Xe,F as me,G as ee,H as et,I as tt,J as nt,a as D,b as je,c as Be,f as Ke,g as Ve,h as $e,i as He,j as pe,k as ze,m as U,o as N,p as q,q as H,r as X,s as L,t as fe,v as We,w as Ze,x as Ye,y as Je,z as Qe}from"./chunk-IXRKOBFA.js";import{g as it}from"./chunk-WANVL25H.js";import{b as Ge}from"./chunk-HXD7VO3F.js";import{b as qe,c as de,e as rt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Et(n){let i=n.now??(()=>Date.now()),p=n.setTimer??((w,c)=>setTimeout(w,c)),f=n.clearTimer??(w=>clearTimeout(w)),g=null,_=!1,d=!1,C=!1,j=0,P=null,A=t(()=>{P!==null&&f(P),P=null},"_"),S=t(()=>{let w=n.armRamp;w===void 0||_||d||C||i()<j||(_=!0,w().catch(()=>{}).then(c=>{if(_=!1,!C){if(c===void 0){j=i()+2e3;return}if(c.challenge===void 0){d=!0;return}g={challenge:c.challenge,expiresAt:c.expiresAt},A(),P=p(()=>{P=null,!C&&g!==null&&n.waiting()&&S()},Math.max(1e3,c.expiresAt-i()-2e4))}}))},"A");return{arm(){g!==null&&g.expiresAt-i()>2e4||S()},take(){let w=g;return g=null,A(),w!==null&&w.expiresAt-i()>=12e3?w.challenge:void 0},stop(){C=!0,g=null,A()}}}t(Et,"gt");function Rt(n){return n.idNumberBound??n.nniBound}t(Rt,"ue");function at(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(at,"ee");var lt="https://api.sekyro.ai",Nt=5e3,Pt=24e4,Ot=9e4,Dt=25*6e4,Lt=20*6e4,Ft=3,Ut=3e3,qt=1500,Gt=10;function ot(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(ot,"_t");var st=new Set(["aborted","embedder_opaque","site_key_rejected"]);function jt(n){return new Promise(i=>setTimeout(i,n))}t(jt,"cn");function Bt(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let i=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(i);else for(let f=0;f<16;f+=1)i[f]=Math.floor(Math.random()*256);i[6]=(i[6]??0)&15|64,i[8]=(i[8]??0)&63|128;let p=[...i].map(f=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}t(Bt,"dn");function Kt(n){return Vt(n,{})}t(Kt,"Po");function Vt(n,i){let p=n.apiOrigin??lt,f=n.autoRetry??!0,g=n.rearm??"auto",_=i.client??new Be({apiOrigin:p,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),d=new Proxy(_,{get(e,r){if(r==="submitCheck")return gt;let a=Reflect.get(e,r,e);return typeof a=="function"?a.bind(e):a}}),C=i.sleep??jt,j=i.uuid??Bt,P=i.getChallengeToken??((e,r)=>import("./challenge-frame-YBTLAQ5G-NN763UU5.js").then(a=>a.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal}))),A=rt(),S=null,w=null,c=!1,ve=new AbortController,h=null,z=null,W=null,Z=t(()=>W??et(h),"ne"),Y=t(()=>tt(ee(h),Z()),"oe"),T=t(e=>{h=e,!N(e)&&(Ee(Lt)||yt(e))&&ue(e),A.emit("view",e),S?.onView(e)},"I"),b=t(()=>h!==null?Promise.resolve(h):(z??(z=d.getSession().then(e=>(T(e),e)).finally(()=>{z=null})),z),"x"),x=t(async()=>{let e=await d.getSession();return T(e),e},"v"),te=t(async(e,r)=>{e.plan!==void 0?T(e):await x()},"le"),J=null,ge=t(async e=>{let r=await b();if(e||!r.consentRecorded){let a=await d.recordConsent(n.locale);a.plan!==void 0?T(a):h!==null&&T({...h,consentRecorded:!0})}Q()&&ue(r)},"Me"),E=t(e=>e?.force===!0?ge(!0):(J??(J=ge(!1).finally(()=>{J=null})),J),"N"),ne={client:d,ensureConsent:t(e=>E(e),"ensureConsent"),sleep:C,uuid:j,...i.random!==void 0?{random:i.random}:{},onBusy:t(e=>{c||A.emit("busy",e)},"onBusy")},_e=!1,be=null,re=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(_e)return;_e=!0}be=JSON.stringify(e),A.emit("result",e)},"me"),ft=t(e=>{be!==JSON.stringify(e)&&re(e)},"Nt"),ke=t(async e=>{let r=h;e&&(r=await x().catch(()=>h));let a=r===null?null:U(r);return a!==null&&!c&&A.emit("method",a),a!==null},"Ie"),ie=null,we=!1,Ae=!1,Ce=t(()=>Je(ne,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Fe"),Me=t(e=>Rt(e)===!0||at(H(e,"population_registry"))===!0,"Ne"),mt=t(async()=>{try{let e=await b();if(N(e)||U(e)!==null||q(e)?.checkType!=="population_registry")return;if(!Me(e)&&at(H(e,"population_registry"))===void 0&&(e=await x()),!Me(e)){Ae=!0;return}await E(),await te(await Ce(),"population_registry");let r=h===null?void 0:H(h,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&ze(r)>0){if(await C(Nt),c)return;await te(await Ce(),"population_registry")}}catch(e){if(e instanceof D&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await x().catch(()=>{});return}we=!0;return}h!==null&&N(h)&&re(fe(h,{autoRetry:f}))},"Ht"),Se=t(()=>(ie??(ie=mt()),ie),"He"),I=i.now??Date.now,F=null,B,ae,ht=0,oe=t((e,r)=>`${e.url}
|
|
2
|
+
${e.siteKey}
|
|
3
|
+
${r}`,"ye"),Te=0,se,le=t((e,r)=>{Te+=1;let a=I(),l=P(e,{signal:ve.signal,subject:r}),s={key:oe(e,r),at:a,token:l};return l.then(()=>{s.issuedAt=I(),ae=void 0},m=>{let u=ot(m);if(s.failed=u,c||u==="aborted")return;ae=u;let{detail:y,readyMs:o}=m;K({check:"attestation",kind:"unavailable",engineKind:u,attempt:ht++,challengeMs:I()-a,readyMs:o,detail:y,inApp:Ge()})}),l.catch(()=>{}),s},"Se"),xe=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||I()-e.issuedAt<Pt),"De"),ue=t((e,r={})=>{let a=e?.challenge??null;if(e===null||a===null||c)return;let l=X(e.sessionId),s=F;(r.replaceFailed===!0&&s?.failed!==void 0&&!st.has(s.failed)||!xe(s,oe(a,l)))&&(F=le(a,l))},"_e"),Ie=t(async(e,r)=>{let a=oe(e,r),l=F;F=null;let s=xe(l,a)?l:le(e,r),m=s===l?0:1,u,y=new Promise(o=>{u=setTimeout(()=>o("late"),Ot)});try{for(;;){let o=await Promise.race([s.token.then(k=>({token:k}),k=>({error:ot(k)})),y]);if(o==="late")return!c&&F===null&&(F=s),{error:ae??"timeout"};if("token"in o)return se=Math.max(0,Math.round((s.issuedAt??I())-s.at)),o;if(c||st.has(o.error)||m>=Ft||m>0&&await Promise.race([C(Ut*m),y])==="late")return o;if(c)return{error:"aborted"};m+=1,s=le(e,r)}}finally{clearTimeout(u)}},"Ue"),O=null,yt=t(e=>pe(e).some(r=>(r.checkType==="phone_otp"||r.checkType==="email_otp")&&r.state!=="passed"&&r.state!=="skipped"),"Dt"),Ee=t(e=>O===null||I()-O>=e,"Be"),Q=t(()=>Ee(Dt),"re"),vt=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"Ut"),Re=new Map,Ne=t(async()=>{let e=await b(),r=e.challenge;if(r==null||e.simulation!==void 0)return;let a=await Ie(r,X(e.sessionId));if(!("token"in a))throw new D({status:400,code:"attestation_invalid",message:`browser check: ${a.error}`});return a.token},"Ge"),gt=t(async(e,r,a={})=>{let l=r;if("attestation"in l)try{let o=await _.submitCheck(e,r,a);return vt(l)&&(O=I()),o}catch(o){throw o instanceof D&&o.code==="attestation_invalid"&&(O=null),o}let s=(e==="phone_otp"||e==="email_otp")&&l.action!=="verify",m=a.idempotencyKey,u=m!==void 0?Re.get(m):void 0;u===void 0&&(s||Q())&&(u=await Ne(),m!==void 0&&u!==void 0&&Re.set(m,u));let y=t((o,k)=>o!==void 0?{...k,browserCheckToken:o}:k,"b");try{let o=await _.submitCheck(e,r,y(u,a));return u!==void 0&&(O=I()),o}catch(o){if(!(o instanceof D)||o.code!=="attestation_invalid"||(O=null,u!==void 0))throw o;let k=await Ne(),M=m!==void 0?{...a,idempotencyKey:j()}:a,R=await _.submitCheck(e,r,y(k,M));return k!==void 0&&(O=I()),R}},"Bt"),Pe=t(async(e={})=>{if(B=void 0,e.always!==!0&&!Q())return{};let r=await b(),a=r.challenge;if(a==null)return{};let l=await Ie(a,X(r.sessionId));if("token"in l)return{channel:"hosted_web",turnstileToken:l.token};if(B=l.error,r.simulation!==void 0)return{channel:"hosted_web"};throw new Ye(l.error)},"Ke"),_t=t(()=>B,"qt"),bt=t(()=>({checks:Math.min(50,Te),...se!==void 0?{challengeMs:Math.min(6e5,se)}:{}}),"Gt"),K=t(e=>{if(c)return;let r=d.reportCaptureIssue;if(r===void 0)return;let a=e.formFactor;try{a??(a=qe())}catch{}try{Promise.resolve(r.call(d,{...e,...a!==void 0?{formFactor:a}:{}})).catch(()=>{})}catch{}},"W"),v=null,V=null,Oe=new WeakMap,De=Promise.resolve(),$=0,kt=t(async()=>{let e=await b();for(let r=0;r<Gt&&!c&&!N(e)&&q(e)===void 0&&pe(e).some(a=>a.state==="processing")&&(await C(qt),!c);r+=1)e=await x();return e},"Kt"),wt=t(async(e,r,a)=>{let{capture:l}=e,s=t(()=>c,"m"),m=t(()=>e.alive&&e.attempt===a,"C"),u=t(o=>{m()&&l.setFlowState(o)},"g"),y=t(o=>{if(!s()&&(o.status==="unavailable"&&o.reasonCode!==void 0&&!Ke(o.reasonCode)&&K({check:"liveness",kind:"unavailable",phase:"upload",engineKind:o.reasonCode,attempt:Math.max(0,e.issues.value)}),re(o),!!m())){if(o.status==="retry"&&g==="auto"){l.handle.retry();return}l.setFlowState("done")}},"b");if(r.degraded==="NO_RECORDER"){let o=h?.sessionId??(await b().catch(()=>null))?.sessionId??"";y(L(o,"no_recorder"));return}u("uploading");try{if(await Se(),s())return;let o=await b(),k;if(!N(o)&&U(o)!==null){await ke(!1),y(L(o.sessionId,"method_required"));return}if(!N(o)){if(q(o)?.checkType==="population_registry"){y(L(o.sessionId,Ae?"nni_unbound":we?"network":"registry_unavailable"));return}if(await E(),s())return;k=h??o;let M=await Qe({...ne,artifacts:r,getAttestation:Pe,attestationError:_t,attestationFacts:bt,clipKeys:{get:t(()=>Oe.get(r)??null,"get"),set:t(R=>{Oe.set(r,R)},"set")},getView:t(()=>h??o,"getView"),refreshView:x,applySubmit:te,onPhase:u,isCancelled:s,onKeyframePromoted:t(R=>{w=R},"onKeyframePromoted")});if(s())return;if(M.kind==="unavailable"){M.reason==="attestation"&&(V={bound:e,artifacts:r});let R=L(o.sessionId,M.reason),Ue=M.reason==="attestation"?B:void 0;y(Ue!==void 0?{...R,attestationError:Ue}:R);return}if(M.kind==="resync"&&await x(),h!==null&&U(h)!==null){await ke(!1),y(L(o.sessionId,"method_required"));return}o=await kt()}y(fe(o,{autoRetry:f,previous:k}))}catch{if(s())return;y(L(h?.sessionId??"","network"))}},"jt"),Le=t((e,r)=>{let a=e.attempt;$>0&&e.alive&&e.capture.setFlowState("uploading"),$+=1,De=De.then(()=>wt(e,r,a)).finally(()=>{$-=1,$===0&&S?.onChainIdle()}).catch(()=>{})},"We"),Fe=t(e=>{v?.capture.handle.destroy(),v!==null&&(v.alive=!1,v.ramp.stop());let r=Et({armRamp:typeof d.armRamp=="function"?()=>d.armRamp():void 0,waiting:t(()=>s.alive&&Y()==="self"&&(l.handle.state==="starting"||l.handle.state==="gating"),"waiting")}),a=Promise.resolve(),l=it(e,S?.captureInternals?.(e)??i.capture,()=>h?.capture?.liveness?.keyframe?.rank===!0,Y,()=>r.take()??h?.capture?.liveness?.screenRamp,{session:t(()=>ee(h),"session"),onModeChange:t(u=>{W=u},"onModeChange")}),s={capture:l,alive:!0,ramp:r,attempt:0,issues:$e()};v=s,l.handle.on("error",u=>{K(Ve("liveness",u,s.issues.value))}),l.handle.on("state",u=>{if(s.issues.note(u),u==="starting"){s.attempt+=1,V?.bound===s&&(V=null),Q()&&ue(h,{replaceFailed:!0});let y=h===null?void 0:q(h)?.checkType;a=y==="liveness"||y==="face_match"?E().catch(()=>{}):Promise.resolve()}(u==="starting"||u==="gating")&&Y()==="self"&&a.then(()=>{s.alive&&r.arm()})}),l.handle.on("captured",u=>{Promise.resolve().then(()=>Le(s,u))});let m=l.handle;return{get state(){return m.state},get captureMode(){return m.captureMode},get facingMode(){return m.facingMode},on:t((u,y)=>m.on(u,y),"on"),start:t(async u=>{if(h===null&&await b().catch(()=>{}),!!s.alive)return m.start(u)},"start"),retry:t(()=>{let u=V;if(u!==null&&u.bound===s&&s.alive){V=null,Le(s,u.artifacts);return}m.retry()},"retry"),switchCamera:t(()=>m.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>m.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(u=>m.setCaptureMode(u),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),v===s&&(v=null),m.destroy()},"destroy")}},"$e"),At=t(async()=>{if(c)return null;try{let e=await b();return c?null:U(e)}catch{return null}},"Yt"),Ct=t(async()=>{if(c)return"self";try{let e=await b();if(c)return"self";let r=ee(e);return r==="choice"?Z()??r:r}catch{return"self"}},"Wt"),Mt=t(async()=>{if(c)return!1;try{let e=await b();return c||N(e)||de()?!1:me(e,q(e))==="phone"||me(e,H(e,"liveness"))==="phone"}catch{return!1}},"$t"),St=t(async()=>{if(c)return!1;try{let e=await b();return!c&&e.returning===!0}catch{return!1}},"Qt"),Tt=t(async e=>{let r=(await b()).plan?.choice,a=r?.options.find(s=>He[s.service]===e);if(!a)throw new RangeError(`method ${String(e)} is not offered`);let l=await d.choose(r.nodeId,a.id);c||T(l)},"Zt"),ce=null,xt=t(()=>(ce??(ce=import("./plan-runner-3BLEJWHF-3K3RBXJU.js").then(e=>{let r=e.createPlanRunner({runtime:ne,currentView:t(()=>h,"currentView"),cameraMode:Y,captureModeSwitch:{pick:Z,choose:t(a=>{W=a},"choose")},ensureView:b,refreshView:x,ensureConsent:t(()=>E(),"ensureConsent"),liveness:Fe,stopLiveness:t(()=>{v!==null&&(v.alive=!1,v.ramp.stop(),v.capture.handle.destroy(),v=null)},"stopLiveness"),chainBusy:t(()=>$>0,"chainBusy"),destroyed:t(()=>c,"destroyed"),sleep:C,isMobile:de,now:i.now??Date.now,keptFaceKey:t(()=>w,"keptFaceKey"),setView:T,baseCapture:i.capture,emitStep:t(a=>{c||A.emit("step",a)},"emitStep"),emitResult:ft,reportCaptureIssue:K,documentInternals:i.document,documentFacts:i.documentFacts,portraitInternals:i.portrait,livePhotoInternals:i.livePhoto,uploadInternals:i.upload,pageCameraInternals:i.pageCamera});return S=r,r})),ce),"Jt");return{consent:t(()=>E(),"consent"),startRegistry:Se,methodChoice:At,selectMethod:Tt,reportCameraUnavailable:t(async e=>{await E();let r=d.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let a=await r.call(d,e).catch(l=>{if(l instanceof D&&l.code==="check_out_of_order")return d.getSession();throw l});c||T(a)},"reportCameraUnavailable"),reportCaptureIssue:K,testerGate:t(async e=>{let r=d.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let a=e.clip,l=je(e.clipMime??"");if(a===void 0||!Ze.includes(l))throw new TypeError("the capture has no clip");await E();let s=await We(d,"clip",l,a.size,{engine:e.engine,durationMs:e.clipMs});await d.uploadToSpaces(s.uploadUrl,a,l);let{key:m}=await d.completeMedia(s.key),u=await Pe({always:!0}),y=await r.call(d,{clipKey:m,attestation:u,captureChannel:e.captureChannel,capture:{...Xe(e),attestationError:B}}),{bound:o,missReason:k,...M}=y;return c||(M.plan!==void 0?T(M):await x()),o===!0||k===void 0?{bound:o===!0}:{bound:!1,missReason:k}},"testerGate"),mobileRequired:Mt,captureMode:Ct,chooseCaptureMode:t(e=>{W=e},"chooseCaptureMode"),get captureChoice(){return Z()},returning:St,liveness:Fe,run:t(async()=>{if(c)throw new Error("verification destroyed");return(await xt()).run()},"run"),currentStep:t(()=>S?.current()??null,"currentStep"),voiceClips:t(async()=>{if(c)return null;try{let e=await b();return c?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>A.on(e,r),"on"),destroy:t(()=>{c=!0,ve.abort(),S?.destroy(),v!==null&&(v.alive=!1,v.capture.handle.destroy(),v=null),A.clear()},"destroy")}}t(Vt,"ln");var ut=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],ct=["carte_identite","passport","residence_permit","drivers_license"],$t=["carte_identite","passport","residence_permit"];function he(n,i){let p=n.byIssuer?.[i]??n.default;return ct.filter(f=>p==="*"?$t.includes(f):p.includes(f))}t(he,"mn");function dt(n,i=ut){return[...new Set([...i,...Object.keys(n.byIssuer??{})])].filter(p=>he(n,p).length>0).sort()}t(dt,"Io");var G={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"};var bn={full_name:G.fullName,occupation:G.occupation,email:G.email,short_text:G.shortText,long_text:G.longText},pt=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),kn=new Map(Object.entries(pt)),wn=new Map(Object.entries(pt).map(([n,i])=>[i,n]));function Ht(n,i){let p=n.options.filter(d=>d.id!==n.current);if(i===void 0)return{switchTo:p,methods:[]};let f=t(d=>d.countries!==void 0&&d.countries.length>0,"i");if(i===null)return{switchTo:p.filter(d=>!f(d)),methods:[]};let g=i.toUpperCase(),_=t(d=>!f(d)||d.countries.includes(g),"u");return{switchTo:p.filter(_),methods:p.filter(d=>f(d)&&_(d))}}t(Ht,"Wo");function zt(n,i,p){let f=n.names?.[i.toUpperCase()],g=f?.[p]??f?.en;if(g!==void 0&&g!=="")return g;let _=n.nationalEid?.providerName;return _!==void 0&&_!==""?_:void 0}t(zt,"$o");function Wt(n){return n===void 0?[]:[...new Set(n.options.filter(i=>i.id!==n.current).flatMap(i=>i.countries??[]).map(i=>i.toUpperCase()))]}t(Wt,"Qo");var An=10*1024*1024;function lr(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(lr,"Ce");var Zt=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Yt=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>Zt.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),Jt=/^[A-Z0-9]{4,20}$/,ye=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Qt=Object.freeze({normalize:ye,check:t(n=>Jt.test(ye(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Xt(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(Xt,"he");var en={trim:t(n=>n.trim(),"trim"),upper_single_space:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:ye},tn={mr_nni_mod97:t(n=>Xt(n),"mr_nni_mod97")};function nn(n){let i=new RegExp(n.pattern,"u"),p=n.check===null?void 0:tn[n.check];return Object.freeze({normalize:en[n.normalize],check:t(f=>i.test(f.trim())&&(p===void 0||p(f)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(nn,"ge");var rn=Object.freeze(Object.fromEntries(Object.entries(nt).map(([n,i])=>[n,nn(i)])));function an(n,i){return rn[`${n.toUpperCase()}:${i}`]??(i==="drivers_license"?Qt:Yt)}t(an,"C");var ur=Object.freeze({JPN:"JP",MRT:"MR"});function cr(n){return an("MR","national_id").check(n)}t(cr,"Ae");function on(n){let i="";for(let p of n){let f=p.codePointAt(0)??0;f>=1632&&f<=1641?i+=String(f-1632):f>=1776&&f<=1785?i+=String(f-1776):p!==" "&&p!=="-"&&p!==" "&&(i+=p)}return i}t(on,"H");function dr(n){return on(n)}t(dr,"De");var pr=he,fr=dt;var sn=t(()=>import("./create-document-capture-4ZOSBL3Y-KLZDMWOQ.js"),"E");function ln(){sn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(ln,"D");function mr(){ln()}t(mr,"rt");var un=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"O");function cn(){un().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(cn,"I");function hr(){cn()}t(hr,"dt");export{Kt as a,Ht as b,zt as c,Wt as d,lr as e,cr as f,dr as g,pr as h,fr as i,mr as j,hr as k};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as I}from"./chunk-UE6IZTZA.js";import{a as C,b as P,c as H}from"./chunk-VYFRJNC5.js";import{a as T}from"./chunk-WZFFQZE2.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
1
|
+
import{d as I}from"./chunk-RTCZJKYC.js";import{a as C,b as P,c as H}from"./chunk-PLWGAXYM.js";import{a as T}from"./chunk-WANVL25H.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
react-dom/cjs/react-dom.production.js:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-PLWGAXYM.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.
|
|
1
|
+
import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.40",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as U}from"./chunk-WZFFQZE2.js";import{a as J,c as R}from"./chunk-TODKCK6A.js";import{b as L}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,m=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var V=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var me={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},fe=`@sekyro/web/${J}`,ye=fe,b,it=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...G(t.challengeMs)?{challengeMs:t.challengeMs}:{},...G(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof m&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof m)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-V>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=U(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-V>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof m&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new m({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[me[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=L();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new m({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(b,"S"),b);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new m({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new m({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new m({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function st(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(st,"J");function rt(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(rt,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function dt(e){return ge.has(e)}r(dt,"Ce");function ut(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(ut,"ve");function lt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(lt,"Pe");var be={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function ke(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(ke,"J");function pt(e){let t=ke(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>be[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(pt,"Me");var we=new Set(["liveness","face_match"]);function j(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(j,"S");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function W(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return j(n)?n:void 0}r(W,"M");function O(e,t){return y(e).find(n=>n.checkType===t)}r(O,"_");function $(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r($,"y");function Se(e,t){let n=O(t,"liveness")?.state,i=$(t)?.state;return($(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Z(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Z,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"R");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"w");function X(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(X,"O");function ht(e,t){let n=Ae(e,t),i=Ce(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(ht,"Ve");var Te=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Ce(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Te.has(t)?t:void 0}r(Ce,"Z");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return Oe(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,X(n,"review",Y(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Q");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"C");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function $e(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r($e,"ie");function Oe(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||$e(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=W(e);return s===void 0&&y(e).some(a=>a.state==="review")?X(n,"review",Y(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r(Oe,"re");function Y(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(Y,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var qe=["video/webm","video/mp4"],Q="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,ze=3,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),k,D=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(k,"k"),k);function Ue(e){let t=$(e);return O(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?j(t):e.capture?.livePhoto?.oneCapture===!0)}r(Ue,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Le=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Le)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof m))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(je.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Je=new Set(["passed","review","processing","skipped"]);async function mt(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!qe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ve(e,t.keyframe),a=Ge(e,n,i,s),c=Be(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let h=W(p),C=h?.checkType,q=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(h?.id)&&o.size<2&&u?"face_match":null;if(q===null)return{kind:"settled"};if(q==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(q==="liveness"){d=!0;let f=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,f)&&o.add($(f)?.id);for(let ie of Z(p,f))o.add(ie);await e.applySubmit(f,"liveness");let _=O(e.getView(),"liveness")?.state;u=_===void 0||Je.has(_)}else{o.add(h?.id);let f=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Z(p,f))o.add(_);await e.applySubmit(f,"face_match")}}catch(f){if(e.isCancelled()||f instanceof D)return{kind:"cancelled"};let _=Xe(f);if(_.kind!=="resync"||l>=ze)return _;l+=1,await e.refreshView()}}}r(mt,"Fe");function Ve(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Q,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Q),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ve,"_e");function Ge(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Ue(e.getView())&&(a=null),e.onPhase("uploading");let[p,h]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let C=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(C.uploadUrl,t,n),(await u.completeMedia(C.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=h===null?null:{imageKey:h})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(h){throw h instanceof A?h:new A(h instanceof Error?h.message:String(h))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Ze(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Ge,"ge");function Be(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Be,"ye");function Ze(e){let t={width:e.width,height:e.height};for(let n of Qe)e[n]!==void 0&&(t[n]=e[n]);return t}r(Ze,"Se");var Qe=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"ke");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof m){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"be");var ft="form_answers_invalid",S,yt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,_t=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),T,vt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(T,"$"),T);function z(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(z,"I");function gt(e,t){if(t===void 0||!j(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=O(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return z(e.documents);case"poa":return z(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:z(n)}default:return null}}r(gt,"De");function Ye(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(Ye,"we");function bt(e){let t=e?.capture?.pick;return Ye(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(bt,"Be");function kt(e,t,n=null){return e==="choice"?t??n??"self":e}r(kt,"$e");var wt={"JP:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{12}$",check:null,registrySources:[],describe:"number must be the 12-digit Japanese driving licence number"},"JP:residence_permit":{normalize:"upper_no_space_or_hyphen",pattern:"^[A-Z]{2}[0-9]{8}[A-Z]{2}$",check:null,registrySources:[],describe:"number must be the 12-character residence card number: two letters, eight digits, two letters"},"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{m as a,v as b,it as c,st as d,rt as e,dt as f,ut as g,lt as h,be as i,y as j,F as k,ke as l,pt as m,j as n,Me as o,W as p,O as q,x as r,E as s,ht as t,Ce as u,ee as v,qe as w,Le as x,ne as y,mt as z,Ze as A,ft as B,yt as C,_t as D,vt as E,gt as F,Ye as G,bt as H,kt as I,wt as J};
|
|
1
|
+
import{b as U}from"./chunk-WANVL25H.js";import{a as J,c as R}from"./chunk-HXD7VO3F.js";import{b as L}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,m=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var V=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var me={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},fe=`@sekyro/web/${J}`,ye=fe,b,it=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...G(t.challengeMs)?{challengeMs:t.challengeMs}:{},...G(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof m&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof m)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-V>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=U(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-V>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof m&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new m({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[me[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=L();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new m({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(b,"S"),b);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new m({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new m({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new m({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function st(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(st,"J");function rt(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(rt,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function dt(e){return ge.has(e)}r(dt,"Ce");function ut(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(ut,"ve");function lt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(lt,"Pe");var be={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function ke(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(ke,"J");function pt(e){let t=ke(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>be[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(pt,"Me");var we=new Set(["liveness","face_match"]);function j(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(j,"S");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function W(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return j(n)?n:void 0}r(W,"M");function O(e,t){return y(e).find(n=>n.checkType===t)}r(O,"_");function $(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r($,"y");function Se(e,t){let n=O(t,"liveness")?.state,i=$(t)?.state;return($(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Z(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Z,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"R");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"w");function X(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(X,"O");function ht(e,t){let n=Ae(e,t),i=Ce(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(ht,"Ve");var Te=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Ce(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Te.has(t)?t:void 0}r(Ce,"Z");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return Oe(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,X(n,"review",Y(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Q");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"C");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function $e(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r($e,"ie");function Oe(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||$e(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=W(e);return s===void 0&&y(e).some(a=>a.state==="review")?X(n,"review",Y(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r(Oe,"re");function Y(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(Y,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var qe=["video/webm","video/mp4"],Q="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,ze=3,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),k,D=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(k,"k"),k);function Ue(e){let t=$(e);return O(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?j(t):e.capture?.livePhoto?.oneCapture===!0)}r(Ue,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Le=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Le)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof m))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(je.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Je=new Set(["passed","review","processing","skipped"]);async function mt(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!qe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ve(e,t.keyframe),a=Ge(e,n,i,s),c=Be(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let h=W(p),C=h?.checkType,q=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(h?.id)&&o.size<2&&u?"face_match":null;if(q===null)return{kind:"settled"};if(q==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(q==="liveness"){d=!0;let f=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,f)&&o.add($(f)?.id);for(let ie of Z(p,f))o.add(ie);await e.applySubmit(f,"liveness");let _=O(e.getView(),"liveness")?.state;u=_===void 0||Je.has(_)}else{o.add(h?.id);let f=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Z(p,f))o.add(_);await e.applySubmit(f,"face_match")}}catch(f){if(e.isCancelled()||f instanceof D)return{kind:"cancelled"};let _=Xe(f);if(_.kind!=="resync"||l>=ze)return _;l+=1,await e.refreshView()}}}r(mt,"Fe");function Ve(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Q,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Q),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ve,"_e");function Ge(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Ue(e.getView())&&(a=null),e.onPhase("uploading");let[p,h]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let C=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(C.uploadUrl,t,n),(await u.completeMedia(C.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=h===null?null:{imageKey:h})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(h){throw h instanceof A?h:new A(h instanceof Error?h.message:String(h))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Ze(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Ge,"ge");function Be(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Be,"ye");function Ze(e){let t={width:e.width,height:e.height};for(let n of Qe)e[n]!==void 0&&(t[n]=e[n]);return t}r(Ze,"Se");var Qe=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"ke");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof m){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"be");var ft="form_answers_invalid",S,yt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,_t=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),T,vt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(T,"$"),T);function z(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(z,"I");function gt(e,t){if(t===void 0||!j(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=O(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return z(e.documents);case"poa":return z(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:z(n)}default:return null}}r(gt,"De");function Ye(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(Ye,"we");function bt(e){let t=e?.capture?.pick;return Ye(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(bt,"Be");function kt(e,t,n=null){return e==="choice"?t??n??"self":e}r(kt,"$e");var wt={"JP:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{12}$",check:null,registrySources:[],describe:"number must be the 12-digit Japanese driving licence number"},"JP:residence_permit":{normalize:"upper_no_space_or_hyphen",pattern:"^[A-Z]{2}[0-9]{8}[A-Z]{2}$",check:null,registrySources:[],describe:"number must be the 12-character residence card number: two letters, eight digits, two letters"},"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{m as a,v as b,it as c,st as d,rt as e,dt as f,ut as g,lt as h,be as i,y as j,F as k,ke as l,pt as m,j as n,Me as o,W as p,O as q,x as r,E as s,ht as t,Ce as u,ee as v,qe as w,Le as x,ne as y,mt as z,Ze as A,ft as B,yt as C,_t as D,vt as E,gt as F,Ye as G,bt as H,kt as I,wt as J};
|