@sekyro/elements 0.1.0-rc.10 → 0.1.0-rc.12
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/{capture-session-doc-2LIRRKFX-GZQBYOR3.js → capture-session-doc-FAMDLRRZ-QPOFTNTG.js} +1 -1
- package/dist/cdn/chunks/challenge-frame-YBTLAQ5G-NN763UU5.js +1 -0
- package/dist/cdn/chunks/chunk-3DDOCOIB.js +1 -0
- package/dist/cdn/chunks/{chunk-6N4AXKCS.js → chunk-4YBL75VD.js} +1 -1
- package/dist/cdn/chunks/{chunk-UQKRYXN5.js → chunk-5JSOPXYS.js} +1 -1
- package/dist/cdn/chunks/{chunk-SJAQ7DUY.js → chunk-5JWGGQBH.js} +1 -1
- package/dist/cdn/chunks/chunk-6MYG4HWP.js +1 -0
- package/dist/cdn/chunks/{chunk-NT7PZPBW.js → chunk-7JUL7AKT.js} +1 -1
- package/dist/cdn/chunks/{chunk-MZ6WG3QQ.js → chunk-AARN2MG7.js} +1 -1
- package/dist/cdn/chunks/{chunk-JDANRDDK.js → chunk-BMUUDLFA.js} +1 -1
- package/dist/cdn/chunks/{chunk-BZDKXIWD.js → chunk-CSKOH7QX.js} +1 -1
- package/dist/cdn/chunks/{chunk-NNYJYD3Q.js → chunk-CVFJQIMW.js} +1 -1
- package/dist/cdn/chunks/{chunk-ZRL6E7XH.js → chunk-FVWYONHZ.js} +1 -1
- package/dist/cdn/chunks/chunk-GPGK6XZM.js +1 -0
- package/dist/cdn/chunks/{chunk-MDDGAHO6.js → chunk-GZOBS7KG.js} +1 -1
- package/dist/cdn/chunks/{chunk-SVROKIYG.js → chunk-JI5WT66H.js} +1 -1
- package/dist/cdn/chunks/chunk-JJ3Q52P3.js +25 -0
- package/dist/cdn/chunks/{chunk-Q6GRUOR3.js → chunk-K4BLQMYZ.js} +1 -1
- package/dist/cdn/chunks/chunk-LBZCFEU4.js +33 -0
- package/dist/cdn/chunks/{chunk-52CHUGVC.js → chunk-Q5BUNNRN.js} +2 -2
- package/dist/cdn/chunks/{chunk-FVMJYXGV.js → chunk-SDK2YXFV.js} +1 -1
- package/dist/cdn/chunks/{chunk-X7QE75V5.js → chunk-UN4V3UNQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-YPIQ6IU7.js → chunk-VHNWBOKW.js} +1 -1
- package/dist/cdn/chunks/{chunk-PH7RJ5GZ.js → chunk-XDRH4VWV.js} +1 -1
- package/dist/cdn/chunks/chunk-XSGZY4JI.js +1 -0
- package/dist/cdn/chunks/{chunk-YGXNL7S2.js → chunk-YFJBTK3L.js} +1 -1
- package/dist/cdn/chunks/chunk-YLH3WX7Y.js +1 -0
- package/dist/cdn/chunks/create-document-capture-WFTNVMCE-QOCPJSAU.js +1 -0
- package/dist/cdn/chunks/{create-portrait-capture-5VGYZUOK-N3333DJC.js → create-portrait-capture-5VGYZUOK-KTCFCHTN.js} +1 -1
- package/dist/cdn/chunks/{detector-scanic-KMAVOHGF-NFYSZ7GU.js → detector-scanic-S4PB2RNW-3KSM3MW5.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-QMXAAYA2-5HJJKIZ4.js → document-capture-view-GENB535Z-YBRM7NWN.js} +1 -1
- package/dist/cdn/chunks/{eid-view-3QTJORA7-S7APLLOM.js → eid-view-IQRZGEMP-SPGYQDQP.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-6MD74OFN-PRYGFOHY.js → email-otp-view-CL76K5TY-TJMSLYLZ.js} +1 -1
- package/dist/cdn/chunks/flow-views-C3EIMXME-ODOF67JZ.js +1 -0
- package/dist/cdn/chunks/{form-view-YAGVGWMI-7BEAIBSC.js → form-view-MEYCK437-JBO5DNG5.js} +1 -1
- package/dist/cdn/chunks/overlay-de-LOQWEHOH-HSNQGD4A.js +1 -0
- package/dist/cdn/chunks/overlay-es-F54CKFZO-BTQKTR4A.js +1 -0
- package/dist/cdn/chunks/overlay-pt-NHIQY3JB-DQ7MH2QJ.js +1 -0
- package/dist/cdn/chunks/{plan-runner-T2ZTSBI4-SEXJ6KJP.js → plan-runner-LSQTIO6L-XZJIKXPZ.js} +1 -1
- package/dist/cdn/chunks/{portrait-capture-view-6EUUL2QA-7F2WSHIW.js → portrait-capture-view-VTN2VU3E-JH34ISLI.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-TTVTYGLG-SVRXTB4Q.js → portrait-review-view-JTRGDYNV-C2O6OFYY.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-5WWGRXJL-JQWHMWVI.js → proof-of-address-view-UQOZZXQO-T3QOIQNE.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-F2IYM4GV.js → chunk-6OZGEXX6.js} +1 -1
- package/dist/{chunk-M3SKGQUG.js → chunk-753PBLDK.js} +1 -1
- package/dist/chunk-BZGVYIDN.js +25 -0
- package/dist/{chunk-XJJ3KCLT.js → chunk-FBXU2OZN.js} +1 -1
- package/dist/{chunk-2WPZFQUP.js → chunk-FCIH6PVW.js} +1 -1
- package/dist/{chunk-SSSIPHG7.js → chunk-GA2DVM5C.js} +1 -1
- package/dist/{chunk-YC4IK7VG.js → chunk-HLMRVFVD.js} +1 -1
- package/dist/chunk-K7PFKAQD.js +1 -0
- package/dist/{chunk-PCLZBE2D.js → chunk-KNWOL5RR.js} +1 -1
- package/dist/chunk-LGFZBFVB.js +33 -0
- package/dist/{chunk-GIMNUGVE.js → chunk-PYQREZ33.js} +1 -1
- package/dist/{chunk-DMESMWZ7.js → chunk-W6ODZ5JK.js} +1 -1
- package/dist/{chunk-NQQZCBHQ.js → chunk-XEWL7C6M.js} +1 -1
- package/dist/{chunk-F67N4IZQ.js → chunk-ZUVOUGIA.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-QMXAAYA2-62JPLXV7.js → document-capture-view-GENB535Z-L5V7YSPP.js} +1 -1
- package/dist/{eid-view-3QTJORA7-TLA52WL7.js → eid-view-IQRZGEMP-LAMWORUL.js} +1 -1
- package/dist/{email-otp-view-6MD74OFN-WVIWSE4A.js → email-otp-view-CL76K5TY-C7O472UB.js} +1 -1
- package/dist/flow-views-C3EIMXME-GGE4OUEO.js +1 -0
- package/dist/{form-view-YAGVGWMI-CWM5GSJJ.js → form-view-MEYCK437-356QICGF.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-LOQWEHOH-YIQXHAUD.js +1 -0
- package/dist/overlay-es-F54CKFZO-JNTVTVWI.js +1 -0
- package/dist/overlay-pt-NHIQY3JB-V5CJ5SGF.js +1 -0
- package/dist/{portrait-capture-view-6EUUL2QA-ZTAGMPU2.js → portrait-capture-view-VTN2VU3E-2HKWLWRG.js} +1 -1
- package/dist/{portrait-review-view-TTVTYGLG-HVTGBDRR.js → portrait-review-view-JTRGDYNV-TNR7WBYD.js} +1 -1
- package/dist/{proof-of-address-view-5WWGRXJL-3BWMP23I.js → proof-of-address-view-UQOZZXQO-XJTGU3G6.js} +1 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/challenge-frame-YAQJ5YMB-MHZYRGKY.js +0 -1
- package/dist/cdn/chunks/chunk-574O5HZZ.js +0 -1
- package/dist/cdn/chunks/chunk-5FPDMYLD.js +0 -33
- package/dist/cdn/chunks/chunk-BIK4PGBE.js +0 -1
- package/dist/cdn/chunks/chunk-CW56KMMH.js +0 -1
- package/dist/cdn/chunks/chunk-LAF6JZRH.js +0 -1
- package/dist/cdn/chunks/chunk-WKQRKYX4.js +0 -25
- package/dist/cdn/chunks/chunk-X42LECG5.js +0 -1
- package/dist/cdn/chunks/create-document-capture-X35M4UAK-BB2SCTPK.js +0 -1
- package/dist/cdn/chunks/flow-views-AEVFAZOT-DUBO6WU5.js +0 -1
- package/dist/cdn/chunks/overlay-de-U5AM34SS-UPJSNTKZ.js +0 -1
- package/dist/cdn/chunks/overlay-es-LS4JWU5J-UFZMJAU6.js +0 -1
- package/dist/cdn/chunks/overlay-pt-M4ZJJRFE-HJIXIX5G.js +0 -1
- package/dist/chunk-BCDTYNQ3.js +0 -1
- package/dist/chunk-K5DAJSLX.js +0 -25
- package/dist/chunk-W23RACX3.js +0 -33
- package/dist/flow-views-AEVFAZOT-PKXWQC2K.js +0 -1
- package/dist/overlay-de-U5AM34SS-ISYPWAT7.js +0 -1
- package/dist/overlay-es-LS4JWU5J-2VRTV7R4.js +0 -1
- package/dist/overlay-pt-M4ZJJRFE-UCQAZFCI.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as Je,F as ue,G as W,H as Qe,I as Xe,J as et,a as I,b as Ue,c as Fe,f as je,g as Ke,h as Be,i as Ve,j as se,k as $e,m as P,o as M,p as O,q as j,r as Z,s as E,t as le,v as He,w as ze,x as Ze,y as We,z as Ye}from"./chunk-
|
|
1
|
+
import{A as Je,F as ue,G as W,H as Qe,I as Xe,J as et,a as I,b as Ue,c as Fe,f as je,g as Ke,h as Be,i as Ve,j as se,k as $e,m as P,o as M,p as O,q as j,r as Z,s as E,t as le,v as He,w as ze,x as Ze,y as We,z as Ye}from"./chunk-YLH3WX7Y.js";import{f as nt}from"./chunk-GPGK6XZM.js";import{b as Ge}from"./chunk-4YBL75VD.js";import{b as qe,c as oe,e as tt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Et(r){return r.idNumberBound??r.nniBound}t(Et,"ae");function rt(r){return r===void 0?void 0:r.idNumberFromDocument??r.nniFromDocument}t(rt,"ee");var ot="https://api.sekyro.ai",Rt=5e3,Nt=24e4,Pt=9e4,Ot=25*6e4,Lt=20*6e4,Dt=3,qt=3e3,Gt=1500,Ut=10;function it(r){return r instanceof Error&&r.name==="ChallengeError"&&r.code||"challenge_failed"}t(it,"St");var at=new Set(["aborted","embedder_opaque","site_key_rejected"]);function Ft(r){return new Promise(l=>setTimeout(l,r))}t(Ft,"un");function jt(){let r=globalThis.crypto;if(r!==void 0&&typeof r.randomUUID=="function")return r.randomUUID();let l=new Uint8Array(16);if(r!==void 0&&typeof r.getRandomValues=="function")r.getRandomValues(l);else for(let f=0;f<16;f+=1)l[f]=Math.floor(Math.random()*256);l[6]=(l[6]??0)&15|64,l[8]=(l[8]??0)&63|128;let p=[...l].map(f=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}t(jt,"cn");function Kt(r){return Bt(r,{})}t(Kt,"wo");function Bt(r,l){let p=r.apiOrigin??ot,f=r.autoRetry??!0,dt=r.rearm??"auto",K=l.client??new Fe({apiOrigin:p,sessionToken:r.clientToken,fetch:r.fetch}),y=new Proxy(K,{get(e,n){if(n==="submitCheck")return _t;let i=Reflect.get(e,n,e);return typeof i=="function"?i.bind(e):i}}),D=l.sleep??Ft,pe=l.uuid??jt,pt=l.getChallengeToken??((e,n)=>import("./challenge-frame-YBTLAQ5G-NN763UU5.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:n.subject,signal:n.signal}))),S=tt(),R=null,fe=null,u=!1,me=new AbortController,c=null,B=null,V=null,$=t(()=>V??Qe(c),"ne"),he=t(()=>Xe(W(c),$()),"Re"),b=t(e=>{c=e,!M(e)&&(xe(Lt)||yt(e))&&ie(e),S.emit("view",e),R?.onView(e)},"O"),v=t(()=>c!==null?Promise.resolve(c):(B??(B=y.getSession().then(e=>(b(e),e)).finally(()=>{B=null})),B),"A"),k=t(async()=>{let e=await y.getSession();return b(e),e},"E"),Y=t(async(e,n)=>{e.plan!==void 0?b(e):await k()},"de"),H=null,ye=t(async e=>{let n=await v();if(e||!n.consentRecorded){let i=await y.recordConsent(r.locale);i.plan!==void 0?b(i):c!==null&&b({...c,consentRecorded:!0})}z()&&ie(n)},"Ie"),A=t(e=>e?.force===!0?ye(!0):(H??(H=ye(!1).finally(()=>{H=null})),H),"N"),J={client:y,ensureConsent:t(e=>A(e),"ensureConsent"),sleep:D,uuid:pe,...l.random!==void 0?{random:l.random}:{},onBusy:t(e=>{u||S.emit("busy",e)},"onBusy")},ve=!1,_e=null,Q=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(ve)return;ve=!0}_e=JSON.stringify(e),S.emit("result",e)},"fe"),ft=t(e=>{_e!==JSON.stringify(e)&&Q(e)},"Nt"),ge=t(async e=>{let n=c;e&&(n=await k().catch(()=>c));let i=n===null?null:P(n);return i!==null&&!u&&S.emit("method",i),i!==null},"Ee"),X=null,be=!1,ke=!1,we=t(()=>We(J,(e,n)=>e.submitCheck("population_registry",{},{idempotencyKey:n})),"Ne"),Ae=t(e=>Et(e)===!0||rt(j(e,"population_registry"))===!0,"Fe"),mt=t(async()=>{try{let e=await v();if(M(e)||P(e)!==null||O(e)?.checkType!=="population_registry")return;if(!Ae(e)&&rt(j(e,"population_registry"))===void 0&&(e=await k()),!Ae(e)){ke=!0;return}await A(),await Y(await we(),"population_registry");let n=c===null?void 0:j(c,"population_registry");if(n?.state==="input_required"&&n.reason==="registry_unavailable"&&$e(n)>0){if(await D(Rt),u)return;await Y(await we(),"population_registry")}}catch(e){if(e instanceof I&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await k().catch(()=>{});return}be=!0;return}c!==null&&M(c)&&Q(le(c,{autoRetry:f}))},"Ft"),Ce=t(()=>(X??(X=mt()),X),"He"),w=l.now??Date.now,N=null,q,ee,ht=0,te=t((e,n)=>`${e.url}
|
|
2
2
|
${e.siteKey}
|
|
3
|
-
${n}`,"he"),Me=0,ne,re=t((e,n)=>{Me+=1;let i=w(),s=pt(e,{signal:me.signal,subject:n}),o={key:te(e,n),at:i,token:s};return s.then(()=>{o.issuedAt=w(),ee=void 0},d=>{let m=it(d);if(o.failed=m,u||m==="aborted")return;ee=m;let{detail:h,readyMs:a}=d;G({check:"attestation",kind:"unavailable",engineKind:m,attempt:ht++,challengeMs:w()-i,readyMs:a,detail:h,inApp:Ge()})}),s.catch(()=>{}),o},"ge"),Se=t((e,n)=>e!==null&&e.key===n&&(e.issuedAt===void 0||w()-e.issuedAt<Nt),"De"),ie=t((e,n={})=>{let i=e?.challenge??null;if(e===null||i===null||u)return;let s=Z(e.sessionId),o=N;(n.replaceFailed===!0&&o?.failed!==void 0&&!at.has(o.failed)||!Se(o,te(i,s)))&&(N=re(i,s))},"Se"),Te=t(async(e,n)=>{let i=te(e,n),s=N;N=null;let o=Se(s,i)?s:re(e,n),d=o===s?0:1,m,h=new Promise(a=>{m=setTimeout(()=>a("late"),Pt)});try{for(;;){let a=await Promise.race([o.token.then(_=>({token:_}),_=>({error:it(_)})),h]);if(a==="late")return!u&&N===null&&(N=o),{error:ee??"timeout"};if("token"in a)return ne=Math.max(0,Math.round((o.issuedAt??w())-o.at)),a;if(u||at.has(a.error)||d>=Dt||d>0&&await Promise.race([D(qt*d),h])==="late")return a;if(u)return{error:"aborted"};d+=1,o=re(e,n)}}finally{clearTimeout(m)}},"Ue"),T=null,yt=t(e=>se(e).some(n=>(n.checkType==="phone_otp"||n.checkType==="email_otp")&&n.state!=="passed"&&n.state!=="skipped"),"Lt"),xe=t(e=>T===null||w()-T>=e,"Be"),z=t(()=>xe(Ot),"oe"),vt=t(e=>{let n=e.attestation;return typeof n?.turnstileToken=="string"&&n.turnstileToken.length>0},"Dt"),Ie=new Map,Ee=t(async()=>{let e=await v(),n=e.challenge;if(n==null||e.simulation!==void 0)return;let i=await Te(n,Z(e.sessionId));if(!("token"in i))throw new I({status:400,code:"attestation_invalid",message:`browser check: ${i.error}`});return i.token},"Ge"),_t=t(async(e,n,i={})=>{let s=n;if("attestation"in s)try{let a=await K.submitCheck(e,n,i);return vt(s)&&(T=w()),a}catch(a){throw a instanceof I&&a.code==="attestation_invalid"&&(T=null),a}let o=(e==="phone_otp"||e==="email_otp")&&s.action!=="verify",d=i.idempotencyKey,m=d!==void 0?Ie.get(d):void 0;m===void 0&&(o||z())&&(m=await Ee(),d!==void 0&&m!==void 0&&Ie.set(d,m));let h=t((a,_)=>a!==void 0?{..._,browserCheckToken:a}:_,"w");try{let a=await K.submitCheck(e,n,h(m,i));return m!==void 0&&(T=w()),a}catch(a){if(!(a instanceof I)||a.code!=="attestation_invalid"||(T=null,m!==void 0))throw a;let _=await Ee(),x=d!==void 0?{...i,idempotencyKey:pe()}:i,C=await K.submitCheck(e,n,h(_,x));return _!==void 0&&(T=w()),C}},"Ut"),Re=t(async(e={})=>{if(q=void 0,e.always!==!0&&!z())return{};let n=await v(),i=n.challenge;if(i==null)return{};let s=await Te(i,Z(n.sessionId));if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if(q=s.error,n.simulation!==void 0)return{channel:"hosted_web"};throw new Ze(s.error)},"Ke"),gt=t(()=>q,"Bt"),bt=t(()=>({checks:Math.min(50,Me),...ne!==void 0?{challengeMs:Math.min(6e5,ne)}:{}}),"qt"),G=t(e=>{if(u)return;let n=y.reportCaptureIssue;if(n===void 0)return;let i=e.formFactor;try{i??(i=qe())}catch{}try{Promise.resolve(n.call(y,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"W"),g=null,U=null,Ne=new WeakMap,Pe=Promise.resolve(),F=0,kt=t(async()=>{let e=await v();for(let n=0;n<Ut&&!u&&!M(e)&&O(e)===void 0&&se(e).some(i=>i.state==="processing")&&(await D(Gt),!u);n+=1)e=await k();return e},"Gt"),wt=t(async(e,n,i)=>{let{capture:s}=e,o=t(()=>u,"p"),d=t(()=>e.alive&&e.attempt===i,"k"),m=t(a=>{d()&&s.setFlowState(a)},"C"),h=t(a=>{if(!o()&&(a.status==="unavailable"&&a.reasonCode!==void 0&&!je(a.reasonCode)&&G({check:"liveness",kind:"unavailable",phase:"upload",engineKind:a.reasonCode,attempt:Math.max(0,e.issues.value)}),Q(a),!!d())){if(a.status==="retry"&&dt==="auto"){s.handle.retry();return}s.setFlowState("done")}},"w");if(n.degraded==="NO_RECORDER"){let a=c?.sessionId??(await v().catch(()=>null))?.sessionId??"";h(E(a,"no_recorder"));return}m("uploading");try{if(await Ce(),o())return;let a=await v(),_;if(!M(a)&&P(a)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}if(!M(a)){if(O(a)?.checkType==="population_registry"){h(E(a.sessionId,ke?"nni_unbound":be?"network":"registry_unavailable"));return}if(await A(),o())return;_=c??a;let x=await Ye({...J,artifacts:n,getAttestation:Re,attestationError:gt,attestationFacts:bt,clipKeys:{get:t(()=>Ne.get(n)??null,"get"),set:t(C=>{Ne.set(n,C)},"set")},getView:t(()=>c??a,"getView"),refreshView:k,applySubmit:Y,onPhase:m,isCancelled:o,onKeyframePromoted:t(C=>{fe=C},"onKeyframePromoted")});if(o())return;if(x.kind==="unavailable"){x.reason==="attestation"&&(U={bound:e,artifacts:n});let C=E(a.sessionId,x.reason),De=x.reason==="attestation"?q:void 0;h(De!==void 0?{...C,attestationError:De}:C);return}if(x.kind==="resync"&&await k(),c!==null&&P(c)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}a=await kt()}h(le(a,{autoRetry:f,previous:_}))}catch{if(o())return;h(E(c?.sessionId??"","network"))}},"Kt"),Oe=t((e,n)=>{let i=e.attempt;F>0&&e.alive&&e.capture.setFlowState("uploading"),F+=1,Pe=Pe.then(()=>wt(e,n,i)).finally(()=>{F-=1,F===0&&R?.onChainIdle()}).catch(()=>{})},"We"),Le=t(e=>{g?.capture.handle.destroy(),g!==null&&(g.alive=!1);let n=nt(e,R?.captureInternals?.(e)??l.capture,()=>c?.capture?.liveness?.keyframe?.rank===!0,he,()=>c?.capture?.liveness?.screenRamp,{session:t(()=>W(c),"session"),onModeChange:t(o=>{V=o},"onModeChange")}),i={capture:n,alive:!0,attempt:0,issues:Be()};g=i,n.handle.on("error",o=>{G(Ke("liveness",o,i.issues.value))}),n.handle.on("state",o=>{if(i.issues.note(o),o==="starting"){i.attempt+=1,U?.bound===i&&(U=null),z()&&ie(c,{replaceFailed:!0});let d=c===null?void 0:O(c)?.checkType;(d==="liveness"||d==="face_match")&&A().catch(()=>{})}}),n.handle.on("captured",o=>{Promise.resolve().then(()=>Oe(i,o))});let s=n.handle;return{get state(){return s.state},get captureMode(){return s.captureMode},get facingMode(){return s.facingMode},on:t((o,d)=>s.on(o,d),"on"),start:t(async o=>{if(c===null&&await v().catch(()=>{}),!!i.alive)return s.start(o)},"start"),retry:t(()=>{let o=U;if(o!==null&&o.bound===i&&i.alive){U=null,Oe(i,o.artifacts);return}s.retry()},"retry"),switchCamera:t(()=>s.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>s.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(o=>s.setCaptureMode(o),"setCaptureMode"),destroy:t(()=>{i.alive=!1,g===i&&(g=null),s.destroy()},"destroy")}},"$e"),At=t(async()=>{if(u)return null;try{let e=await v();return u?null:P(e)}catch{return null}},"jt"),Ct=t(async()=>{if(u)return"self";try{let e=await v();if(u)return"self";let n=W(e);return n==="choice"?$()??n:n}catch{return"self"}},"Yt"),Mt=t(async()=>{if(u)return!1;try{let e=await v();return u||M(e)||oe()?!1:ue(e,O(e))==="phone"||ue(e,j(e,"liveness"))==="phone"}catch{return!1}},"Wt"),St=t(async()=>{if(u)return!1;try{let e=await v();return!u&&e.returning===!0}catch{return!1}},"$t"),Tt=t(async e=>{let n=(await v()).plan?.choice,i=n?.options.find(o=>Ve[o.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let s=await y.choose(n.nodeId,i.id);u||b(s)},"Qt"),ae=null,xt=t(()=>(ae??(ae=import("./plan-runner-T2ZTSBI4-SEXJ6KJP.js").then(e=>{let n=e.createPlanRunner({runtime:J,currentView:t(()=>c,"currentView"),cameraMode:he,captureModeSwitch:{pick:$,choose:t(i=>{V=i},"choose")},ensureView:v,refreshView:k,ensureConsent:t(()=>A(),"ensureConsent"),liveness:Le,stopLiveness:t(()=>{g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null)},"stopLiveness"),chainBusy:t(()=>F>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:D,isMobile:oe,now:l.now??Date.now,keptFaceKey:t(()=>fe,"keptFaceKey"),setView:b,baseCapture:l.capture,emitStep:t(i=>{u||S.emit("step",i)},"emitStep"),emitResult:ft,reportCaptureIssue:G,documentInternals:l.document,portraitInternals:l.portrait,livePhotoInternals:l.livePhoto,uploadInternals:l.upload,pageCameraInternals:l.pageCamera});return R=n,n})),ae),"Zt");return{consent:t(()=>A(),"consent"),startRegistry:Ce,methodChoice:At,selectMethod:Tt,reportCameraUnavailable:t(async e=>{await A();let n=y.reportCameraUnavailable;if(n===void 0)throw new TypeError("this client cannot report a missing camera");let i=await n.call(y,e).catch(s=>{if(s instanceof I&&s.code==="check_out_of_order")return y.getSession();throw s});u||b(i)},"reportCameraUnavailable"),reportCaptureIssue:G,testerGate:t(async e=>{let n=y.testerGate;if(n===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,s=Ue(e.clipMime??"");if(i===void 0||!ze.includes(s))throw new TypeError("the capture has no clip");await A();let o=await He(y,"clip",s,i.size,{engine:e.engine,durationMs:e.clipMs});await y.uploadToSpaces(o.uploadUrl,i,s);let{key:d}=await y.completeMedia(o.key),m=await Re({always:!0}),h=await n.call(y,{clipKey:d,attestation:m,captureChannel:e.captureChannel,capture:{...Je(e),attestationError:q}}),{bound:a,..._}=h;return u||(_.plan!==void 0?b(_):await k()),{bound:a===!0}},"testerGate"),mobileRequired:Mt,captureMode:Ct,chooseCaptureMode:t(e=>{V=e},"chooseCaptureMode"),get captureChoice(){return $()},returning:St,liveness:Le,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await xt()).run()},"run"),currentStep:t(()=>R?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await v();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,n)=>S.on(e,n),"on"),destroy:t(()=>{u=!0,me.abort(),R?.destroy(),g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null),S.clear()},"destroy")}}t(Bt,"dn");var st=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],lt=["carte_identite","passport","residence_permit","drivers_license"],Vt=["carte_identite","passport","residence_permit"];function ce(r,l){let p=r.byIssuer?.[l]??r.default;return lt.filter(f=>p==="*"?Vt.includes(f):p.includes(f))}t(ce,"fn");function ut(r,l=st){return[...new Set([...l,...Object.keys(r.byIssuer??{})])].filter(p=>ce(r,p).length>0).sort()}t(ut,"Ro");var L={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"};var yn={full_name:L.fullName,occupation:L.occupation,email:L.email,short_text:L.shortText,long_text:L.longText},ct=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),vn=new Map(Object.entries(ct)),_n=new Map(Object.entries(ct).map(([r,l])=>[l,r]));var gn=10*1024*1024;function ir(r){if(r==="permission")return"denied";if(r==="notfound"||r==="insecure"||r==="unsupported")return"no_camera"}t(ir,"ce");var $t=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Ht=Object.freeze({normalize:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(r=>$t.test(r),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),zt=/^[A-Z0-9]{4,20}$/,de=t(r=>r.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Zt=Object.freeze({normalize:de,check:t(r=>zt.test(de(r)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Wt(r){return typeof r=="string"&&/^\d{10}$/.test(r)&&Number(r)%97===1}t(Wt,"fe");var Yt={trim:t(r=>r.trim(),"trim"),upper_single_space:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:de},Jt={mr_nni_mod97:t(r=>Wt(r),"mr_nni_mod97")};function Qt(r){let l=new RegExp(r.pattern,"u"),p=r.check===null?void 0:Jt[r.check];return Object.freeze({normalize:Yt[r.normalize],check:t(f=>l.test(f.trim())&&(p===void 0||p(f)),"check"),registrySources:Object.freeze([...r.registrySources]),describe:r.describe})}t(Qt,"Pe");var Xt=Object.freeze(Object.fromEntries(Object.entries(et).map(([r,l])=>[r,Qt(l)])));function en(r,l){return Xt[`${r.toUpperCase()}:${l}`]??(l==="drivers_license"?Zt:Ht)}t(en,"C");var ar=Object.freeze({MRT:"MR"});function or(r){return en("MR","national_id").check(r)}t(or,"Me");function tn(r){let l="";for(let p of r){let f=p.codePointAt(0)??0;f>=1632&&f<=1641?l+=String(f-1632):f>=1776&&f<=1785?l+=String(f-1776):p!==" "&&p!=="-"&&p!==" "&&(l+=p)}return l}t(tn,"H");function sr(r){return tn(r)}t(sr,"He");var lr=ce,ur=ut;var nn=t(()=>import("./create-document-capture-X35M4UAK-BB2SCTPK.js"),"E");function rn(){nn().then(r=>r.warmDocumentCapture()).catch(()=>{})}t(rn,"D");function cr(){rn()}t(cr,"et");var an=t(()=>import("./create-portrait-capture-5VGYZUOK-N3333DJC.js"),"O");function on(){an().then(r=>r.warmPortraitCapture()).catch(()=>{})}t(on,"I");function dr(){on()}t(dr,"at");export{Kt as a,ir as b,or as c,sr as d,lr as e,ur as f,cr as g,dr as h};
|
|
3
|
+
${n}`,"he"),Me=0,ne,re=t((e,n)=>{Me+=1;let i=w(),s=pt(e,{signal:me.signal,subject:n}),o={key:te(e,n),at:i,token:s};return s.then(()=>{o.issuedAt=w(),ee=void 0},d=>{let m=it(d);if(o.failed=m,u||m==="aborted")return;ee=m;let{detail:h,readyMs:a}=d;G({check:"attestation",kind:"unavailable",engineKind:m,attempt:ht++,challengeMs:w()-i,readyMs:a,detail:h,inApp:Ge()})}),s.catch(()=>{}),o},"ge"),Se=t((e,n)=>e!==null&&e.key===n&&(e.issuedAt===void 0||w()-e.issuedAt<Nt),"De"),ie=t((e,n={})=>{let i=e?.challenge??null;if(e===null||i===null||u)return;let s=Z(e.sessionId),o=N;(n.replaceFailed===!0&&o?.failed!==void 0&&!at.has(o.failed)||!Se(o,te(i,s)))&&(N=re(i,s))},"Se"),Te=t(async(e,n)=>{let i=te(e,n),s=N;N=null;let o=Se(s,i)?s:re(e,n),d=o===s?0:1,m,h=new Promise(a=>{m=setTimeout(()=>a("late"),Pt)});try{for(;;){let a=await Promise.race([o.token.then(_=>({token:_}),_=>({error:it(_)})),h]);if(a==="late")return!u&&N===null&&(N=o),{error:ee??"timeout"};if("token"in a)return ne=Math.max(0,Math.round((o.issuedAt??w())-o.at)),a;if(u||at.has(a.error)||d>=Dt||d>0&&await Promise.race([D(qt*d),h])==="late")return a;if(u)return{error:"aborted"};d+=1,o=re(e,n)}}finally{clearTimeout(m)}},"Ue"),T=null,yt=t(e=>se(e).some(n=>(n.checkType==="phone_otp"||n.checkType==="email_otp")&&n.state!=="passed"&&n.state!=="skipped"),"Lt"),xe=t(e=>T===null||w()-T>=e,"Be"),z=t(()=>xe(Ot),"oe"),vt=t(e=>{let n=e.attestation;return typeof n?.turnstileToken=="string"&&n.turnstileToken.length>0},"Dt"),Ie=new Map,Ee=t(async()=>{let e=await v(),n=e.challenge;if(n==null||e.simulation!==void 0)return;let i=await Te(n,Z(e.sessionId));if(!("token"in i))throw new I({status:400,code:"attestation_invalid",message:`browser check: ${i.error}`});return i.token},"Ge"),_t=t(async(e,n,i={})=>{let s=n;if("attestation"in s)try{let a=await K.submitCheck(e,n,i);return vt(s)&&(T=w()),a}catch(a){throw a instanceof I&&a.code==="attestation_invalid"&&(T=null),a}let o=(e==="phone_otp"||e==="email_otp")&&s.action!=="verify",d=i.idempotencyKey,m=d!==void 0?Ie.get(d):void 0;m===void 0&&(o||z())&&(m=await Ee(),d!==void 0&&m!==void 0&&Ie.set(d,m));let h=t((a,_)=>a!==void 0?{..._,browserCheckToken:a}:_,"w");try{let a=await K.submitCheck(e,n,h(m,i));return m!==void 0&&(T=w()),a}catch(a){if(!(a instanceof I)||a.code!=="attestation_invalid"||(T=null,m!==void 0))throw a;let _=await Ee(),x=d!==void 0?{...i,idempotencyKey:pe()}:i,C=await K.submitCheck(e,n,h(_,x));return _!==void 0&&(T=w()),C}},"Ut"),Re=t(async(e={})=>{if(q=void 0,e.always!==!0&&!z())return{};let n=await v(),i=n.challenge;if(i==null)return{};let s=await Te(i,Z(n.sessionId));if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if(q=s.error,n.simulation!==void 0)return{channel:"hosted_web"};throw new Ze(s.error)},"Ke"),gt=t(()=>q,"Bt"),bt=t(()=>({checks:Math.min(50,Me),...ne!==void 0?{challengeMs:Math.min(6e5,ne)}:{}}),"qt"),G=t(e=>{if(u)return;let n=y.reportCaptureIssue;if(n===void 0)return;let i=e.formFactor;try{i??(i=qe())}catch{}try{Promise.resolve(n.call(y,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"W"),g=null,U=null,Ne=new WeakMap,Pe=Promise.resolve(),F=0,kt=t(async()=>{let e=await v();for(let n=0;n<Ut&&!u&&!M(e)&&O(e)===void 0&&se(e).some(i=>i.state==="processing")&&(await D(Gt),!u);n+=1)e=await k();return e},"Gt"),wt=t(async(e,n,i)=>{let{capture:s}=e,o=t(()=>u,"p"),d=t(()=>e.alive&&e.attempt===i,"k"),m=t(a=>{d()&&s.setFlowState(a)},"C"),h=t(a=>{if(!o()&&(a.status==="unavailable"&&a.reasonCode!==void 0&&!je(a.reasonCode)&&G({check:"liveness",kind:"unavailable",phase:"upload",engineKind:a.reasonCode,attempt:Math.max(0,e.issues.value)}),Q(a),!!d())){if(a.status==="retry"&&dt==="auto"){s.handle.retry();return}s.setFlowState("done")}},"w");if(n.degraded==="NO_RECORDER"){let a=c?.sessionId??(await v().catch(()=>null))?.sessionId??"";h(E(a,"no_recorder"));return}m("uploading");try{if(await Ce(),o())return;let a=await v(),_;if(!M(a)&&P(a)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}if(!M(a)){if(O(a)?.checkType==="population_registry"){h(E(a.sessionId,ke?"nni_unbound":be?"network":"registry_unavailable"));return}if(await A(),o())return;_=c??a;let x=await Ye({...J,artifacts:n,getAttestation:Re,attestationError:gt,attestationFacts:bt,clipKeys:{get:t(()=>Ne.get(n)??null,"get"),set:t(C=>{Ne.set(n,C)},"set")},getView:t(()=>c??a,"getView"),refreshView:k,applySubmit:Y,onPhase:m,isCancelled:o,onKeyframePromoted:t(C=>{fe=C},"onKeyframePromoted")});if(o())return;if(x.kind==="unavailable"){x.reason==="attestation"&&(U={bound:e,artifacts:n});let C=E(a.sessionId,x.reason),De=x.reason==="attestation"?q:void 0;h(De!==void 0?{...C,attestationError:De}:C);return}if(x.kind==="resync"&&await k(),c!==null&&P(c)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}a=await kt()}h(le(a,{autoRetry:f,previous:_}))}catch{if(o())return;h(E(c?.sessionId??"","network"))}},"Kt"),Oe=t((e,n)=>{let i=e.attempt;F>0&&e.alive&&e.capture.setFlowState("uploading"),F+=1,Pe=Pe.then(()=>wt(e,n,i)).finally(()=>{F-=1,F===0&&R?.onChainIdle()}).catch(()=>{})},"We"),Le=t(e=>{g?.capture.handle.destroy(),g!==null&&(g.alive=!1);let n=nt(e,R?.captureInternals?.(e)??l.capture,()=>c?.capture?.liveness?.keyframe?.rank===!0,he,()=>c?.capture?.liveness?.screenRamp,{session:t(()=>W(c),"session"),onModeChange:t(o=>{V=o},"onModeChange")}),i={capture:n,alive:!0,attempt:0,issues:Be()};g=i,n.handle.on("error",o=>{G(Ke("liveness",o,i.issues.value))}),n.handle.on("state",o=>{if(i.issues.note(o),o==="starting"){i.attempt+=1,U?.bound===i&&(U=null),z()&&ie(c,{replaceFailed:!0});let d=c===null?void 0:O(c)?.checkType;(d==="liveness"||d==="face_match")&&A().catch(()=>{})}}),n.handle.on("captured",o=>{Promise.resolve().then(()=>Oe(i,o))});let s=n.handle;return{get state(){return s.state},get captureMode(){return s.captureMode},get facingMode(){return s.facingMode},on:t((o,d)=>s.on(o,d),"on"),start:t(async o=>{if(c===null&&await v().catch(()=>{}),!!i.alive)return s.start(o)},"start"),retry:t(()=>{let o=U;if(o!==null&&o.bound===i&&i.alive){U=null,Oe(i,o.artifacts);return}s.retry()},"retry"),switchCamera:t(()=>s.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>s.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(o=>s.setCaptureMode(o),"setCaptureMode"),destroy:t(()=>{i.alive=!1,g===i&&(g=null),s.destroy()},"destroy")}},"$e"),At=t(async()=>{if(u)return null;try{let e=await v();return u?null:P(e)}catch{return null}},"jt"),Ct=t(async()=>{if(u)return"self";try{let e=await v();if(u)return"self";let n=W(e);return n==="choice"?$()??n:n}catch{return"self"}},"Yt"),Mt=t(async()=>{if(u)return!1;try{let e=await v();return u||M(e)||oe()?!1:ue(e,O(e))==="phone"||ue(e,j(e,"liveness"))==="phone"}catch{return!1}},"Wt"),St=t(async()=>{if(u)return!1;try{let e=await v();return!u&&e.returning===!0}catch{return!1}},"$t"),Tt=t(async e=>{let n=(await v()).plan?.choice,i=n?.options.find(o=>Ve[o.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let s=await y.choose(n.nodeId,i.id);u||b(s)},"Qt"),ae=null,xt=t(()=>(ae??(ae=import("./plan-runner-LSQTIO6L-XZJIKXPZ.js").then(e=>{let n=e.createPlanRunner({runtime:J,currentView:t(()=>c,"currentView"),cameraMode:he,captureModeSwitch:{pick:$,choose:t(i=>{V=i},"choose")},ensureView:v,refreshView:k,ensureConsent:t(()=>A(),"ensureConsent"),liveness:Le,stopLiveness:t(()=>{g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null)},"stopLiveness"),chainBusy:t(()=>F>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:D,isMobile:oe,now:l.now??Date.now,keptFaceKey:t(()=>fe,"keptFaceKey"),setView:b,baseCapture:l.capture,emitStep:t(i=>{u||S.emit("step",i)},"emitStep"),emitResult:ft,reportCaptureIssue:G,documentInternals:l.document,portraitInternals:l.portrait,livePhotoInternals:l.livePhoto,uploadInternals:l.upload,pageCameraInternals:l.pageCamera});return R=n,n})),ae),"Zt");return{consent:t(()=>A(),"consent"),startRegistry:Ce,methodChoice:At,selectMethod:Tt,reportCameraUnavailable:t(async e=>{await A();let n=y.reportCameraUnavailable;if(n===void 0)throw new TypeError("this client cannot report a missing camera");let i=await n.call(y,e).catch(s=>{if(s instanceof I&&s.code==="check_out_of_order")return y.getSession();throw s});u||b(i)},"reportCameraUnavailable"),reportCaptureIssue:G,testerGate:t(async e=>{let n=y.testerGate;if(n===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,s=Ue(e.clipMime??"");if(i===void 0||!ze.includes(s))throw new TypeError("the capture has no clip");await A();let o=await He(y,"clip",s,i.size,{engine:e.engine,durationMs:e.clipMs});await y.uploadToSpaces(o.uploadUrl,i,s);let{key:d}=await y.completeMedia(o.key),m=await Re({always:!0}),h=await n.call(y,{clipKey:d,attestation:m,captureChannel:e.captureChannel,capture:{...Je(e),attestationError:q}}),{bound:a,..._}=h;return u||(_.plan!==void 0?b(_):await k()),{bound:a===!0}},"testerGate"),mobileRequired:Mt,captureMode:Ct,chooseCaptureMode:t(e=>{V=e},"chooseCaptureMode"),get captureChoice(){return $()},returning:St,liveness:Le,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await xt()).run()},"run"),currentStep:t(()=>R?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await v();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,n)=>S.on(e,n),"on"),destroy:t(()=>{u=!0,me.abort(),R?.destroy(),g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null),S.clear()},"destroy")}}t(Bt,"dn");var st=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],lt=["carte_identite","passport","residence_permit","drivers_license"],Vt=["carte_identite","passport","residence_permit"];function ce(r,l){let p=r.byIssuer?.[l]??r.default;return lt.filter(f=>p==="*"?Vt.includes(f):p.includes(f))}t(ce,"fn");function ut(r,l=st){return[...new Set([...l,...Object.keys(r.byIssuer??{})])].filter(p=>ce(r,p).length>0).sort()}t(ut,"Ro");var L={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"};var yn={full_name:L.fullName,occupation:L.occupation,email:L.email,short_text:L.shortText,long_text:L.longText},ct=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),vn=new Map(Object.entries(ct)),_n=new Map(Object.entries(ct).map(([r,l])=>[l,r]));var gn=10*1024*1024;function ir(r){if(r==="permission")return"denied";if(r==="notfound"||r==="insecure"||r==="unsupported")return"no_camera"}t(ir,"ce");var $t=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Ht=Object.freeze({normalize:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(r=>$t.test(r),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),zt=/^[A-Z0-9]{4,20}$/,de=t(r=>r.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Zt=Object.freeze({normalize:de,check:t(r=>zt.test(de(r)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Wt(r){return typeof r=="string"&&/^\d{10}$/.test(r)&&Number(r)%97===1}t(Wt,"fe");var Yt={trim:t(r=>r.trim(),"trim"),upper_single_space:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:de},Jt={mr_nni_mod97:t(r=>Wt(r),"mr_nni_mod97")};function Qt(r){let l=new RegExp(r.pattern,"u"),p=r.check===null?void 0:Jt[r.check];return Object.freeze({normalize:Yt[r.normalize],check:t(f=>l.test(f.trim())&&(p===void 0||p(f)),"check"),registrySources:Object.freeze([...r.registrySources]),describe:r.describe})}t(Qt,"Pe");var Xt=Object.freeze(Object.fromEntries(Object.entries(et).map(([r,l])=>[r,Qt(l)])));function en(r,l){return Xt[`${r.toUpperCase()}:${l}`]??(l==="drivers_license"?Zt:Ht)}t(en,"C");var ar=Object.freeze({MRT:"MR"});function or(r){return en("MR","national_id").check(r)}t(or,"Me");function tn(r){let l="";for(let p of r){let f=p.codePointAt(0)??0;f>=1632&&f<=1641?l+=String(f-1632):f>=1776&&f<=1785?l+=String(f-1776):p!==" "&&p!=="-"&&p!==" "&&(l+=p)}return l}t(tn,"H");function sr(r){return tn(r)}t(sr,"He");var lr=ce,ur=ut;var nn=t(()=>import("./create-document-capture-WFTNVMCE-QOCPJSAU.js"),"E");function rn(){nn().then(r=>r.warmDocumentCapture()).catch(()=>{})}t(rn,"D");function cr(){rn()}t(cr,"et");var an=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"O");function on(){an().then(r=>r.warmPortraitCapture()).catch(()=>{})}t(on,"I");function dr(){on()}t(dr,"at");export{Kt as a,ir as b,or as c,sr as d,lr as e,ur as f,cr as g,dr as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-5JWGGQBH.js";import{K as b,a as k,b as y,c as x}from"./chunk-JJ3Q52P3.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as c,c as f}from"./chunk-4FHWXBOB.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-C3EIMXME-ODOF67JZ.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var B=(0,l.createContext)(void 0);function H({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(B),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(H,"K");n(H,"PhoneHandoff");export{j as a,S as b,B as c,H as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as X}from"./chunk-52CHUGVC.js";import{a as z,b as ee}from"./chunk-WKQRKYX4.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
|
|
1
|
+
import{d as X}from"./chunk-Q5BUNNRN.js";import{a as z,b as ee}from"./chunk-JJ3Q52P3.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as U}from"./chunk-
|
|
1
|
+
import{d as U}from"./chunk-BMUUDLFA.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-JJ3Q52P3.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a as N,c as R}from"./chunk-4FHWXBOB.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Nr}from"./chunk-NNYJYD3Q.js";import{c as _t}from"./chunk-LAF6JZRH.js";import{b as kr,d as br}from"./chunk-JDANRDDK.js";import{b as xr,c as Ct}from"./chunk-MDDGAHO6.js";import{a as yr,b as vr,c as gr,d as Le}from"./chunk-MZ6WG3QQ.js";import{F as _r,K as wr,L as Sr,a as D,b as de,c as X,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as se,v as Ae,w as tt,y as Cr}from"./chunk-WKQRKYX4.js";import{b as lr,c as cr,d as ur,g as dr}from"./chunk-X42LECG5.js";import{b as kt}from"./chunk-6N4AXKCS.js";import{a as s}from"./chunk-5QL6W6FW.js";import{f as ir}from"./chunk-CW56KMMH.js";import{a as o,c as E}from"./chunk-4FHWXBOB.js";var Rr=E(D(),1),v=E(de(),1),ee=E(de(),1),ye=E(D(),1),B=E(de(),1),C=E(D(),1),y=E(D(),1),at=E(D(),1),fe=E(de(),1),Wr=E(D(),1),Y=E(D(),1),it=E(D(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1);var lt=E(D(),1),pe=E(D(),1);var Q=E(D(),1);var M=E(D(),1),me=E(D(),1),Oe=E(D(),1),Rt=E(de(),1),k=E(de(),1);function oe({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})}o(oe,"te");s(oe,"Svg");var Lt="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 Lr(e){return(0,v.jsxs)(oe,{...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"})]})}o(Lr,"ln");s(Lr,"SunIcon");function Ar(e){return(0,v.jsxs)(oe,{...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"})]})}o(Ar,"un");s(Ar,"FaceUncoveredIcon");function Er(e){return(0,v.jsxs)(oe,{...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"})]})}o(Er,"dn");s(Er,"PhoneEyeLevelIcon");function Ir(e){return(0,v.jsxs)(oe,{...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"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(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"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Or(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}o(Or,"yn");s(Or,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,v.jsxs)(oe,{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"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Pr(e){return(0,v.jsx)(oe,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Pr,"gn");s(Pr,"CheckIcon");function Tr(e){return(0,v.jsxs)(oe,{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"})]})}o(Tr,"hn");s(Tr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],En={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Lr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(Ar,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Er,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Le(),n=(0,Rr.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"?En[r]:void 0,i=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})]},i)})})]})}o(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:i,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=bt(),[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)},In))},"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:i?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:o(()=>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:o(()=>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))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["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","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var Un=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&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",On={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}o(ae,"ne");s(ae,"synth");function Hr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Hr,"Lr");s(Hr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function At(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(At,"Mn");s(At,"pickVoice");function Dr(e){if(!Hr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||At(t,e)!==void 0}o(Dr,"wn");s(Dr,"speechUsable");function Fr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o(Fr,"Ln");s(Fr,"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}`}}o(He,"Ke");s(He,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function $r(){let e=null,t=null,n=0,r=null,a=[],i=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=At(a,N);if(a.length===0||j!==void 0){p.cancel();let _=new SpeechSynthesisUtterance(d);_.lang=N,j!==void 0&&(_.voice=j),_.rate=.95,R!==void 0&&(_.onend=_.onerror=R),p.speak(_);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(i.has(R))continue;let p=new Audio;p.preload="auto",p.src=N,i.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 _=h();_.pause(),_.muted=!1,_.src=d.url,_.currentTime=0,_.onended=j??null,_.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(jn),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 _=ae();if(N&&_!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,_.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&&xt(e),e=null;for(let d of i.values())xt(d);i.clear()}}}o($r,"_n");s($r,"createVoicePlayer");var Pn="sekyro.voiceGuidance";function Gr(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}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Tn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let i=a===Ve?null:je(e,a,t);i===null||n.has(He(i))||(n.add(He(i)),r.push(i))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},i=a.storageKey===void 0?Pn:a.storageKey,[l,u]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(l),[h,w]=(0,C.useState)(!1),[x,I]=(0,C.useState)("none"),[d,N]=(0,C.useState)(!1),R=(0,C.useRef)(!1),[p,j]=(0,C.useState)(0),_=(0,C.useRef)(null),A=(0,C.useCallback)(()=>(_.current??(_.current=$r()),_.current),[]),q=On[e],F=a.speechFallback,f=F===void 0||F===!0?!0:F===!1?!1:F.includes(e),G=a.clips??t??Bn,ie=(0,C.useRef)(!1),le=(0,C.useRef)(G);Tn(()=>{le.current=G,S.current=l}),(0,C.useEffect)(()=>{if(r||i===null)return;let L=Gr(i);L!==null&&(S.current=L,u(L))},[r,i]),(0,C.useEffect)(()=>{if(!(r||!f))return Fr(()=>j(L=>L+1))},[r,f]);let c=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=f&&Dr(q);w(rt(G,e).length>0||L),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(G,Ve,e)!==null||L?"default":"none")},[r,G,c,e,f,q,p]),(0,C.useEffect)(()=>{if(r||!l||!ie.current)return;let L=rt(G,e);L.length>0&&A().prefetch(L)},[r,l,G,e,A]),(0,C.useEffect)(()=>()=>{_.current?.dispose(),_.current=null,ie.current=!1},[]);let V=(0,C.useCallback)(L=>{r||(ie.current=!0,A().unlock({lang:q,speech:f,...L?{prefetch:rt(le.current,e)}:{}}))},[r,A,q,f,e]),O=(0,C.useCallback)(()=>V(S.current),[V]),K=(0,C.useCallback)(()=>{R.current=!1,N(!1)},[]),T=(0,C.useCallback)(()=>{K(),_.current?.stop()},[K]),ve=(0,C.useCallback)(()=>{R.current&&T()},[T]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(R.current){T();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:K})},[r,T,A,e,q,f,K]),z=(0,C.useCallback)(L=>{r||(L?V(!0):T(),i!==null&&Kr(i,L),S.current=L,u(L))},[r,V,T,i]),Z=(0,C.useCallback)(()=>z(!S.current),[z]),te=(0,C.useCallback)((L,xe)=>{if(r||!l)return;R.current&&K();let ge=je(le.current,L,e);A().say({url:ge,text:xe,lang:q,speech:f})},[r,l,e,A,q,f,K]);return(0,C.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:z,toggle:Z,unlock:O,speakKey:te,stop:T,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,z,Z,O,te,T,x,d,he,ve])}o(zr,"vt");s(zr,"useVoiceGuidance");function Zr(e,t,n,r){let{speakKey:a,stop:i,enabled:l}=e,u=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!l){u.current&&i(),u.current=!1;return}u.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,i])}o(Zr,"Ct");s(Zr,"useSpeakGuidance");function ot(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"}}o(ot,"Pn");s(ot,"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 Qr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let i=Le(),l=(0,at.useRef)(null);return(0,at.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:i(De[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:De[t].tips.map(u=>(0,fe.jsx)("li",{children:i(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:i("capture.recordAgain")}):null]})}o(Qr,"Tn");s(Qr,"CapturedPanel");function Et(){try{return!1}catch{return!1}}o(Et,"nt");s(Et,"isDevBuild");var qn=(0,Wr.createContext)(null);function Yr({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)(Ur,{}):e==="denied"?(0,we.jsx)(Or,{}):(0,we.jsx)(jr,{});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}`)})]})}o(Yr,"On");s(Yr,"PermissionRow");function Jr({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:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{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)(Pr,{className:"sekyro-switch__check"}):null})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:i,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 G=p.current;e!=="loading"&&(p.current=!1),en(I.current)&&(e==="failed"?N.current?.focus():G&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),_=e==="loading",A=_||S,q=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),F;return e==="failed"?F=(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")})]}):F=(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":_?"true":void 0,onClick:q,children:_?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tr,{}),w("capture.preparing.title")]}):u??w("capture.start")}),_?(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,i!==!1?(0,U.jsx)(Br,{tips:i}):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)(nt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Yr,{state:n}),(0,U.jsx)(Jr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),F,(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"):""})]})}o(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,lt.useState)({state:"unknown",settled:!1});return(0,lt.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}o(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}o(nn,"jn");s(nn,"useReturning");function It(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 i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{i&&r({required:l===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function sn(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 i=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>i.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)(i=>{e?.chooseCaptureMode?.(i),r(l=>({...l,choice:i}))},[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}}o(sn,"$n");s(sn,"useCaptureMode");function an(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}o(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return lr(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function on(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>ur(h,e),[e]),()=>cr(e),Vn),[r,a]=(0,Q.useState)(null),i=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{Nt(e).then(h=>{i.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(i.current=!0,l(),()=>{i.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)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(on,"Jn");s(on,"useLivenessAssets");var Mr={progress:0,hint:null,faceDetected:!1};function ln(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Et()&&(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 i=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(Mr),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,R]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[_,A]=(0,M.useState)(null),[q,F]=(0,M.useState)(null),[f,G]=(0,M.useState)(null),[ie,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[O,K]=(0,M.useState)(!1),T=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[z,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):dr(ce);i.current=H;let Ne=s(()=>V(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?K(!0):b!=="starting"&&b!=="gating"&&K(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,Z(Math.max(0,he.current))),F(null),G(null),h(Mr),d(!1),x(!1),R(null),A(null),T.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),R(null),T.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=T.current;T.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=>{F(b),le(null),te.current.onCaptured?.(b)}),H.on("error",b=>{G(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Ee=>ke.call(r,Ee),xr("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 Fe)b?.();i.current=null,H.destroy()}},[r,t,n]);let L=(0,M.useCallback)(()=>{i.current?.start()},[]),xe=(0,M.useCallback)(()=>{i.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=i.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=i.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:_,artifacts:q,error:f,result:ie,facingMode:c,start:L,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:O,attempt:z}}o(ln,"er");s(ln,"useLivenessHandle");var Hn=new Set(["national_number"]);function Mt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Mt,"tr");s(Mt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[i,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(Mt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(Mt(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:i,failed:u,select:h}}o(cn,"nr");s(cn,"useMethodChoice");var Dn=["ar","fr","en"];function un(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}}o(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Dn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[i,l]of Object.entries(a))!st(i)||!un(l)||((n[r]??(n[r]={}))[i]=l)}return Object.keys(n).length>0?n:null}o(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Oe.useState)(null);(0,Oe.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,i=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(i,()=>i(null))}catch{i(null)}let l=e.on("view",u=>i(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Oe.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}o(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Le();return(0,Rt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,Rt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),$n=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(fn,"fo");s(fn,"isDefaultTips");function mn(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}o(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}o(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"ho");s(vn,"isCapturing");function gn(e){return e==="captured"||e==="uploading"||e==="checking"}o(gn,"vo");s(gn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:i=!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:_,className:A}){let q=vr(t),F=(0,y.useMemo)(()=>yr(t,r),[t,r,q]),f=(0,y.useMemo)(()=>g=>F[g]??"",[F]),G=n??(t==="ar"?"rtl":"ltr"),ie=(0,y.useRef)(null),le=(0,y.useContext)(qn),c=ln({verification:e,videoRef:ie,assetBaseUrl:_,onCaptured:N,onResult:R,onError:p,onStateChange:j}),V=on(_,c.state==="idle"&&c.error===null),O=cn(e),K=O.choice!==null,T=rn(e),ve=nn(e),he=an(e),z=tn(),Z=sn(e),te=Z.session==="choice",L=Z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=pn(xe?e:void 0),P=zr({locale:t,defaultClips:ge,options:I}),J=L?"environment":"user",ce=Z.settled,H=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),Fe=(0,y.useRef)(P.unlock);Fe.current=P.unlock,(0,y.useEffect)(()=>{let g=H.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ne)g.removeEventListener(qe,Re,!0)},"disarm");function Re(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}o(Re,"Re"),s(Re,"onGesture");for(let qe of ne)g.addEventListener(qe,Re,{capture:!0,passive:!0});return _e},[]);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,jt=!K&&!T.required&&(i===!0||i==="when-permitted"&&z.permission==="granted"),Ot=jt&&O.settled&&T.settled&&ce,Cn=i==="when-permitted"&&!z.permissionSettled&&!Ee.current,Pt=jt&&Pe&&!Ee.current,ut=(Cn||Pt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ot||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ot,Pe,V.gate,ke]);let _n=Pe&&!K&&!T.required&&!(Pt&&V.gate==="ready"),[Tt,Bt]=(0,y.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=c;(0,y.useEffect)(()=>{if(!Z.settled||!te){Bt(!1);return}let g=!0;return qt().then(ne=>{g&&Bt(ne)}),()=>{g=!1}},[Z.settled,te,qt]);let{choose:Ht}=Z,Ie=L?"self":"assisted",wn=(0,y.useCallback)(async()=>{await Vt(Ie)&&Ht(Ie)},[Vt,Ht,Ie]),Dt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=ie.current?.style;Dt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Dt]);let $e=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if($e!==null)return()=>URL.revokeObjectURL($e)},[$e]);let Ft=c.frozenPreview??$e,Ue=e!==void 0,$=vn(c.state),be=gn(c.state),Ge=$||be,re=c.result,$t=c.state==="done"&&re!==null,Ke=$&&c.rampColour!==null,dt=c.state==="recording"&&c.frozenPreview!==null&&!Ke,ze=le!==null,Gt=Tt&&$&&!dt?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,Ze=c.modeRestarted&&$?f("capture.modeSwitch.restarted"):null,Te=be||dt,Kt=be?"checking":dt?"frozen":c.state==="recording"||Ke?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Qe=$?c.gate.hint:null,We=c.state==="starting"?"capture.preparing.title":Qe===null?null:Qe==="center"&&!c.gate.faceDetected?"fcv3.no_face":pr(Qe),[Sn,zt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(We!=="fcv3.no_face"){zt(We);return}if(!$)return;let g=setTimeout(()=>zt(We),$n);return()=>clearTimeout(g)},[We,$]);let pt=$&&!Ke&&typeof x=="string"&&x!=="",Zt=L&&$?f("capture.assisted.stage"):null,Me=$&&!pt?Ke?Gn:Sn:null,ht=pt?x:Me===null?"":f(Me);Zr(P,Me,ht,$);let Qt=(0,y.useRef)(d);Qt.current=d,(0,y.useEffect)(()=>{if(st(Me))try{Qt.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]),ft=a?.voicePrompt,Wt=ft!==void 0,Yt=I===void 0,Jt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Wt||!Yt||Jt.current||!Et()||(Jt.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."))},[Wt,Yt]);let xn=ft!==void 0?(g,ne,_e)=>ft(g,ne,_e,Be):P.supported?()=>(0,k.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=P,Ye=w!==void 0&&w!=="",rr=Ye?w:f("capture.tips.summary"),nr=Ye?mt!=="none":mt==="partner"||mt==="default"&&fn(h),Nn=(0,y.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Ye}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Ye]),Mn=(0,y.useMemo)(()=>({assets:ut,retryAssets:V.retry,permission:z.permission,permissionSettled:z.permissionSettled,captureMode:Z.mode,facing:J,voice:Be}),[ut,V.retry,z.permission,z.permissionSettled,Z.mode,J,Be]),Rn=yn(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"&&!K&&re.reasonCode!=="portrait_required"?re:null,Ce=$t&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,yt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Re=fr(t,ne);if(Re!==null)return f(Re.key).replace("{time}",Re.time)}let _e=et(g);return _e===null?null:f(_e)},"reasonText"),vt=s(g=>{let ne=g.retakeHint===void 0?null:Xe(g.retakeHint);return ne===null?yt(g.reasonCode):f(ne)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?f("errors.session_expired"):null),Ln=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"),Je=W?.reasonCode,ar=c.attempt;(0,y.useEffect)(()=>{W===null||Je===void 0||e?.reportCaptureIssue===void 0||Kn.has(Je)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Je,attempt:Math.min(1e3,ar)})},[W,Je,ar,e]);let or=bt(),An=K&&O.auto===null&&!$&&!be&&c.error===null,gt=(0,y.useCallback)(async g=>{await O.select(g)&&c.state==="done"&&c.retry()},[O.select,c.state,c.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!$&&!be&>(O.auto)},[O.auto,O.busy,$,be,gt]),(0,k.jsx)(gr,{value:f,children:(0,k.jsxs)("div",{ref:H,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&vt(ue)!==null&&!(ze&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:vt(ue)})}):null,Ze!==null&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Ze})}):null,he&&be&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,T.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(hr(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:or,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:yt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Ln?(0,k.jsx)(X,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,k.jsx)(se,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:sr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:ze?le({videoRef:ie,guidance:Te&&Ue?f("capture.checking"):ht,coached:pt&&!(Te&&Ue),note:Te?Ue?f(he?"capture.busy":"capture.checkingHint"):null:Ze??(ue!==null?vt(ue):Zt),settled:Te&&Ue,progress:c.gate.progress,phase:Kt,still:Te?Ft:null,live:Ge,modeSwitch:Gt,...Tt?{status:Ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(kr,{videoRef:ie,guidanceText:ht,guidanceHint:Qe,guidanceKey:Me,progress:c.gate.progress,phase:Kt,draining:c.draining,stillUrl:Ft,showChecking:Ue,operatorText:Zt,voicePrompt:xn,overlay:o(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(br,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Gt})}),An&&O.choice!==null?(0,k.jsx)(qr,{title:f("method.title"),description:f("method.description"),options:O.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:O.busy,error:O.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{gt(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,Rn,a?.intro!==void 0?a.intro(b,Mn):(0,k.jsx)(Xr,{assets:ut,onRetryAssets:V.retry,permission:z.permission,captureMode:Z.mode,voice:Be,tips:h??wt,summary:Nn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Qr,{showCoaching:ue!==null,coaching:ot(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(F,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!$&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}o(zn,"xi");s(zn,"LivenessCapture");var Ut=E(D(),1),ct=E(D(),1),m=E(de(),1);var Cs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Zn(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}}o(Zn,"Y");s(Zn,"identityLabel");function Qn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,i]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),i(null),l().then(()=>r(!1),u=>{r(!1),i(e.t(Nr(u,e.strings))),t?.(u)})},"run")}}o(Qn,"q");s(Qn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.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})`})]})}o(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Yn(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}}o(Yn,"te");s(Yn,"faceIntroRetryOf");var Jn={"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 Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:i=!1,notice:l,retry:u}){let S=_t(),{t:h}=S,w=u===void 0?"face":ot(u.reason),x=w==="face"?null:De[w].tips,I=(0,ct.useContext)(_r)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(kn,{}),t.captureMode==="assisted"?(0,m.jsx)(tt,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,m.jsx)(tt,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(tt,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(bn,{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:Jn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Wn[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)(Cr,{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")]})})]})}o(Xn,"ne");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,m.jsxs)(wr,{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:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(bn,"T");s(bn,"RetryNotice");function ts(e){return kt(e)}o(ts,"se");s(ts,"isInAppBrowser");function rs(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`}o(rs,"ce");s(rs,"androidBrowserIntent");export{qr as a,Et as b,qn as c,sn as d,zn as e,Cs as f,Zn as g,Qn as h,Yn as i,Xn as j,ts as k,rs as l};
|
|
1
|
+
import{a as Nr}from"./chunk-CVFJQIMW.js";import{c as _t}from"./chunk-3DDOCOIB.js";import{b as kr,d as br}from"./chunk-BMUUDLFA.js";import{b as xr,c as Ct}from"./chunk-GZOBS7KG.js";import{a as yr,b as vr,c as gr,d as Le}from"./chunk-AARN2MG7.js";import{F as _r,K as wr,L as Sr,a as F,b as de,c as X,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as se,v as Ae,w as tt,y as Cr}from"./chunk-JJ3Q52P3.js";import{b as lr,c as cr,d as ur,g as dr}from"./chunk-GPGK6XZM.js";import{b as kt}from"./chunk-4YBL75VD.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as ir}from"./chunk-6MYG4HWP.js";import{a as o,c as E}from"./chunk-4FHWXBOB.js";var Rr=E(F(),1),v=E(de(),1),ee=E(de(),1),ye=E(F(),1),P=E(de(),1),C=E(F(),1),y=E(F(),1),at=E(F(),1),fe=E(de(),1),Wr=E(F(),1),Y=E(F(),1),it=E(F(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1);var lt=E(F(),1),pe=E(F(),1);var W=E(F(),1);var M=E(F(),1),me=E(F(),1),Oe=E(F(),1),Rt=E(de(),1),k=E(de(),1);function oe({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})}o(oe,"te");s(oe,"Svg");var Lt="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 Lr(e){return(0,v.jsxs)(oe,{...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"})]})}o(Lr,"ln");s(Lr,"SunIcon");function Ar(e){return(0,v.jsxs)(oe,{...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"})]})}o(Ar,"un");s(Ar,"FaceUncoveredIcon");function Er(e){return(0,v.jsxs)(oe,{...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"})]})}o(Er,"dn");s(Er,"PhoneEyeLevelIcon");function Ir(e){return(0,v.jsxs)(oe,{...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"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(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"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Or(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}o(Or,"yn");s(Or,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,v.jsxs)(oe,{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"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Tr(e){return(0,v.jsx)(oe,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Tr,"gn");s(Tr,"CheckIcon");function Br(e){return(0,v.jsxs)(oe,{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"})]})}o(Br,"hn");s(Br,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],En={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Lr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(Ar,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Er,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(Ir,{}),"icon")}};function Pr({tips:e}){let t=Le(),n=(0,Rr.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"?En[r]:void 0,i=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})]},i)})})]})}o(Pr,"Cn");s(Pr,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:i,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=bt(),[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)},In))},"choose");return(0,P.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,P.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)("h2",{id:w,ref:i?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,P.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,P.jsx)(se,{tone:"danger",children:(0,P.jsx)("span",{children:a})}):null,u==="buttons"?(0,P.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,P.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,P.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,P.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:o(()=>R(p.id),"onClick"),children:[p.glyph!==void 0?(0,P.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,P.jsxs)("span",{className:"sekyro-card__body",children:[(0,P.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,P.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,P.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["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","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var Un=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&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",On={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}o(ae,"ne");s(ae,"synth");function Hr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Hr,"Lr");s(Hr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function At(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(At,"Mn");s(At,"pickVoice");function Dr(e){if(!Hr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||At(t,e)!==void 0}o(Dr,"wn");s(Dr,"speechUsable");function Fr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o(Fr,"Ln");s(Fr,"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}`}}o(He,"Ke");s(He,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function $r(){let e=null,t=null,n=0,r=null,a=[],i=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=At(a,N);if(a.length===0||j!==void 0){p.cancel();let _=new SpeechSynthesisUtterance(d);_.lang=N,j!==void 0&&(_.voice=j),_.rate=.95,R!==void 0&&(_.onend=_.onerror=R),p.speak(_);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(i.has(R))continue;let p=new Audio;p.preload="auto",p.src=N,i.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 _=h();_.pause(),_.muted=!1,_.src=d.url,_.currentTime=0,_.onended=j??null,_.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(jn),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 _=ae();if(N&&_!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,_.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&&xt(e),e=null;for(let d of i.values())xt(d);i.clear()}}}o($r,"_n");s($r,"createVoicePlayer");var Tn="sekyro.voiceGuidance";function Gr(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}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Bn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Pn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let i=a===Ve?null:je(e,a,t);i===null||n.has(He(i))||(n.add(He(i)),r.push(i))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},i=a.storageKey===void 0?Tn:a.storageKey,[l,u]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(l),[h,w]=(0,C.useState)(!1),[x,I]=(0,C.useState)("none"),[d,N]=(0,C.useState)(!1),R=(0,C.useRef)(!1),[p,j]=(0,C.useState)(0),_=(0,C.useRef)(null),A=(0,C.useCallback)(()=>(_.current??(_.current=$r()),_.current),[]),q=On[e],$=a.speechFallback,f=$===void 0||$===!0?!0:$===!1?!1:$.includes(e),K=a.clips??t??Pn,ie=(0,C.useRef)(!1),le=(0,C.useRef)(K);Bn(()=>{le.current=K,S.current=l}),(0,C.useEffect)(()=>{if(r||i===null)return;let L=Gr(i);L!==null&&(S.current=L,u(L))},[r,i]),(0,C.useEffect)(()=>{if(!(r||!f))return Fr(()=>j(L=>L+1))},[r,f]);let c=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=f&&Dr(q);w(rt(K,e).length>0||L),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(K,Ve,e)!==null||L?"default":"none")},[r,K,c,e,f,q,p]),(0,C.useEffect)(()=>{if(r||!l||!ie.current)return;let L=rt(K,e);L.length>0&&A().prefetch(L)},[r,l,K,e,A]),(0,C.useEffect)(()=>()=>{_.current?.dispose(),_.current=null,ie.current=!1},[]);let V=(0,C.useCallback)(L=>{r||(ie.current=!0,A().unlock({lang:q,speech:f,...L?{prefetch:rt(le.current,e)}:{}}))},[r,A,q,f,e]),O=(0,C.useCallback)(()=>V(S.current),[V]),z=(0,C.useCallback)(()=>{R.current=!1,N(!1)},[]),B=(0,C.useCallback)(()=>{z(),_.current?.stop()},[z]),ve=(0,C.useCallback)(()=>{R.current&&B()},[B]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(R.current){B();return}let ge=A();ge.stop(),R.current=!0,N(!0);let T=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:T,text:L,lang:q,speech:f,onEnd:z})},[r,B,A,e,q,f,z]),Z=(0,C.useCallback)(L=>{r||(L?V(!0):B(),i!==null&&Kr(i,L),S.current=L,u(L))},[r,V,B,i]),Q=(0,C.useCallback)(()=>Z(!S.current),[Z]),te=(0,C.useCallback)((L,xe)=>{if(r||!l)return;R.current&&z();let ge=je(le.current,L,e);A().say({url:ge,text:xe,lang:q,speech:f})},[r,l,e,A,q,f,z]);return(0,C.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:Z,toggle:Q,unlock:O,speakKey:te,stop:B,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,Z,Q,O,te,B,x,d,he,ve])}o(zr,"vt");s(zr,"useVoiceGuidance");function Zr(e,t,n,r){let{speakKey:a,stop:i,enabled:l}=e,u=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!l){u.current&&i(),u.current=!1;return}u.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,i])}o(Zr,"Ct");s(Zr,"useSpeakGuidance");function ot(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"}}o(ot,"Pn");s(ot,"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 Qr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let i=Le(),l=(0,at.useRef)(null);return(0,at.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:i(De[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:De[t].tips.map(u=>(0,fe.jsx)("li",{children:i(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:i("capture.recordAgain")}):null]})}o(Qr,"Tn");s(Qr,"CapturedPanel");function Et(){try{return!1}catch{return!1}}o(Et,"nt");s(Et,"isDevBuild");var qn=(0,Wr.createContext)(null);function Yr({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)(Ur,{}):e==="denied"?(0,we.jsx)(Or,{}):(0,we.jsx)(jr,{});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}`)})]})}o(Yr,"On");s(Yr,"PermissionRow");function Jr({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:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{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})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:i,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 K=p.current;e!=="loading"&&(p.current=!1),en(I.current)&&(e==="failed"?N.current?.focus():K&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),_=e==="loading",A=_||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":_?"true":void 0,onClick:q,children:_?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Br,{}),w("capture.preparing.title")]}):u??w("capture.start")}),_?(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,i!==!1?(0,U.jsx)(Pr,{tips:i}):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)(nt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Yr,{state:n}),(0,U.jsx)(Jr,{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"):""})]})}o(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,lt.useState)({state:"unknown",settled:!1});return(0,lt.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}o(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}o(nn,"jn");s(nn,"useReturning");function It(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 i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{i&&r({required:l===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function sn(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 i=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>i.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)(i=>{e?.chooseCaptureMode?.(i),r(l=>({...l,choice:i}))},[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}}o(sn,"$n");s(sn,"useCaptureMode");function an(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}o(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return lr(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function on(e,t=!0){let n=(0,W.useSyncExternalStore)((0,W.useCallback)(h=>ur(h,e),[e]),()=>cr(e),Vn),[r,a]=(0,W.useState)(null),i=(0,W.useRef)(!1),l=(0,W.useCallback)(()=>{Nt(e).then(h=>{i.current&&h==="idle"&&a({base:e})})},[e]);(0,W.useEffect)(()=>(i.current=!0,l(),()=>{i.current=!1}),[l]);let u=(0,W.useRef)(null);(0,W.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,W.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(on,"Jn");s(on,"useLivenessAssets");var Mr={progress:0,hint:null,faceDetected:!1};function ln(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Et()&&(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 i=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(Mr),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,R]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[_,A]=(0,M.useState)(null),[q,$]=(0,M.useState)(null),[f,K]=(0,M.useState)(null),[ie,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[O,z]=(0,M.useState)(!1),B=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[Z,Q]=(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):dr(ce);i.current=H;let Ne=s(()=>V(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,Q(Math.max(0,he.current))),$(null),K(null),h(Mr),d(!1),x(!1),R(null),A(null),B.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),R(null),B.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=B.current;B.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=>{K(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Ee=>ke.call(r,Ee),xr("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 Fe)b?.();i.current=null,H.destroy()}},[r,t,n]);let L=(0,M.useCallback)(()=>{i.current?.start()},[]),xe=(0,M.useCallback)(()=>{i.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=i.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),T=(0,M.useCallback)(async J=>{let ce=i.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:_,artifacts:q,error:f,result:ie,facingMode:c,start:L,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:T,modeRestarted:O,attempt:Z}}o(ln,"er");s(ln,"useLivenessHandle");var Hn=new Set(["national_number"]);function Mt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Mt,"tr");s(Mt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[i,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(Mt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(Mt(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:i,failed:u,select:h}}o(cn,"nr");s(cn,"useMethodChoice");var Dn=["ar","fr","en"];function un(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}}o(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Dn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[i,l]of Object.entries(a))!st(i)||!un(l)||((n[r]??(n[r]={}))[i]=l)}return Object.keys(n).length>0?n:null}o(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Oe.useState)(null);(0,Oe.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,i=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(i,()=>i(null))}catch{i(null)}let l=e.on("view",u=>i(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Oe.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}o(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Le();return(0,Rt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,Rt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),$n=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(fn,"fo");s(fn,"isDefaultTips");function mn(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}o(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}o(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"ho");s(vn,"isCapturing");function gn(e){return e==="captured"||e==="uploading"||e==="checking"}o(gn,"vo");s(gn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:i=!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:_,className:A}){let q=vr(t),$=(0,y.useMemo)(()=>yr(t,r),[t,r,q]),f=(0,y.useMemo)(()=>g=>$[g]??"",[$]),K=n??(t==="ar"?"rtl":"ltr"),ie=(0,y.useRef)(null),le=(0,y.useContext)(qn),c=ln({verification:e,videoRef:ie,assetBaseUrl:_,onCaptured:N,onResult:R,onError:p,onStateChange:j}),V=on(_,c.state==="idle"&&c.error===null),O=cn(e),z=O.choice!==null,B=rn(e),ve=nn(e),he=an(e),Z=tn(),Q=sn(e),te=Q.session==="choice",L=Q.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=pn(xe?e:void 0),T=zr({locale:t,defaultClips:ge,options:I}),J=L?"environment":"user",ce=Q.settled,H=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),Fe=(0,y.useRef)(T.unlock);Fe.current=T.unlock,(0,y.useEffect)(()=>{let g=H.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ne)g.removeEventListener(qe,Re,!0)},"disarm");function Re(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}o(Re,"Re"),s(Re,"onGesture");for(let qe of ne)g.addEventListener(qe,Re,{capture:!0,passive:!0});return _e},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,T.unlock()),c.start()},[T.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Te=c.state==="idle"&&c.error===null,jt=!z&&!B.required&&(i===!0||i==="when-permitted"&&Z.permission==="granted"),Ot=jt&&O.settled&&B.settled&&ce,Cn=i==="when-permitted"&&!Z.permissionSettled&&!Ee.current,Tt=jt&&Te&&!Ee.current,ut=(Cn||Tt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ot||!Te||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ot,Te,V.gate,ke]);let _n=Te&&!z&&!B.required&&!(Tt&&V.gate==="ready"),[Bt,Pt]=(0,y.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=c;(0,y.useEffect)(()=>{if(!Q.settled||!te){Pt(!1);return}let g=!0;return qt().then(ne=>{g&&Pt(ne)}),()=>{g=!1}},[Q.settled,te,qt]);let{choose:Ht}=Q,Ie=L?"self":"assisted",wn=(0,y.useCallback)(async()=>{await Vt(Ie)&&Ht(Ie)},[Vt,Ht,Ie]),Dt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=ie.current?.style;Dt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Dt]);let $e=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if($e!==null)return()=>URL.revokeObjectURL($e)},[$e]);let Ft=c.frozenPreview??$e,Ue=e!==void 0,G=vn(c.state),be=gn(c.state),Ge=G||be,re=c.result,$t=c.state==="done"&&re!==null,Ke=G&&c.rampColour!==null,dt=c.state==="recording"&&c.frozenPreview!==null&&!Ke,ze=le!==null,Gt=Bt&&G&&!dt?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,Ze=c.modeRestarted&&G?f("capture.modeSwitch.restarted"):null,Be=be||dt,Kt=be?"checking":dt?"frozen":c.state==="recording"||Ke?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Qe=G?c.gate.hint:null,We=c.state==="starting"?"capture.preparing.title":Qe===null?null:Qe==="center"&&!c.gate.faceDetected?"fcv3.no_face":pr(Qe),[Sn,zt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(We!=="fcv3.no_face"){zt(We);return}if(!G)return;let g=setTimeout(()=>zt(We),$n);return()=>clearTimeout(g)},[We,G]);let pt=G&&!Ke&&typeof x=="string"&&x!=="",Zt=L&&G?f("capture.assisted.stage"):null,Me=G&&!pt?Ke?Gn:Sn:null,ht=pt?x:Me===null?"":f(Me);Zr(T,Me,ht,G);let Qt=(0,y.useRef)(d);Qt.current=d,(0,y.useEffect)(()=>{if(st(Me))try{Qt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let Pe=(0,y.useMemo)(()=>({supported:T.supported,enabled:T.enabled,setEnabled:T.setEnabled,toggle:T.toggle}),[T.supported,T.enabled,T.setEnabled,T.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Yt=I===void 0,Jt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Wt||!Yt||Jt.current||!Et()||(Jt.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."))},[Wt,Yt]);let xn=ft!==void 0?(g,ne,_e)=>ft(g,ne,_e,Pe):T.supported?()=>(0,k.jsx)(hn,{voice:Pe}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=T,Ye=w!==void 0&&w!=="",rr=Ye?w:f("capture.tips.summary"),nr=Ye?mt!=="none":mt==="partner"||mt==="default"&&fn(h),Nn=(0,y.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Ye}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Ye]),Mn=(0,y.useMemo)(()=>({assets:ut,retryAssets:V.retry,permission:Z.permission,permissionSettled:Z.permissionSettled,captureMode:Q.mode,facing:J,voice:Pe}),[ut,V.retry,Z.permission,Z.permissionSettled,Q.mode,J,Pe]),Rn=yn(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,D=$t&&re.status==="unavailable"&&!z&&re.reasonCode!=="portrait_required"?re:null,Ce=$t&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,yt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Re=fr(t,ne);if(Re!==null)return f(Re.key).replace("{time}",Re.time)}let _e=et(g);return _e===null?null:f(_e)},"reasonText"),vt=s(g=>{let ne=g.retakeHint===void 0?null:Xe(g.retakeHint);return ne===null?yt(g.reasonCode):f(ne)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?f("errors.session_expired"):null),Ln=D!==null&&D.reasonCode!==void 0&&D.reasonCode!=="nni_unbound"&&D.reasonCode!=="id_number_unbound"&&D.reasonCode!=="method_required"&&D.reasonCode!=="mobile_required"&&!(D.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Je=D?.reasonCode,ar=c.attempt;(0,y.useEffect)(()=>{D===null||Je===void 0||e?.reportCaptureIssue===void 0||Kn.has(Je)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Je,attempt:Math.min(1e3,ar)})},[D,Je,ar,e]);let or=bt(),An=z&&O.auto===null&&!G&&!be&&c.error===null,gt=(0,y.useCallback)(async g=>{await O.select(g)&&c.state==="done"&&c.retry()},[O.select,c.state,c.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!G&&!be&>(O.auto)},[O.auto,O.busy,G,be,gt]),(0,k.jsx)(gr,{value:f,children:(0,k.jsxs)("div",{ref:H,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:K,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&vt(ue)!==null&&!(ze&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:vt(ue)})}):null,Ze!==null&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Ze})}):null,he&&be&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,B.required&&Te?(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(hr(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,D!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:(D.reasonCode==="attestation"&&D.attestationError==="clock_wrong"?f("errors.device_clock"):yt(D.reasonCode))??f(D.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Ln?(0,k.jsx)(X,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f(D.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,k.jsx)(se,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:sr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:ze?le({videoRef:ie,guidance:Be&&Ue?f("capture.checking"):ht,coached:pt&&!(Be&&Ue),note:Be?Ue?f(he?"capture.busy":"capture.checkingHint"):null:Ze??(ue!==null?vt(ue):Zt),settled:Be&&Ue,progress:c.gate.progress,phase:Kt,still:Be?Ft:null,live:Ge,modeSwitch:Gt,...Bt?{status:Ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(kr,{videoRef:ie,guidanceText:ht,guidanceHint:Qe,guidanceKey:Me,progress:c.gate.progress,phase:Kt,draining:c.draining,stillUrl:Ft,showChecking:Ue,operatorText:Zt,voicePrompt:xn,overlay:o(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(br,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Gt})}),An&&O.choice!==null?(0,k.jsx)(qr,{title:f("method.title"),description:f("method.description"),options:O.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:O.busy,error:O.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{gt(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,Rn,a?.intro!==void 0?a.intro(b,Mn):(0,k.jsx)(Xr,{assets:ut,onRetryAssets:V.retry,permission:Z.permission,captureMode:Q.mode,voice:Pe,tips:h??wt,summary:Nn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Qr,{showCoaching:ue!==null,coaching:ot(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr($,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!G&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}o(zn,"xi");s(zn,"LivenessCapture");var Ut=E(F(),1),ct=E(F(),1),m=E(de(),1);var Cs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Zn(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}}o(Zn,"Y");s(Zn,"identityLabel");function Qn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,i]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),i(null),l().then(()=>r(!1),u=>{r(!1),i(e.t(Nr(u,e.strings))),t?.(u)})},"run")}}o(Qn,"q");s(Qn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.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})`})]})}o(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Yn(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}}o(Yn,"te");s(Yn,"faceIntroRetryOf");var Jn={"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 Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:i=!1,notice:l,retry:u}){let S=_t(),{t:h}=S,w=u===void 0?"face":ot(u.reason),x=w==="face"?null:De[w].tips,I=(0,ct.useContext)(_r)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(kn,{}),t.captureMode==="assisted"?(0,m.jsx)(tt,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,m.jsx)(tt,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(tt,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(bn,{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:Jn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Wn[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)(Cr,{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")]})})]})}o(Xn,"ne");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,m.jsxs)(wr,{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:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(bn,"T");s(bn,"RetryNotice");function ts(e){return kt(e)}o(ts,"se");s(ts,"isInAppBrowser");function rs(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`}o(rs,"ce");s(rs,"androidBrowserIntent");export{qr as a,Et as b,qn as c,sn as d,zn as e,Cs as f,Zn as g,Qn as h,Yn as i,Xn as j,ts as k,rs as l};
|