@sekyro/elements 0.1.0-rc.1 → 0.1.0-rc.3
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 +17 -0
- package/dist/cdn/chunks/{background-monitor-GCMNCJMG-UXYQ5GX7.js → background-monitor-A7FKJOAG-K3WF3C2D.js} +1 -1
- package/dist/cdn/chunks/{camera-trait-HVV5ZEDI-JB4HN6S3.js → camera-trait-V4UAOPIQ-TFCPOCSU.js} +1 -1
- package/dist/cdn/chunks/{capture-session-doc-ELX6VK6Z-SDM3ILRA.js → capture-session-doc-WZMI5XPE-AZDHR6MQ.js} +1 -1
- package/dist/cdn/chunks/challenge-frame-NUGPTWFP-V3GGQN65.js +1 -0
- package/dist/cdn/chunks/{chunk-HQF66Y6S.js → chunk-2T6RLTDQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-6H22RNSK.js → chunk-434MMEWK.js} +1 -1
- package/dist/cdn/chunks/{chunk-FCTRNWRU.js → chunk-5K4YQOZN.js} +1 -1
- package/dist/cdn/chunks/chunk-6BRQUKUP.js +1 -0
- package/dist/cdn/chunks/{chunk-ZKLSZJFN.js → chunk-7MV4CI4L.js} +1 -1
- package/dist/cdn/chunks/{chunk-D334IAZJ.js → chunk-CW56KMMH.js} +1 -1
- package/dist/cdn/chunks/{chunk-BZ37D4FR.js → chunk-CXQO6QMQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-CMS5FVGM.js → chunk-EWTKC2C2.js} +1 -1
- package/dist/cdn/chunks/{chunk-BF6SE2AC.js → chunk-FV4TIWHC.js} +1 -1
- package/dist/cdn/chunks/{chunk-FEWP7HBJ.js → chunk-H22YHQ6V.js} +1 -1
- package/dist/cdn/chunks/{chunk-CYGAKCKG.js → chunk-LA2MA2UQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-FDWO4KXK.js → chunk-MJEQ5ANO.js} +1 -1
- package/dist/cdn/chunks/{chunk-KLE75SX4.js → chunk-POHYEXNR.js} +1 -1
- package/dist/cdn/chunks/{chunk-T4M2J44L.js → chunk-Q5ZVLMKQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-LYYAVERP.js → chunk-QOZB3DLY.js} +1 -1
- package/dist/cdn/chunks/{chunk-ZIC5GEH2.js → chunk-RKH7O2P5.js} +1 -1
- package/dist/cdn/chunks/chunk-SGUCIULX.js +3 -0
- package/dist/cdn/chunks/{chunk-YWPZG2MZ.js → chunk-SIPFHN7E.js} +1 -1
- package/dist/cdn/chunks/chunk-TKJVGZWP.js +33 -0
- package/dist/cdn/chunks/{chunk-36WGD7QV.js → chunk-UNQ3QO4U.js} +1 -1
- package/dist/cdn/chunks/{chunk-JM3CYFFZ.js → chunk-UQKRYXN5.js} +1 -1
- package/dist/cdn/chunks/{chunk-X767DBO7.js → chunk-WPRIGJHG.js} +1 -1
- package/dist/cdn/chunks/{chunk-IBOJTLL7.js → chunk-Y6PC7FZV.js} +1 -1
- package/dist/cdn/chunks/chunk-YRTHQZAW.js +1 -0
- package/dist/cdn/chunks/{chunk-7Y73DZJB.js → chunk-ZMHEKDRM.js} +1 -1
- package/dist/cdn/chunks/{chunk-U3UDWPBG.js → chunk-ZYZPLDA2.js} +1 -1
- package/dist/cdn/chunks/create-document-capture-OXPLKHOF-GVCM77EK.js +1 -0
- package/dist/cdn/chunks/create-portrait-capture-5VGYZUOK-N3333DJC.js +1 -0
- package/dist/cdn/chunks/{detector-scanic-F3Y5X3DF-FGVR4NEM.js → detector-scanic-23DAYT3H-AJXQA7H4.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-UL3ISHNS-WZLR5RSQ.js +1 -0
- package/dist/cdn/chunks/{eid-view-RZS6MLT6-35VSHTV3.js → eid-view-FKFEF42L-2OQYMKAB.js} +1 -1
- package/dist/cdn/chunks/email-otp-view-NRZCAJJ4-BJNXOVUF.js +1 -0
- package/dist/cdn/chunks/{flow-views-5L7JF3MM-M6C3RXSX.js → flow-views-N7LBFI55-27RU7EZG.js} +1 -1
- package/dist/cdn/chunks/icao-gate-T3BTOKFJ-BWMLKL7A.js +1 -0
- package/dist/cdn/chunks/icao-tuning-4ETMF53W-FRBTB5R7.js +1 -0
- package/dist/cdn/chunks/{landmarker-3BBP3RBY-DDXMOLGK.js → landmarker-KB7LVXAU-F7BQTP3H.js} +1 -1
- package/dist/cdn/chunks/mrz-band-VYHOTDHY-VEZ2J5IL.js +1 -0
- package/dist/cdn/chunks/overlay-de-KYSF3MDD-XORYFTYU.js +1 -0
- package/dist/cdn/chunks/overlay-es-36H5G6S5-22UFLFPZ.js +1 -0
- package/dist/cdn/chunks/overlay-pt-EB4UDBFE-CWJXQDCQ.js +1 -0
- package/dist/cdn/chunks/plan-runner-EP26JU6A-LU7KJ6JU.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-GQIBQY4U-TJUYRCTI.js → portrait-capture-view-6KZGPAJU-2O54W4SR.js} +1 -1
- package/dist/cdn/chunks/portrait-review-view-TBSABVSX-5SVU25AE.js +1 -0
- package/dist/cdn/chunks/{print-4WOMNRBE-DNXJ7ERA.js → print-SEWS3VHQ-HWJTHADG.js} +1 -1
- package/dist/cdn/chunks/proof-of-address-view-3GG3XEQK-CPQ2AQEQ.js +1 -0
- package/dist/cdn/chunks/upload-file-EGXXM6TQ-NNVVB5QQ.js +1 -0
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-XEY5ANJ6.js → chunk-2FHYNKUL.js} +1 -1
- package/dist/{chunk-7URX73UH.js → chunk-A75VY7L7.js} +1 -1
- package/dist/{chunk-72JW2LCH.js → chunk-APM7FCA2.js} +1 -1
- package/dist/{chunk-6NQ7EWA4.js → chunk-CFERAKA2.js} +1 -1
- package/dist/{chunk-IGC6OQZ2.js → chunk-JCCTKW23.js} +1 -1
- package/dist/{chunk-IBPUWYHJ.js → chunk-JUB6FRPB.js} +1 -1
- package/dist/chunk-LYFBZCIH.js +33 -0
- package/dist/{chunk-B6A5RXN4.js → chunk-PMIO3U3J.js} +1 -1
- package/dist/{chunk-AGPBG22V.js → chunk-PNTIMH72.js} +1 -1
- package/dist/{chunk-ESSKMX7I.js → chunk-UXPM24JI.js} +1 -1
- package/dist/{chunk-QE2B3MSJ.js → chunk-UZJG5SPC.js} +1 -1
- package/dist/chunk-WBXQX6DQ.js +1 -0
- package/dist/{chunk-RMV3BNWO.js → chunk-YPBTBTOU.js} +1 -1
- package/dist/{chunk-SEE6MST7.js → chunk-YZ6YGLNN.js} +1 -1
- package/dist/define.cjs +6 -6
- package/dist/define.js +1 -1
- package/dist/document-capture-view-UL3ISHNS-K636D7VR.js +1 -0
- package/dist/{eid-view-RZS6MLT6-2W2T3AWK.js → eid-view-FKFEF42L-ZXQWPIIA.js} +1 -1
- package/dist/email-otp-view-NRZCAJJ4-RANTR7SO.js +1 -0
- package/dist/{flow-views-5L7JF3MM-P55CCCOH.js → flow-views-N7LBFI55-DZ3PH2EP.js} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-KYSF3MDD-2ZNXM2N7.js +1 -0
- package/dist/overlay-es-36H5G6S5-VQWD57TO.js +1 -0
- package/dist/overlay-pt-EB4UDBFE-6VWPTFO2.js +1 -0
- package/dist/{portrait-capture-view-GQIBQY4U-AFPEUDLY.js → portrait-capture-view-6KZGPAJU-LAGNB7A4.js} +1 -1
- package/dist/portrait-review-view-TBSABVSX-MLNZZBL5.js +1 -0
- package/dist/proof-of-address-view-3GG3XEQK-FWM7OQ4K.js +1 -0
- package/dist/styles.css +15 -0
- package/package.json +2 -2
- package/sbom.cdx.json +153 -0
- package/dist/cdn/chunks/chunk-5FLR7RPJ.js +0 -1
- package/dist/cdn/chunks/chunk-CFJJD6T2.js +0 -1
- package/dist/cdn/chunks/chunk-PUO2VWDE.js +0 -33
- package/dist/cdn/chunks/chunk-X3BGM3B2.js +0 -1
- package/dist/cdn/chunks/create-document-capture-UHZJUZHC-YYZNCSW6.js +0 -1
- package/dist/cdn/chunks/create-portrait-capture-VRZZOMJS-I4FBRNBP.js +0 -1
- package/dist/cdn/chunks/document-capture-view-JE6IX4IE-2454PW6Z.js +0 -1
- package/dist/cdn/chunks/email-otp-view-WUQ5OGDD-YDSUKAN2.js +0 -1
- package/dist/cdn/chunks/icao-gate-SO6YJ7RV-MPW6W3QN.js +0 -1
- package/dist/cdn/chunks/icao-tuning-DCZCMCEQ-ZQSK7ZOV.js +0 -1
- package/dist/cdn/chunks/mrz-band-DCXFWDBD-OPMO6HYS.js +0 -1
- package/dist/cdn/chunks/overlay-de-JQ2FDZBA-HLFTXIF6.js +0 -1
- package/dist/cdn/chunks/overlay-es-WDYRSRHH-UXHTYCHD.js +0 -1
- package/dist/cdn/chunks/overlay-pt-AQMDWDWX-BD7TO6Y4.js +0 -1
- package/dist/cdn/chunks/plan-runner-ZHOYMRAO-RDS523K5.js +0 -1
- package/dist/cdn/chunks/portrait-review-view-XOQYQNU7-LPONGGFW.js +0 -1
- package/dist/cdn/chunks/turnstile-N4K4U2AI-SLP55XAA.js +0 -1
- package/dist/cdn/chunks/upload-file-C4MFKLT3-DXCNEDXP.js +0 -1
- package/dist/chunk-EIRNIJXL.js +0 -1
- package/dist/chunk-ZDF5JILV.js +0 -33
- package/dist/document-capture-view-JE6IX4IE-5HJYAEDX.js +0 -1
- package/dist/email-otp-view-WUQ5OGDD-NGI6PBX3.js +0 -1
- package/dist/overlay-de-JQ2FDZBA-FR25JPE4.js +0 -1
- package/dist/overlay-es-WDYRSRHH-PFDMX5D2.js +0 -1
- package/dist/overlay-pt-AQMDWDWX-LTD4N2DW.js +0 -1
- package/dist/portrait-review-view-XOQYQNU7-IPKAZBP6.js +0 -1
- /package/dist/cdn/chunks/{chunk-SK6UAYX2.js → chunk-2FETDQV5.js} +0 -0
- /package/dist/cdn/chunks/{chunk-RK4HVNRS.js → chunk-5QL6W6FW.js} +0 -0
- /package/dist/cdn/chunks/{chunk-HDJ6JFXX.js → chunk-IO7MUUC6.js} +0 -0
- /package/dist/cdn/chunks/{chunk-RRLXNT33.js → chunk-JS2IXPNL.js} +0 -0
- /package/dist/cdn/chunks/{chunk-ET7NCKUV.js → chunk-KHSYTJ46.js} +0 -0
- /package/dist/cdn/chunks/{chunk-CMDITVXF.js → chunk-KVTY4E6J.js} +0 -0
- /package/dist/cdn/chunks/{chunk-7HJH5Q4M.js → chunk-L22GFJQV.js} +0 -0
- /package/dist/cdn/chunks/{chunk-FAIDO3QL.js → chunk-L244IUB3.js} +0 -0
- /package/dist/cdn/chunks/{chunk-UZWMCNZI.js → chunk-P7K7ELYZ.js} +0 -0
- /package/dist/cdn/chunks/{chunk-JOZCJGRV.js → chunk-YVQ6LFN4.js} +0 -0
- /package/dist/cdn/chunks/{clip-inspect-HZ7N2YOP-DCDXB76T.js → clip-inspect-DLJXVKV6-TNHTD4LV.js} +0 -0
- /package/dist/cdn/chunks/{keyframe-rank-R4NPQGN3-VRURE6OQ.js → keyframe-rank-YAJLYJYF-WCA6RPMD.js} +0 -0
- /package/dist/cdn/chunks/{scanic-ml-stub-XPNKT2N3-YSXFN7KY.js → scanic-ml-stub-KW7IZHUT-XLERBDWM.js} +0 -0
- /package/dist/cdn/chunks/{segmenter-3CVPTZMM-WGI6XGWN.js → segmenter-USLNBX65-HFEEUGXG.js} +0 -0
- /package/dist/{chunk-TPIBYY2S.js → chunk-N2DNXUEA.js} +0 -0
- /package/dist/{chunk-RPLVIGTS.js → chunk-SSU37LFQ.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sekyro/elements
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Carries the @sekyro/react release of this version: the changes in its changelog reach the element.
|
|
8
|
+
- Updated dependencies [246b0f3]
|
|
9
|
+
- Updated dependencies [cc7eedb]
|
|
10
|
+
- @sekyro/web@0.1.0-rc.26
|
|
11
|
+
|
|
12
|
+
## 0.1.0-rc.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Carries the @sekyro/react release of this version: the changes in its changelog reach the element.
|
|
17
|
+
- Updated dependencies [0d23a56]
|
|
18
|
+
- @sekyro/web@0.1.0-rc.25
|
|
19
|
+
|
|
3
20
|
## 0.1.0-rc.1
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-Y6PC7FZV.js";import"./chunk-KHSYTJ46.js";import"./chunk-4FHWXBOB.js";export{o as createBackgroundMonitor};
|
package/dist/cdn/chunks/{camera-trait-HVV5ZEDI-JB4HN6S3.js → camera-trait-V4UAOPIQ-TFCPOCSU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as e,c as r,d as o}from"./chunk-
|
|
1
|
+
import{a,b as e,c as r,d as o}from"./chunk-KVTY4E6J.js";import"./chunk-4FHWXBOB.js";export{a as bounded,r as cameraHash,e as hex16,o as noteCameraTrait};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-
|
|
1
|
+
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-ZMHEKDRM.js";import"./chunk-WPRIGJHG.js";import"./chunk-2FETDQV5.js";import"./chunk-EWTKC2C2.js";import"./chunk-L22GFJQV.js";import"./chunk-434MMEWK.js";import"./chunk-P7K7ELYZ.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{i as CAPTURE_CANDIDATE_SPACING_MS,p as CAPTURE_EXTRA_CANDIDATES,C as CaptureSessionDoc,o as DOC_BLACK_FRAME_LUMA,r as DOC_BLACK_FRAME_TICKS,_ as DOC_CADENCE_HZ,s as DOC_FIRST_FRAME_MS,t as DOC_SHUTTER_DEFAULTS,D as passportBandOf,A as resolveDocShutterTuning,a as warmDocDetector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-4FHWXBOB.js";var k=new Set(["challenge_frame_blocked","challenge_script_blocked","site_key_rejected","challenge_failed","timeout","embedder_opaque"]),f,o=(f=class extends Error{constructor(t,n){super(`Sekyro challenge failed: ${t}${n!==void 0?` (${n})`:""}`),this.name="ChallengeError",this.code=t,n!==void 0&&(this.detail=n)}},i(f,"i"),f),b=1e4,p=3e4,E="sekyro.challenge.",T="position:fixed;width:1px;height:1px;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none;border:0",d=null,m=Promise.resolve();function S(){h(),m=Promise.resolve(),g=!1}i(S,"A");function u(){return new o("aborted")}i(u,"d");function L(){let e=globalThis.crypto;return e!==void 0&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}i(L,"k");function v(e){return new URL(e,document.baseURI).origin}i(v,"y");function h(){let e=d;if(e!==null){d=null,window.removeEventListener("message",e.listener),e.iframe.remove();for(let t of e.waiters.values())t.reject(new o("challenge_frame_blocked"));e.waiters.clear()}}i(h,"u");function R(e,t){if(t.source!==e.iframe.contentWindow||t.origin!==e.origin)return;let n=t.data;if(typeof n!="object"||n===null)return;let r=n;if(typeof r.type!="string"||!r.type.startsWith(E)||r.v!==1)return;if(r.type==="sekyro.challenge.ready"){e.isReady=!0,e.onReady?.();return}if(typeof r.id!="string")return;let l=e.waiters.get(r.id);if(l!==void 0){if(r.type==="sekyro.challenge.token"&&typeof r.token=="string"&&r.token!=="")e.waiters.delete(r.id),l.resolve(r.token);else if(r.type==="sekyro.challenge.error"){e.waiters.delete(r.id);let a=typeof r.code=="string"&&k.has(r.code)?r.code:"challenge_failed",s=typeof r.detail=="string"||typeof r.detail=="number"?String(r.detail).slice(0,32):void 0;l.reject(new o(a,s))}}}i(R,"C");function U(e){if(d!==null&&d.url===e)return d;h();let t=document.createElement("iframe");t.setAttribute("title","Security check"),t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("style",T);let n={url:e,origin:v(e),iframe:t,isReady:!1,onReady:null,waiters:new Map,listener:i(r=>R(n,r),"listener")};return window.addEventListener("message",n.listener),t.src=e,document.body.appendChild(t),d=n,n}i(U,"M");function x(e,t,n){return e.isReady?Promise.resolve():new Promise((r,l)=>{let a=i(()=>{clearTimeout(c),n?.removeEventListener("abort",s),e.onReady=null},"o"),s=i(()=>{a(),l(u())},"s"),c=setTimeout(()=>{a(),l(new o("challenge_frame_blocked"))},t);n?.addEventListener("abort",s,{once:!0}),e.onReady=()=>{a(),r()}})}i(x,"x");async function w(e){let t=e.signal;if(t?.aborted)throw u();let n=U(e.frameUrl);await x(n,e.readyTimeoutMs??b,t);let r=n.iframe.contentWindow;if(r===null)throw new o("challenge_frame_blocked");let l=e.timeoutMs??p,a=L(),s,c;try{return await new Promise((_,y)=>{n.waiters.set(a,{resolve:_,reject:y}),s=setTimeout(()=>y(new o("timeout")),l),t!==void 0&&(c=i(()=>y(u()),"l"),t.addEventListener("abort",c,{once:!0})),r.postMessage({type:"sekyro.challenge.request",v:1,id:a,siteKey:e.siteKey,action:e.action,subject:e.subject},n.origin)})}finally{clearTimeout(s),t!==void 0&&c!==void 0&&t.removeEventListener("abort",c),n.waiters.delete(a)}}i(w,"h");var g=!1;function A(e,t){if(g)return;let n;if(t==="challenge_frame_blocked"){let r=e;try{r=v(e)}catch{}n=`Sekyro: the security check frame could not load. Allow \`frame-src ${r}\` in your Content-Security-Policy.`}else if(t==="embedder_opaque")n="Sekyro: the security check needs a page with an origin. Do not run the SDK in a sandboxed or data: document.";else return;g=!0,console.warn(n)}i(A,"R");async function C(e){if(globalThis.origin==="null")throw new o("embedder_opaque");if(e.signal?.aborted)throw u();try{return await w(e)}catch(t){if(h(),e.signal?.aborted||t instanceof o&&t.code==="aborted")throw u();try{return await w(e)}catch(n){throw h(),e.signal?.aborted?u():n instanceof o?n:new o("challenge_failed")}}}i(C,"S");function M(e){let t=i(()=>C(e).catch(r=>{throw r instanceof o&&A(e.frameUrl,r.code),r}),"n"),n=m.then(t,t);return m=n.catch(()=>{}),n}i(M,"T");export{p as CHALLENGE_EXECUTE_TIMEOUT_MS,b as CHALLENGE_READY_TIMEOUT_MS,o as ChallengeError,M as executeChallenge,S as resetChallengeFrameForTests};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as xr}from"./chunk-FDWO4KXK.js";import{c as _t}from"./chunk-X3BGM3B2.js";import{b as gr,d as kr}from"./chunk-36WGD7QV.js";import{b as Sr,c as bt}from"./chunk-FCTRNWRU.js";import{a as mr,b as yr,c as vr,d as Le}from"./chunk-LYYAVERP.js";import{F as _r,K as Cr,L as wr,a as D,b as de,c as X,m as dr,n as Je,p as pr,q as Xe,r as hr,s as fr,t as kt,u as se,v as Ae,w as et,y as br}from"./chunk-YWPZG2MZ.js";import{b as or,c as lr,d as cr,g as ur}from"./chunk-ZKLSZJFN.js";import{b as gt}from"./chunk-6H22RNSK.js";import{a as s}from"./chunk-RK4HVNRS.js";import{f as ir}from"./chunk-D334IAZJ.js";import{a as i,c as E}from"./chunk-4FHWXBOB.js";var Mr=E(D(),1),v=E(de(),1),ee=E(de(),1),ye=E(D(),1),B=E(de(),1),_=E(D(),1),y=E(D(),1),st=E(D(),1),fe=E(de(),1),Qr=E(D(),1),Y=E(D(),1),it=E(D(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1);var ot=E(D(),1),pe=E(D(),1);var Q=E(D(),1);var M=E(D(),1),me=E(D(),1),Te=E(D(),1),Mt=E(de(),1),k=E(de(),1);function ie({className:e,children:t}){return(0,v.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}i(ie,"te");s(ie,"Svg");var Rt="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";function Rr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}i(Rr,"cn");s(Rr,"SunIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(Lr,"ln");s(Lr,"FaceUncoveredIcon");function Ar(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Ar,"un");s(Ar,"PhoneEyeLevelIcon");function Er(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(Er,"dn");s(Er,"LookStraightIcon");function Ir(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Ir,"pn");s(Ir,"CameraCheckIcon");function Ur(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}i(Ur,"fn");s(Ur,"CameraAskIcon");function jr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(jr,"mn");s(jr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Tr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Tr,"yn");s(Tr,"CheckIcon");function Pr(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Pr,"gn");s(Pr,"SpinnerIcon");var Ct=["light","uncover","eyeLevel","straight"],An={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Rr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(Lr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Ar,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(Er,{}),"icon")}};function Or({tips:e}){let t=Le(),n=(0,Mr.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?An[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Or,"vn");s(Or,"TipList");var En=220;function Br({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=kt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let R=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},En))},"choose");return(0,B.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,B.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,B.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,B.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,B.jsx)(se,{tone:"danger",children:(0,B.jsx)("span",{children:a})}):null,u==="buttons"?(0,B.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,B.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,B.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,B.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>R(p.id),"onClick"),children:[p.glyph!==void 0?(0,B.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,B.jsxs)("span",{className:"sekyro-card__body",children:[(0,B.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,B.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,B.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Br,"kn");s(Br,"ChoiceScreen");var qr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary"];function nt(e){return e!==null&&qr.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var In=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&In(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Un="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",jn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function Vr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(Vr,"wr");s(Vr,"speechAvailable");function wt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(wt,"bn");s(wt,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=wt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>wt(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Hr(e){if(!Vr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Hr,"Mn");s(Hr,"speechUsable");function Dr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Dr,"wn");s(Dr,"subscribeVoices");function He(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}i(He,"Ke");s(He,"clipIdentity");function St(e){e.pause(),e.removeAttribute("src"),e.load()}i(St,"Sn");s(St,"release");function $r(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,R)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,R!==void 0&&(C.onend=C.onerror=R),p.speak(C);return}}R?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let R=He(N);if(o.has(R))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(R,p)}},"warmClips");return{say(d){let N=d.url!==null?He(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let R=n,p=d.onEnd,j=p!==void 0?()=>{R===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{R===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:R}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Un),q=>q.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(R??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&St(e),e=null;for(let d of o.values())St(d);o.clear()}}}i($r,"Ln");s($r,"createVoicePlayer");var Tn="sekyro.voiceGuidance";function Fr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}i(Fr,"xn");s(Fr,"readVoicePreference");function Gr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Gr,"In");s(Gr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?_.useLayoutEffect:_.useEffect,On=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of qr){let o=a===Ve?null:je(e,a,t);o===null||n.has(He(o))||(n.add(He(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Kr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Tn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),R=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=$r()),C.current),[]),q=jn[e],$=a.speechFallback,f=$===void 0||$===!0?!0:$===!1?!1:$.includes(e),F=a.clips??t??On,oe=(0,_.useRef)(!1),le=(0,_.useRef)(F);Pn(()=>{le.current=F,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let L=Fr(o);L!==null&&(S.current=L,u(L))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Dr(()=>j(L=>L+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let L=f&&Hr(q);w(tt(F,e).length>0||L),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(F,Ve,e)!==null||L?"default":"none")},[r,F,c,e,f,q,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let L=tt(F,e);L.length>0&&A().prefetch(L)},[r,l,F,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(L=>{r||(oe.current=!0,A().unlock({lang:q,speech:f,...L?{prefetch:tt(le.current,e)}:{}}))},[r,A,q,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{R.current=!1,N(!1)},[]),O=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{R.current&&O()},[O]),he=(0,_.useCallback)((L,xe)=>{if(r)return;if(R.current){O();return}let ge=A();ge.stop(),R.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:L,lang:q,speech:f,onEnd:G})},[r,O,A,e,q,f,G]),K=(0,_.useCallback)(L=>{r||(L?V(!0):O(),o!==null&&Gr(o,L),S.current=L,u(L))},[r,V,O,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((L,xe)=>{if(r||!l)return;R.current&&G();let ge=je(le.current,L,e);A().say({url:ge,text:xe,lang:q,speech:f})},[r,l,e,A,q,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:O,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,O,x,d,he,ve])}i(Kr,"ht");s(Kr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i(zr,"vt");s(zr,"useSpeakGuidance");function at(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}i(at,"Pn");s(at,"retryCoachingOf");var De={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Zr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Le(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(De[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:De[t].tips.map(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Zr,"An");s(Zr,"CapturedPanel");function At(){try{return!1}catch{return!1}}i(At,"tt");s(At,"isDevBuild");var Bn=(0,Qr.createContext)(null);function Wr({state:e}){let t=Le(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ir,{}):e==="denied"?(0,we.jsx)(jr,{}):(0,we.jsx)(Ur,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}i(Wr,"Kn");s(Wr,"PermissionRow");function Yr({voice:e}){let t=Le();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Tr,{className:"sekyro-switch__check"}):null})})]})}i(Yr,"Un");s(Yr,"VoiceSwitch");function Jr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Le(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),R=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=R.current;if(R.current=e,f===e)return;let F=p.current;e!=="loading"&&(p.current=!1),Xr(I.current)&&(e==="failed"?N.current?.focus():F&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,q=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),$;return e==="failed"?$=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):$=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:q,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pr,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Or,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Wr,{state:n}),(0,U.jsx)(Yr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),$,(0,U.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}i(Jr,"Gn");s(Jr,"PreCaptureScreen");function Xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(Xr,"Or");s(Xr,"focusIsOurs");function en(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(en,"Fn");s(en,"useCameraStatus");function tn(e){return Et(e,"mobileRequired")}i(tn,"qn");s(tn,"useMobileRequired");function rn(e){return Et(e,"returning").required}i(rn,"Dn");s(rn,"useReturning");function Et(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(Et,"jn");s(Et,"useFlag");function nn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}i(nn,"$n");s(nn,"useCaptureMode");function sn(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}i(sn,"zn");s(sn,"useBusy");var qn=s(()=>"idle","serverSnapshot");function xt(e){return or(e!==void 0?{assetBaseUrl:e}:{})}i(xt,"Wn");s(xt,"preload");function an(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>cr(h,e),[e]),()=>lr(e),qn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{xt(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{xt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(an,"Qn");s(an,"useLivenessAssets");var Nr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&At()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(Nr),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,R]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[q,$]=(0,M.useState)(null),[f,F]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),O=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):ur(ce);o.current=H;let Ne=s(()=>V(H.facingMode??null),"readFacing");Ne();let $e=[H.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),$(null),F(null),h(Nr),d(!1),x(!1),R(null),A(null),O.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),R(null),O.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=O.current;O.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),H.on("frozen",({previewDataUrl:b})=>R(b)),H.on("profile",({animations:b})=>j(b==="reduced")),H.on("ramp",({colour:b})=>A(b)),H.on("captured",b=>{$(b),le(null),te.current.onCaptured?.(b)}),H.on("error",b=>{F(b);let ke=r?.reportCaptureIssue;ke!==void 0&&bt(Ee=>ke.call(r,Ee),Sr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();o.current=null,H.destroy()}},[r,t,n]);let L=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(J).catch(()=>!1)===!0;return H&&V(ce.facingMode??null),H},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:q,error:f,result:oe,facingMode:c,start:L,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(on,"Xn");s(on,"useLivenessHandle");var Vn=new Set(["national_number"]);function Nt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Vn.has(n));return t.length>0?{...e,options:t}:null}i(Nt,"er");s(Nt,"pending");function ln(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(Nt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(Nt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(ln,"tr");s(ln,"useMethodChoice");var Hn=["ar","fr","en"];function cn(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}i(cn,"oo");s(cn,"isClipUrl");function un(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Hn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!cn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(un,"so");s(un,"toVoiceClipMap");function dn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?un(t):null,[t]);return e===void 0?null:r}i(dn,"nr");s(dn,"useServerVoiceClips");function pn({voice:e}){let t=Le();return(0,Mt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Mt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(pn,"or");s(pn,"VoiceChip");var Dn=new Set(["abandoned","not_opened","cancelled","superseded"]),$n=800;function hn(e){return e===void 0||e!==!1&&e.length===Ct.length&&Ct.every(t=>e.includes(t))}i(hn,"uo");s(hn,"isDefaultTips");function fn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}i(fn,"po");s(fn,"carriesActivation");function mn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(mn,"fo");s(mn,"isNoticeObject");var Fn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function yn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(yn,"yo");s(yn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}i(vn,"go");s(vn,"isPostCapture");function Gn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:R,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let q=yr(t),$=(0,y.useMemo)(()=>mr(t,r),[t,r,q]),f=(0,y.useMemo)(()=>g=>$[g]??"",[$]),F=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(Bn),c=on({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:R,onError:p,onStateChange:j}),V=an(C,c.state==="idle"&&c.error===null),T=ln(e),G=T.choice!==null,O=tn(e),ve=rn(e),he=sn(e),K=en(),z=nn(e),te=z.session==="choice",L=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=dn(xe?e:void 0),P=Kr({locale:t,defaultClips:ge,options:I}),J=L?"environment":"user",ce=z.settled,H=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),$e=(0,y.useRef)(P.unlock);$e.current=P.unlock,(0,y.useEffect)(()=>{let g=H.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let qe of ne)g.removeEventListener(qe,Re,!0)},"disarm");function Re(qe){if(Ne.current){Ce();return}fn(qe)&&(Ne.current=!0,Ce(),$e.current())}i(Re,"Re"),s(Re,"onGesture");for(let qe of ne)g.addEventListener(qe,Re,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,Ut=!G&&!O.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),jt=Ut&&T.settled&&O.settled&&ce,bn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,Tt=Ut&&Pe&&!Ee.current,ct=(bn||Tt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!jt||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[jt,Pe,V.gate,ke]);let _n=Pe&&!G&&!O.required&&!(Tt&&V.gate==="ready"),[Pt,Ot]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Ot(!1);return}let g=!0;return Bt().then(ne=>{g&&Ot(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Vt}=z,Ie=L?"self":"assisted",Cn=(0,y.useCallback)(async()=>{await qt(Ie)&&Vt(Ie)},[qt,Vt,Ie]),Ht=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Ht==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Ht]);let Fe=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Dt=c.frozenPreview??Fe,Ue=e!==void 0,Z=yn(c.state),be=vn(c.state),Ge=Z||be,re=c.result,$t=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ft=Pt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{Cn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Oe=be||ut,Gt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":dr(Ze),[wn,Kt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Kt(Qe);return}if(!Z)return;let g=setTimeout(()=>Kt(Qe),$n);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",zt=L&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?wn:null,pt=dt?x:Me===null?"":f(Me);zr(P,Me,pt,Z);let Zt=(0,y.useRef)(d);Zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{Zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let Be=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Qt=ht!==void 0,Wt=I===void 0,Yt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Qt||!Wt||Yt.current||!At()||(Yt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Qt,Wt]);let Sn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,Be):P.supported?()=>(0,k.jsx)(pn,{voice:Be}):void 0,{summary:ft,summaryPlaying:Jt,toggleSummary:Xt,stopSummary:er}=P,We=w!==void 0&&w!=="",tr=We?w:f("capture.tips.summary"),rr=We?ft!=="none":ft==="partner"||ft==="default"&&hn(h),xn=(0,y.useMemo)(()=>rr?{playing:Jt,toggle:s(()=>Xt(tr,{clip:!We}),"toggle"),stop:er}:void 0,[rr,Jt,Xt,tr,er,We]),Nn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:Be}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,Be]),Mn=mn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=$t&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=$t&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Re=hr(t,ne);if(Re!==null)return f(Re.key).replace("{time}",Re.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),nr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Dn.has(_e.reason)?f("errors.session_expired"):null),Rn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,sr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Fn.has(Ye)||bt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,sr)})},[W,Ye,sr,e]);let ar=kt(),Ln=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(vr,{value:f,children:(0,k.jsxs)("div",{ref:H,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:F,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,O.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(pr(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Rn?(0,k.jsx)(X,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,nr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:nr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Oe&&Ue?f("capture.checking"):pt,coached:dt&&!(Oe&&Ue),note:Oe?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):zt),settled:Oe&&Ue,progress:c.gate.progress,phase:Gt,still:Oe?Dt:null,live:Ge,modeSwitch:Ft,...Pt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(gr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Gt,draining:c.draining,stillUrl:Dt,showChecking:Ue,operatorText:zt,voicePrompt:Sn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(kr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ft})}),Ln&&T.choice!==null?(0,k.jsx)(Br,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,_n?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,Mn,a?.intro!==void 0?a.intro(b,Nn):(0,k.jsx)(Jr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:Be,tips:h??Ct,summary:xn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Zr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?fr($,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Gn,"_i");s(Gn,"LivenessCapture");var It=E(D(),1),lt=E(D(),1),m=E(de(),1);var ks={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Kn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}i(Kn,"Y");s(Kn,"identityLabel");function zn(e,t){let[n,r]=(0,It.useState)(!1),[a,o]=(0,It.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(xr(u,e.strings))),t?.(u)})},"run")}}i(zn,"q");s(zn,"useChoiceAction");function gn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(gn,"O");s(gn,"FaceMark");var Zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Qn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(Qn,"te");s(Qn,"faceIntroRetryOf");var Wn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Yn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=_t(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:De[w].tips,I=(0,lt.useContext)(_r)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(gn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(kn,{retry:u,title:De[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Wn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(br,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Yn,"ne");s(Yn,"FaceIntro");var Jn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function kn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Jn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(Cr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:wr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(kn,"T");s(kn,"RetryNotice");function Xn(e){return gt(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(es,"ce");s(es,"androidBrowserIntent");export{Br as a,At as b,Bn as c,nn as d,Gn as e,ks as f,Kn as g,zn as h,Qn as i,Yn as j,Xn as k,es as l};
|
|
1
|
+
import{a as xr}from"./chunk-MJEQ5ANO.js";import{b as gr,d as kr}from"./chunk-UNQ3QO4U.js";import{b as Sr,c as bt}from"./chunk-5K4YQOZN.js";import{c as _t}from"./chunk-YRTHQZAW.js";import{a as mr,b as yr,c as vr,d as Le}from"./chunk-QOZB3DLY.js";import{F as _r,K as Cr,L as wr,a as D,b as de,c as X,m as dr,n as Je,p as pr,q as Xe,r as hr,s as fr,t as kt,u as se,v as Ae,w as et,y as br}from"./chunk-SIPFHN7E.js";import{b as or,c as lr,d as cr,g as ur}from"./chunk-7MV4CI4L.js";import{b as gt}from"./chunk-434MMEWK.js";import{a as s}from"./chunk-5QL6W6FW.js";import{f as ir}from"./chunk-CW56KMMH.js";import{a as i,c as E}from"./chunk-4FHWXBOB.js";var Mr=E(D(),1),v=E(de(),1),ee=E(de(),1),ye=E(D(),1),B=E(de(),1),_=E(D(),1),y=E(D(),1),st=E(D(),1),fe=E(de(),1),Qr=E(D(),1),Y=E(D(),1),it=E(D(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1);var ot=E(D(),1),pe=E(D(),1);var Q=E(D(),1);var M=E(D(),1),me=E(D(),1),Te=E(D(),1),Mt=E(de(),1),k=E(de(),1);function ie({className:e,children:t}){return(0,v.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}i(ie,"te");s(ie,"Svg");var Rt="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";function Rr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}i(Rr,"cn");s(Rr,"SunIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(Lr,"ln");s(Lr,"FaceUncoveredIcon");function Ar(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Ar,"un");s(Ar,"PhoneEyeLevelIcon");function Er(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(Er,"dn");s(Er,"LookStraightIcon");function Ir(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Ir,"pn");s(Ir,"CameraCheckIcon");function Ur(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}i(Ur,"fn");s(Ur,"CameraAskIcon");function jr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Rt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(jr,"mn");s(jr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Tr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Tr,"yn");s(Tr,"CheckIcon");function Pr(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Pr,"gn");s(Pr,"SpinnerIcon");var Ct=["light","uncover","eyeLevel","straight"],An={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Rr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(Lr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Ar,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(Er,{}),"icon")}};function Or({tips:e}){let t=Le(),n=(0,Mr.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?An[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Or,"vn");s(Or,"TipList");var En=220;function Br({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=kt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let R=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},En))},"choose");return(0,B.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,B.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,B.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,B.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,B.jsx)(se,{tone:"danger",children:(0,B.jsx)("span",{children:a})}):null,u==="buttons"?(0,B.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,B.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,B.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,B.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>R(p.id),"onClick"),children:[p.glyph!==void 0?(0,B.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,B.jsxs)("span",{className:"sekyro-card__body",children:[(0,B.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,B.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,B.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Br,"kn");s(Br,"ChoiceScreen");var qr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary"];function nt(e){return e!==null&&qr.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var In=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&In(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Un="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",jn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function Vr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(Vr,"wr");s(Vr,"speechAvailable");function wt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(wt,"bn");s(wt,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=wt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>wt(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Hr(e){if(!Vr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Hr,"Mn");s(Hr,"speechUsable");function Dr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Dr,"wn");s(Dr,"subscribeVoices");function He(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}i(He,"Ke");s(He,"clipIdentity");function St(e){e.pause(),e.removeAttribute("src"),e.load()}i(St,"Sn");s(St,"release");function $r(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,R)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,R!==void 0&&(C.onend=C.onerror=R),p.speak(C);return}}R?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let R=He(N);if(o.has(R))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(R,p)}},"warmClips");return{say(d){let N=d.url!==null?He(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let R=n,p=d.onEnd,j=p!==void 0?()=>{R===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{R===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:R}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Un),q=>q.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(R??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&St(e),e=null;for(let d of o.values())St(d);o.clear()}}}i($r,"Ln");s($r,"createVoicePlayer");var Tn="sekyro.voiceGuidance";function Fr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}i(Fr,"xn");s(Fr,"readVoicePreference");function Gr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Gr,"In");s(Gr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?_.useLayoutEffect:_.useEffect,On=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of qr){let o=a===Ve?null:je(e,a,t);o===null||n.has(He(o))||(n.add(He(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Kr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Tn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),R=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=$r()),C.current),[]),q=jn[e],$=a.speechFallback,f=$===void 0||$===!0?!0:$===!1?!1:$.includes(e),F=a.clips??t??On,oe=(0,_.useRef)(!1),le=(0,_.useRef)(F);Pn(()=>{le.current=F,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let L=Fr(o);L!==null&&(S.current=L,u(L))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Dr(()=>j(L=>L+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let L=f&&Hr(q);w(tt(F,e).length>0||L),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(F,Ve,e)!==null||L?"default":"none")},[r,F,c,e,f,q,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let L=tt(F,e);L.length>0&&A().prefetch(L)},[r,l,F,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(L=>{r||(oe.current=!0,A().unlock({lang:q,speech:f,...L?{prefetch:tt(le.current,e)}:{}}))},[r,A,q,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{R.current=!1,N(!1)},[]),O=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{R.current&&O()},[O]),he=(0,_.useCallback)((L,xe)=>{if(r)return;if(R.current){O();return}let ge=A();ge.stop(),R.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:L,lang:q,speech:f,onEnd:G})},[r,O,A,e,q,f,G]),K=(0,_.useCallback)(L=>{r||(L?V(!0):O(),o!==null&&Gr(o,L),S.current=L,u(L))},[r,V,O,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((L,xe)=>{if(r||!l)return;R.current&&G();let ge=je(le.current,L,e);A().say({url:ge,text:xe,lang:q,speech:f})},[r,l,e,A,q,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:O,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,O,x,d,he,ve])}i(Kr,"ht");s(Kr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i(zr,"vt");s(zr,"useSpeakGuidance");function at(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}i(at,"Pn");s(at,"retryCoachingOf");var De={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Zr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Le(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(De[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:De[t].tips.map(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Zr,"An");s(Zr,"CapturedPanel");function At(){try{return!1}catch{return!1}}i(At,"tt");s(At,"isDevBuild");var Bn=(0,Qr.createContext)(null);function Wr({state:e}){let t=Le(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ir,{}):e==="denied"?(0,we.jsx)(jr,{}):(0,we.jsx)(Ur,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}i(Wr,"Kn");s(Wr,"PermissionRow");function Yr({voice:e}){let t=Le();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Tr,{className:"sekyro-switch__check"}):null})})]})}i(Yr,"Un");s(Yr,"VoiceSwitch");function Jr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Le(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),R=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=R.current;if(R.current=e,f===e)return;let F=p.current;e!=="loading"&&(p.current=!1),Xr(I.current)&&(e==="failed"?N.current?.focus():F&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,q=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),$;return e==="failed"?$=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):$=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:q,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pr,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Or,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Wr,{state:n}),(0,U.jsx)(Yr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),$,(0,U.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}i(Jr,"Gn");s(Jr,"PreCaptureScreen");function Xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(Xr,"Or");s(Xr,"focusIsOurs");function en(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(en,"Fn");s(en,"useCameraStatus");function tn(e){return Et(e,"mobileRequired")}i(tn,"qn");s(tn,"useMobileRequired");function rn(e){return Et(e,"returning").required}i(rn,"Dn");s(rn,"useReturning");function Et(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(Et,"jn");s(Et,"useFlag");function nn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}i(nn,"$n");s(nn,"useCaptureMode");function sn(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}i(sn,"zn");s(sn,"useBusy");var qn=s(()=>"idle","serverSnapshot");function xt(e){return or(e!==void 0?{assetBaseUrl:e}:{})}i(xt,"Wn");s(xt,"preload");function an(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>cr(h,e),[e]),()=>lr(e),qn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{xt(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{xt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(an,"Qn");s(an,"useLivenessAssets");var Nr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&At()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(Nr),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,R]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[q,$]=(0,M.useState)(null),[f,F]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),O=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):ur(ce);o.current=H;let Ne=s(()=>V(H.facingMode??null),"readFacing");Ne();let $e=[H.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),$(null),F(null),h(Nr),d(!1),x(!1),R(null),A(null),O.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),R(null),O.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=O.current;O.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),H.on("frozen",({previewDataUrl:b})=>R(b)),H.on("profile",({animations:b})=>j(b==="reduced")),H.on("ramp",({colour:b})=>A(b)),H.on("captured",b=>{$(b),le(null),te.current.onCaptured?.(b)}),H.on("error",b=>{F(b);let ke=r?.reportCaptureIssue;ke!==void 0&&bt(Ee=>ke.call(r,Ee),Sr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();o.current=null,H.destroy()}},[r,t,n]);let L=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(J).catch(()=>!1)===!0;return H&&V(ce.facingMode??null),H},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:q,error:f,result:oe,facingMode:c,start:L,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(on,"Xn");s(on,"useLivenessHandle");var Vn=new Set(["national_number"]);function Nt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Vn.has(n));return t.length>0?{...e,options:t}:null}i(Nt,"er");s(Nt,"pending");function ln(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(Nt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(Nt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(ln,"tr");s(ln,"useMethodChoice");var Hn=["ar","fr","en"];function cn(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}i(cn,"oo");s(cn,"isClipUrl");function un(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Hn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!cn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(un,"so");s(un,"toVoiceClipMap");function dn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?un(t):null,[t]);return e===void 0?null:r}i(dn,"nr");s(dn,"useServerVoiceClips");function pn({voice:e}){let t=Le();return(0,Mt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Mt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(pn,"or");s(pn,"VoiceChip");var Dn=new Set(["abandoned","not_opened","cancelled","superseded"]),$n=800;function hn(e){return e===void 0||e!==!1&&e.length===Ct.length&&Ct.every(t=>e.includes(t))}i(hn,"uo");s(hn,"isDefaultTips");function fn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}i(fn,"po");s(fn,"carriesActivation");function mn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(mn,"fo");s(mn,"isNoticeObject");var Fn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function yn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(yn,"yo");s(yn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}i(vn,"go");s(vn,"isPostCapture");function Gn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:R,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let q=yr(t),$=(0,y.useMemo)(()=>mr(t,r),[t,r,q]),f=(0,y.useMemo)(()=>g=>$[g]??"",[$]),F=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(Bn),c=on({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:R,onError:p,onStateChange:j}),V=an(C,c.state==="idle"&&c.error===null),T=ln(e),G=T.choice!==null,O=tn(e),ve=rn(e),he=sn(e),K=en(),z=nn(e),te=z.session==="choice",L=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=dn(xe?e:void 0),P=Kr({locale:t,defaultClips:ge,options:I}),J=L?"environment":"user",ce=z.settled,H=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),$e=(0,y.useRef)(P.unlock);$e.current=P.unlock,(0,y.useEffect)(()=>{let g=H.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let qe of ne)g.removeEventListener(qe,Re,!0)},"disarm");function Re(qe){if(Ne.current){Ce();return}fn(qe)&&(Ne.current=!0,Ce(),$e.current())}i(Re,"Re"),s(Re,"onGesture");for(let qe of ne)g.addEventListener(qe,Re,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,Ut=!G&&!O.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),jt=Ut&&T.settled&&O.settled&&ce,bn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,Tt=Ut&&Pe&&!Ee.current,ct=(bn||Tt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!jt||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[jt,Pe,V.gate,ke]);let _n=Pe&&!G&&!O.required&&!(Tt&&V.gate==="ready"),[Pt,Ot]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Ot(!1);return}let g=!0;return Bt().then(ne=>{g&&Ot(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Vt}=z,Ie=L?"self":"assisted",Cn=(0,y.useCallback)(async()=>{await qt(Ie)&&Vt(Ie)},[qt,Vt,Ie]),Ht=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Ht==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Ht]);let Fe=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Dt=c.frozenPreview??Fe,Ue=e!==void 0,Z=yn(c.state),be=vn(c.state),Ge=Z||be,re=c.result,$t=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ft=Pt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{Cn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Oe=be||ut,Gt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":dr(Ze),[wn,Kt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Kt(Qe);return}if(!Z)return;let g=setTimeout(()=>Kt(Qe),$n);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",zt=L&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?wn:null,pt=dt?x:Me===null?"":f(Me);zr(P,Me,pt,Z);let Zt=(0,y.useRef)(d);Zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{Zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let Be=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Qt=ht!==void 0,Wt=I===void 0,Yt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Qt||!Wt||Yt.current||!At()||(Yt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Qt,Wt]);let Sn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,Be):P.supported?()=>(0,k.jsx)(pn,{voice:Be}):void 0,{summary:ft,summaryPlaying:Jt,toggleSummary:Xt,stopSummary:er}=P,We=w!==void 0&&w!=="",tr=We?w:f("capture.tips.summary"),rr=We?ft!=="none":ft==="partner"||ft==="default"&&hn(h),xn=(0,y.useMemo)(()=>rr?{playing:Jt,toggle:s(()=>Xt(tr,{clip:!We}),"toggle"),stop:er}:void 0,[rr,Jt,Xt,tr,er,We]),Nn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:Be}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,Be]),Mn=mn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=$t&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=$t&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Re=hr(t,ne);if(Re!==null)return f(Re.key).replace("{time}",Re.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),nr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Dn.has(_e.reason)?f("errors.session_expired"):null),Rn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,sr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Fn.has(Ye)||bt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,sr)})},[W,Ye,sr,e]);let ar=kt(),Ln=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(vr,{value:f,children:(0,k.jsxs)("div",{ref:H,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:F,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,O.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(pr(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Rn?(0,k.jsx)(X,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,nr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:nr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Oe&&Ue?f("capture.checking"):pt,coached:dt&&!(Oe&&Ue),note:Oe?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):zt),settled:Oe&&Ue,progress:c.gate.progress,phase:Gt,still:Oe?Dt:null,live:Ge,modeSwitch:Ft,...Pt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(gr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Gt,draining:c.draining,stillUrl:Dt,showChecking:Ue,operatorText:zt,voicePrompt:Sn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(kr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ft})}),Ln&&T.choice!==null?(0,k.jsx)(Br,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,_n?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,Mn,a?.intro!==void 0?a.intro(b,Nn):(0,k.jsx)(Jr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:Be,tips:h??Ct,summary:xn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Zr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?fr($,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Gn,"_i");s(Gn,"LivenessCapture");var It=E(D(),1),lt=E(D(),1),m=E(de(),1);var ks={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Kn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}i(Kn,"Y");s(Kn,"identityLabel");function zn(e,t){let[n,r]=(0,It.useState)(!1),[a,o]=(0,It.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(xr(u,e.strings))),t?.(u)})},"run")}}i(zn,"q");s(zn,"useChoiceAction");function gn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(gn,"O");s(gn,"FaceMark");var Zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Qn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(Qn,"te");s(Qn,"faceIntroRetryOf");var Wn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Yn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=_t(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:De[w].tips,I=(0,lt.useContext)(_r)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(gn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(kn,{retry:u,title:De[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Wn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(br,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Yn,"ne");s(Yn,"FaceIntro");var Jn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function kn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Jn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(Cr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:wr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(kn,"T");s(kn,"RetryNotice");function Xn(e){return gt(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(es,"ce");s(es,"androidBrowserIntent");export{Br as a,At as b,Bn as c,nn as d,Gn as e,ks as f,Kn as g,zn as h,Qn as i,Yn as j,Xn as k,es as l};
|
|
@@ -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.26",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-SEWS3VHQ-HWJTHADG.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 g=await i,p=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...g?[{kind:"web_fp",value:g}]:[]],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-V4UAOPIQ-TFCPOCSU.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{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-SIPFHN7E.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as te,b as fe,c as ge,d as ve,f as ye}from"./chunk-2FETDQV5.js";import{c as we,d as Me}from"./chunk-EWTKC2C2.js";import{e as Y}from"./chunk-7MV4CI4L.js";import{e as me,j as he}from"./chunk-CW56KMMH.js";import{g as ee}from"./chunk-JS2IXPNL.js";import{a as n}from"./chunk-4FHWXBOB.js";var qe={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 Be(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,c=r==="4g"||l!=null&&l>=5,v=t!=null&&t>=6,f;s||d?f="low":c&&v?f="good":f="mid";let y=qe[f],M=u&&u>0?Math.min(y.maxLongEdge,u):y.maxLongEdge;return{tier:f,...y,maxLongEdge:M}}n(Be,"Ve");function ze(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),Be(t)}n(ze,"we");function Ie(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))}n(Ie,"Ye");function Oe(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))}}n(Oe,"Qe");async function Ue(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}}n(Ue,"Ke");async function Ne(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=Oe(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let c=d.getContext("2d");if(!c)return null;c.drawImage(e,0,0,u,s);let v=n(q=>new Promise((g,m)=>{d.toBlob(h=>h?g(h):m(new Error("canvas toBlob returned null")),"image/jpeg",q)}),"f"),f=Ie(l,i.qMin,i.qMax),{blob:y,quality:M}=await Ue(v,{startQ:f,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(y.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:y,quality:M,width:u,height:s}}n(Ne,"Ce");async function Ve(e){let t=ze(Math.max(e.width,e.height)),r=await Ne(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}}n(Ve,"ee");function Ce(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}}n(Ce,"ne");var Re=n(e=>e==="recto"?"verso":"recto","xe"),Ae=n(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","ve"),oe=n(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"re");function re(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}}n(re,"te");function je(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,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!Ae(e))return d;if(e.needFlip&&!l){if(!t.ready)return{...d,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...d,goodSince:void 0,phase:e.restPhase};let v=e.goodSince??r;return r-v>=1800?{...d,goodSince:v,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...d,goodSince:v,phase:e.restPhase}}return t.ready?{...d,phase:"capturing",goodSince:e.goodSince??r}:{...d,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}n(je,"je");function He(e,t){if(!Ae(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}n(He,"$e");function Ge(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||oe({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}}n(Ge,"Je");function Le(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:Re(r),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}n(Le,"Le");function _e(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return Le(e,t,r);let i=e.pending.filter(c=>c!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(oe(l)!==1||e.layout==="singlePage")return l;let u=Re(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}}n(_e,"Ze");function Qe(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(v=>v!==r),u=e.layout==="twoSided"&&oe({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,c=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(v=>v!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:c,restPhase:c,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}n(Qe,"et");function Ye(e,t){switch(t.type){case"report":return je(re(e,t.at),t.report,t.at);case"tick":return He(re(e,t.at),t.at);case"captured":return Ge(re(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 _e(e,t.id,t.side);case"duplicate":return Le(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 Qe(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{...Ce(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}n(Ye,"Te");function Je(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}n(Je,"tt");async function $e(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return Je(r,e,t)}n($e,"nt");async function be(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 $e(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}n(be,"oe");var ae=n((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"ae"),J=n(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Y");async function Ke(e,t,r,i){let l=i.decode??(c=>createImageBitmap(c)),u=n(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"c"),s;try{s=await u()}catch{try{await new Promise(c=>setTimeout(c,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:ae(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[J(d[0]),J(d[1]),J(Math.min(d[2],1-d[0])),J(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:ae(r.framesToValid,1,1e3),msToValid:ae(r.msToValid,0,12e4)}}n(Ke,"_e");var Ze=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]),Xe=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 et(e,t=globalThis){let r=t.WebAssembly?.validate;if(typeof r!="function")return{ok:!1,reason:"simd"};try{if(!r.call(t.WebAssembly,Ze)||!r.call(t.WebAssembly,Xe))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let i=t.navigator?.deviceMemory;return typeof i=="number"&&i<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}n(et,"Ee");function tt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}n(tt,"Oe");var U,E=(U=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},n(U,"_"),U);function ke(){let e=n(t=>(t.close(),Promise.reject(new E("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:n(()=>{},"dispose")}}n(ke,"Pe");function rt(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 ke()}catch{return ke()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",m=>{let h=m.data,S=r.get(h.id);S&&(r.delete(h.id),S.resolve(h))});let d=n(()=>{for(let m of r.values())m.reject(new E("error"));r.clear(),v()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function c(m,h=[]){if(l)return Promise.reject(new E("disposed"));let S=++i;return new Promise((W,F)=>{r.set(S,{resolve:W,reject:F});try{t.postMessage({...m,id:S},h)}catch{r.delete(S),F(new E("error"))}})}n(c,"l");function v(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let m of r.values())m.reject(new E("disposed"));r.clear()}}n(v,"f");let f=(async()=>{let m=await c({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(m.kind==="failed")return m.reason;if(m.kind!=="ready")return"error";let h=await c({kind:"warmup"});return h.kind!=="ready"?"error":{warmupMs:h.warmupMs,downloadMs:m.downloadMs,cached:m.cached}})().catch(()=>"error"),y,M=new Promise(m=>{y=setTimeout(()=>m("timeout"),e.tuning.loadTimeoutMs)}),q=Promise.race([f,M]).then(m=>(clearTimeout(y),typeof m=="string"?v():s=!0,l&&typeof m!="string"?"error":m));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",v,{once:!0});async function g(m,h,S){if(l)throw h.close(),new E("disposed");if(!s)throw h.close(),new E("not_ready");if(u)throw h.close(),new E("busy");u=!0;let W;try{let F=new Promise((j,N)=>{W=setTimeout(()=>{N(new E("timeout")),v()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([c(m,[h]),F]);if(P.kind===S){let{id:j,...N}=P;return N}throw new E(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(W),u=!1}}return n(g,"w"),{ready:q,get busy(){return u},bandRead:n((m,h=e.tuning.detectorLimit)=>g({kind:"band",bitmap:m,detectorLimit:h},m,"band"),"bandRead"),stillRead:n((m,h,S=e.tuning.detectorLimit)=>g({kind:"still",bitmap:m,region:h,detectorLimit:S},m,"band"),"stillRead"),layoutRead:n((m,h)=>g({kind:"layout",bitmap:m,detectorLimit:h},m,"layout"),"layoutRead"),dispose:v}}n(rt,"Ae");var $="sekyro-ocr-1",ie=n(e=>e!==null&&typeof e=="object"?e:{},"ie"),R=n((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"v"),Se=n((e,t)=>typeof e=="boolean"?e:t,"Be"),xe=n(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"Ie");function at(e,t={}){let r=ie(e),i=ie(r.liveMrz),l=ie(r.frontLock),u=xe(t.engine??$),s=t.mode==="off",d=n(h=>h.enabled===!0?h.arm==="live"?"live":"control":null,"u"),c=d(i),v=d(l),f=n((h,S)=>!s&&S==="live"&&xe(h.minEngine??$)<=u,"p"),y=ve,M=f(i,c)?{detectorLimit:R(i.detectorLimit,320,1600,y.detectorLimit),bandMaxWidthPx:R(i.bandMaxWidthPx,320,4096,y.bandMaxWidthPx),minBandWidthPx:R(i.minBandWidthPx,0,4096,y.minBandWidthPx),bandTop:R(i.bandTop,0,.95,y.bandTop),minIntervalMs:R(i.minIntervalMs,0,5e3,y.minIntervalMs),stableReads:Math.round(R(i.stableReads,1,10,y.stableReads)),profileReads:Math.round(R(i.profileReads,1,100,y.profileReads)),maxReadMs:R(i.maxReadMs,50,6e4,y.maxReadMs),searchTimeoutMs:R(i.searchTimeoutMs,1e3,12e4,y.searchTimeoutMs),hint:Se(i.hint,!0),stillConfirm:Se(i.stillConfirm,!0)}:null,q=ge,g=n((h,S,W)=>R(l[h],S,W,q[h]),"h"),m=f(l,v)?{minLines:Math.round(g("minLines",1,50)),fillMin:g("fillMin",0,1),fillMax:g("fillMax",0,2),offsetMax:g("offsetMax",0,1),steadyFillDelta:g("steadyFillDelta",0,1),steadyOffsetDelta:g("steadyOffsetDelta",0,1),layoutShiftMax:g("layoutShiftMax",0,1),lineCountDelta:Math.round(g("lineCountDelta",0,50)),lockMs:g("lockMs",0,3e4),steadyMs:g("steadyMs",0,3e4),minFrames:Math.round(g("minFrames",1,100)),minIntervalMs:g("minIntervalMs",0,5e3),maxWidthPx:g("maxWidthPx",160,2048),detectorLimit:g("detectorLimit",320,1600),searchTimeoutMs:g("searchTimeoutMs",1e3,12e4)}:null;return{enabled:M!==null||m!==null,liveMrz:M,textLock:m,liveMrzArm:c,frontLockArm:v,load:{detectorLimit:M?.detectorLimit??m?.detectorLimit??y.detectorLimit,loadTimeoutMs:R(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:R(i.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:R(i.minDeviceMemoryGb,0,64,2)},reportSampleRate:R(i.reportSampleRate,0,1,1)}}n(at,"We");function it(e,t){return e.enabled?!(t.probe??et)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??tt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:rt({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}:{}})}:{ok:!1,reason:"off"}}n(it,"Fe");function nt(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"}n(nt,"at");var z=n(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"W"),ne=n((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"se");function ot(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??$,arm:e.arm,capture:e.capture,outcome:l,reads:ne(t?.reads??0,0,1e4)??0,browser:e.browser??nt()},s=n((d,c)=>{c!==void 0&&(u[d]=c)},"s");return s("format",t?.format),s("framesToValid",ne(t?.framesToValid,1,1e4)),s("msToValid",z(t?.msToValid)),s("framesToLock",ne(t?.framesToLock,1,1e4)),s("msToLock",z(t?.msToLock)),s("msToCapture",z(e.msToCapture)),s("readP50Ms",z(t?.readP50Ms)),s("readP90Ms",z(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",z(r.warmupMs)),s("downloadMs",z(r.downloadMs)),s("cached",r.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}n(ot,"ze");function Te(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}n(Te,"ue");var lt=2;async function st(e){let t=await import("./capture-session-doc-WZMI5XPE-AZDHR6MQ.js");return new t.CaptureSessionDoc(e)}n(st,"st");function dt(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}}}n(dt,"ut");function ut(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}n(ut,"ct");function vt(){import("./capture-session-doc-WZMI5XPE-AZDHR6MQ.js").then(e=>e.warmDocDetector()).catch(()=>{})}n(vt,"Ht");function yt(e){return ct(e,{}).handle}n(yt,"Xt");function ct(e,t){let r=me(),i=he({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=e.documentType==="passport"||e.side==="single",c=Ce(d?"singlePage":"twoSided",s());if(!d&&(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 v="idle",f=null,y=null,M=!0,q=0,g=0,m=!1,h=!1,S="",W=null,F,P=null,j=[],N=we.find(a=>a.docType===e.documentType)?.mrz==="none",x=t.webOcr!==void 0&&!N?at(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,V=null,I=x===null||!x.enabled?"off":null,H=null,G=null,le=new WeakMap,K="";if(x!==null&&x.enabled&&t.webOcr!==void 0){let a=t.webOcr,o=it(x,{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(o.ok){V=o.engine;let p=new ye({textLock:x.textLock,liveMrz:x.liveMrz});H=p;let w=o.engine;w.ready.then(A=>{I=A,typeof A!="string"&&M&&p.setEngine(w)})}else I=o.reason}let O=n(a=>{let o=JSON.stringify(a);o!==K&&(K=o,r.emit("mrz",a))},"z"),se=n((a,o)=>{let p=t.webOcr?.reports;if(p===void 0||x===null||a===void 0)return;let w=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",A=w!=="recto"?x.liveMrzArm??x.frontLockArm:x.frontLockArm;if(A===null||Math.random()>=x.reportSampleRate)return;let L=a.via==="live_mrz"?G:null,C=n(()=>{let D=L?.value??null;p([ot({arm:A,capture:w,assist:a.ocr??null,load:A==="control"?"off":I,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...D!==null&&D.stillConfirmed!==void 0?{stillConfirmed:D.stillConfirmed}:{},...o!==void 0?{typeMismatch:Te(o.format,e.documentType==="passport"?"passport":"card")}:{}})])},"x");L!==null&&L.value===null?Promise.race([L.promise,new Promise(D=>setTimeout(D,3e3))]).then(C):C()},"le"),B=n(a=>{!M||a===v||(v=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"I"),Pe=n((a,o)=>o===void 0?null:d?"single":a.captured.recto===o?"recto":a.captured.verso===o?"verso":null,"Ne"),De=n(a=>({phase:a.phase,captured:d?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(o=>a.captured[o]!==void 0),expected:d?null:a.current??null,notice:a.notice??null,lastShot:Pe(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:h}),"Ue"),de=n(()=>{let a=f;a!==null&&a.captureNow().catch(()=>T({type:"captureFailed",at:s()}))},"de");function T(a){if(!M)return;let o=c;c=Ye(c,a),c.phase==="capturing"&&o.phase!=="capturing"&&Promise.resolve().then(de),c.phase==="result"&&o.phase!=="result"&&(B("done"),ue());let p=De(c),w=JSON.stringify(p);w!==S&&(S=w,r.emit("scan",p))}n(T,"R");function ue(){P!==null&&clearInterval(P),P=null;for(let a of j.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}n(ue,"me");let ce=n(()=>f?.captureReport?.(),"pe"),Z=!1,pe=n((a,o)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,o)}catch{}},"fe"),_=n(a=>{K="",!(f===null||c.phase==="reading"||c.phase==="result")&&(Z=!1,f.rearm(d?"single":c.current??a))},"H"),Ee=n(async(a,o,p,w)=>{if(G=null,w!==void 0&&V!==null&&x?.liveMrz?.hint===!0){let b={promise:Ke(V,a,w,{engine:$,detectorLimit:x.liveMrz.detectorLimit}).catch(()=>null),value:null};b.promise.then(k=>{b.value=k}),G=b}w!==void 0&&Te(w.format,e.documentType==="passport"?"passport":"card")&&O({state:"mismatch",format:w.format});let A=ce();pe(A,"captured"),Z=!0,se(A,w);let L=p===void 0?W:p===null?null:{quad:dt(p),frameWidth:0,frameHeight:0,inStill:!0},C={decoded:null},D=n(()=>(C.decoded??(C.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),C.decoded),"E");try{await We(a,o,L,D,G)}finally{C.decoded!==null&&(await C.decoded)?.close()}},"Ge"),We=n(async(a,o,p,w,A)=>{let L=`shot-${q+=1}`;if(T({type:"captured",id:L,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!m&&u>0){let b=await(t.measureSharpness!==void 0?t.measureSharpness(a,p):w().then(k=>k===null?-1:fe(k,te(p?.quad??null,p?.inStill===!0?k:{width:p?.frameWidth??0,height:p?.frameHeight??0},k)))).catch(()=>-1);if(!M)return;if(Number.isFinite(b)&&b>=0&&b<u){m=!0;let k=d?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");T({type:"readFailed",side:k,id:L,issue:"blurry"}),_(k);return}}m=!1;let C;if(d)C="single";else{let b=c.current,k=await(t.classify!==void 0?t.classify(a):w().then(Q=>Q===null?b??"recto":p?.inStill===!0?be(Q,480,null,!0):be(Q,480,te(p?.quad??null,{width:p?.frameWidth??0,height:p?.frameHeight??0},Q)))).catch(()=>b??"recto");if(!M)return;if(c.captured[k]!==void 0&&g<lt){g+=1,T({type:"duplicate",id:L,side:k}),_(k==="recto"?"verso":"recto");return}C=c.captured[k]!==void 0&&b!==void 0?b:k,g=0,T({type:"classified",id:L,side:C})}let D=C==="verso"?"verso":"recto";try{let b=t.encode!==void 0?await t.encode(a):await w().then(k=>{if(k===null)throw new Error("the still could not be decoded");return Ve(k)});if(!M)return;A!==null&&le.set(b.blob,A),r.emit("captured",{image:b.blob,side:C,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:b.width,height:b.height,previewDataUrl:o}),t.deferRead!==!0&&T({type:"readOk",side:D})}catch(b){T({type:"readFailed",side:D,id:L,issue:"technical"}),r.emit("error",Y("generic",!0,{phase:"keyframes",name:ee(b)}))}_(D==="recto"?"verso":"recto")},"qe"),Fe=n(a=>{j.push(a.on("statechange",({state:o})=>{o==="preflight"||o==="acquiring"?B("starting"):o==="positioning"?B("scanning"):o==="captured"?B("captured"):o==="error"&&B("error")}),a.on("feedback",({key:o,reticle:p})=>r.emit("feedback",{key:o,reticle:p})),a.on("checks",o=>{r.emit("gate",{progress:o.p,quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight,...o.guide!==void 0?{guide:{detected:o.guide.detected,fill:o.guide.fill,offsetX:o.guide.offsetX??0,offsetY:o.guide.offsetY??0}}:{}});let p=o.ocr?.mrz;p!==void 0&&(p.state==="fallback"?O({state:"fallback",reason:p.reason}):p.state==="valid"?O({state:"valid",format:p.format}):p.state==="reading"?O({state:"reading",...p.format?{format:p.format}:{},...p.coach?{coach:p.coach}:{}}):O({state:"searching"}));let w=o.quad===null?0:ut(o.quad,o.frameWidth,o.frameHeight);W=o.quad===null?null:{quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight},T({type:"report",report:{present:o.quad!==null&&o.plausible||o.guide?.detected===!0,ready:o.ready===!0,locking:o.p>=.5,areaFrac:w},at:s()})}),a.on("error",({kind:o,retryable:p,detail:w})=>r.emit("error",Y(o,p,w))),a.on("artifacts",o=>{Ee(o.keyframe,o.previewDataUrl,o.docRegion,o.liveMrz)}))},"He"),X=n(()=>(y??(y=(async()=>{if(M){if(f===null){let a;try{a=await(t.createEngine??st)({...t.engineOptions??{},...F!==void 0?{guide:F}:{},video:e.video,format:Me(e.documentType),side:d?"single":e.side??"recto",autoCapture:!1,...H!==null?{ocr:H}:{}})}catch(p){B("error"),r.emit("error",Y("models",!0,{phase:"models",name:ee(p)}));return}if(!M){a.destroy();return}f=a,Fe(a);let o=t.tickMs??500;o>0&&(P=setInterval(()=>T({type:"tick",at:s()}),o))}T({type:"clockRestart"}),x!==null&&x.liveMrzArm==="live"&&(I==="unsupported"||I==="off")&&O({state:"fallback",reason:I}),await f.start()}})().finally(()=>{y=null})),y),"$");return{handle:{get state(){return v},on:n((a,o)=>r.on(a,o),"on"),start:X,retry:n(()=>{if(f===null&&c.phase==="result"){T({type:"retake"}),g=0,m=!1,X();return}if(f!==null&&v!=="error"){T({type:"retake"}),g=0,m=!1,f.rearm(d?"single":void 0);return}X()},"retry"),setSide:n(a=>{d||a==="single"||(c.current!==a&&(c={...c,current:a}),T({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f?.rearm(a))},"setSide"),shutter:de,focusAt:n((a,o)=>{f?.focusAt?.(a,o)},"focusAt"),setGuide:n(a=>{F=a,f?.setGuide?.(a)},"setGuide"),setTorch:n(a=>{h=a,f?.setTorch(a),T({type:"tick",at:s()})},"setTorch"),destroy:n(()=>{if(M&&f!==null&&v!=="done"){let a=ce();!Z&&a!==void 0&&a.ticks>0&&pe(a,"abandoned"),se(a,void 0)}M=!1,ue(),H?.setEngine(null),V?.dispose(),V=null,r.clear()},"destroy")},setFlowState:n(a=>{(c.phase==="reading"||c.phase==="result")&&B(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:n((a,o)=>{let p=a==="verso"?"verso":"recto";T(o.ok?{type:"readOk",side:p}:{type:"readFailed",side:p,issue:o.issue}),o.ok||_(p)},"settle"),takeDeviceRead:n(a=>le.get(a.image)?.value??null,"takeDeviceRead")}}n(ct,"lt");export{lt as a,vt as b,yt as c,ct as d};
|