@sekyro/react 0.1.0-rc.32 → 0.1.0-rc.33
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 +6 -0
- package/dist/{chunk-OHNOGFT2.js → chunk-2GC262YE.js} +1 -1
- package/dist/chunk-4E3G5TXC.js +2 -0
- package/dist/{chunk-AZF7USGM.js → chunk-BBN7JI6L.js} +1 -1
- package/dist/{chunk-MBLJZVNN.js → chunk-GNGZASHZ.js} +1 -1
- package/dist/{chunk-QD66CL7R.js → chunk-GPPZFBYP.js} +1 -1
- package/dist/{document-capture-view-GENB535Z.js → document-capture-view-57N5YWTH.js} +1 -1
- package/dist/{flow-views-C3EIMXME.js → flow-views-IAR45I3I.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{portrait-capture-view-VTN2VU3E.js → portrait-capture-view-ZF4YAMA6.js} +1 -1
- package/dist/{portrait-review-view-JTRGDYNV.js → portrait-review-view-LOS5AYBI.js} +1 -1
- package/dist/{proof-of-address-view-UQOZZXQO.js → proof-of-address-view-X2EVWZBX.js} +1 -1
- package/dist/verification/index.cjs +1 -1
- package/dist/verification/index.js +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +4 -4
- package/dist/chunk-K5H7KWEY.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as co}from"../chunk-JEOESSNW.js";import{a as ee,b as B,c as lo}from"../chunk-QD66CL7R.js";import{a as qt,b as Yt,d as Wt,e as Zt}from"../chunk-ZARKJW2C.js";import{a as $,d as Ut,e as it,f as ze,g as $t,h as Kt}from"../chunk-AZF7USGM.js";import{a as zt,b as Gt,c as oo}from"../chunk-GUTF3SPK.js";import{a as no,b as ro,c as so,d as io,e as ao,f as lt}from"../chunk-MBLJZVNN.js";import{a as Ze}from"../chunk-VNVE5DMF.js";import{d as st,f as Dt,g as Mt,j as Ht}from"../chunk-K5H7KWEY.js";import{b as Vt}from"../chunk-M7JKVIGW.js";import{a as Ft}from"../chunk-7MMT5M4E.js";import{a as ue}from"../chunk-VRDPGOXM.js";import{a as Xo,b as Jo,c as jo,d as en,e as tn,f as Oe,g as v}from"../chunk-PMNUDJWG.js";import{a as M,b as J,c as Qt,d as j,e as Xt,f as Ge,g as qe,h as at,i as Jt,k as Ye,l as jt,m as eo,o as to,p as P,q as We}from"../chunk-Q5BGUJMS.js";import"../chunk-DYWLZHSM.js";import{a as h,c as rt,j as Zo,l as Qo,n as Bt,o as Lt,p as At,r as Re,s as ke}from"../chunk-WC4U54LZ.js";import{a as i}from"../chunk-2KED7D2Q.js";import{useEffect as on,useState as uo}from"react";function ct(e){let[t,n]=uo(()=>e?.currentStep?.()??null),[r,a]=uo(null);return on(()=>{if(e===void 0)return;if(typeof e.run!="function"){a(new Error("The step components need @sekyro/web 0.2 or later (Verification.run)."));return}let s=!0,o=e.on("step",l=>{s&&n(l)});return e.run().then(l=>{s&&n(u=>u??l)},l=>{s&&a(l)}),()=>{s=!1,o()}},[e]),{step:t,error:r}}i(ct,"useVerificationStep");import{useEffect as po,useId as nn,useMemo as rn,useRef as mo,useState as Se}from"react";import{Fragment as go,jsx as b,jsxs as G}from"react/jsx-runtime";var fo=i((e,t,n)=>{if(e===void 0)return 0;let r=Date.parse(e)-t;return Number.isFinite(r)?Math.min(n,Math.max(0,Math.ceil(r/1e3))):0},"secondsUntil"),sn=600,an=30,ln=i(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss"),cn=["whatsapp","sms"],yo=new Set(["otp_daily_cap_reached","payment_method_required","spend_cap_reached","insufficient_balance","otp_expired","otp_send_failed","otp_channel_unavailable","otp_destination_not_allowed","otp_destination_unknown","otp_rate_limited","otp_resend_limit","otp_number_invalid","otp_number_not_mobile"]);function un(e){let t=[];for(let n of e.phoneCountries??["MR"]){let r=e.phoneRules?.find(s=>s.code===n),a=r?.dial??qt(n);a!==void 0&&!t.some(s=>s.code===n)&&t.push({code:n,dial:`+${a}`,...r!==void 0?{rule:r}:{}})}return t}i(un,"phoneCountriesOf");function ut({step:e,locale:t,strings:n,className:r,defaultPhone:a,onError:s}){let o=v(t,n),{t:l}=o,u=rn(()=>un(e),[e.phoneCountries,e.phoneRules]),p=a??u[0]?.dial??"",f=e.phoneInternational===!0,g=Wt({countries:u,international:f,closed:!!e.phoneRules?.length,defaultPhone:p}),[k,m]=Se(""),[y,w]=Se(!1),[N,O]=Se(null),[R,S]=Se(null),[x,_]=Se(!1),[Z,H]=Se(null),U=mo(null),D=e.phase==="verify"&&!x,fe=e.phase==="verify",Ne=oo(fe),[_e,Fe]=zt(e.reason==="otp_mismatch",e.attemptsRemaining,()=>m("")),K=nn(),De=mo(null);po(()=>{let C=setTimeout(()=>De.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(C)},[D]);let se=e.phase==="verify"?e.codeExpiresAt??"sent":null;po(()=>{se!==null&&(_(!1),U.current!==null&&!yo.has(e.reason??"")&&H(U.current),U.current=null)},[se]);let ye=i(async C=>{w(!0),S(null);try{await C()}catch(V){S(ue(V,o.strings)),s?.(V)}finally{w(!1),O(null)}},"run"),z=cn.filter(C=>(e.channels??[]).includes(C)),Me=g.typed,ne=!e.needsPhone||Me!==null,ie=i((C,V=!1)=>{let d=e.needsPhone?V?Z:{number:Me??g.phone,shown:g.shown}:null;U.current=d,O(C??null),ye(async()=>{try{await e.send({...d!==null?{phone:d.number}:{},...C!==void 0?{channel:C}:{}})}catch(I){throw U.current=null,I}})},"send"),Pe=i(C=>{ye(()=>e.verify(C))},"submitCode"),He=i(C=>{C.preventDefault(),D?Pe(k):z.length<=1&&ne&&ie(z[0])},"onSubmit"),Ue=`${K}-phone`,ge=fo(e.codeExpiresAt,Ne,sn),Q=fo(e.resendAvailableAt,Ne,an),ae=D&&e.codeExpiresAt!==void 0&&ge===0,xe=e.needsPhone&&!e.attemptsExhausted,le=fe&&(e.codeExpiresAt===void 0||ge>0),Ie=D&&xe?()=>_(!0):x&&le?()=>_(!1):null;Ge(Ie===null?null:y?()=>{}:Ie);let L=i(C=>l(C==="whatsapp"?"otp.channelWhatsapp":"otp.channelSms"),"label"),Te=i(C=>y&&N!==null&&N===C,"busyFor"),[nt,T]=l("otp.sentTo",{channel:L(e.channel)}).split("{number}"),ce=e.context.simulation?.otpCode,$e=e.reason==="otp_mismatch"?G(P,{tone:"danger",children:[b("span",{children:l("otp.reason_otp_mismatch")}),b("span",{children:We(o,e.attemptsRemaining,e.attemptsExhausted)})]}):e.reason!==void 0&&yo.has(e.reason)?b(P,{tone:"warning",children:b("span",{children:l(`otp.reason_${e.reason}`)})}):e.reason==="tester_phone_mismatch"?b(P,{tone:"warning",children:b("span",{children:l("reasons.tester_phone_mismatch")})}):null,Ee=G(go,{children:[$e,R!==null?b(P,{tone:"danger",children:b("span",{children:l(R)})}):null]});if(D){let C=z.length===0;return G("form",{className:`sekyro-step sekyro-otp${r?` ${r}`:""}`,"aria-labelledby":K,onSubmit:He,noValidate:!0,children:[b(J,{id:K,title:l("otp.verifyTitle"),lead:ce!==void 0?b(eo,{template:l("sandbox.otpHint"),code:ce}):G(go,{children:[nt,b("bdi",{dir:"ltr",className:"sekyro-mono",children:Z?.shown??e.sentToMasked}),T]})}),Ee,G("div",{className:"sekyro-field",children:[b("label",{className:"sekyro-label",htmlFor:`${K}-code`,children:l("otp.codeLabel")}),b(Gt,{id:`${K}-code`,value:k,invalid:_e,onChange:V=>{V!==""&&Fe(),m(V),V.length===6&&k.length!==6&&!y&&!e.attemptsExhausted&&Pe(V)}}),b("span",{className:`sekyro-help sekyro-otp-expiry${ae?" is-danger":""}`,"aria-hidden":!ae||void 0,children:ae?l("otp.expired"):l("otp.expiresIn",{time:ln(ge)})})]}),b("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:ae?l("otp.expired"):""}),G(j,{children:[b(h,{type:"submit",full:!0,disabled:y||k.length!==6||e.attemptsExhausted,"aria-busy":y||void 0,children:l("otp.verify")}),G("div",{className:"sekyro-resend-row",children:[C?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y||Q>0,onClick:()=>ie(void 0,!0),children:Q>0?l("otp.resendIn",{seconds:Q}):l("otp.resend")}):Q>0?b("p",{className:"sekyro-resend is-waiting",children:l("otp.resendIn",{seconds:Q})}):z.map(V=>b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>ie(V,!0),children:l("otp.resendBy",{channel:L(V)})},V)),xe?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>_(!0),"data-testid":"sekyro-otp-change",children:l("otp.changeNumber")}):null]})]})]})}return G("form",{className:`sekyro-step sekyro-otp${r?` ${r}`:""}`,"aria-labelledby":K,onSubmit:He,noValidate:!0,children:[b(J,{id:K,title:l("otp.sendTitle"),lead:l("otp.sendDescription")}),Ee,e.needsPhone?G("div",{className:"sekyro-field",children:[b("label",{className:"sekyro-label",htmlFor:Ue,children:l("otp.phoneLabel")}),b(Zt,{field:g,id:Ue,locale:o.locale,t:l,inputRef:De,ready:ne})]}):b("p",{className:"sekyro-text-muted",children:l("otp.prefilledNotice")}),G(j,{children:[z.length===1?b(h,{type:"submit",full:!0,disabled:y||!ne,"aria-busy":Te(z[0])||void 0,children:l("otp.sendBy",{channel:L(z[0])})}):z.length>1?G("div",{className:"sekyro-actions__group",role:"group","aria-label":l("otp.chooseChannel"),children:[b("p",{className:"sekyro-label","aria-hidden":"true",children:l("otp.chooseChannel")}),b("div",{className:"sekyro-channel-row",children:z.map(C=>G(h,{kind:"primary",disabled:y||!ne,"aria-busy":Te(C)||void 0,onClick:()=>ie(C),children:[b(M,{name:C}),L(C)]},C))})]}):b(h,{type:"submit",full:!0,disabled:y||!ne,"aria-busy":y||void 0,children:l("otp.send")}),b("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:y&&N!==null?l("otp.sending",{channel:L(N)}):""}),x&&le?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>_(!1),"data-testid":"sekyro-otp-back-to-code",children:l("otp.backToCode")}):null]})]})}i(ut,"PhoneOtpStep");import{lazy as dn,Suspense as pn,useMemo as mn,useState as fn}from"react";import{jsx as he,jsxs as gn}from"react/jsx-runtime";var yn={load:i(()=>import("../email-otp-view-CL76K5TY.js"),"load")};function dt({locale:e,strings:t,...n}){let r=v(e,t),[a,s]=fn(0),o=mn(()=>dn(()=>yn.load().then(u=>({default:u.EmailOtpView}))),[a]),l=gn(P,{tone:"danger",children:[he("span",{children:r.t("errors.network_error")}),he(h,{kind:"secondary",onClick:()=>s(u=>u+1),children:r.t("common.retry")})]});return he(ee,{fallback:l,children:he(pn,{fallback:he("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:r.t("common.loading")}),children:he(o,{...n,i18n:r})})},a)}i(dt,"EmailOtpStep");import{lazy as kn,Suspense as Sn,useMemo as hn,useState as bn}from"react";import{jsx as be,jsxs as Cn}from"react/jsx-runtime";var vn={load:i(()=>import("../eid-view-IQRZGEMP.js"),"load")};function pt({locale:e,strings:t,...n}){let r=v(e,t),[a,s]=bn(0),o=hn(()=>kn(()=>vn.load().then(u=>({default:u.EidView}))),[a]),l=Cn(P,{tone:"danger",children:[be("span",{children:r.t("errors.network_error")}),be(h,{kind:"secondary",onClick:()=>s(u=>u+1),children:r.t("common.retry")})]});return be(ee,{fallback:l,children:be(Sn,{fallback:be("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:r.t("common.loading")}),children:be(o,{...n,i18n:r})})},a)}i(pt,"EidStep");import{useMemo as wn}from"react";import{jsx as mt,jsxs as Nn}from"react/jsx-runtime";function ft({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),{busy:o,error:l,run:u}=so(s,a),p=wn(()=>e.choice.options.flatMap(g=>{let k=ro(g,s),m=no[g.service];return k===null?[]:[{id:g.id,label:k,glyph:m&&mt(M,{name:m})}]}),[e.choice.options,s]),f=e.choice.options.find(g=>g.service==="national_eid");return Nn("div",{className:r,children:[mt(Dt,{title:s.t("method.heading"),description:s.t("method.description"),options:p,busy:o,error:l,focus:!0,testId:"sekyro-method",onChoose:g=>u(()=>e.choose(g))}),f?.nationalEid?.afterPass==="continue"?mt(B,{view:"EidContinueHint",i18n:s,provider:f.nationalEid.providerName,quiet:!0}):null]})}i(ft,"MethodChoice");import{isValidNni as _n,normalizeNni as ko}from"@sekyro/web";import{useId as Pn,useState as yt}from"react";import{Fragment as En,jsx as F,jsxs as ve}from"react/jsx-runtime";var xn=new Set(["nni_not_found","registry_record_not_found"]),In=new Set(["nni_invalid","id_number_invalid"]);function Qe({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),{t:o}=s,[l,u]=yt(""),[p,f]=yt(!1),[g,k]=yt(null),m=Pn(),y=e.attemptsExhausted,w=i(async U=>{f(!0),k(null);try{await U()}catch(D){k(ue(D,s.strings)),a?.(D)}finally{f(!1)}},"run"),N=i(U=>{if(U.preventDefault(),e.source!=="typed"){w(()=>e.confirm());return}let D=ko(l);if(!/^\d{10}$/.test(D))return k("population.invalid");if(!_n(D))return k("population.reason_id_number_invalid");w(()=>typeof e.submitIdNumber=="function"?e.submitIdNumber(D):e.submitNni(D))},"onSubmit"),O=We(s,e.attemptsRemaining,y),R=e.reason!==void 0&&xn.has(e.reason),S=e.reason!==void 0&&In.has(e.reason),x=ve(En,{children:[e.reason==="registry_unavailable"?ve(P,{tone:"warning",children:[F("span",{children:o("population.reason_registry_unavailable")}),F("span",{children:O})]}):null,R&&e.canUseDocument?ve(P,{tone:"warning",children:[F("span",{children:o("population.reason_registry_record_not_found_or_document")}),F("span",{children:O}),F(h,{kind:"secondary",disabled:p,onClick:()=>{w(()=>e.useDocument())},children:o("population.useDocument")})]}):null,R&&!e.canUseDocument||S?ve(P,{tone:"danger",children:[F("span",{children:o(R?"population.reason_registry_record_not_found":"population.reason_id_number_invalid")}),F("span",{children:O})]}):null,y&&e.reason===void 0?F(P,{tone:"danger",children:F("span",{children:O})}):null,g!==null?F(P,{tone:"danger",children:F("span",{children:o(g)})}):null]}),[_,Z,H]=e.source==="document"?["population.fromDocument.title","population.fromDocument.description","population.fromDocument.continue"]:e.source==="bound"?["session.steps.population.title","population.bound.description","population.bound.confirm"]:e.recheck?["population.recheck.title","population.recheck.description","population.submit"]:["session.steps.population.title","session.steps.population.description","population.submit"];return ve("form",{className:`sekyro-step${r?` ${r}`:""}`,"aria-labelledby":m,onSubmit:N,noValidate:!0,children:[F(J,{id:m,title:o(_),lead:o(Z)}),x,e.source==="typed"?ve("div",{className:"sekyro-field",children:[F("label",{className:"sekyro-label",htmlFor:`${m}-id-number`,children:o("population.label")}),F("input",{id:`${m}-id-number`,className:"sekyro-input sekyro-input--number",dir:"ltr",inputMode:"numeric",autoComplete:"off",placeholder:o("population.placeholder"),value:l,"aria-describedby":`${m}-id-number-help`,"aria-invalid":g==="population.invalid"||g==="population.reason_id_number_invalid"||void 0,onChange:U=>{k(null),u(ko(U.target.value).replace(/\D/g,"").slice(0,10))}}),F("span",{id:`${m}-id-number-help`,className:"sekyro-help",children:o("population.helper")})]}):null,F(j,{children:y?null:F(h,{type:"submit",full:!0,disabled:p,"aria-busy":p||void 0,children:o(H)})})]})}i(Qe,"IdNumberEntry");function Tn(e){return Qe(e)}i(Tn,"NniEntry");import{acceptedIssuers as Ln,acceptedTypesFor as Co,warmDocumentCapture as An}from"@sekyro/web";import{lazy as Vn,Suspense as Fn,useEffect as Dn,useMemo as Mn,useState as kt}from"react";import{acceptedIssuers as Rn,acceptedTypesFor as gt}from"@sekyro/web";import{useEffect as So,useMemo as ho,useState as bo}from"react";import{jsx as q,jsxs as Xe}from"react/jsx-runtime";var On=220;function Bn(e,t,n=[],r){let a=null;try{a=new Intl.DisplayNames([e],{type:"region"})}catch{}let s=t.map(u=>({code:u,name:a?.of(u)??u})),o=new Intl.Collator(e),l=i(u=>{if(u===r)return-1;let p=n.indexOf(u);return p<0?n.length:p},"rank");return s.sort((u,p)=>l(u.code)-l(p.code)||o.compare(u.name,p.name))}i(Bn,"countryNames");function vo({step:e,i18n:t,issuer:n,onPicked:r,ageStepUp:a=!1}){let{t:s,locale:o}=t,l=ho(()=>Rn(e.documents),[e.documents]),u=ho(()=>Bn(o,l,Object.keys(e.documents.byIssuer??{}),e.detectedCountry),[o,l,e.documents,e.detectedCountry]),p=l.length===1?l[0]:null,[f,g]=bo(n??p),[k,m]=bo(null),y=p===null?[]:gt(e.documents,p),w=p!==null&&y.length===1?y[0]:null;So(()=>{p!==null&&w!==null&&e.selectDocument(p,w)},[p,w]);let N=i((S,x)=>{e.selectDocument(S,x),r?.()},"pick"),O=i(S=>{let x=gt(e.documents,S);x.length===1?N(S,x[0]):g(S)},"chooseIssuer");if(So(()=>{if(k===null||f===null)return;let S=setTimeout(()=>N(f,k),On);return()=>clearTimeout(S)},[k]),Ge(f!==null&&l.length>1&&n===void 0?()=>{g(null),m(null)}:null),w!==null)return null;if(f===null)return Xe("section",{className:"sekyro-step",children:[q(J,{title:s("doc.countryTitle"),lead:s(a?"doc.ageStepUp":"doc.pickDescription")}),q(Yt,{countries:u,label:s("doc.countryLabel"),searchPlaceholder:s("doc.countrySearch"),noMatch:s("doc.noCountryMatch"),onPick:O}),q(j,{children:null})]});let R=gt(e.documents,f);return Xe("section",{className:"sekyro-step",children:[q(J,{title:s("doc.pickTitle"),lead:s(a&&p!==null?"doc.ageStepUp":"native.doc.holdIt")}),q("div",{className:"sekyro-choices",children:R.map(S=>Xe("button",{type:"button",className:"sekyro-card","aria-pressed":k===S,disabled:k!==null&&k!==S,onClick:()=>m(S),children:[q("span",{className:"sekyro-card__tile",children:q(M,{name:S==="passport"?"passport":"card"})}),Xe("span",{className:"sekyro-card__body",children:[q("span",{className:"sekyro-card__title",children:s(`doc.type.${S}`)}),q("span",{className:"sekyro-card__sub",children:s(`doc.sub.${S}`)})]}),q("span",{className:"sekyro-radio","aria-hidden":"true"})]},S))}),l.length>1?q("button",{type:"button",className:"sekyro-link",onClick:()=>{g(null),m(null)},children:s("native.doc.changeCountry")}):null,q(j,{children:null})]})}i(vo,"DocumentPicker");import{jsx as re,jsxs as Un}from"react/jsx-runtime";var Hn={load:i(()=>import("../document-capture-view-GENB535Z.js"),"load")};function St({step:e,locale:t,strings:n,className:r,liveMrz:a,barcodeAssetBaseUrl:s}){let o=v(t,n),[l,u]=kt(0),[p,f]=kt(null),g=Ln(e.documents),k=g.length>1,m=e.issuer!==null&&Co(e.documents,e.issuer).length>1,y=e.documentType===null||e.issuer===null||p!==null,w=g.length===1&&Co(e.documents,g[0]).length===1,[N]=kt(()=>y&&!w),O=e.ageStepUp===!0,R=Mn(()=>Vn(()=>Hn.load().then(x=>({default:x.DocumentCaptureView}))),[l]);Dn(()=>{An()},[]);let S=Un(P,{tone:"danger",children:[re("span",{children:o.t("errors.network_error")}),re(h,{kind:"secondary",onClick:()=>u(x=>x+1),children:o.t("doc.retryCamera")})]});return re("div",{className:r,children:y?re(vo,{step:e,i18n:o,ageStepUp:O&&p===null&&N,...p==="document"&&e.issuer!==null?{issuer:e.issuer}:{},onPicked:()=>f(null)}):re(ee,{fallback:S,children:re(Fn,{fallback:re("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:o.t("common.loading")}),children:re(R,{step:e,i18n:o,ageLead:O&&!N,liveMrz:e.documentType==="drivers_license"?void 0:a,barcodeAssetBaseUrl:s,...k?{onChangeCountry:i(()=>f("country"),"onChangeCountry")}:{},...m?{onChangeDocument:i(()=>f("document"),"onChangeDocument")}:{}})})},l)})}i(St,"DocumentCapture");import{warmPortraitCapture as $n}from"@sekyro/web";import{Component as Kn,lazy as wo,Suspense as No,useContext as zn,useEffect as Gn,useMemo as _o,useState as Po}from"react";import{jsx as E,jsxs as je}from"react/jsx-runtime";var qn={load:i(()=>import("../portrait-capture-view-VTN2VU3E.js"),"load")},Yn={load:i(()=>import("../portrait-review-view-JTRGDYNV.js"),"load")},bt=class bt extends Kn{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(bt,"LoadBoundary");var Je=bt;function Wn({step:e,i18n:t}){let{t:n}=t,r=ke();return je("section",{className:"sekyro-stack sekyro-stack--2","data-testid":"sekyro-portrait-match",children:[E("h2",{ref:r,tabIndex:-1,className:"sekyro-text-body",children:n(e.review?"portrait.reviewTitle":"session.steps.portrait.title")}),e.review?E("p",{className:"sekyro-text-muted",children:n("portrait.reviewDescription")}):null,e.uploadFailed?je(P,{tone:"danger",children:[E("span",{children:n("portrait.uploadFailed")}),E(h,{kind:"secondary",onClick:()=>{e.resubmit()},children:n("portrait.sendAgain")})]}):E("p",{role:"status","aria-live":"polite","aria-busy":"true",className:"sekyro-text-muted",children:n("portrait.matching")})]})}i(Wn,"MatchPhase");function ht({step:e,locale:t,strings:n,className:r,assetBaseUrl:a,verification:s}){let o=v(t,n),l=Mt(s),u=zn(Ye),[p,f]=Po(0),[g,k]=Po(null),m=_o(()=>wo(()=>qn.load().then(H=>({default:H.PortraitCaptureView}))),[p]),y=_o(()=>wo(()=>Yn.load().then(H=>({default:H.PortraitScreens}))),[p]),w=typeof e.uploadPortrait=="function",N=w?e.photo?.source??"camera":"camera",O=w&&N!=="camera"&&e.photo?.uploadOffered===!0,R=N!=="upload",S=N==="upload"?"upload":N==="choice"?g??e.photo?.pick??"source":"camera",x=e.phase==="capture"&&e.photo?.cameraOnPhone===!0;if(Gn(()=>{e.phase==="capture"&&S==="camera"&&!x&&$n()},[e.phase,S,x]),e.phase==="match")return E("div",{className:r,children:E(Wn,{step:e,i18n:o})});let _=E("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:o.t("common.loading")});if(u!==null&&(u.busy||u.failed!==null)&&e.phase==="capture"&&S==="camera")return je("section",{className:`sekyro-step${r?` ${r}`:""}`,children:[E(J,{title:o.t("session.steps.portrait.title")}),E(j,{children:E(h,{kind:"secondary",full:!0,disabled:u.busy,onClick:u.reset,children:o.t("portrait.retryCamera")})})]});if(e.phase==="review"||S!=="camera"||x)return E("div",{className:r,children:E(Je,{fallback:E(h,{kind:"ghost",onClick:()=>f(H=>H+1),children:o.t("common.retry")}),children:E(No,{fallback:_,children:E(y,{screen:e.phase==="review"?"review":x&&S==="camera"?"phone":S==="camera"?"review":S,step:e,i18n:o,...R?{onCamera:i(()=>k("camera"),"onCamera")}:{},onUpload:()=>k("upload"),onDeclined:()=>k(null)})})},p)});if(!l.settled)return E("div",{className:r,children:_});let Z=je(P,{tone:"danger",children:[E("span",{children:o.t("errors.network_error")}),E(h,{kind:"secondary",onClick:()=>f(H=>H+1),children:o.t("portrait.retryCamera")})]});return E("div",{className:r,children:E(Je,{fallback:Z,children:E(No,{fallback:_,children:E(m,{step:e,i18n:o,...a!==void 0?{assetBaseUrl:a}:{},...O?{onUpload:i(()=>k("upload"),"onUpload")}:{}})})},p)})}i(ht,"PortraitCapture");import{lazy as Zn,Suspense as Qn,useMemo as Xn,useState as Jn}from"react";import{jsx as de,jsxs as er}from"react/jsx-runtime";var jn={load:i(()=>import("../proof-of-address-view-UQOZZXQO.js"),"load")};function vt({step:e,locale:t,strings:n,className:r}){let a=v(t,n),[s,o]=Jn(0),l=Xn(()=>Zn(()=>jn.load().then(p=>({default:p.ProofOfAddressView}))),[s]),u=er(P,{tone:"danger",children:[de("span",{children:a.t("errors.network_error")}),de(h,{kind:"secondary",onClick:()=>o(p=>p+1),children:a.t("common.retry")})]});return de("div",{className:r,children:de(ee,{fallback:u,children:de(Qn,{fallback:de("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:de(l,{step:e,i18n:a})})},s)})}i(vt,"ProofOfAddress");import{lazy as tr,Suspense as or,useMemo as nr,useState as rr}from"react";import{jsx as pe,jsxs as ir}from"react/jsx-runtime";var sr={load:i(()=>import("../form-view-MEYCK437.js"),"load")};function Ct({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),[o,l]=rr(0),u=nr(()=>tr(()=>sr.load().then(f=>({default:f.FormView}))),[o]),p=ir(P,{tone:"danger",children:[pe("span",{children:s.t("errors.network_error")}),pe(h,{kind:"secondary",onClick:()=>l(f=>f+1),children:s.t("common.retry")})]});return pe("div",{className:r,children:pe(ee,{fallback:p,children:pe(or,{fallback:pe("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:s.t("common.loading")}),children:pe(u,{step:e,i18n:s,...a!==void 0?{onError:a}:{}})})},o)})}i(Ct,"FormStep");import{cameraUnavailableCauseOf as xr}from"@sekyro/web";import{useCallback as te,useContext as Ir,useEffect as Ve,useId as Tr,useMemo as Rt,useRef as oe,useState as W}from"react";var wt={light:{lineBrand:"#0d3b66",successSoft:"#d5f0e8",successFg:"#005341",onSuccess:"#ffffff",warningSoft:"#fff7e6",warningFg:"#735003",onWarning:"#191a1b",dangerSoft:"#ffdada",dangerFg:"#ca0f07",onDanger:"#ffffff",info:"#0563d4",infoSoft:"#d3e5ff",infoFg:"#064da5",onInfo:"#ffffff"},dark:{lineBrand:"#3f80bf",successSoft:"#002c23",successFg:"#53ffd4",onSuccess:"#030303",warningSoft:"#463102",warningFg:"#ffd98a",onWarning:"#030303",dangerSoft:"#9c1008",dangerFg:"#ffbbbb",onDanger:"#030303",info:"#5da9ff",infoSoft:"#063778",infoFg:"#acd0ff",onInfo:"#030303"},sizes:{buttonHeight:"52px",controlRadius:"10px",cardRadius:"16px",fieldRadius:"10px",iconTile:"56px",iconTileRadius:"16px",headerTile:"40px",choiceTile:"40px",tileRadius:"10px",resultDisc:"64px",resultRing:"8px",progressHeight:"4px",focusRing:"2px",focusRingOffset:"2px",otpBox:"60px",choiceMinHeight:"76px",stepGap:"32px",headingGap:"12px"},motion:{page:"320ms",easeOut:"cubic-bezier(0.16, 1, 0.3, 1)"}};var Be={light:{danger:{base:"#ca0f07",soft:"#ffdada",fg:"#ca0f07",on:"#ffffff"},success:{base:"#007a5e",soft:"#d5f0e8",fg:"#005341",on:"#ffffff"},warning:{base:"#ffab00",soft:"#fff7e6",fg:"#735003",on:"#191a1b"},info:{base:"#0563d4",soft:"#d3e5ff",fg:"#064da5",on:"#ffffff"}},dark:{danger:{base:"#ff7c7c",soft:"#9c1008",fg:"#ffbbbb",on:"#030303"},success:{base:"#00c897",soft:"#002c23",fg:"#53ffd4",on:"#030303"},warning:{base:"#ffbb2e",soft:"#463102",fg:"#ffd98a",on:"#030303"},info:{base:"#5da9ff",soft:"#063778",fg:"#acd0ff",on:"#030303"}}},ar=["danger","success","warning","info"];function Nt(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}i(Nt,"channel");function xo(e){let t=Nt(parseInt(e.slice(1,3),16)),n=Nt(parseInt(e.slice(3,5),16)),r=Nt(parseInt(e.slice(5,7),16));return .2126*t+.7152*n+.0722*r}i(xo,"luminance");function lr(e,t){let n=xo(e),r=xo(t),a=Math.max(n,r),s=Math.min(n,r);return(a+.05)/(s+.05)}i(lr,"contrastRatio");function Io(e,t){return Math.min(...ar.map(n=>lr(Be[e][n].fg,t)))}i(Io,"worstAgainst");function To(e,t,n){return Math.min(Io(e,t),Io(e,n))}i(To,"worstStatusContrast");function Eo(e,t){return To("light",e,t)>=To("dark",e,t)?"light":"dark"}i(Eo,"statusSchemeFor");import{useRef as dr,useState as pr}from"react";import{useEffect as cr,useId as ur,useRef as _t}from"react";import{jsx as Ce,jsxs as Ro}from"react/jsx-runtime";function et({open:e,title:t,closeLabel:n,onClose:r,children:a,actions:s,role:o,testId:l,returnFocus:u}){let p=_t(null),f=_t(null),g=_t(!1),k=ur();return cr(()=>{let m=p.current;if(m!==null){if(e&&!m.open?(f.current=typeof document>"u"?null:document.activeElement,typeof m.showModal=="function"?m.showModal():m.setAttribute("open","")):!e&&m.open&&(typeof m.close=="function"?m.close():m.removeAttribute("open")),!e&&g.current){let y=u?.current??(f.current instanceof HTMLElement?f.current:null);f.current=null,y?.focus()}g.current=e}},[e,u]),Ce("dialog",{ref:p,className:"sekyro-dialog","aria-labelledby":k,...o==="alertdialog"?{role:o}:{},"data-testid":l,onCancel:m=>{m.preventDefault(),r()},onClick:m=>{m.target===m.currentTarget&&r()},children:Ro("div",{className:"sekyro-dialog__panel",children:[Ro("div",{className:"sekyro-dialog__head",children:[Ce("h2",{id:k,className:"sekyro-dialog__title",children:t}),n!==void 0?Ce("button",{type:"button",className:"sekyro-disc sekyro-dialog__close","aria-label":n,onClick:r,children:Ce(M,{name:"close"})}):null]}),a!==void 0?Ce("div",{className:"sekyro-dialog__body",children:a}):null,s!==void 0?Ce("div",{className:"sekyro-dialog__actions",children:s}):null]})})}i(et,"FlowDialog");import{jsx as Le,jsxs as Oo}from"react/jsx-runtime";var mr=["intro","data","processing","sharing","retention"];function Bo({i18n:e,purpose:t="identity"}){let{t:n}=e,[r,a]=pr(!1),s=dr(null),[o,l=""]=n("consent.short").split("{terms}");return Oo("div",{className:"sekyro-consent","data-testid":"sekyro-consent",children:[Oo("p",{className:"sekyro-consent__line",children:[o,Le("button",{ref:s,type:"button",className:"sekyro-link sekyro-link--inline","aria-haspopup":"dialog",onClick:()=>a(!0),children:n("consent.termsLink")}),l]}),Le(et,{open:r,title:n("consent.termsTitle"),closeLabel:n("native.close"),onClose:()=>a(!1),returnFocus:s,testId:"sekyro-consent-terms",children:Le("div",{className:"sekyro-stack sekyro-stack--3",children:t==="human"?Le(B,{view:"HumanConsentTerms",i18n:e,quiet:!0}):mr.map(u=>Le("p",{children:n(`consent.terms.${u}`)},u))})})]})}i(Bo,"ConsentNotice");function Lo(e){let t=e.trim().split(/\s+/).filter(r=>r!=="");return(t.length>=2?[t[0],t[1]].map(r=>Array.from(r??"")[0]??""):Array.from(t[0]??"").slice(0,2)).join("").toUpperCase()}i(Lo,"initials");import{useSyncExternalStore as fr}from"react";var Fo=i(e=>({colors:{...e?$.dark:$.light},radius:$.radius,fontFamily:$.font}),"brandTheme"),ea=Fo(!1),Ao=/^#[0-9a-f]{6}$/i;function Pt(e,t,n){if(t)return null;let r=it(e).colors,a=n?.colors?.bg??r?.bg,s=n?.colors?.surface??r?.surface;return a===void 0&&s===void 0||a!==void 0&&!Ao.test(a)||s!==void 0&&!Ao.test(s)?null:Eo(a??$.light.bg,s??$.light.surface)}i(Pt,"partnerStatusScheme");function tt(e,t,n){let r=it(e);if(n&&r.colors!==void 0){let{brand:a,brandFg:s}=r.colors;a!==void 0&&Sr(a,$.dark.bg)>=3?r.colors={brand:a,ring:a,...s!==void 0?{brandFg:s}:{}}:delete r.colors}if(Pt(e,n,t)==="dark"){let a=Be.dark;r.colors={...r.colors,danger:a.danger.base,success:a.success.base,warning:a.warning.fg}}return ze(Fo(n),r,Ut(t))}i(tt,"verificationTheme");function ot(e){let t=fr(kr,gr,()=>!1);return e==="dark"||e==="system"&&t}i(ot,"useDarkScheme");var yr="(prefers-color-scheme: dark)",Do=i(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(yr):null,"media"),gr=i(()=>Do()?.matches??!1,"prefersDark");function kr(e){let t=Do();return t?.addEventListener("change",e),()=>t?.removeEventListener("change",e)}i(kr,"subscribe");function Sr(e,t){let[n,r]=[Vo(e),Vo(t)];return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}i(Sr,"contrast");function Vo(e){let t=[1,3,5].map(n=>{let r=Number.parseInt(e.slice(n,n+2),16)/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4});return .2126*(t[0]??0)+.7152*(t[1]??0)+.0722*(t[2]??0)}i(Vo,"luminance");var xt="sekyro.testerGate";function It(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}i(It,"store");function Mo(e=Date.now()){try{It()?.setItem(xt,String(e))}catch{}}i(Mo,"rememberTester");function Ho(e=Date.now()){try{let t=Number(It()?.getItem(xt)??"");return Number.isFinite(t)&&t>0&&e-t<2592e6}catch{return!1}}i(Ho,"rememberedTester");function Uo(){try{It()?.removeItem(xt)}catch{}}i(Uo,"forgetTester");import{useEffect as hr,useId as br,useState as vr}from"react";import{jsx as A,jsxs as me}from"react/jsx-runtime";var $o=new Set(["document_id_number_mismatch","name_mismatch","birth_date_mismatch"]),Cr={review:{icon:"pending",tone:"info"},cooldown:{icon:"timer",tone:"info"},rejected:{icon:"close",tone:"neutral"},policy:{icon:"close",tone:"neutral"},inconclusive:{icon:"warning",tone:"neutral"},unavailable:{icon:"timer",tone:"neutral"},expired:{icon:"timer",tone:"neutral"}};function wr({screen:e}){if(e==="verified")return me("svg",{className:"sekyro-outcome sekyro-outcome--approved",viewBox:"0 0 136 136","aria-hidden":"true",focusable:"false",children:[A("circle",{className:"sekyro-outcome__ring",cx:"68",cy:"68",r:"54",pathLength:"1"}),A("circle",{className:"sekyro-outcome__disc",cx:"68",cy:"68",r:"48"}),A("path",{className:"sekyro-outcome__glyph",d:"M6.5 12.5l3.6 3.6 7.4-8.2",pathLength:"1",transform:"translate(39 39) scale(2.4167)"})]});let{icon:t,tone:n}=Cr[e];return A("span",{className:`sekyro-tile sekyro-tile--${n} sekyro-outcome-tile`,"aria-hidden":"true","data-screen":e,children:A(M,{name:t})})}i(wr,"OutcomeMark");function Nr({label:e,id:t,copied:n}){let[r,a]=vr(!1);return hr(()=>{if(!r)return;let s=setTimeout(()=>a(!1),1600);return()=>clearTimeout(s)},[r]),me("button",{type:"button",className:`sekyro-reference${r?" is-copied":""}`,onClick:()=>{navigator.clipboard?.writeText(t).then(()=>a(!0),()=>{})},children:[A("span",{"aria-live":"polite",children:r?n:e}),A("bdi",{dir:"ltr",children:t}),A(M,{name:"copy"})]})}i(Nr,"ReferenceLine");function _r({step:e,t}){let n=e.context.sandbox?e.context.simulation?.reason:void 0;return n===void 0?null:me(Re,{tone:"warning",role:"status",testId:"sekyro-simulated-notice",children:[A("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:A(M,{name:"info"})}),me("div",{className:"sekyro-notice__body","data-reason":n,children:[A("strong",{children:t("sandbox.simulatedTitle")}),A("span",{children:t(n==="no_testers"?"sandbox.simulatedNoTesters":"sandbox.simulatedGate")})]})]})}i(_r,"SimulationNotice");function Pr(e,t){return e==="expired"?"native.result.expiredTitle":e!=="verified"?`session.result.${e}.title`:t.level===3?"session.result.verified.title":t.level===1&&t.assurance==="contact_phone"?"session.result.verified.titlePhone":t.level===1&&t.assurance==="contact_email"?"session.result.verified.titleEmail":t.level===1?"session.result.verified.titleContact":"session.result.verified.titleHuman"}i(Pr,"resultTitleKey");function Tt({step:e,locale:t,strings:n,className:r,onClose:a}){let s=v(t,n),{t:o}=s,l=br(),u=ke(),p=e.context.orgName,f=e.reasonCode??"",g=e.display==="platform_unsupported"?"policy":e.display,k=i(y=>(p!==""||y==="verified")&&y!=="cooldown"?o(`native.result.${y}`,{org:p}):o(`session.result.${y}.description`),"partnerLine"),m;switch(e.display){case"rejected":f==="identity_not_verified"?m=p!==""?o("reasons.identity_not_verified",{org:p}):o("session.result.identityNotVerified"):m=$o.has(rt(f))?o("session.result.detailsMismatch",{org:p}):k("rejected");break;case"policy":{if($o.has(rt(f)))m=o("session.result.detailsMismatch",{org:p});else if(f==="device_velocity_exceeded")m=o("session.result.deviceVelocity",{org:p});else if(f==="capture_tampered")m=o("session.result.deviceStop");else if(f==="camera_unavailable")m=o("reasons.camera_unavailable",{org:p});else if(f==="underage_estimated")m=o("reasons.underage_estimated");else if(f==="starter_credit_claimed")m=o("reasons.starter_credit_claimed");else if(f==="blocked_by_org")m=o("reasons.blocked_by_org");else{let y=f===""?null:Lt(f);m=y!==null?o(y,{org:p}):k("policy")}break}case"cooldown":{let y=At(s.locale,e.retryAfter);m=y!==null?o(y.key,{time:y.time}):o("session.result.cooldown.description");break}case"platform_unsupported":m=o("result.platform_unsupported");break;default:m=k(g)}return me("section",{className:`sekyro-result${r?` ${r}`:""}`,"aria-labelledby":l,"data-testid":"sekyro-result",children:[me("div",{className:"sekyro-result__body",children:[A(wr,{screen:g}),me("div",{className:"sekyro-heading",children:[A("h2",{id:l,ref:u,tabIndex:-1,className:"sekyro-text-body",children:o(Pr(g,e.result))}),A("p",{className:"sekyro-text-muted",children:m})]}),A(_r,{step:e,t:o}),A(Nr,{label:o("result.referenceLabel"),id:e.context.sessionId,copied:o("native.result.copied")})]}),a!==void 0?A("div",{className:"sekyro-actions",children:A(h,{full:!0,onClick:a,children:o("native.result.continue",{org:p})})}):null]})}i(Tt,"VerificationResultScreen");import{Fragment as Ae,jsx as c,jsxs as Y}from"react/jsx-runtime";function Er(e,t,n){let r=t?$.dark:$.light,a=t?$.roles.dark:$.roles.light,s=e.colors??{},o={},l=s.fg===r.fg&&s.surface===r.surface;s.brand===r.brand&&s.surface===r.surface&&(o["--sekyro-color-brand-soft"]=a.brandSoft),l&&(o["--sekyro-color-line"]=a.line,o["--sekyro-color-line-subtle"]=a.lineSubtle,o["--sekyro-color-line-strong"]=a.lineStrong,o["--sekyro-color-sunken"]=a.sunken),s.fgMuted===r.fgMuted&&s.surface===r.surface&&(o["--sekyro-color-fg-subtle"]=a.fgSubtle),e.fontFamily===$.font&&(o["--sekyro-font-display"]=$.fontDisplay);let u=t?wt.dark:wt.light;if(o["--sekyro-color-success-soft"]=u.successSoft,o["--sekyro-color-success-fg"]=u.successFg,o["--sekyro-color-on-success"]=u.onSuccess,o["--sekyro-color-warning-soft"]=u.warningSoft,o["--sekyro-color-warning-fg"]=u.warningFg,o["--sekyro-color-danger-soft"]=u.dangerSoft,o["--sekyro-color-danger-fg"]=u.dangerFg,o["--sekyro-color-on-danger"]=u.onDanger,o["--sekyro-color-info-soft"]=u.infoSoft,o["--sekyro-color-info-fg"]=u.infoFg,s.brand===r.brand&&(o["--sekyro-color-line-brand"]=u.lineBrand),n!==null){let p=Be[n];for(let f of["danger","success","warning","info"])o[`--sekyro-color-${f}-soft`]=p[f].soft,o[`--sekyro-color-${f}-fg`]=p[f].fg;o["--sekyro-color-on-success"]=p.success.on,o["--sekyro-color-on-danger"]=p.danger.on}return o}i(Er,"flowRoles");function Ot(e){let{verification:t,locale:n,strings:r,onStep:a,onResult:s}=e,{step:o,error:l}=ct(t);Ve(()=>{o!==null&&a?.(o)},[o,a]),Ve(()=>s===void 0?void 0:t.on("result",s),[t,s]);let u=ot(e.colorScheme??"light"),p=o?.context.branding,f=tt(p,e.theme,u),[g,k]=W(!1),m=`sekyro-verification${u?" sekyro-verification--dark":""}${g?" is-immersive":""}${e.className!==void 0?` ${e.className}`:""}`,y=oe(e.onClose);y.current=e.onClose;let w=oe(o);w.current=o;let N=te(()=>{let _=w.current;y.current?.(_?.kind==="result"?{reason:"finished",result:_.result}:{reason:"cancelled"})},[]),[O,R]=W(null),S=te(()=>{let _=w.current;_!==null&&_.kind!=="result"&&_.context.consentRecorded?R("close"):N()},[N]),x=Rt(()=>t.reportCaptureIssue===void 0?null:_=>t.reportCaptureIssue?.(_),[t]);return c(Kt,{theme:f,className:m,children:c(Oe,{locale:n,...r!==void 0?{strings:r}:{},children:c("div",{dir:e.dir??(n==="ar"?"rtl":"ltr"),lang:n,className:"sekyro-flow",style:Er(f,u,Pt(p,u,e.theme)),children:c(Jt.Provider,{value:k,children:c(at.Provider,{value:e.onClose!==void 0?N:void 0,children:c(qe.Provider,{value:e.onClose!==void 0?S:void 0,children:Y(Ft.Provider,{value:x,children:[c(Vr,{...e,step:o,error:l,immersive:g,onLeaveAsk:()=>R("history"),onClosed:N}),c(Br,{open:O!==null,onStay:()=>{O==="history"&&Et(),R(null)},onLeave:()=>{let _=O;R(null),_==="close"||e.onClose!==void 0?N():typeof window<"u"&&qo()}})]})})})})})})})}i(Ot,"SekyroVerification");function Rr(e,t){if(t===void 0||t==="aml_screening")return null;let n=e,r=n[`session.processing.${t}.title`],a=n[`session.processing.${t}.description`];return typeof r=="string"&&r!==""&&typeof a=="string"&&a!==""?{title:r,description:a}:null}i(Rr,"processingCopyOf");function Or({error:e,retry:t}){let{t:n}=v(),r=ke();return Y(Re,{tone:"danger",testId:"sekyro-error-notice",children:[c("span",{children:n(Bt(e))}),e.retryable?c(h,{ref:r,kind:"secondary",className:"sekyro-btn--start",onClick:t,children:n("common.retry")}):null]})}i(Or,"CameraErrorNotice");var zo="sekyroFlow";function Go(){let e=window.history.state;return typeof e=="object"&&e!==null&&e[zo]===!0}i(Go,"onGuard");function Et(){if(typeof window>"u"||Go())return;let e=window.history.state;window.history.pushState({...typeof e=="object"&&e!==null?e:{},[zo]:!0},"")}i(Et,"pushGuard");function qo(){window.history.back()}i(qo,"leaveHistory");function Br({open:e,onStay:t,onLeave:n}){let{t:r}=v();return c(et,{open:e,role:"alertdialog",title:r("leave.title"),onClose:t,testId:"sekyro-leave",actions:Y(Ae,{children:[c(h,{full:!0,onClick:t,children:r("leave.stay")}),c(h,{full:!0,kind:"danger",onClick:n,children:r("leave.confirm")})]}),children:c("p",{className:"sekyro-text-muted",children:r("leave.body")})})}i(Br,"LeaveDialog");function Lr(e,t){let[n,r]=W(!1),[a,s]=W(null),o=e===null?void 0:e.skipCapture,l=oe(o);l.current=o;let u=oe(!1),p=e?.key;Ve(()=>s(null),[p]);let f=te(()=>{if(u.current)return;let y=l.current;y!==void 0&&(u.current=!0,r(!0),s(null),y().catch(w=>s(t.t(ue(w,t.strings)))).finally(()=>{u.current=!1,r(!1)}))},[t]),g=te(()=>s(null),[]),k=o!==void 0,m=t.t("sandbox.skipCapture");return Rt(()=>k?{label:m,busy:n,failed:a,run:f,reset:g}:null,[k,m,n,a,f,g])}i(Lr,"useSkipCapture");function Ar({skip:e}){return Y(Ae,{children:[e.failed!==null?c(P,{tone:"danger",children:c("span",{children:e.failed})}):null,c(h,{kind:"ghost",full:!0,disabled:e.busy,"aria-busy":e.busy||void 0,onClick:e.run,"data-testid":"sekyro-skip-capture",children:e.label})]})}i(Ar,"SkipAction");function Vr(e){let{step:t,error:n,slots:r,immersive:a}=e,s=v(),{t:o}=s,[l,u]=W(!1),[p,f]=W([]),g=te(d=>(f(I=>[...I,d]),()=>f(I=>I.filter(X=>X!==d))),[]),[k,m]=W(null),y=te(d=>m(()=>d),[]),[w,N]=W(0),[O,R]=W(null),S=Lr(t,s),x=t?.context.testerGate!==void 0,[_,Z]=W(!1),H=oe(null);Ve(()=>{!x||H.current!==null||(H.current=Ho(),H.current&&Z(!0))},[x]);let U=t?.context.purpose??"identity",D=t?.context.returning===!0,fe=e.verification,Ne=U==="human"||t?.context.cameraUnavailableHandled===!0,_e=fe.reportCameraUnavailable!==void 0&&Ne?d=>fe.reportCameraUnavailable?.(d)??Promise.resolve():void 0,Fe=t?.kind==="liveness"&&t.mode==="liveness"&&t.reason===void 0&&!t.attemptsExhausted,K=e.handoffUrl,De=oe({last:null,count:0}),se=te((d,I,X=!1)=>_e===void 0&&I!=="denied"?void 0:c(B,{view:"NoCameraView",i18n:s,quiet:!0,cause:I,onRetry:d,repeated:X,...Fe&&_e!==void 0?{onContinue:_e}:{},...K!==void 0?{handoffUrl:K}:{}}),[s,fe,Ne,Fe,K]),ye=Rt(()=>io(t),[t]),z=te((d,I)=>c(ao,{start:d,context:I,human:U==="human",returning:D,notice:I.permissionSettled&&I.permission==="denied"?se(d,"denied"):void 0,...ye!==void 0?{retry:ye}:{}}),[U,D,se,ye]),Me=te((d,I)=>{let X=xr(d.kind),Ke=De.current;d.kind==="permission"&&d!==Ke.last&&(Ke.last=d,Ke.count+=1);let Wo=d.kind==="permission"&&Ke.count>1;return(X!==void 0?se(I,X,Wo):void 0)??Y(Ae,{children:[c(Or,{error:d,retry:I}),X!==void 0&&K!==void 0?c(B,{view:"DesktopHandoffView",i18n:s,quiet:!0,url:K}):null]})},[se,K,s]),ne=oe(""),ie=e.livenessProps?.slots?.stageOverlay,Pe=te(d=>(d.guidance!==""&&!d.coached&&(ne.current=d.guidance),c(co,{testId:"sekyro-capture-stage",video:c("video",{ref:d.videoRef,playsInline:!0,muted:!0,className:"sekyro-lm-video sekyro-fc-video","aria-hidden":"true","data-testid":"sekyro-capture-video"}),instruction:d.settled?o("capture.checkingTitle"):d.guidance!==""?d.guidance:ne.current,note:d.note,status:d.status,busy:d.settled,progress:d.phase==="seeking"||d.phase==="aligning"?d.progress:1,still:d.still,live:d.live,closeLabel:o("native.close"),overlay:ie?.(d.videoRef),ramp:d.ramp?.colour??null,...d.settled?{}:{onClose:i(()=>N(I=>I+1),"onClose")},end:d.modeSwitch!=null?c(Vt,{view:d.modeSwitch,className:"sekyro-glass sekyro-glass--label"}):null,children:d.settled||!d.live?null:c(jt,{onStop:()=>N(I=>I+1)})})),[o,ie]),He=Tr(),Ue=t,ge=t!==null&&O===t.key&&t.context.switchable!==void 0,Q=k??(t===null||t.kind==="result"?null:ge?()=>R(null):t.context.switchable!==void 0&&typeof Ue?.chooseOption=="function"?()=>R(t.key):null),ae=oe(Q);ae.current=Q;let xe=oe(t);xe.current=t;let le=oe({ask:e.onLeaveAsk,closed:e.onClosed,hostClose:e.onClose!==void 0});le.current={ask:e.onLeaveAsk,closed:e.onClosed,hostClose:e.onClose!==void 0};let Ie=e.backNavigation==="history";if(Ve(()=>{if(!Ie||typeof window>"u")return;Et();let d=i(()=>{if(Go())return;let I=xe.current,X=ae.current;X!==null?(X(),Et()):I?.kind!=="result"&&I?.context.consentRecorded===!0?le.current.ask():le.current.hostClose?le.current.closed():qo()},"onPop");return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[Ie]),n!==null)return c(Re,{tone:"danger",children:c("span",{children:o(ue(n,s.strings))})});if(t===null)return Y("div",{className:"sekyro-skeleton",role:"status","aria-busy":"true",children:[c("span",{className:"sekyro-visually-hidden",children:o("common.loading")}),c("span",{className:"sekyro-skeleton__bar is-title"}),c("span",{className:"sekyro-skeleton__bar"}),c("span",{className:"sekyro-skeleton__bar is-short"}),c("span",{className:"sekyro-skeleton__bar is-block"})]});let{context:L}=t,Te=i(d=>{u(!0),d().finally(()=>u(!1))},"refresh"),nt=r?.header??c(Dr,{context:L,headerId:He,end:r?.headerEnd,...Q!==null?{onBack:Q}:{}}),T,ce=ge;if(_&&e.verification.testerGate!==void 0)T=c(st.Provider,{value:Pe,children:c(B,{view:"TesterGateView",i18n:s,verification:e.verification,attemptsLeft:L.testerGate?.attemptsLeft??0,livenessProps:{...e.livenessProps??{},slots:{...e.livenessProps?.slots,intro:e.livenessProps?.slots?.intro??z},locale:e.locale,dir:e.dir,strings:s.strings,assetBaseUrl:e.assetBaseUrl,voice:e.voice},onBound:()=>Mo(),onDone:d=>{d&&Uo(),Z(!1)}})});else if(ce)T=c(B,{view:"LaneChoiceView",i18n:s,step:t,onClose:()=>R(null)});else switch(t.kind){case"phone_otp":T=c(ut,{step:t});break;case"email_otp":T=c(dt,{step:t});break;case"method":T=c(ft,{step:t});break;case"registry":T=c(Qe,{step:t});break;case"document":T=c(St,{step:t,...e.documentLiveMrz!==void 0?{liveMrz:e.documentLiveMrz}:{},...e.documentBarcodeAssetBaseUrl!==void 0?{barcodeAssetBaseUrl:e.documentBarcodeAssetBaseUrl}:{}});break;case"liveness":{let d=e.livenessProps?.slots?.intro,I={...e.livenessProps??{},slots:{...e.livenessProps?.slots,intro:d??z,...d===void 0&&e.livenessProps?.slots?.errorPanel===void 0?{errorPanel:Me}:{}},...w>0?{autoStart:!1}:{},verification:e.verification,locale:e.locale,dir:e.dir,strings:s.strings,assetBaseUrl:e.assetBaseUrl,voice:e.voice,onCaptured:e.onLivenessCaptured};T=c(st.Provider,{value:Pe,children:t.instructions==="icao"||t.livePhoto?.icao===!0?c(B,{view:"LivePhotoLiveness",i18n:s,step:t,livenessProps:I,sekyroIntro:d===void 0},w):c(Ht,{...I},w)});break}case"portrait":T=Y(Ae,{children:[t.retakeOnly?c(B,{view:"PortraitRetakeNotice",i18n:s,quiet:!0}):null,c(ht,{step:t,verification:e.verification,...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}})]});break;case"proof_of_address":T=c(vt,{step:t});break;case"form":T=c(Ct,{step:t});break;case"contact_choice":T=c(B,{view:"ContactChoiceView",i18n:s,step:t});break;case"choice":T=c(B,{view:"GenericChoiceView",i18n:s,step:t});break;case"identity_summary":T=c(B,{view:"IdentitySummaryView",i18n:s,step:t});break;case"mobile_required":{let d=t.checkType==="doc_ocr"?o("handoff.lead.document"):t.checkType==="portrait_icao"?o("handoff.lead.portrait"):t.checkType==="poa"?o("handoff.lead.poa"):void 0;T=e.handoffUrl!==void 0?c(B,{view:"HandoffView",i18n:s,url:e.handoffUrl,refresh:t.refresh,...d!==void 0?{lead:d}:{}}):c(Ze,{tone:"brand",icon:"smartphone",title:o("handoff.title"),actions:c(h,{kind:"secondary",full:!0,disabled:l,onClick:()=>Te(t.refresh),children:o("common.refresh")}),children:c("p",{children:d??o("reasons.mobile_required")})});break}case"native_app_required":T=c(B,{view:"NativeAppView",i18n:s,org:L.orgName,nativeApp:t.nativeApp,...e.handoffUrl!==void 0?{fallbackUrl:e.handoffUrl}:{},refresh:t.refresh,footer:c(Ko,{org:L.orgName})});break;case"processing":{let d=Rr(s.strings,t.service);T=c(Ze,{tone:"brand",icon:"pending",busy:!t.stalled,live:!0,title:d?.title??o("session.processing.title"),actions:t.stalled?c(h,{kind:"secondary",full:!0,disabled:l,onClick:()=>Te(t.refresh),children:o("common.refresh")}):null,children:c("p",{children:d?.description??o("session.processing.description")})});break}case"eid":T=c(pt,{step:t});break;case"unsupported":{let d=t.reason==="platform_unsupported";T=c(Ze,{tone:"neutral",icon:"smartphone",title:o(d?"needsApp.title":"unsupported.title"),actions:c(Ko,{org:L.orgName}),children:c("p",{children:d?L.orgName!==""?o("needsApp.description",{org:L.orgName}):o("needsApp.descriptionNoOrg"):o("unsupported.description",{org:L.orgName})})});break}case"result":T=r?.result?.(t)??c(Fr,{step:t});break;default:{let d=t;T=null}}let $e=!a&&!L.consentRecorded&&t.kind!=="result"?c(Bo,{i18n:s,purpose:L.purpose}):null,Ee=S!==null&&!a&&!ce&&!_?c(Ar,{skip:S}):null,C=x&&!_&&!a&&!ce&&e.verification.testerGate!==void 0?c(B,{view:"TesterGateAction",i18n:s,quiet:!0,onOpen:()=>Z(!0)}):null,V=Ee===null&&C===null?$e:Y(Ae,{children:[C,Ee,$e]});return c(Xt.Provider,{value:y,children:c(Ye.Provider,{value:S,children:c(lo.Provider,{value:e.handoffUrl,children:Y(Qt.Provider,{value:V===null?null:{node:V,owner:p[0]??null,claim:g},children:[a?null:nt,!a&&t.kind!=="result"&&L.sections.length>1?c(Mr,{context:L,current:t.section,i18n:s}):null,c(to,{pageKey:t.key,children:T}),!a&&!ce&&t.kind!=="result"&&t.context.switchable!==void 0?c(B,{view:"LaneSwitch",i18n:s,step:t,onOpen:()=>R(t.key),quiet:!0},t.key):null,p.length===0?V:null,a?null:r?.footer!==void 0?r.footer:L.branding?.hideAttribution===!0?null:Y("a",{className:"sekyro-footer",href:"https://sekyro.ai",target:"_blank",rel:"noopener noreferrer",children:[c(M,{name:"lock"}),o("shell.verifiedBy")]})]})})})})}i(Vr,"Body");function Ko({org:e}){let{t}=v(),n=Ir(at);return n===void 0?null:c(h,{full:!0,onClick:n,children:t("native.result.continue",{org:e})})}i(Ko,"BackToOrg");function Fr({step:e}){return c(qe.Consumer,{children:t=>c(Tt,{step:e,...t!==void 0?{onClose:t}:{}})})}i(Fr,"ResultPage");function Dr({context:e,headerId:t,end:n,onBack:r}){let{t:a}=v(),[s,o]=W(!1),l=s?void 0:e.branding?.logoUrl,u=e.orgName!==""?e.orgName:a(e.returning?"returning.heading":"session.title");return c("header",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":t,children:Y("div",{className:"sekyro-org",children:[r!==void 0?c("button",{type:"button",className:"sekyro-disc sekyro-org__back","aria-label":a("common.back"),onClick:r,"data-testid":"sekyro-back",children:c(M,{name:"back"})}):null,c("span",{className:"sekyro-org__tile","aria-hidden":"true",children:l!==void 0?c("img",{className:"sekyro-org__logo",src:l,alt:"",onError:()=>o(!0)}):Lo(e.orgName)}),Y("div",{className:"sekyro-org__text",children:[c("h1",{id:t,className:"sekyro-org__name",children:u}),c("p",{className:"sekyro-org__sub",children:a(e.purpose==="human"?"shell.subtitleHuman":"shell.subtitle")})]}),e.sandbox?c("span",{className:"sekyro-sandbox-badge","data-testid":"sekyro-sandbox-badge",children:a("app.sandboxBadge")}):null,n!=null?c("div",{className:"sekyro-org__end",children:n}):null,c(qe.Consumer,{children:p=>p!==void 0?c("button",{type:"button",className:"sekyro-disc sekyro-org__close","aria-label":a("native.close"),onClick:p,children:c(M,{name:"close"})}):null})]})})}i(Dr,"OrgHeader");function Mr({context:e,current:t,i18n:n}){let r=t===null?-1:e.sections.indexOf(t),a=e.progress,s=a!==void 0&&a.length===e.sections.length?a:e.sections.map((o,l)=>({id:o,state:l<r?"done":l===r?"current":"upcoming"}));return c("ol",{className:"sekyro-progress__bars","aria-label":n.t("session.progressLabel"),children:s.map(({id:o,state:l})=>c("li",{className:`sekyro-progress__bar${l==="done"?" is-done":l==="current"?" is-current":""}`,...l==="current"?{"aria-current":"step"}:{},children:c("span",{className:"sekyro-visually-hidden",children:n.strings[`section.${o}`]??o})},o))})}i(Mr,"SectionProgress");import{useEffect as Hr,useState as Yo}from"react";import{jsx as we}from"react/jsx-runtime";function Ur(){return typeof window>"u"?"":window.location.href.split("#")[0]??""}i(Ur,"pageUrl");function $r({hostedUrl:e,inAppBrowser:t,...n}){let[r,a]=Yo(t===!0);Hr(()=>{t===void 0&<()&&a(!0)},[t]);let[s,o]=Yo(!1),l=ot(n.colorScheme??"light"),u=n.handoffUrl??e??Ur();return r&&!s?we($t,{theme:ze(tt(void 0,void 0,l),n.theme),className:`sekyro-verification${l?" sekyro-verification--dark":""}${n.className!==void 0?` ${n.className}`:""}`,children:we(Oe,{locale:n.locale,...n.strings!==void 0?{strings:n.strings}:{},children:we("div",{dir:n.dir??(n.locale==="ar"?"rtl":"ltr"),lang:n.locale,className:"sekyro-flow",children:we(Kr,{url:u,onContinue:()=>o(!0)})})})}):we(Ot,{...n,...u!==""?{handoffUrl:u}:{}})}i($r,"SekyroFlow");function Kr({url:e,onContinue:t}){let n=v();return we(B,{view:"InAppBrowserPrompt",i18n:n,url:e,onContinue:t})}i(Kr,"Prompt");export{St as DocumentCapture,pt as EidStep,dt as EmailOtpStep,Ct as FormStep,Qe as IdNumberEntry,ft as MethodChoice,Tn as NniEntry,ut as PhoneOtpStep,ht as PortraitCapture,vt as ProofOfAddress,$r as SekyroFlow,Ot as SekyroVerification,Oe as StepI18nProvider,Tt as VerificationResultScreen,Xo as arSteps,Jo as enSteps,en as formatTemplate,jo as frSteps,lt as isInAppBrowser,Zo as loadSekyroLocale,tn as resolveSekyroStrings,Qo as retakeHintStringKey,v as useStepI18n,ct as useVerificationStep};
|
|
2
|
+
import{a as co}from"../chunk-JEOESSNW.js";import{a as ee,b as B,c as lo}from"../chunk-GPPZFBYP.js";import{a as qt,b as Yt,d as Wt,e as Zt}from"../chunk-ZARKJW2C.js";import{a as $,d as Ut,e as it,f as ze,g as $t,h as Kt}from"../chunk-BBN7JI6L.js";import{a as zt,b as Gt,c as oo}from"../chunk-GUTF3SPK.js";import{a as no,b as ro,c as so,d as io,e as ao,f as lt}from"../chunk-GNGZASHZ.js";import{a as Ze}from"../chunk-VNVE5DMF.js";import{d as st,f as Dt,g as Mt,j as Ht}from"../chunk-4E3G5TXC.js";import{b as Vt}from"../chunk-M7JKVIGW.js";import{a as Ft}from"../chunk-7MMT5M4E.js";import{a as ue}from"../chunk-VRDPGOXM.js";import{a as Xo,b as Jo,c as jo,d as en,e as tn,f as Oe,g as v}from"../chunk-PMNUDJWG.js";import{a as M,b as J,c as Qt,d as j,e as Xt,f as Ge,g as qe,h as at,i as Jt,k as Ye,l as jt,m as eo,o as to,p as P,q as We}from"../chunk-Q5BGUJMS.js";import"../chunk-DYWLZHSM.js";import{a as h,c as rt,j as Zo,l as Qo,n as Bt,o as Lt,p as At,r as Re,s as ke}from"../chunk-WC4U54LZ.js";import{a as i}from"../chunk-2KED7D2Q.js";import{useEffect as on,useState as uo}from"react";function ct(e){let[t,n]=uo(()=>e?.currentStep?.()??null),[r,a]=uo(null);return on(()=>{if(e===void 0)return;if(typeof e.run!="function"){a(new Error("The step components need @sekyro/web 0.2 or later (Verification.run)."));return}let s=!0,o=e.on("step",l=>{s&&n(l)});return e.run().then(l=>{s&&n(u=>u??l)},l=>{s&&a(l)}),()=>{s=!1,o()}},[e]),{step:t,error:r}}i(ct,"useVerificationStep");import{useEffect as po,useId as nn,useMemo as rn,useRef as mo,useState as Se}from"react";import{Fragment as go,jsx as b,jsxs as G}from"react/jsx-runtime";var fo=i((e,t,n)=>{if(e===void 0)return 0;let r=Date.parse(e)-t;return Number.isFinite(r)?Math.min(n,Math.max(0,Math.ceil(r/1e3))):0},"secondsUntil"),sn=600,an=30,ln=i(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss"),cn=["whatsapp","sms"],yo=new Set(["otp_daily_cap_reached","payment_method_required","spend_cap_reached","insufficient_balance","otp_expired","otp_send_failed","otp_channel_unavailable","otp_destination_not_allowed","otp_destination_unknown","otp_rate_limited","otp_resend_limit","otp_number_invalid","otp_number_not_mobile"]);function un(e){let t=[];for(let n of e.phoneCountries??["MR"]){let r=e.phoneRules?.find(s=>s.code===n),a=r?.dial??qt(n);a!==void 0&&!t.some(s=>s.code===n)&&t.push({code:n,dial:`+${a}`,...r!==void 0?{rule:r}:{}})}return t}i(un,"phoneCountriesOf");function ut({step:e,locale:t,strings:n,className:r,defaultPhone:a,onError:s}){let o=v(t,n),{t:l}=o,u=rn(()=>un(e),[e.phoneCountries,e.phoneRules]),p=a??u[0]?.dial??"",f=e.phoneInternational===!0,g=Wt({countries:u,international:f,closed:!!e.phoneRules?.length,defaultPhone:p}),[k,m]=Se(""),[y,w]=Se(!1),[N,O]=Se(null),[R,S]=Se(null),[x,_]=Se(!1),[Z,H]=Se(null),U=mo(null),D=e.phase==="verify"&&!x,fe=e.phase==="verify",Ne=oo(fe),[_e,Fe]=zt(e.reason==="otp_mismatch",e.attemptsRemaining,()=>m("")),K=nn(),De=mo(null);po(()=>{let C=setTimeout(()=>De.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(C)},[D]);let se=e.phase==="verify"?e.codeExpiresAt??"sent":null;po(()=>{se!==null&&(_(!1),U.current!==null&&!yo.has(e.reason??"")&&H(U.current),U.current=null)},[se]);let ye=i(async C=>{w(!0),S(null);try{await C()}catch(V){S(ue(V,o.strings)),s?.(V)}finally{w(!1),O(null)}},"run"),z=cn.filter(C=>(e.channels??[]).includes(C)),Me=g.typed,ne=!e.needsPhone||Me!==null,ie=i((C,V=!1)=>{let d=e.needsPhone?V?Z:{number:Me??g.phone,shown:g.shown}:null;U.current=d,O(C??null),ye(async()=>{try{await e.send({...d!==null?{phone:d.number}:{},...C!==void 0?{channel:C}:{}})}catch(I){throw U.current=null,I}})},"send"),Pe=i(C=>{ye(()=>e.verify(C))},"submitCode"),He=i(C=>{C.preventDefault(),D?Pe(k):z.length<=1&&ne&&ie(z[0])},"onSubmit"),Ue=`${K}-phone`,ge=fo(e.codeExpiresAt,Ne,sn),Q=fo(e.resendAvailableAt,Ne,an),ae=D&&e.codeExpiresAt!==void 0&&ge===0,xe=e.needsPhone&&!e.attemptsExhausted,le=fe&&(e.codeExpiresAt===void 0||ge>0),Ie=D&&xe?()=>_(!0):x&&le?()=>_(!1):null;Ge(Ie===null?null:y?()=>{}:Ie);let L=i(C=>l(C==="whatsapp"?"otp.channelWhatsapp":"otp.channelSms"),"label"),Te=i(C=>y&&N!==null&&N===C,"busyFor"),[nt,T]=l("otp.sentTo",{channel:L(e.channel)}).split("{number}"),ce=e.context.simulation?.otpCode,$e=e.reason==="otp_mismatch"?G(P,{tone:"danger",children:[b("span",{children:l("otp.reason_otp_mismatch")}),b("span",{children:We(o,e.attemptsRemaining,e.attemptsExhausted)})]}):e.reason!==void 0&&yo.has(e.reason)?b(P,{tone:"warning",children:b("span",{children:l(`otp.reason_${e.reason}`)})}):e.reason==="tester_phone_mismatch"?b(P,{tone:"warning",children:b("span",{children:l("reasons.tester_phone_mismatch")})}):null,Ee=G(go,{children:[$e,R!==null?b(P,{tone:"danger",children:b("span",{children:l(R)})}):null]});if(D){let C=z.length===0;return G("form",{className:`sekyro-step sekyro-otp${r?` ${r}`:""}`,"aria-labelledby":K,onSubmit:He,noValidate:!0,children:[b(J,{id:K,title:l("otp.verifyTitle"),lead:ce!==void 0?b(eo,{template:l("sandbox.otpHint"),code:ce}):G(go,{children:[nt,b("bdi",{dir:"ltr",className:"sekyro-mono",children:Z?.shown??e.sentToMasked}),T]})}),Ee,G("div",{className:"sekyro-field",children:[b("label",{className:"sekyro-label",htmlFor:`${K}-code`,children:l("otp.codeLabel")}),b(Gt,{id:`${K}-code`,value:k,invalid:_e,onChange:V=>{V!==""&&Fe(),m(V),V.length===6&&k.length!==6&&!y&&!e.attemptsExhausted&&Pe(V)}}),b("span",{className:`sekyro-help sekyro-otp-expiry${ae?" is-danger":""}`,"aria-hidden":!ae||void 0,children:ae?l("otp.expired"):l("otp.expiresIn",{time:ln(ge)})})]}),b("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:ae?l("otp.expired"):""}),G(j,{children:[b(h,{type:"submit",full:!0,disabled:y||k.length!==6||e.attemptsExhausted,"aria-busy":y||void 0,children:l("otp.verify")}),G("div",{className:"sekyro-resend-row",children:[C?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y||Q>0,onClick:()=>ie(void 0,!0),children:Q>0?l("otp.resendIn",{seconds:Q}):l("otp.resend")}):Q>0?b("p",{className:"sekyro-resend is-waiting",children:l("otp.resendIn",{seconds:Q})}):z.map(V=>b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>ie(V,!0),children:l("otp.resendBy",{channel:L(V)})},V)),xe?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>_(!0),"data-testid":"sekyro-otp-change",children:l("otp.changeNumber")}):null]})]})]})}return G("form",{className:`sekyro-step sekyro-otp${r?` ${r}`:""}`,"aria-labelledby":K,onSubmit:He,noValidate:!0,children:[b(J,{id:K,title:l("otp.sendTitle"),lead:l("otp.sendDescription")}),Ee,e.needsPhone?G("div",{className:"sekyro-field",children:[b("label",{className:"sekyro-label",htmlFor:Ue,children:l("otp.phoneLabel")}),b(Zt,{field:g,id:Ue,locale:o.locale,t:l,inputRef:De,ready:ne})]}):b("p",{className:"sekyro-text-muted",children:l("otp.prefilledNotice")}),G(j,{children:[z.length===1?b(h,{type:"submit",full:!0,disabled:y||!ne,"aria-busy":Te(z[0])||void 0,children:l("otp.sendBy",{channel:L(z[0])})}):z.length>1?G("div",{className:"sekyro-actions__group",role:"group","aria-label":l("otp.chooseChannel"),children:[b("p",{className:"sekyro-label","aria-hidden":"true",children:l("otp.chooseChannel")}),b("div",{className:"sekyro-channel-row",children:z.map(C=>G(h,{kind:"primary",disabled:y||!ne,"aria-busy":Te(C)||void 0,onClick:()=>ie(C),children:[b(M,{name:C}),L(C)]},C))})]}):b(h,{type:"submit",full:!0,disabled:y||!ne,"aria-busy":y||void 0,children:l("otp.send")}),b("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:y&&N!==null?l("otp.sending",{channel:L(N)}):""}),x&&le?b("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:y,onClick:()=>_(!1),"data-testid":"sekyro-otp-back-to-code",children:l("otp.backToCode")}):null]})]})}i(ut,"PhoneOtpStep");import{lazy as dn,Suspense as pn,useMemo as mn,useState as fn}from"react";import{jsx as he,jsxs as gn}from"react/jsx-runtime";var yn={load:i(()=>import("../email-otp-view-CL76K5TY.js"),"load")};function dt({locale:e,strings:t,...n}){let r=v(e,t),[a,s]=fn(0),o=mn(()=>dn(()=>yn.load().then(u=>({default:u.EmailOtpView}))),[a]),l=gn(P,{tone:"danger",children:[he("span",{children:r.t("errors.network_error")}),he(h,{kind:"secondary",onClick:()=>s(u=>u+1),children:r.t("common.retry")})]});return he(ee,{fallback:l,children:he(pn,{fallback:he("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:r.t("common.loading")}),children:he(o,{...n,i18n:r})})},a)}i(dt,"EmailOtpStep");import{lazy as kn,Suspense as Sn,useMemo as hn,useState as bn}from"react";import{jsx as be,jsxs as Cn}from"react/jsx-runtime";var vn={load:i(()=>import("../eid-view-IQRZGEMP.js"),"load")};function pt({locale:e,strings:t,...n}){let r=v(e,t),[a,s]=bn(0),o=hn(()=>kn(()=>vn.load().then(u=>({default:u.EidView}))),[a]),l=Cn(P,{tone:"danger",children:[be("span",{children:r.t("errors.network_error")}),be(h,{kind:"secondary",onClick:()=>s(u=>u+1),children:r.t("common.retry")})]});return be(ee,{fallback:l,children:be(Sn,{fallback:be("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:r.t("common.loading")}),children:be(o,{...n,i18n:r})})},a)}i(pt,"EidStep");import{useMemo as wn}from"react";import{jsx as mt,jsxs as Nn}from"react/jsx-runtime";function ft({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),{busy:o,error:l,run:u}=so(s,a),p=wn(()=>e.choice.options.flatMap(g=>{let k=ro(g,s),m=no[g.service];return k===null?[]:[{id:g.id,label:k,glyph:m&&mt(M,{name:m})}]}),[e.choice.options,s]),f=e.choice.options.find(g=>g.service==="national_eid");return Nn("div",{className:r,children:[mt(Dt,{title:s.t("method.heading"),description:s.t("method.description"),options:p,busy:o,error:l,focus:!0,testId:"sekyro-method",onChoose:g=>u(()=>e.choose(g))}),f?.nationalEid?.afterPass==="continue"?mt(B,{view:"EidContinueHint",i18n:s,provider:f.nationalEid.providerName,quiet:!0}):null]})}i(ft,"MethodChoice");import{isValidNni as _n,normalizeNni as ko}from"@sekyro/web";import{useId as Pn,useState as yt}from"react";import{Fragment as En,jsx as F,jsxs as ve}from"react/jsx-runtime";var xn=new Set(["nni_not_found","registry_record_not_found"]),In=new Set(["nni_invalid","id_number_invalid"]);function Qe({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),{t:o}=s,[l,u]=yt(""),[p,f]=yt(!1),[g,k]=yt(null),m=Pn(),y=e.attemptsExhausted,w=i(async U=>{f(!0),k(null);try{await U()}catch(D){k(ue(D,s.strings)),a?.(D)}finally{f(!1)}},"run"),N=i(U=>{if(U.preventDefault(),e.source!=="typed"){w(()=>e.confirm());return}let D=ko(l);if(!/^\d{10}$/.test(D))return k("population.invalid");if(!_n(D))return k("population.reason_id_number_invalid");w(()=>typeof e.submitIdNumber=="function"?e.submitIdNumber(D):e.submitNni(D))},"onSubmit"),O=We(s,e.attemptsRemaining,y),R=e.reason!==void 0&&xn.has(e.reason),S=e.reason!==void 0&&In.has(e.reason),x=ve(En,{children:[e.reason==="registry_unavailable"?ve(P,{tone:"warning",children:[F("span",{children:o("population.reason_registry_unavailable")}),F("span",{children:O})]}):null,R&&e.canUseDocument?ve(P,{tone:"warning",children:[F("span",{children:o("population.reason_registry_record_not_found_or_document")}),F("span",{children:O}),F(h,{kind:"secondary",disabled:p,onClick:()=>{w(()=>e.useDocument())},children:o("population.useDocument")})]}):null,R&&!e.canUseDocument||S?ve(P,{tone:"danger",children:[F("span",{children:o(R?"population.reason_registry_record_not_found":"population.reason_id_number_invalid")}),F("span",{children:O})]}):null,y&&e.reason===void 0?F(P,{tone:"danger",children:F("span",{children:O})}):null,g!==null?F(P,{tone:"danger",children:F("span",{children:o(g)})}):null]}),[_,Z,H]=e.source==="document"?["population.fromDocument.title","population.fromDocument.description","population.fromDocument.continue"]:e.source==="bound"?["session.steps.population.title","population.bound.description","population.bound.confirm"]:e.recheck?["population.recheck.title","population.recheck.description","population.submit"]:["session.steps.population.title","session.steps.population.description","population.submit"];return ve("form",{className:`sekyro-step${r?` ${r}`:""}`,"aria-labelledby":m,onSubmit:N,noValidate:!0,children:[F(J,{id:m,title:o(_),lead:o(Z)}),x,e.source==="typed"?ve("div",{className:"sekyro-field",children:[F("label",{className:"sekyro-label",htmlFor:`${m}-id-number`,children:o("population.label")}),F("input",{id:`${m}-id-number`,className:"sekyro-input sekyro-input--number",dir:"ltr",inputMode:"numeric",autoComplete:"off",placeholder:o("population.placeholder"),value:l,"aria-describedby":`${m}-id-number-help`,"aria-invalid":g==="population.invalid"||g==="population.reason_id_number_invalid"||void 0,onChange:U=>{k(null),u(ko(U.target.value).replace(/\D/g,"").slice(0,10))}}),F("span",{id:`${m}-id-number-help`,className:"sekyro-help",children:o("population.helper")})]}):null,F(j,{children:y?null:F(h,{type:"submit",full:!0,disabled:p,"aria-busy":p||void 0,children:o(H)})})]})}i(Qe,"IdNumberEntry");function Tn(e){return Qe(e)}i(Tn,"NniEntry");import{acceptedIssuers as Ln,acceptedTypesFor as Co,warmDocumentCapture as An}from"@sekyro/web";import{lazy as Vn,Suspense as Fn,useEffect as Dn,useMemo as Mn,useState as kt}from"react";import{acceptedIssuers as Rn,acceptedTypesFor as gt}from"@sekyro/web";import{useEffect as So,useMemo as ho,useState as bo}from"react";import{jsx as q,jsxs as Xe}from"react/jsx-runtime";var On=220;function Bn(e,t,n=[],r){let a=null;try{a=new Intl.DisplayNames([e],{type:"region"})}catch{}let s=t.map(u=>({code:u,name:a?.of(u)??u})),o=new Intl.Collator(e),l=i(u=>{if(u===r)return-1;let p=n.indexOf(u);return p<0?n.length:p},"rank");return s.sort((u,p)=>l(u.code)-l(p.code)||o.compare(u.name,p.name))}i(Bn,"countryNames");function vo({step:e,i18n:t,issuer:n,onPicked:r,ageStepUp:a=!1}){let{t:s,locale:o}=t,l=ho(()=>Rn(e.documents),[e.documents]),u=ho(()=>Bn(o,l,Object.keys(e.documents.byIssuer??{}),e.detectedCountry),[o,l,e.documents,e.detectedCountry]),p=l.length===1?l[0]:null,[f,g]=bo(n??p),[k,m]=bo(null),y=p===null?[]:gt(e.documents,p),w=p!==null&&y.length===1?y[0]:null;So(()=>{p!==null&&w!==null&&e.selectDocument(p,w)},[p,w]);let N=i((S,x)=>{e.selectDocument(S,x),r?.()},"pick"),O=i(S=>{let x=gt(e.documents,S);x.length===1?N(S,x[0]):g(S)},"chooseIssuer");if(So(()=>{if(k===null||f===null)return;let S=setTimeout(()=>N(f,k),On);return()=>clearTimeout(S)},[k]),Ge(f!==null&&l.length>1&&n===void 0?()=>{g(null),m(null)}:null),w!==null)return null;if(f===null)return Xe("section",{className:"sekyro-step",children:[q(J,{title:s("doc.countryTitle"),lead:s(a?"doc.ageStepUp":"doc.pickDescription")}),q(Yt,{countries:u,label:s("doc.countryLabel"),searchPlaceholder:s("doc.countrySearch"),noMatch:s("doc.noCountryMatch"),onPick:O}),q(j,{children:null})]});let R=gt(e.documents,f);return Xe("section",{className:"sekyro-step",children:[q(J,{title:s("doc.pickTitle"),lead:s(a&&p!==null?"doc.ageStepUp":"native.doc.holdIt")}),q("div",{className:"sekyro-choices",children:R.map(S=>Xe("button",{type:"button",className:"sekyro-card","aria-pressed":k===S,disabled:k!==null&&k!==S,onClick:()=>m(S),children:[q("span",{className:"sekyro-card__tile",children:q(M,{name:S==="passport"?"passport":"card"})}),Xe("span",{className:"sekyro-card__body",children:[q("span",{className:"sekyro-card__title",children:s(`doc.type.${S}`)}),q("span",{className:"sekyro-card__sub",children:s(`doc.sub.${S}`)})]}),q("span",{className:"sekyro-radio","aria-hidden":"true"})]},S))}),l.length>1?q("button",{type:"button",className:"sekyro-link",onClick:()=>{g(null),m(null)},children:s("native.doc.changeCountry")}):null,q(j,{children:null})]})}i(vo,"DocumentPicker");import{jsx as re,jsxs as Un}from"react/jsx-runtime";var Hn={load:i(()=>import("../document-capture-view-57N5YWTH.js"),"load")};function St({step:e,locale:t,strings:n,className:r,liveMrz:a,barcodeAssetBaseUrl:s}){let o=v(t,n),[l,u]=kt(0),[p,f]=kt(null),g=Ln(e.documents),k=g.length>1,m=e.issuer!==null&&Co(e.documents,e.issuer).length>1,y=e.documentType===null||e.issuer===null||p!==null,w=g.length===1&&Co(e.documents,g[0]).length===1,[N]=kt(()=>y&&!w),O=e.ageStepUp===!0,R=Mn(()=>Vn(()=>Hn.load().then(x=>({default:x.DocumentCaptureView}))),[l]);Dn(()=>{An()},[]);let S=Un(P,{tone:"danger",children:[re("span",{children:o.t("errors.network_error")}),re(h,{kind:"secondary",onClick:()=>u(x=>x+1),children:o.t("doc.retryCamera")})]});return re("div",{className:r,children:y?re(vo,{step:e,i18n:o,ageStepUp:O&&p===null&&N,...p==="document"&&e.issuer!==null?{issuer:e.issuer}:{},onPicked:()=>f(null)}):re(ee,{fallback:S,children:re(Fn,{fallback:re("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:o.t("common.loading")}),children:re(R,{step:e,i18n:o,ageLead:O&&!N,liveMrz:e.documentType==="drivers_license"?void 0:a,barcodeAssetBaseUrl:s,...k?{onChangeCountry:i(()=>f("country"),"onChangeCountry")}:{},...m?{onChangeDocument:i(()=>f("document"),"onChangeDocument")}:{}})})},l)})}i(St,"DocumentCapture");import{warmPortraitCapture as $n}from"@sekyro/web";import{Component as Kn,lazy as wo,Suspense as No,useContext as zn,useEffect as Gn,useMemo as _o,useState as Po}from"react";import{jsx as E,jsxs as je}from"react/jsx-runtime";var qn={load:i(()=>import("../portrait-capture-view-ZF4YAMA6.js"),"load")},Yn={load:i(()=>import("../portrait-review-view-LOS5AYBI.js"),"load")},bt=class bt extends Kn{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(bt,"LoadBoundary");var Je=bt;function Wn({step:e,i18n:t}){let{t:n}=t,r=ke();return je("section",{className:"sekyro-stack sekyro-stack--2","data-testid":"sekyro-portrait-match",children:[E("h2",{ref:r,tabIndex:-1,className:"sekyro-text-body",children:n(e.review?"portrait.reviewTitle":"session.steps.portrait.title")}),e.review?E("p",{className:"sekyro-text-muted",children:n("portrait.reviewDescription")}):null,e.uploadFailed?je(P,{tone:"danger",children:[E("span",{children:n("portrait.uploadFailed")}),E(h,{kind:"secondary",onClick:()=>{e.resubmit()},children:n("portrait.sendAgain")})]}):E("p",{role:"status","aria-live":"polite","aria-busy":"true",className:"sekyro-text-muted",children:n("portrait.matching")})]})}i(Wn,"MatchPhase");function ht({step:e,locale:t,strings:n,className:r,assetBaseUrl:a,verification:s}){let o=v(t,n),l=Mt(s),u=zn(Ye),[p,f]=Po(0),[g,k]=Po(null),m=_o(()=>wo(()=>qn.load().then(H=>({default:H.PortraitCaptureView}))),[p]),y=_o(()=>wo(()=>Yn.load().then(H=>({default:H.PortraitScreens}))),[p]),w=typeof e.uploadPortrait=="function",N=w?e.photo?.source??"camera":"camera",O=w&&N!=="camera"&&e.photo?.uploadOffered===!0,R=N!=="upload",S=N==="upload"?"upload":N==="choice"?g??e.photo?.pick??"source":"camera",x=e.phase==="capture"&&e.photo?.cameraOnPhone===!0;if(Gn(()=>{e.phase==="capture"&&S==="camera"&&!x&&$n()},[e.phase,S,x]),e.phase==="match")return E("div",{className:r,children:E(Wn,{step:e,i18n:o})});let _=E("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:o.t("common.loading")});if(u!==null&&(u.busy||u.failed!==null)&&e.phase==="capture"&&S==="camera")return je("section",{className:`sekyro-step${r?` ${r}`:""}`,children:[E(J,{title:o.t("session.steps.portrait.title")}),E(j,{children:E(h,{kind:"secondary",full:!0,disabled:u.busy,onClick:u.reset,children:o.t("portrait.retryCamera")})})]});if(e.phase==="review"||S!=="camera"||x)return E("div",{className:r,children:E(Je,{fallback:E(h,{kind:"ghost",onClick:()=>f(H=>H+1),children:o.t("common.retry")}),children:E(No,{fallback:_,children:E(y,{screen:e.phase==="review"?"review":x&&S==="camera"?"phone":S==="camera"?"review":S,step:e,i18n:o,...R?{onCamera:i(()=>k("camera"),"onCamera")}:{},onUpload:()=>k("upload"),onDeclined:()=>k(null)})})},p)});if(!l.settled)return E("div",{className:r,children:_});let Z=je(P,{tone:"danger",children:[E("span",{children:o.t("errors.network_error")}),E(h,{kind:"secondary",onClick:()=>f(H=>H+1),children:o.t("portrait.retryCamera")})]});return E("div",{className:r,children:E(Je,{fallback:Z,children:E(No,{fallback:_,children:E(m,{step:e,i18n:o,...a!==void 0?{assetBaseUrl:a}:{},...O?{onUpload:i(()=>k("upload"),"onUpload")}:{}})})},p)})}i(ht,"PortraitCapture");import{lazy as Zn,Suspense as Qn,useMemo as Xn,useState as Jn}from"react";import{jsx as de,jsxs as er}from"react/jsx-runtime";var jn={load:i(()=>import("../proof-of-address-view-X2EVWZBX.js"),"load")};function vt({step:e,locale:t,strings:n,className:r}){let a=v(t,n),[s,o]=Jn(0),l=Xn(()=>Zn(()=>jn.load().then(p=>({default:p.ProofOfAddressView}))),[s]),u=er(P,{tone:"danger",children:[de("span",{children:a.t("errors.network_error")}),de(h,{kind:"secondary",onClick:()=>o(p=>p+1),children:a.t("common.retry")})]});return de("div",{className:r,children:de(ee,{fallback:u,children:de(Qn,{fallback:de("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:de(l,{step:e,i18n:a})})},s)})}i(vt,"ProofOfAddress");import{lazy as tr,Suspense as or,useMemo as nr,useState as rr}from"react";import{jsx as pe,jsxs as ir}from"react/jsx-runtime";var sr={load:i(()=>import("../form-view-MEYCK437.js"),"load")};function Ct({step:e,locale:t,strings:n,className:r,onError:a}){let s=v(t,n),[o,l]=rr(0),u=nr(()=>tr(()=>sr.load().then(f=>({default:f.FormView}))),[o]),p=ir(P,{tone:"danger",children:[pe("span",{children:s.t("errors.network_error")}),pe(h,{kind:"secondary",onClick:()=>l(f=>f+1),children:s.t("common.retry")})]});return pe("div",{className:r,children:pe(ee,{fallback:p,children:pe(or,{fallback:pe("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:s.t("common.loading")}),children:pe(u,{step:e,i18n:s,...a!==void 0?{onError:a}:{}})})},o)})}i(Ct,"FormStep");import{cameraUnavailableCauseOf as xr}from"@sekyro/web";import{useCallback as te,useContext as Ir,useEffect as Ve,useId as Tr,useMemo as Rt,useRef as oe,useState as W}from"react";var wt={light:{lineBrand:"#0d3b66",successSoft:"#d5f0e8",successFg:"#005341",onSuccess:"#ffffff",warningSoft:"#fff7e6",warningFg:"#735003",onWarning:"#191a1b",dangerSoft:"#ffdada",dangerFg:"#ca0f07",onDanger:"#ffffff",info:"#0563d4",infoSoft:"#d3e5ff",infoFg:"#064da5",onInfo:"#ffffff"},dark:{lineBrand:"#3f80bf",successSoft:"#002c23",successFg:"#53ffd4",onSuccess:"#030303",warningSoft:"#463102",warningFg:"#ffd98a",onWarning:"#030303",dangerSoft:"#9c1008",dangerFg:"#ffbbbb",onDanger:"#030303",info:"#5da9ff",infoSoft:"#063778",infoFg:"#acd0ff",onInfo:"#030303"},sizes:{buttonHeight:"52px",controlRadius:"10px",cardRadius:"16px",fieldRadius:"10px",iconTile:"56px",iconTileRadius:"16px",headerTile:"40px",choiceTile:"40px",tileRadius:"10px",resultDisc:"64px",resultRing:"8px",progressHeight:"4px",focusRing:"2px",focusRingOffset:"2px",otpBox:"60px",choiceMinHeight:"76px",stepGap:"32px",headingGap:"12px"},motion:{page:"320ms",easeOut:"cubic-bezier(0.16, 1, 0.3, 1)"}};var Be={light:{danger:{base:"#ca0f07",soft:"#ffdada",fg:"#ca0f07",on:"#ffffff"},success:{base:"#007a5e",soft:"#d5f0e8",fg:"#005341",on:"#ffffff"},warning:{base:"#ffab00",soft:"#fff7e6",fg:"#735003",on:"#191a1b"},info:{base:"#0563d4",soft:"#d3e5ff",fg:"#064da5",on:"#ffffff"}},dark:{danger:{base:"#ff7c7c",soft:"#9c1008",fg:"#ffbbbb",on:"#030303"},success:{base:"#00c897",soft:"#002c23",fg:"#53ffd4",on:"#030303"},warning:{base:"#ffbb2e",soft:"#463102",fg:"#ffd98a",on:"#030303"},info:{base:"#5da9ff",soft:"#063778",fg:"#acd0ff",on:"#030303"}}},ar=["danger","success","warning","info"];function Nt(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}i(Nt,"channel");function xo(e){let t=Nt(parseInt(e.slice(1,3),16)),n=Nt(parseInt(e.slice(3,5),16)),r=Nt(parseInt(e.slice(5,7),16));return .2126*t+.7152*n+.0722*r}i(xo,"luminance");function lr(e,t){let n=xo(e),r=xo(t),a=Math.max(n,r),s=Math.min(n,r);return(a+.05)/(s+.05)}i(lr,"contrastRatio");function Io(e,t){return Math.min(...ar.map(n=>lr(Be[e][n].fg,t)))}i(Io,"worstAgainst");function To(e,t,n){return Math.min(Io(e,t),Io(e,n))}i(To,"worstStatusContrast");function Eo(e,t){return To("light",e,t)>=To("dark",e,t)?"light":"dark"}i(Eo,"statusSchemeFor");import{useRef as dr,useState as pr}from"react";import{useEffect as cr,useId as ur,useRef as _t}from"react";import{jsx as Ce,jsxs as Ro}from"react/jsx-runtime";function et({open:e,title:t,closeLabel:n,onClose:r,children:a,actions:s,role:o,testId:l,returnFocus:u}){let p=_t(null),f=_t(null),g=_t(!1),k=ur();return cr(()=>{let m=p.current;if(m!==null){if(e&&!m.open?(f.current=typeof document>"u"?null:document.activeElement,typeof m.showModal=="function"?m.showModal():m.setAttribute("open","")):!e&&m.open&&(typeof m.close=="function"?m.close():m.removeAttribute("open")),!e&&g.current){let y=u?.current??(f.current instanceof HTMLElement?f.current:null);f.current=null,y?.focus()}g.current=e}},[e,u]),Ce("dialog",{ref:p,className:"sekyro-dialog","aria-labelledby":k,...o==="alertdialog"?{role:o}:{},"data-testid":l,onCancel:m=>{m.preventDefault(),r()},onClick:m=>{m.target===m.currentTarget&&r()},children:Ro("div",{className:"sekyro-dialog__panel",children:[Ro("div",{className:"sekyro-dialog__head",children:[Ce("h2",{id:k,className:"sekyro-dialog__title",children:t}),n!==void 0?Ce("button",{type:"button",className:"sekyro-disc sekyro-dialog__close","aria-label":n,onClick:r,children:Ce(M,{name:"close"})}):null]}),a!==void 0?Ce("div",{className:"sekyro-dialog__body",children:a}):null,s!==void 0?Ce("div",{className:"sekyro-dialog__actions",children:s}):null]})})}i(et,"FlowDialog");import{jsx as Le,jsxs as Oo}from"react/jsx-runtime";var mr=["intro","data","processing","sharing","retention"];function Bo({i18n:e,purpose:t="identity"}){let{t:n}=e,[r,a]=pr(!1),s=dr(null),[o,l=""]=n("consent.short").split("{terms}");return Oo("div",{className:"sekyro-consent","data-testid":"sekyro-consent",children:[Oo("p",{className:"sekyro-consent__line",children:[o,Le("button",{ref:s,type:"button",className:"sekyro-link sekyro-link--inline","aria-haspopup":"dialog",onClick:()=>a(!0),children:n("consent.termsLink")}),l]}),Le(et,{open:r,title:n("consent.termsTitle"),closeLabel:n("native.close"),onClose:()=>a(!1),returnFocus:s,testId:"sekyro-consent-terms",children:Le("div",{className:"sekyro-stack sekyro-stack--3",children:t==="human"?Le(B,{view:"HumanConsentTerms",i18n:e,quiet:!0}):mr.map(u=>Le("p",{children:n(`consent.terms.${u}`)},u))})})]})}i(Bo,"ConsentNotice");function Lo(e){let t=e.trim().split(/\s+/).filter(r=>r!=="");return(t.length>=2?[t[0],t[1]].map(r=>Array.from(r??"")[0]??""):Array.from(t[0]??"").slice(0,2)).join("").toUpperCase()}i(Lo,"initials");import{useSyncExternalStore as fr}from"react";var Fo=i(e=>({colors:{...e?$.dark:$.light},radius:$.radius,fontFamily:$.font}),"brandTheme"),ea=Fo(!1),Ao=/^#[0-9a-f]{6}$/i;function Pt(e,t,n){if(t)return null;let r=it(e).colors,a=n?.colors?.bg??r?.bg,s=n?.colors?.surface??r?.surface;return a===void 0&&s===void 0||a!==void 0&&!Ao.test(a)||s!==void 0&&!Ao.test(s)?null:Eo(a??$.light.bg,s??$.light.surface)}i(Pt,"partnerStatusScheme");function tt(e,t,n){let r=it(e);if(n&&r.colors!==void 0){let{brand:a,brandFg:s}=r.colors;a!==void 0&&Sr(a,$.dark.bg)>=3?r.colors={brand:a,ring:a,...s!==void 0?{brandFg:s}:{}}:delete r.colors}if(Pt(e,n,t)==="dark"){let a=Be.dark;r.colors={...r.colors,danger:a.danger.base,success:a.success.base,warning:a.warning.fg}}return ze(Fo(n),r,Ut(t))}i(tt,"verificationTheme");function ot(e){let t=fr(kr,gr,()=>!1);return e==="dark"||e==="system"&&t}i(ot,"useDarkScheme");var yr="(prefers-color-scheme: dark)",Do=i(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(yr):null,"media"),gr=i(()=>Do()?.matches??!1,"prefersDark");function kr(e){let t=Do();return t?.addEventListener("change",e),()=>t?.removeEventListener("change",e)}i(kr,"subscribe");function Sr(e,t){let[n,r]=[Vo(e),Vo(t)];return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}i(Sr,"contrast");function Vo(e){let t=[1,3,5].map(n=>{let r=Number.parseInt(e.slice(n,n+2),16)/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4});return .2126*(t[0]??0)+.7152*(t[1]??0)+.0722*(t[2]??0)}i(Vo,"luminance");var xt="sekyro.testerGate";function It(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}i(It,"store");function Mo(e=Date.now()){try{It()?.setItem(xt,String(e))}catch{}}i(Mo,"rememberTester");function Ho(e=Date.now()){try{let t=Number(It()?.getItem(xt)??"");return Number.isFinite(t)&&t>0&&e-t<2592e6}catch{return!1}}i(Ho,"rememberedTester");function Uo(){try{It()?.removeItem(xt)}catch{}}i(Uo,"forgetTester");import{useEffect as hr,useId as br,useState as vr}from"react";import{jsx as A,jsxs as me}from"react/jsx-runtime";var $o=new Set(["document_id_number_mismatch","name_mismatch","birth_date_mismatch"]),Cr={review:{icon:"pending",tone:"info"},cooldown:{icon:"timer",tone:"info"},rejected:{icon:"close",tone:"neutral"},policy:{icon:"close",tone:"neutral"},inconclusive:{icon:"warning",tone:"neutral"},unavailable:{icon:"timer",tone:"neutral"},expired:{icon:"timer",tone:"neutral"}};function wr({screen:e}){if(e==="verified")return me("svg",{className:"sekyro-outcome sekyro-outcome--approved",viewBox:"0 0 136 136","aria-hidden":"true",focusable:"false",children:[A("circle",{className:"sekyro-outcome__ring",cx:"68",cy:"68",r:"54",pathLength:"1"}),A("circle",{className:"sekyro-outcome__disc",cx:"68",cy:"68",r:"48"}),A("path",{className:"sekyro-outcome__glyph",d:"M6.5 12.5l3.6 3.6 7.4-8.2",pathLength:"1",transform:"translate(39 39) scale(2.4167)"})]});let{icon:t,tone:n}=Cr[e];return A("span",{className:`sekyro-tile sekyro-tile--${n} sekyro-outcome-tile`,"aria-hidden":"true","data-screen":e,children:A(M,{name:t})})}i(wr,"OutcomeMark");function Nr({label:e,id:t,copied:n}){let[r,a]=vr(!1);return hr(()=>{if(!r)return;let s=setTimeout(()=>a(!1),1600);return()=>clearTimeout(s)},[r]),me("button",{type:"button",className:`sekyro-reference${r?" is-copied":""}`,onClick:()=>{navigator.clipboard?.writeText(t).then(()=>a(!0),()=>{})},children:[A("span",{"aria-live":"polite",children:r?n:e}),A("bdi",{dir:"ltr",children:t}),A(M,{name:"copy"})]})}i(Nr,"ReferenceLine");function _r({step:e,t}){let n=e.context.sandbox?e.context.simulation?.reason:void 0;return n===void 0?null:me(Re,{tone:"warning",role:"status",testId:"sekyro-simulated-notice",children:[A("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:A(M,{name:"info"})}),me("div",{className:"sekyro-notice__body","data-reason":n,children:[A("strong",{children:t("sandbox.simulatedTitle")}),A("span",{children:t(n==="no_testers"?"sandbox.simulatedNoTesters":"sandbox.simulatedGate")})]})]})}i(_r,"SimulationNotice");function Pr(e,t){return e==="expired"?"native.result.expiredTitle":e!=="verified"?`session.result.${e}.title`:t.level===3?"session.result.verified.title":t.level===1&&t.assurance==="contact_phone"?"session.result.verified.titlePhone":t.level===1&&t.assurance==="contact_email"?"session.result.verified.titleEmail":t.level===1?"session.result.verified.titleContact":"session.result.verified.titleHuman"}i(Pr,"resultTitleKey");function Tt({step:e,locale:t,strings:n,className:r,onClose:a}){let s=v(t,n),{t:o}=s,l=br(),u=ke(),p=e.context.orgName,f=e.reasonCode??"",g=e.display==="platform_unsupported"?"policy":e.display,k=i(y=>(p!==""||y==="verified")&&y!=="cooldown"?o(`native.result.${y}`,{org:p}):o(`session.result.${y}.description`),"partnerLine"),m;switch(e.display){case"rejected":f==="identity_not_verified"?m=p!==""?o("reasons.identity_not_verified",{org:p}):o("session.result.identityNotVerified"):m=$o.has(rt(f))?o("session.result.detailsMismatch",{org:p}):k("rejected");break;case"policy":{if($o.has(rt(f)))m=o("session.result.detailsMismatch",{org:p});else if(f==="device_velocity_exceeded")m=o("session.result.deviceVelocity",{org:p});else if(f==="capture_tampered")m=o("session.result.deviceStop");else if(f==="camera_unavailable")m=o("reasons.camera_unavailable",{org:p});else if(f==="underage_estimated")m=o("reasons.underage_estimated");else if(f==="starter_credit_claimed")m=o("reasons.starter_credit_claimed");else if(f==="blocked_by_org")m=o("reasons.blocked_by_org");else{let y=f===""?null:Lt(f);m=y!==null?o(y,{org:p}):k("policy")}break}case"cooldown":{let y=At(s.locale,e.retryAfter);m=y!==null?o(y.key,{time:y.time}):o("session.result.cooldown.description");break}case"platform_unsupported":m=o("result.platform_unsupported");break;default:m=k(g)}return me("section",{className:`sekyro-result${r?` ${r}`:""}`,"aria-labelledby":l,"data-testid":"sekyro-result",children:[me("div",{className:"sekyro-result__body",children:[A(wr,{screen:g}),me("div",{className:"sekyro-heading",children:[A("h2",{id:l,ref:u,tabIndex:-1,className:"sekyro-text-body",children:o(Pr(g,e.result))}),A("p",{className:"sekyro-text-muted",children:m})]}),A(_r,{step:e,t:o}),A(Nr,{label:o("result.referenceLabel"),id:e.context.sessionId,copied:o("native.result.copied")})]}),a!==void 0?A("div",{className:"sekyro-actions",children:A(h,{full:!0,onClick:a,children:o("native.result.continue",{org:p})})}):null]})}i(Tt,"VerificationResultScreen");import{Fragment as Ae,jsx as c,jsxs as Y}from"react/jsx-runtime";function Er(e,t,n){let r=t?$.dark:$.light,a=t?$.roles.dark:$.roles.light,s=e.colors??{},o={},l=s.fg===r.fg&&s.surface===r.surface;s.brand===r.brand&&s.surface===r.surface&&(o["--sekyro-color-brand-soft"]=a.brandSoft),l&&(o["--sekyro-color-line"]=a.line,o["--sekyro-color-line-subtle"]=a.lineSubtle,o["--sekyro-color-line-strong"]=a.lineStrong,o["--sekyro-color-sunken"]=a.sunken),s.fgMuted===r.fgMuted&&s.surface===r.surface&&(o["--sekyro-color-fg-subtle"]=a.fgSubtle),e.fontFamily===$.font&&(o["--sekyro-font-display"]=$.fontDisplay);let u=t?wt.dark:wt.light;if(o["--sekyro-color-success-soft"]=u.successSoft,o["--sekyro-color-success-fg"]=u.successFg,o["--sekyro-color-on-success"]=u.onSuccess,o["--sekyro-color-warning-soft"]=u.warningSoft,o["--sekyro-color-warning-fg"]=u.warningFg,o["--sekyro-color-danger-soft"]=u.dangerSoft,o["--sekyro-color-danger-fg"]=u.dangerFg,o["--sekyro-color-on-danger"]=u.onDanger,o["--sekyro-color-info-soft"]=u.infoSoft,o["--sekyro-color-info-fg"]=u.infoFg,s.brand===r.brand&&(o["--sekyro-color-line-brand"]=u.lineBrand),n!==null){let p=Be[n];for(let f of["danger","success","warning","info"])o[`--sekyro-color-${f}-soft`]=p[f].soft,o[`--sekyro-color-${f}-fg`]=p[f].fg;o["--sekyro-color-on-success"]=p.success.on,o["--sekyro-color-on-danger"]=p.danger.on}return o}i(Er,"flowRoles");function Ot(e){let{verification:t,locale:n,strings:r,onStep:a,onResult:s}=e,{step:o,error:l}=ct(t);Ve(()=>{o!==null&&a?.(o)},[o,a]),Ve(()=>s===void 0?void 0:t.on("result",s),[t,s]);let u=ot(e.colorScheme??"light"),p=o?.context.branding,f=tt(p,e.theme,u),[g,k]=W(!1),m=`sekyro-verification${u?" sekyro-verification--dark":""}${g?" is-immersive":""}${e.className!==void 0?` ${e.className}`:""}`,y=oe(e.onClose);y.current=e.onClose;let w=oe(o);w.current=o;let N=te(()=>{let _=w.current;y.current?.(_?.kind==="result"?{reason:"finished",result:_.result}:{reason:"cancelled"})},[]),[O,R]=W(null),S=te(()=>{let _=w.current;_!==null&&_.kind!=="result"&&_.context.consentRecorded?R("close"):N()},[N]),x=Rt(()=>t.reportCaptureIssue===void 0?null:_=>t.reportCaptureIssue?.(_),[t]);return c(Kt,{theme:f,className:m,children:c(Oe,{locale:n,...r!==void 0?{strings:r}:{},children:c("div",{dir:e.dir??(n==="ar"?"rtl":"ltr"),lang:n,className:"sekyro-flow",style:Er(f,u,Pt(p,u,e.theme)),children:c(Jt.Provider,{value:k,children:c(at.Provider,{value:e.onClose!==void 0?N:void 0,children:c(qe.Provider,{value:e.onClose!==void 0?S:void 0,children:Y(Ft.Provider,{value:x,children:[c(Vr,{...e,step:o,error:l,immersive:g,onLeaveAsk:()=>R("history"),onClosed:N}),c(Br,{open:O!==null,onStay:()=>{O==="history"&&Et(),R(null)},onLeave:()=>{let _=O;R(null),_==="close"||e.onClose!==void 0?N():typeof window<"u"&&qo()}})]})})})})})})})}i(Ot,"SekyroVerification");function Rr(e,t){if(t===void 0||t==="aml_screening")return null;let n=e,r=n[`session.processing.${t}.title`],a=n[`session.processing.${t}.description`];return typeof r=="string"&&r!==""&&typeof a=="string"&&a!==""?{title:r,description:a}:null}i(Rr,"processingCopyOf");function Or({error:e,retry:t}){let{t:n}=v(),r=ke();return Y(Re,{tone:"danger",testId:"sekyro-error-notice",children:[c("span",{children:n(Bt(e))}),e.retryable?c(h,{ref:r,kind:"secondary",className:"sekyro-btn--start",onClick:t,children:n("common.retry")}):null]})}i(Or,"CameraErrorNotice");var zo="sekyroFlow";function Go(){let e=window.history.state;return typeof e=="object"&&e!==null&&e[zo]===!0}i(Go,"onGuard");function Et(){if(typeof window>"u"||Go())return;let e=window.history.state;window.history.pushState({...typeof e=="object"&&e!==null?e:{},[zo]:!0},"")}i(Et,"pushGuard");function qo(){window.history.back()}i(qo,"leaveHistory");function Br({open:e,onStay:t,onLeave:n}){let{t:r}=v();return c(et,{open:e,role:"alertdialog",title:r("leave.title"),onClose:t,testId:"sekyro-leave",actions:Y(Ae,{children:[c(h,{full:!0,onClick:t,children:r("leave.stay")}),c(h,{full:!0,kind:"danger",onClick:n,children:r("leave.confirm")})]}),children:c("p",{className:"sekyro-text-muted",children:r("leave.body")})})}i(Br,"LeaveDialog");function Lr(e,t){let[n,r]=W(!1),[a,s]=W(null),o=e===null?void 0:e.skipCapture,l=oe(o);l.current=o;let u=oe(!1),p=e?.key;Ve(()=>s(null),[p]);let f=te(()=>{if(u.current)return;let y=l.current;y!==void 0&&(u.current=!0,r(!0),s(null),y().catch(w=>s(t.t(ue(w,t.strings)))).finally(()=>{u.current=!1,r(!1)}))},[t]),g=te(()=>s(null),[]),k=o!==void 0,m=t.t("sandbox.skipCapture");return Rt(()=>k?{label:m,busy:n,failed:a,run:f,reset:g}:null,[k,m,n,a,f,g])}i(Lr,"useSkipCapture");function Ar({skip:e}){return Y(Ae,{children:[e.failed!==null?c(P,{tone:"danger",children:c("span",{children:e.failed})}):null,c(h,{kind:"ghost",full:!0,disabled:e.busy,"aria-busy":e.busy||void 0,onClick:e.run,"data-testid":"sekyro-skip-capture",children:e.label})]})}i(Ar,"SkipAction");function Vr(e){let{step:t,error:n,slots:r,immersive:a}=e,s=v(),{t:o}=s,[l,u]=W(!1),[p,f]=W([]),g=te(d=>(f(I=>[...I,d]),()=>f(I=>I.filter(X=>X!==d))),[]),[k,m]=W(null),y=te(d=>m(()=>d),[]),[w,N]=W(0),[O,R]=W(null),S=Lr(t,s),x=t?.context.testerGate!==void 0,[_,Z]=W(!1),H=oe(null);Ve(()=>{!x||H.current!==null||(H.current=Ho(),H.current&&Z(!0))},[x]);let U=t?.context.purpose??"identity",D=t?.context.returning===!0,fe=e.verification,Ne=U==="human"||t?.context.cameraUnavailableHandled===!0,_e=fe.reportCameraUnavailable!==void 0&&Ne?d=>fe.reportCameraUnavailable?.(d)??Promise.resolve():void 0,Fe=t?.kind==="liveness"&&t.mode==="liveness"&&t.reason===void 0&&!t.attemptsExhausted,K=e.handoffUrl,De=oe({last:null,count:0}),se=te((d,I,X=!1)=>_e===void 0&&I!=="denied"?void 0:c(B,{view:"NoCameraView",i18n:s,quiet:!0,cause:I,onRetry:d,repeated:X,...Fe&&_e!==void 0?{onContinue:_e}:{},...K!==void 0?{handoffUrl:K}:{}}),[s,fe,Ne,Fe,K]),ye=Rt(()=>io(t),[t]),z=te((d,I)=>c(ao,{start:d,context:I,human:U==="human",returning:D,notice:I.permissionSettled&&I.permission==="denied"?se(d,"denied"):void 0,...ye!==void 0?{retry:ye}:{}}),[U,D,se,ye]),Me=te((d,I)=>{let X=xr(d.kind),Ke=De.current;d.kind==="permission"&&d!==Ke.last&&(Ke.last=d,Ke.count+=1);let Wo=d.kind==="permission"&&Ke.count>1;return(X!==void 0?se(I,X,Wo):void 0)??Y(Ae,{children:[c(Or,{error:d,retry:I}),X!==void 0&&K!==void 0?c(B,{view:"DesktopHandoffView",i18n:s,quiet:!0,url:K}):null]})},[se,K,s]),ne=oe(""),ie=e.livenessProps?.slots?.stageOverlay,Pe=te(d=>(d.guidance!==""&&!d.coached&&(ne.current=d.guidance),c(co,{testId:"sekyro-capture-stage",video:c("video",{ref:d.videoRef,playsInline:!0,muted:!0,className:"sekyro-lm-video sekyro-fc-video","aria-hidden":"true","data-testid":"sekyro-capture-video"}),instruction:d.settled?o("capture.checkingTitle"):d.guidance!==""?d.guidance:ne.current,note:d.note,status:d.status,busy:d.settled,progress:d.phase==="seeking"||d.phase==="aligning"?d.progress:1,still:d.still,live:d.live,closeLabel:o("native.close"),overlay:ie?.(d.videoRef),ramp:d.ramp?.colour??null,...d.settled?{}:{onClose:i(()=>N(I=>I+1),"onClose")},end:d.modeSwitch!=null?c(Vt,{view:d.modeSwitch,className:"sekyro-glass sekyro-glass--label"}):null,children:d.settled||!d.live?null:c(jt,{onStop:()=>N(I=>I+1)})})),[o,ie]),He=Tr(),Ue=t,ge=t!==null&&O===t.key&&t.context.switchable!==void 0,Q=k??(t===null||t.kind==="result"?null:ge?()=>R(null):t.context.switchable!==void 0&&typeof Ue?.chooseOption=="function"?()=>R(t.key):null),ae=oe(Q);ae.current=Q;let xe=oe(t);xe.current=t;let le=oe({ask:e.onLeaveAsk,closed:e.onClosed,hostClose:e.onClose!==void 0});le.current={ask:e.onLeaveAsk,closed:e.onClosed,hostClose:e.onClose!==void 0};let Ie=e.backNavigation==="history";if(Ve(()=>{if(!Ie||typeof window>"u")return;Et();let d=i(()=>{if(Go())return;let I=xe.current,X=ae.current;X!==null?(X(),Et()):I?.kind!=="result"&&I?.context.consentRecorded===!0?le.current.ask():le.current.hostClose?le.current.closed():qo()},"onPop");return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[Ie]),n!==null)return c(Re,{tone:"danger",children:c("span",{children:o(ue(n,s.strings))})});if(t===null)return Y("div",{className:"sekyro-skeleton",role:"status","aria-busy":"true",children:[c("span",{className:"sekyro-visually-hidden",children:o("common.loading")}),c("span",{className:"sekyro-skeleton__bar is-title"}),c("span",{className:"sekyro-skeleton__bar"}),c("span",{className:"sekyro-skeleton__bar is-short"}),c("span",{className:"sekyro-skeleton__bar is-block"})]});let{context:L}=t,Te=i(d=>{u(!0),d().finally(()=>u(!1))},"refresh"),nt=r?.header??c(Dr,{context:L,headerId:He,end:r?.headerEnd,...Q!==null?{onBack:Q}:{}}),T,ce=ge;if(_&&e.verification.testerGate!==void 0)T=c(st.Provider,{value:Pe,children:c(B,{view:"TesterGateView",i18n:s,verification:e.verification,attemptsLeft:L.testerGate?.attemptsLeft??0,livenessProps:{...e.livenessProps??{},slots:{...e.livenessProps?.slots,intro:e.livenessProps?.slots?.intro??z},locale:e.locale,dir:e.dir,strings:s.strings,assetBaseUrl:e.assetBaseUrl,voice:e.voice},onBound:()=>Mo(),onDone:d=>{d&&Uo(),Z(!1)}})});else if(ce)T=c(B,{view:"LaneChoiceView",i18n:s,step:t,onClose:()=>R(null)});else switch(t.kind){case"phone_otp":T=c(ut,{step:t});break;case"email_otp":T=c(dt,{step:t});break;case"method":T=c(ft,{step:t});break;case"registry":T=c(Qe,{step:t});break;case"document":T=c(St,{step:t,...e.documentLiveMrz!==void 0?{liveMrz:e.documentLiveMrz}:{},...e.documentBarcodeAssetBaseUrl!==void 0?{barcodeAssetBaseUrl:e.documentBarcodeAssetBaseUrl}:{}});break;case"liveness":{let d=e.livenessProps?.slots?.intro,I={...e.livenessProps??{},slots:{...e.livenessProps?.slots,intro:d??z,...d===void 0&&e.livenessProps?.slots?.errorPanel===void 0?{errorPanel:Me}:{}},...w>0?{autoStart:!1}:{},verification:e.verification,locale:e.locale,dir:e.dir,strings:s.strings,assetBaseUrl:e.assetBaseUrl,voice:e.voice,onCaptured:e.onLivenessCaptured};T=c(st.Provider,{value:Pe,children:t.instructions==="icao"||t.livePhoto?.icao===!0?c(B,{view:"LivePhotoLiveness",i18n:s,step:t,livenessProps:I,sekyroIntro:d===void 0},w):c(Ht,{...I},w)});break}case"portrait":T=Y(Ae,{children:[t.retakeOnly?c(B,{view:"PortraitRetakeNotice",i18n:s,quiet:!0}):null,c(ht,{step:t,verification:e.verification,...e.assetBaseUrl!==void 0?{assetBaseUrl:e.assetBaseUrl}:{}})]});break;case"proof_of_address":T=c(vt,{step:t});break;case"form":T=c(Ct,{step:t});break;case"contact_choice":T=c(B,{view:"ContactChoiceView",i18n:s,step:t});break;case"choice":T=c(B,{view:"GenericChoiceView",i18n:s,step:t});break;case"identity_summary":T=c(B,{view:"IdentitySummaryView",i18n:s,step:t});break;case"mobile_required":{let d=t.checkType==="doc_ocr"?o("handoff.lead.document"):t.checkType==="portrait_icao"?o("handoff.lead.portrait"):t.checkType==="poa"?o("handoff.lead.poa"):void 0;T=e.handoffUrl!==void 0?c(B,{view:"HandoffView",i18n:s,url:e.handoffUrl,refresh:t.refresh,...d!==void 0?{lead:d}:{}}):c(Ze,{tone:"brand",icon:"smartphone",title:o("handoff.title"),actions:c(h,{kind:"secondary",full:!0,disabled:l,onClick:()=>Te(t.refresh),children:o("common.refresh")}),children:c("p",{children:d??o("reasons.mobile_required")})});break}case"native_app_required":T=c(B,{view:"NativeAppView",i18n:s,org:L.orgName,nativeApp:t.nativeApp,...e.handoffUrl!==void 0?{fallbackUrl:e.handoffUrl}:{},refresh:t.refresh,footer:c(Ko,{org:L.orgName})});break;case"processing":{let d=Rr(s.strings,t.service);T=c(Ze,{tone:"brand",icon:"pending",busy:!t.stalled,live:!0,title:d?.title??o("session.processing.title"),actions:t.stalled?c(h,{kind:"secondary",full:!0,disabled:l,onClick:()=>Te(t.refresh),children:o("common.refresh")}):null,children:c("p",{children:d?.description??o("session.processing.description")})});break}case"eid":T=c(pt,{step:t});break;case"unsupported":{let d=t.reason==="platform_unsupported";T=c(Ze,{tone:"neutral",icon:"smartphone",title:o(d?"needsApp.title":"unsupported.title"),actions:c(Ko,{org:L.orgName}),children:c("p",{children:d?L.orgName!==""?o("needsApp.description",{org:L.orgName}):o("needsApp.descriptionNoOrg"):o("unsupported.description",{org:L.orgName})})});break}case"result":T=r?.result?.(t)??c(Fr,{step:t});break;default:{let d=t;T=null}}let $e=!a&&!L.consentRecorded&&t.kind!=="result"?c(Bo,{i18n:s,purpose:L.purpose}):null,Ee=S!==null&&!a&&!ce&&!_?c(Ar,{skip:S}):null,C=x&&!_&&!a&&!ce&&e.verification.testerGate!==void 0?c(B,{view:"TesterGateAction",i18n:s,quiet:!0,onOpen:()=>Z(!0)}):null,V=Ee===null&&C===null?$e:Y(Ae,{children:[C,Ee,$e]});return c(Xt.Provider,{value:y,children:c(Ye.Provider,{value:S,children:c(lo.Provider,{value:e.handoffUrl,children:Y(Qt.Provider,{value:V===null?null:{node:V,owner:p[0]??null,claim:g},children:[a?null:nt,!a&&t.kind!=="result"&&L.sections.length>1?c(Mr,{context:L,current:t.section,i18n:s}):null,c(to,{pageKey:t.key,children:T}),!a&&!ce&&t.kind!=="result"&&t.context.switchable!==void 0?c(B,{view:"LaneSwitch",i18n:s,step:t,onOpen:()=>R(t.key),quiet:!0},t.key):null,p.length===0?V:null,a?null:r?.footer!==void 0?r.footer:L.branding?.hideAttribution===!0?null:Y("a",{className:"sekyro-footer",href:"https://sekyro.ai",target:"_blank",rel:"noopener noreferrer",children:[c(M,{name:"lock"}),o("shell.verifiedBy")]})]})})})})}i(Vr,"Body");function Ko({org:e}){let{t}=v(),n=Ir(at);return n===void 0?null:c(h,{full:!0,onClick:n,children:t("native.result.continue",{org:e})})}i(Ko,"BackToOrg");function Fr({step:e}){return c(qe.Consumer,{children:t=>c(Tt,{step:e,...t!==void 0?{onClose:t}:{}})})}i(Fr,"ResultPage");function Dr({context:e,headerId:t,end:n,onBack:r}){let{t:a}=v(),[s,o]=W(!1),l=s?void 0:e.branding?.logoUrl,u=e.orgName!==""?e.orgName:a(e.returning?"returning.heading":"session.title");return c("header",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":t,children:Y("div",{className:"sekyro-org",children:[r!==void 0?c("button",{type:"button",className:"sekyro-disc sekyro-org__back","aria-label":a("common.back"),onClick:r,"data-testid":"sekyro-back",children:c(M,{name:"back"})}):null,c("span",{className:"sekyro-org__tile","aria-hidden":"true",children:l!==void 0?c("img",{className:"sekyro-org__logo",src:l,alt:"",onError:()=>o(!0)}):Lo(e.orgName)}),Y("div",{className:"sekyro-org__text",children:[c("h1",{id:t,className:"sekyro-org__name",children:u}),c("p",{className:"sekyro-org__sub",children:a(e.purpose==="human"?"shell.subtitleHuman":"shell.subtitle")})]}),e.sandbox?c("span",{className:"sekyro-sandbox-badge","data-testid":"sekyro-sandbox-badge",children:a("app.sandboxBadge")}):null,n!=null?c("div",{className:"sekyro-org__end",children:n}):null,c(qe.Consumer,{children:p=>p!==void 0?c("button",{type:"button",className:"sekyro-disc sekyro-org__close","aria-label":a("native.close"),onClick:p,children:c(M,{name:"close"})}):null})]})})}i(Dr,"OrgHeader");function Mr({context:e,current:t,i18n:n}){let r=t===null?-1:e.sections.indexOf(t),a=e.progress,s=a!==void 0&&a.length===e.sections.length?a:e.sections.map((o,l)=>({id:o,state:l<r?"done":l===r?"current":"upcoming"}));return c("ol",{className:"sekyro-progress__bars","aria-label":n.t("session.progressLabel"),children:s.map(({id:o,state:l})=>c("li",{className:`sekyro-progress__bar${l==="done"?" is-done":l==="current"?" is-current":""}`,...l==="current"?{"aria-current":"step"}:{},children:c("span",{className:"sekyro-visually-hidden",children:n.strings[`section.${o}`]??o})},o))})}i(Mr,"SectionProgress");import{useEffect as Hr,useState as Yo}from"react";import{jsx as we}from"react/jsx-runtime";function Ur(){return typeof window>"u"?"":window.location.href.split("#")[0]??""}i(Ur,"pageUrl");function $r({hostedUrl:e,inAppBrowser:t,...n}){let[r,a]=Yo(t===!0);Hr(()=>{t===void 0&<()&&a(!0)},[t]);let[s,o]=Yo(!1),l=ot(n.colorScheme??"light"),u=n.handoffUrl??e??Ur();return r&&!s?we($t,{theme:ze(tt(void 0,void 0,l),n.theme),className:`sekyro-verification${l?" sekyro-verification--dark":""}${n.className!==void 0?` ${n.className}`:""}`,children:we(Oe,{locale:n.locale,...n.strings!==void 0?{strings:n.strings}:{},children:we("div",{dir:n.dir??(n.locale==="ar"?"rtl":"ltr"),lang:n.locale,className:"sekyro-flow",children:we(Kr,{url:u,onContinue:()=>o(!0)})})})}):we(Ot,{...n,...u!==""?{handoffUrl:u}:{}})}i($r,"SekyroFlow");function Kr({url:e,onContinue:t}){let n=v();return we(B,{view:"InAppBrowserPrompt",i18n:n,url:e,onContinue:t})}i(Kr,"Prompt");export{St as DocumentCapture,pt as EidStep,dt as EmailOtpStep,Ct as FormStep,Qe as IdNumberEntry,ft as MethodChoice,Tn as NniEntry,ut as PhoneOtpStep,ht as PortraitCapture,vt as ProofOfAddress,$r as SekyroFlow,Ot as SekyroVerification,Oe as StepI18nProvider,Tt as VerificationResultScreen,Xo as arSteps,Jo as enSteps,en as formatTemplate,jo as frSteps,lt as isInAppBrowser,Zo as loadSekyroLocale,tn as resolveSekyroStrings,Qo as retakeHintStringKey,v as useStepI18n,ct as useVerificationStep};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sekyro/react",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.33",
|
|
4
4
|
"description": "Sekyro AI React SDK — the themeable, accessible <LivenessCapture /> component over @sekyro/web (Arabic, French, English, Spanish, Portuguese and German, RTL-safe, WCAG AAA defaults)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
package/sbom.cdx.json
CHANGED
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"type": "application",
|
|
98
98
|
"name": "react",
|
|
99
99
|
"group": "@sekyro",
|
|
100
|
-
"version": "0.1.0-rc.
|
|
101
|
-
"bom-ref": "@sekyro/react@0.1.0-rc.
|
|
100
|
+
"version": "0.1.0-rc.33",
|
|
101
|
+
"bom-ref": "@sekyro/react@0.1.0-rc.33",
|
|
102
102
|
"description": "Sekyro AI React SDK — the themeable, accessible <LivenessCapture /> component over @sekyro/web (Arabic, French, English, Spanish, Portuguese and German, RTL-safe, WCAG AAA defaults)",
|
|
103
103
|
"licenses": [
|
|
104
104
|
{
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
],
|
|
111
|
-
"purl": "pkg:npm/%40sekyro/react@0.1.0-rc.
|
|
111
|
+
"purl": "pkg:npm/%40sekyro/react@0.1.0-rc.33?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-react",
|
|
112
112
|
"externalReferences": [
|
|
113
113
|
{
|
|
114
114
|
"url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"components": [],
|
|
148
148
|
"dependencies": [
|
|
149
149
|
{
|
|
150
|
-
"ref": "@sekyro/react@0.1.0-rc.
|
|
150
|
+
"ref": "@sekyro/react@0.1.0-rc.33"
|
|
151
151
|
}
|
|
152
152
|
]
|
|
153
153
|
}
|
package/dist/chunk-K5H7KWEY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as sn,c as cn}from"./chunk-M7JKVIGW.js";import{b as an,c as Qe}from"./chunk-7MMT5M4E.js";import{a as nn,b as rn,c as on,d as $}from"./chunk-DYWLZHSM.js";import{a as F,k as Wt,l as Qt,n as Jt,o as Xt,p as en,q as tn,r as D,s as Je}from"./chunk-WC4U54LZ.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as Cr}from"react";import{Fragment as vr,jsx as M,jsxs as ee}from"react/jsx-runtime";function te({className:e,children:t}){return M("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})}n(te,"Svg");var gt="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 ln(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"4"}),M("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"})]})}n(ln,"SunIcon");function un(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"9"}),M("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(un,"FaceUncoveredIcon");function dn(e){return ee(te,{...e,children:[M("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),M("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),M("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(dn,"PhoneEyeLevelIcon");function pn(e){return ee(te,{...e,children:[M("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"}),M("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(pn,"LookStraightIcon");function fn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M9 13l2 2 4-4"})]})}n(fn,"CameraCheckIcon");function mn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("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"})]})}n(mn,"CameraAskIcon");function yn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M3 3l18 18"})]})}n(yn,"CameraBlockedIcon");function Ve({off:e,className:t}){return ee(te,{className:t,children:[M("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?M("path",{d:"M4 4l16 16"}):ee(vr,{children:[M("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),M("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(Ve,"SpeakerIcon");function gn(e){return M(te,{...e,children:M("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(gn,"CheckIcon");function hn(e){return ee(te,{className:e.className??"sekyro-spinner",children:[M("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),M("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(hn,"SpinnerIcon");import{jsx as pe,jsxs as vn}from"react/jsx-runtime";var Xe=["light","uncover","eyeLevel","straight"],kr={light:{key:"capture.tips.light",icon:n(()=>pe(ln,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>pe(un,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>pe(dn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>pe(pn,{}),"icon")}};function Cn({tips:e}){let t=$(),o=Cr();return e.length===0?null:vn("section",{className:"sekyro-tips","aria-labelledby":o,"data-testid":"sekyro-tips",children:[pe("p",{className:"sekyro-tips__title",id:o,children:t("capture.tips.title")}),pe("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?kr[r]:void 0,c=typeof r=="string"?r:r.id,i=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,u=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return vn("li",{className:"sekyro-tips__item",children:[i!=null?pe("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:i}):null,pe("span",{children:u})]},c)})})]})}n(Cn,"TipList");import{useEffect as kn,useId as br,useRef as Sr,useState as Rr}from"react";import{jsx as W,jsxs as et}from"react/jsx-runtime";var Vr=220;function bn({title:e,description:t,options:o,busy:r,error:s,focus:c,testId:i,look:u="cards",marked:k,onChoose:b}){let y=br(),w=Je(),[S,d]=Rr(null),C=Sr(null);kn(()=>{s!==null&&d(null)},[s]),kn(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let v=n(l=>{r||S!==null||(d(l),C.current=setTimeout(()=>{C.current=null,d(null),b(l)},Vr))},"choose");return et("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":y,"data-testid":i,children:[et("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[W("h2",{id:y,ref:c?w:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?W("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?W(D,{tone:"danger",children:W("span",{children:s})}):null,u==="buttons"?W("div",{className:"sekyro-stack sekyro-stack--3",children:o.map((l,L)=>W(F,{kind:L===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>b(l.id),children:l.label},l.id))}):W("div",{className:"sekyro-choices",children:o.map(l=>et("button",{type:"button",className:"sekyro-card","aria-pressed":(S??k)===l.id,"aria-busy":r||void 0,disabled:r||S!==null&&S!==l.id,onClick:()=>v(l.id),children:[l.glyph!==void 0?W("span",{className:"sekyro-card__tile",children:l.glyph}):null,et("span",{className:"sekyro-card__body",children:[W("span",{className:"sekyro-card__title",children:l.label}),l.sub!==void 0?W("span",{className:"sekyro-card__sub",children:l.sub}):null]}),W("span",{className:"sekyro-radio","aria-hidden":"true"})]},l.id))})]})}n(bn,"ChoiceScreen");var tt=["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 he(e){return e!==null&&tt.includes(e)}n(he,"isVoiceKey");import{useCallback as re,useEffect as ve,useLayoutEffect as _r,useMemo as Ir,useRef as we,useState as Oe}from"react";var Mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function Me(e,t,o){let r;try{if(typeof e=="function")r=e(t,o);else{let s=e[o];r=s!=null&&Mr(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}n(Me,"resolveClip");var wr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Vn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ne(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}n(ne,"synth");function Lr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(Lr,"speechAvailable");function Sn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(Sn,"baseLang");function Mn(e,t){let o=n(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=Sn(t);return e.find(s=>o(s.lang)===o(t))??e.find(s=>Sn(s.lang)===r)}n(Mn,"pickVoice");function wn(e){if(!Lr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||Mn(t,e)!==void 0}n(wn,"speechUsable");function Ln(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Ln,"subscribeVoices");function Ke(e){try{let t=typeof location<"u"?location.href:"http://localhost/",o=new URL(e,t);return`clip:${o.origin}${o.pathname}`}catch{return`clip:${e}`}}n(Ke,"clipIdentity");function Rn(e){e.pause(),e.removeAttribute("src"),e.load()}n(Rn,"release");function _n(){let e=null,t=null,o=0,r=null,s=[],c=new Map,i=n(()=>{s=ne()?.getVoices()??[]},"loadVoices"),u=!1,k=n(()=>{let d=ne();u||d===null||(u=!0,i(),d.addEventListener?.("voiceschanged",i))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),y=n((d,C,v)=>{let l=ne();if(l!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){k();let L=Mn(s,C);if(s.length===0||L!==void 0){l.cancel();let g=new SpeechSynthesisUtterance(d);g.lang=C,L!==void 0&&(g.voice=L),g.rate=.95,v!==void 0&&(g.onend=g.onerror=v),l.speak(g);return}}v?.()},"speak"),w=n(()=>{o+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),S=n(d=>{for(let C of d){let v=Ke(C);if(c.has(v))continue;let l=new Audio;l.preload="auto",l.src=C,c.set(v,l)}},"warmClips");return{say(d){let C=d.url!==null?Ke(d.url):`tts:${d.lang}:${d.text}`;if(C===r)return;r=C,o+=1;let v=o,l=d.onEnd,L=l!==void 0?()=>{v===o&&l()}:void 0;if(ne()?.cancel(),d.url!==null){let g=b();g.pause(),g.muted=!1,g.src=d.url,g.currentTime=0,g.onended=L??null,g.play()?.catch(V=>{v===o&&V?.name!=="AbortError"&&(d.speech?y(d.text,d.lang,L):L?.())});return}d.speech?y(d.text,d.lang,L):L?.()},unlock({lang:d,speech:C,prefetch:v}){let l=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let V=Uint8Array.from(atob(wr),E=>E.charCodeAt(0));t=URL.createObjectURL(new Blob([V],{type:"audio/wav"}))}let L=l.paused===!1&&t!==null&&l.src!==t;t!==null&&!L&&(l.muted=!0,l.onended=null,l.src=t,l.play()?.catch(()=>{}));let g=ne();if(C&&g!==null&&typeof SpeechSynthesisUtterance=="function"){k();let V=new SpeechSynthesisUtterance(" ");V.volume=0,V.lang=d,g.speak(V)}S(v??[])},prefetch:S,stop:w,dispose(){w(),u&&ne()?.removeEventListener?.("voiceschanged",i),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Rn(e),e=null;for(let d of c.values())Rn(d);c.clear()}}}n(_n,"createVoicePlayer");var In="sekyro.voiceGuidance";function xn(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}}n(xn,"readVoicePreference");function En(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(En,"writeVoicePreference");var Ue="capture.tips.summary",xr=typeof window<"u"?_r:ve,Er=Object.freeze({});function ht(e,t){let o=new Set,r=[];for(let s of tt){let c=s===Ue?null:Me(e,s,t);c===null||o.has(Ke(c))||(o.add(Ke(c)),r.push(c))}return r}n(ht,"resolvedClipUrls");function vt({locale:e,defaultClips:t,options:o}){let r=o===!1,s=r?{}:o??{},c=s.storageKey===void 0?In:s.storageKey,[i,u]=Oe(s.defaultEnabled??!0),k=we(i),[b,y]=Oe(!1),[w,S]=Oe("none"),[d,C]=Oe(!1),v=we(!1),[l,L]=Oe(0),g=we(null),V=re(()=>(g.current??(g.current=_n()),g.current),[]),E=Vn[e],O=s.speechFallback,p=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),H=s.clips??t??Er,B=we(!1),se=we(H);xr(()=>{se.current=H,k.current=i}),ve(()=>{if(r||c===null)return;let h=xn(c);h!==null&&(k.current=h,u(h))},[r,c]),ve(()=>{if(!(r||!p))return Ln(()=>L(h=>h+1))},[r,p]);let a=s.clips;ve(()=>{if(r)return;let h=p&&wn(E);y(ht(H,e).length>0||h),S(a!==void 0&&Me(a,Ue,e)!==null?"partner":Me(H,Ue,e)!==null||h?"default":"none")},[r,H,a,e,p,E,l]),ve(()=>{if(r||!i||!B.current)return;let h=ht(H,e);h.length>0&&V().prefetch(h)},[r,i,H,e,V]),ve(()=>()=>{g.current?.dispose(),g.current=null,B.current=!1},[]);let T=re(h=>{r||(B.current=!0,V().unlock({lang:E,speech:p,...h?{prefetch:ht(se.current,e)}:{}}))},[r,V,E,p,e]),_=re(()=>T(k.current),[T]),G=re(()=>{v.current=!1,C(!1)},[]),N=re(()=>{G(),g.current?.stop()},[G]),ie=re(()=>{v.current&&N()},[N]),ae=re((h,me)=>{if(r)return;if(v.current){N();return}let ce=V();ce.stop(),v.current=!0,C(!0);let I=me?.clip===!1?null:Me(se.current,Ue,e);ce.say({url:I,text:h,lang:E,speech:p,onEnd:G})},[r,N,V,e,E,p,G]),A=re(h=>{r||(h?T(!0):N(),c!==null&&En(c,h),k.current=h,u(h))},[r,T,N,c]),U=re(()=>A(!k.current),[A]),fe=re((h,me)=>{if(r||!i)return;v.current&&G();let ce=Me(se.current,h,e);V().say({url:ce,text:me,lang:E,speech:p})},[r,i,e,V,E,p,G]);return Ir(()=>({supported:!r&&b,enabled:!r&&i,setEnabled:A,toggle:U,unlock:_,speakKey:fe,stop:N,summary:r?"none":w,summaryPlaying:d,toggleSummary:ae,stopSummary:ie}),[r,b,i,A,U,_,fe,N,w,d,ae,ie])}n(vt,"useVoiceGuidance");function Ct(e,t,o,r){let{speakKey:s,stop:c,enabled:i}=e,u=we(!1);ve(()=>{if(!r||!i){u.current&&c(),u.current=!1;return}u.current=!0,he(t)&&t!==Ue&&o!==""&&s(t,o)},[r,i,t,o,s,c])}n(Ct,"useSpeakGuidance");import{isValidElement as ao,useCallback as it,useContext as co,useEffect as oe,useMemo as Ie,useRef as ke,useState as ir}from"react";import{useEffect as Nr,useRef as Ar}from"react";import{jsx as He,jsxs as An}from"react/jsx-runtime";function Pn(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"}}n(Pn,"retryCoachingOf");var Nn={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 Tn({showCoaching:e,coaching:t="face",attemptsText:o,showRetake:r,onRetake:s}){let c=$(),i=Ar(null);return Nr(()=>{r&&i.current?.focus()},[r]),!e&&!r?null:An("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?An("div",{className:"sekyro-stack sekyro-stack--1",children:[He("p",{className:"sekyro-text-body",children:c(Nn[t].title)}),He("ul",{className:"sekyro-coaching",children:Nn[t].tips.map(u=>He("li",{children:c(u)},u))}),o!==null?He("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:o}):null]}):null,r?He(F,{ref:i,className:"sekyro-btn--start",onClick:s,children:c("capture.recordAgain")}):null]})}n(Tn,"CapturedPanel");function nt(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(nt,"isDevBuild");import{createContext as Pr}from"react";var Kn=Pr(null);import{useCallback as Bn,useEffect as Gn,useRef as Le}from"react";import{useEffect as Tr,useState as Kr}from"react";import{jsx as Be,jsxs as Or}from"react/jsx-runtime";function On({state:e}){let t=$(),[o,r]=Kr(!1);Tr(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?Be(fn,{}):e==="denied"?Be(yn,{}):Be(mn,{});return Or("div",{role:o?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Be("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),Be("span",{children:t(`capture.permission.${e}`)})]})}n(On,"PermissionRow");import{jsx as rt,jsxs as Un}from"react/jsx-runtime";function Hn({voice:e}){let t=$();if(!e.supported)return null;let o=e.enabled;return Un("button",{type:"button",role:"switch","aria-checked":o,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[Un("span",{className:"sekyro-switch__label",children:[rt(Ve,{off:!o}),t("capture.voiceGuidance")]}),rt("span",{className:"sekyro-switch__track","aria-hidden":"true",children:rt("span",{className:"sekyro-switch__thumb",children:o?rt(gn,{className:"sekyro-switch__check"}):null})})]})}n(Hn,"VoiceSwitch");import{Fragment as Hr,jsx as q,jsxs as _e}from"react/jsx-runtime";function Fn({assets:e,onRetryAssets:t,permission:o,captureMode:r="self",voice:s,tips:c,summary:i,startLabel:u,startDisabled:k,onStart:b}){let y=$(),w=Le(i?.stop);w.current=i?.stop,Gn(()=>()=>w.current?.(),[]);let S=Le(null),d=Le(null),C=Le(null),v=Le(e),l=Le(!1);Gn(()=>{let H=v.current;if(v.current=e,H===e)return;let B=l.current;e!=="loading"&&(l.current=!1),Ur(S.current)&&(e==="failed"?C.current?.focus():B&&d.current?.focus())},[e]);let L=Bn(()=>{l.current=!0,t()},[t]),g=e==="loading",V=g||k,E=Bn(()=>{V||(w.current?.(),b())},[V,b]),O;return e==="failed"?O=_e(D,{tone:"danger",testId:"sekyro-assets-error",children:[q("p",{className:"sekyro-text-body",children:y("fcv2.err.models")}),q(F,{kind:"ghost",ref:C,className:"sekyro-btn--start",onClick:L,"data-testid":"sekyro-assets-retry",children:y("common.retry")})]}):O=_e("div",{className:"sekyro-stack sekyro-stack--1",children:[q(F,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":V?"true":void 0,"aria-busy":g?"true":void 0,onClick:E,children:g?_e(Hr,{children:[q(hn,{}),y("capture.preparing.title")]}):u??y("capture.start")}),g?q("p",{className:"sekyro-text-muted",children:y("capture.preparing.hint")}):null]}),_e("div",{ref:S,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?_e("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[q("h2",{className:"sekyro-text-body",children:y("capture.assisted.title")}),q("p",{className:"sekyro-text-muted",children:y("capture.assisted.lead")})]}):null,c!==!1?q(Cn,{tips:c}):null,i!==void 0?_e(F,{kind:"ghost",className:"sekyro-btn--start",onClick:i.toggle,"data-testid":"sekyro-tips-listen",children:[q(Ve,{off:!1}),y(i.playing?"capture.tips.stop":"capture.tips.listen")]}):null,q(On,{state:o}),q(Hn,{voice:s}),q("p",{className:"sekyro-text-muted",children:y("capture.securityNote")}),O,q("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?y("capture.preparing.title"):e==="ready"?y("capture.ready"):""})]})}n(Fn,"PreCaptureScreen");function Ur(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(Ur,"focusIsOurs");import{subscribeCameraPermission as Br}from"@sekyro/web";import{useEffect as Gr,useState as Fr}from"react";function Dn(){let[e,t]=Fr({state:"unknown",settled:!1});return Gr(()=>Br(o=>t({state:o,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}n(Dn,"useCameraStatus");import{useCallback as Dr,useEffect as kt,useState as bt}from"react";function qn(e){return Yn(e,"mobileRequired")}n(qn,"useMobileRequired");function jn(e){return Yn(e,"returning").required}n(jn,"useReturning");function Yn(e,t){let[o,r]=bt({required:!1,settled:e===void 0});return kt(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let c=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(i=>{c&&r({required:i===!0,settled:!0})},()=>{c&&r({required:!1,settled:!0})}),()=>{c=!1}},[e,t]),o}n(Yn,"useFlag");function $n(e){let t=n(()=>e?.captureChoice??null,"initialChoice"),[o,r]=bt(()=>({session:"self",choice:t(),settled:e===void 0}));kt(()=>{let i=e?.captureMode,u=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:u,settled:!0});return}let k=!0;return r({session:"self",choice:u,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(b=>{let y=e.captureChoice??null;k&&r({session:y!==null&&b===y?"choice":b==="assisted"||b==="choice"?b:"self",choice:y,settled:!0})},()=>{k&&r({session:"self",choice:null,settled:!0})}),()=>{k=!1}},[e]);let s=Dr(i=>{e?.chooseCaptureMode?.(i),r(u=>({...u,choice:i}))},[e]);return{mode:o.session==="choice"?o.choice??"self":o.session==="assisted"?"assisted":"self",session:o.session,choice:o.choice,settled:o.settled,choose:s}}n($n,"useCaptureMode");function zn(e){let[t,o]=bt(!1);return kt(()=>{if(o(!1),e===void 0)return;let r=e.on("busy",()=>o(!0)),s=e.on("result",()=>o(!1));return()=>{r(),s()}},[e]),t}n(zn,"useBusy");import{getLivenessAssetsStatus as qr,preloadLivenessAssets as jr,subscribeLivenessAssets as Yr}from"@sekyro/web";import{useCallback as St,useEffect as Zn,useRef as Wn,useState as $r,useSyncExternalStore as zr}from"react";var Zr=n(()=>"idle","serverSnapshot");function Qn(e){return jr(e!==void 0?{assetBaseUrl:e}:{})}n(Qn,"preload");function Jn(e,t=!0){let o=zr(St(w=>Yr(w,e),[e]),()=>qr(e),Zr),[r,s]=$r(null),c=Wn(!1),i=St(()=>{Qn(e).then(w=>{c.current&&w==="idle"&&s({base:e})})},[e]);Zn(()=>(c.current=!0,i(),()=>{c.current=!1}),[i]);let u=Wn(null);Zn(()=>{if(o!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,i())},[o,e,i,t]);let k=St(()=>{Qn(e)},[e]);return{gate:r!==null&&r.base===e&&o==="idle"||o==="ready"?"ready":o==="failed"?"failed":"loading",retry:k}}n(Jn,"useLivenessAssets");import{createLivenessCapture as Wr}from"@sekyro/web";import{useCallback as ot,useEffect as Qr,useRef as Ce,useState as j}from"react";var Xn={progress:0,hint:null,faceDetected:!1};function er(e){let{videoRef:t,assetBaseUrl:o}=e,s=Ce(e.verification).current,c=Ce(!1);e.verification!==s&&!c.current&&nt()&&(c.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=Ce(null),[u,k]=j("idle"),[b,y]=j(Xn),[w,S]=j(!1),[d,C]=j(!1),[v,l]=j(null),[L,g]=j(!1),[V,E]=j(null),[O,p]=j(null),[H,B]=j(null),[se,a]=j(null),[T,_]=j(null),[G,N]=j(!1),ie=Ce(null),ae=Ce("idle"),A=Ce(-1),[U,fe]=j(0),h=Ce(e);h.current=e,Qr(()=>{let z=t.current;if(z===null)return;let Q={video:z,...o!==void 0?{assetBaseUrl:o}:{}},x=s!==void 0?s.liveness(Q):Wr(Q);i.current=x;let Ne=n(()=>_(x.facingMode??null),"readFacing");Ne();let Ge=[x.on("state",m=>{m==="mode_switch"?N(!0):m!=="starting"&&m!=="gating"&&N(!1),m==="starting"?(ae.current!=="starting"&&(A.current+=1,fe(Math.max(0,A.current))),p(null),B(null),y(Xn),C(!1),S(!1),l(null),E(null),ie.current=null):m==="gating"&&ae.current==="recording"&&(C(!1),S(!1),l(null),ie.current=null),ae.current=m,Ne(),k(m),h.current.onStateChange?.(m)}),x.on("gate",m=>{let J=ie.current;ie.current=m.progress,S(J!==null&&m.progress<J-.001&&m.progress>0&&m.progress<1),m.progress>=1&&C(!0),y(m)}),x.on("frozen",({previewDataUrl:m})=>l(m)),x.on("profile",({animations:m})=>g(m==="reduced")),x.on("ramp",({colour:m})=>E(m)),x.on("captured",m=>{p(m),a(null),h.current.onCaptured?.(m)}),x.on("error",m=>{B(m);let J=s?.reportCaptureIssue;J!==void 0&&Qe(ye=>J.call(s,ye),an("liveness",m,Math.max(0,A.current))),h.current.onError?.(m)}),s?.on("result",m=>{a(m),h.current.onResult?.(m)})];return()=>{for(let m of Ge)m?.();i.current=null,x.destroy()}},[s,t,o]);let me=ot(()=>{i.current?.start()},[]),ce=ot(()=>{i.current?.retry()},[]),I=ot(async()=>{let z=i.current;return z===null||typeof z.canSwitchCaptureMode!="function"?!1:await z.canSwitchCaptureMode().catch(()=>!1)===!0},[]),Ee=ot(async z=>{let Q=i.current;if(Q===null||typeof Q.setCaptureMode!="function")return!1;let x=await Q.setCaptureMode(z).catch(()=>!1)===!0;return x&&_(Q.facingMode??null),x},[]);return{state:u,gate:b,draining:w,gateLocked:d,frozenPreview:v,reduceMotion:L,rampColour:V,artifacts:O,error:H,result:se,facingMode:T,start:me,retry:ce,canSwitchCaptureMode:I,setCaptureMode:Ee,modeRestarted:G,attempt:U}}n(er,"useLivenessHandle");import{useCallback as Jr,useEffect as Xr,useState as st}from"react";var eo=new Set(["national_number"]);function tr(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(o=>eo.has(o));return t.length>0?{...e,options:t}:null}n(tr,"pending");function nr(e){let[t,o]=st(null),[r,s]=st(e===void 0),[c,i]=st(!1),[u,k]=st(!1);Xr(()=>{if(o(null),e===void 0){s(!0);return}let S=!0,d=e.methodChoice;typeof d=="function"?(s(!1),Promise.resolve().then(()=>d.call(e)).then(v=>{S&&o(tr(v))},()=>{}).finally(()=>{S&&s(!0)})):s(!0);let C=e.on("method",v=>o(tr(v)));return()=>{S=!1,C()}},[e]);let b=Jr(async S=>{if(e===void 0)return!1;i(!0),k(!1);try{return await e.selectMethod(S),o(null),!0}catch{return k(!0),!1}finally{i(!1)}},[e]),y=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:y==="national_number"&&!u?y:null,settled:r,busy:c,failed:u,select:b}}n(nr,"useMethodChoice");import{useEffect as to,useMemo as no,useState as ro}from"react";var oo=["ar","fr","en"];function so(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}}n(so,"isClipUrl");function io(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let o={};for(let r of oo){let s=t[r];if(!(typeof s!="object"||s===null))for(let[c,i]of Object.entries(s))!he(c)||!so(i)||((o[r]??(o[r]={}))[c]=i)}return Object.keys(o).length>0?o:null}n(io,"toVoiceClipMap");function rr(e){let[t,o]=ro(null);to(()=>{if(o(null),e===void 0)return;let s=!0,c=n(u=>{if(!s)return;let k=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;o(b=>b?.setId===k?.setId?b:k)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(c,()=>c(null))}catch{c(null)}let i=e.on("view",u=>c(u.voice));return()=>{s=!1,i()}},[e]);let r=no(()=>t!==null?io(t):null,[t]);return e===void 0?null:r}n(rr,"useServerVoiceClips");import{jsx as or}from"react/jsx-runtime";function sr({voice:e}){let t=$();return or(F,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:or(Ve,{off:!e.enabled,className:"sekyro-icon"})})}n(sr,"VoiceChip");import{Fragment as ar,jsx as R,jsxs as xe}from"react/jsx-runtime";var lo=new Set(["abandoned","not_opened","cancelled","superseded"]),uo=800,po="capture.lookAtColours";function fo(e){return e===void 0||e!==!1&&e.length===Xe.length&&Xe.every(t=>e.includes(t))}n(fo,"isDefaultTips");function mo(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}n(mo,"carriesActivation");function yo(e){return typeof e=="object"&&e!==null&&!ao(e)&&"tone"in e&&"text"in e}n(yo,"isNoticeObject");var go=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function ho(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}n(ho,"isCapturing");function vo(e){return e==="captured"||e==="uploading"||e==="checking"}n(vo,"isPostCapture");function xi({verification:e,locale:t,dir:o,strings:r,slots:s,autoStart:c=!1,notice:i,startDisabled:u=!1,startLabel:k,tips:b,tipsSummary:y,coach:w,voice:S,onGuidance:d,onCaptured:C,onResult:v,onError:l,onStateChange:L,assetBaseUrl:g,className:V}){let E=rn(t),O=Ie(()=>nn(t,r),[t,r,E]),p=Ie(()=>f=>O[f]??"",[O]),H=o??(t==="ar"?"rtl":"ltr"),B=ke(null),se=co(Kn),a=er({verification:e,videoRef:B,assetBaseUrl:g,onCaptured:C,onResult:v,onError:l,onStateChange:L}),T=Jn(g,a.state==="idle"&&a.error===null),_=nr(e),G=_.choice!==null,N=qn(e),ie=jn(e),ae=zn(e),A=Dn(),U=$n(e),fe=U.session==="choice",h=U.mode==="assisted",me=S!==!1&&S?.clips===void 0,ce=rr(me?e:void 0),I=vt({locale:t,defaultClips:ce,options:S}),Ee=h?"environment":"user",z=U.settled,Q=ke(null),x=ke(!1),Ne=ke(I.unlock);Ne.current=I.unlock,oe(()=>{let f=Q.current;if(f===null)return;let Y=["pointerup","touchend","click","keydown"],de=n(()=>{for(let Te of Y)f.removeEventListener(Te,Re,!0)},"disarm");function Re(Te){if(x.current){de();return}mo(Te)&&(x.current=!0,de(),Ne.current())}n(Re,"onGesture");for(let Te of Y)f.addEventListener(Te,Re,{capture:!0,passive:!0});return de},[]);let Ge=it(()=>{x.current||(x.current=!0,I.unlock()),a.start()},[I.unlock,a.start]),m=it(()=>a.start(),[a.start]),J=ke(!1),ye=a.state==="idle"&&a.error===null,Rt=!G&&!N.required&&(c===!0||c==="when-permitted"&&A.permission==="granted"),Vt=Rt&&_.settled&&N.settled&&z,cr=c==="when-permitted"&&!A.permissionSettled&&!J.current,Mt=Rt&&ye&&!J.current,at=(cr||Mt||!z)&&T.gate==="ready"?"loading":T.gate;oe(()=>{!Vt||!ye||T.gate!=="ready"||J.current||(J.current=!0,m())},[Vt,ye,T.gate,m]);let lr=ye&&!G&&!N.required&&!(Mt&&T.gate==="ready"),[wt,Lt]=ir(!1),{canSwitchCaptureMode:_t,setCaptureMode:It}=a;oe(()=>{if(!U.settled||!fe){Lt(!1);return}let f=!0;return _t().then(Y=>{f&&Lt(Y)}),()=>{f=!1}},[U.settled,fe,_t]);let{choose:xt}=U,be=h?"self":"assisted",ur=it(async()=>{await It(be)&&xt(be)},[It,xt,be]),Et=a.state!=="idle"&&a.facingMode!==null?a.facingMode:Ee;oe(()=>{let f=B.current?.style;Et==="user"?f?.removeProperty("transform"):f&&(f.transform="none")},[Et]);let Fe=Ie(()=>a.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(a.artifacts.keyframe):null,[a.artifacts]);oe(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Nt=a.frozenPreview??Fe,Se=e!==void 0,K=ho(a.state),le=vo(a.state),De=K||le,Z=a.result,At=a.state==="done"&&Z!==null,qe=K&&a.rampColour!==null,ct=a.state==="recording"&&a.frozenPreview!==null&&!qe,je=se!==null,Pt=wt&&K&&!ct?{to:be,label:p(be==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:p(be==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:n(()=>{ur()},"onSwitch")}:null,Ye=a.modeRestarted&&K?p("capture.modeSwitch.restarted"):null,Ae=le||ct,Tt=le?"checking":ct?"frozen":a.state==="recording"||qe?"recording":a.gateLocked||a.gate.progress>=1?"locked":a.gate.faceDetected?"aligning":"seeking",$e=K?a.gate.hint:null,ze=a.state==="starting"?"capture.preparing.title":$e===null?null:$e==="center"&&!a.gate.faceDetected?"fcv3.no_face":Wt($e),[dr,Kt]=ir(null);oe(()=>{if(ze!=="fcv3.no_face"){Kt(ze);return}if(!K)return;let f=setTimeout(()=>Kt(ze),uo);return()=>clearTimeout(f)},[ze,K]);let lt=K&&!qe&&typeof w=="string"&&w!=="",Ot=h&&K?p("capture.assisted.stage"):null,ge=K&&!lt?qe?po:dr:null,ut=lt?w:ge===null?"":p(ge);Ct(I,ge,ut,K);let Ut=ke(d);Ut.current=d,oe(()=>{if(he(ge))try{Ut.current?.(ge)}catch(f){console.error("[@sekyro/react] onGuidance threw:",f)}},[ge]);let Pe=Ie(()=>({supported:I.supported,enabled:I.enabled,setEnabled:I.setEnabled,toggle:I.toggle}),[I.supported,I.enabled,I.setEnabled,I.toggle]),dt=s?.voicePrompt,Ht=dt!==void 0,Bt=S===void 0,Gt=ke(!1);oe(()=>{!Ht||!Bt||Gt.current||!nt()||(Gt.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."))},[Ht,Bt]);let pr=dt!==void 0?(f,Y,de)=>dt(f,Y,de,Pe):I.supported?()=>R(sr,{voice:Pe}):void 0,{summary:pt,summaryPlaying:Ft,toggleSummary:Dt,stopSummary:qt}=I,Ze=y!==void 0&&y!=="",jt=Ze?y:p("capture.tips.summary"),Yt=Ze?pt!=="none":pt==="partner"||pt==="default"&&fo(b),fr=Ie(()=>Yt?{playing:Ft,toggle:n(()=>Dt(jt,{clip:!Ze}),"toggle"),stop:qt}:void 0,[Yt,Ft,Dt,jt,qt,Ze]),mr=Ie(()=>({assets:at,retryAssets:T.retry,permission:A.permission,permissionSettled:A.permissionSettled,captureMode:U.mode,facing:Ee,voice:Pe}),[at,T.retry,A.permission,A.permissionSettled,U.mode,Ee,Pe]),yr=yo(i)?R(D,{tone:i.tone,testId:"sekyro-host-notice",children:R("span",{children:i.text})}):i??null,X=Z!==null&&Z.status==="retry"?Z:null,P=At&&Z.status==="unavailable"&&!G&&Z.reasonCode!=="portrait_required"?Z:null,ue=At&&(Z.status==="verified"||Z.status==="not_verified"||Z.status==="review")?Z:null,ft=n((f,Y)=>{if(f===void 0)return null;if(f==="device_cooldown"){let Re=en(t,Y);if(Re!==null)return p(Re.key).replace("{time}",Re.time)}let de=Xt(f);return de===null?null:p(de)},"reasonText"),mt=n(f=>{let Y=f.retakeHint===void 0?null:Qt(f.retakeHint);return Y===null?ft(f.reasonCode):p(Y)},"retryText"),$t=ue===null?null:ft(ue.reasonCode,ue.retryAfter)??(ue.status==="not_verified"&&ue.reason!==void 0&&lo.has(ue.reason)?p("errors.session_expired"):null),gr=P!==null&&P.reasonCode!==void 0&&P.reasonCode!=="nni_unbound"&&P.reasonCode!=="id_number_unbound"&&P.reasonCode!=="method_required"&&P.reasonCode!=="mobile_required"&&!(P.reasonCode==="no_recorder"&&a.artifacts?.degraded==="NO_RECORDER"),We=P?.reasonCode,zt=a.attempt;oe(()=>{P===null||We===void 0||e?.reportCaptureIssue===void 0||go.has(We)||Qe(f=>e.reportCaptureIssue?.(f),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:We,attempt:Math.min(1e3,zt)})},[P,We,zt,e]);let Zt=Je(),hr=G&&_.auto===null&&!K&&!le&&a.error===null,yt=it(async f=>{await _.select(f)&&a.state==="done"&&a.retry()},[_.select,a.state,a.retry]);return oe(()=>{_.auto!==null&&!_.busy&&!K&&!le&&yt(_.auto)},[_.auto,_.busy,K,le,yt]),R(on,{value:p,children:xe("div",{ref:Q,className:V===void 0?"sekyro-capture":`sekyro-capture ${V}`,dir:H,lang:t,"data-testid":"sekyro-liveness-capture","data-state":a.state,children:[s?.header,X!==null&&mt(X)!==null&&!(je&&De)?R(D,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:mt(X)})}):null,Ye!==null&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:R("span",{children:Ye})}):null,ae&&le&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:p("capture.busy")})}):null,N.required&&ye?R(D,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:p("reasons.mobile_required")})}):null,a.error!==null?s?.errorPanel!==void 0?s.errorPanel(a.error,a.retry):xe(D,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:p(Jt(a.error))}),a.error.retryable?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p("common.retry")}):null]}):null,P!==null?xe(D,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:(P.reasonCode==="attestation"&&P.attestationError==="clock_wrong"?p("errors.device_clock"):ft(P.reasonCode))??p(P.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),gr?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p(P.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,$t!==null&&ue!==null?R(D,{tone:ue.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:$t})}):null,R("div",{className:De?void 0:"sekyro-hidden","data-capture-live":De?"":void 0,children:je?se({videoRef:B,guidance:Ae&&Se?p("capture.checking"):ut,coached:lt&&!(Ae&&Se),note:Ae?Se?p(ae?"capture.busy":"capture.checkingHint"):null:Ye??(X!==null?mt(X):Ot),settled:Ae&&Se,progress:a.gate.progress,phase:Tt,still:Ae?Nt:null,live:De,modeSwitch:Pt,...wt?{status:Ye}:{},ramp:a.rampColour===null?null:{colour:a.rampColour}}):R(sn,{videoRef:B,guidanceText:ut,guidanceHint:$e,guidanceKey:ge,progress:a.gate.progress,phase:Tt,draining:a.draining,stillUrl:Nt,showChecking:Se,operatorText:Ot,voicePrompt:pr,overlay:f=>xe(ar,{children:[s?.stageOverlay?.(f),R(cn,{colour:a.rampColour})]}),reduceMotion:a.reduceMotion,modeSwitch:Pt})}),hr&&_.choice!==null?R(bn,{title:p("method.title"),description:p("method.description"),options:_.choice.options.map(f=>({id:f,label:p(`method.${f}`)})),busy:_.busy,error:_.failed?p("errors.network_error"):null,focus:a.state==="done",testId:"sekyro-method",look:"buttons",onChoose:f=>{yt(f)}}):null,lr?xe(ar,{children:[ie&&s?.header===void 0&&s?.intro===void 0?xe("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:p("returning.title")}),R("p",{className:"sekyro-text-muted",children:p("returning.description")})]}):null,yr,s?.intro!==void 0?s.intro(Ge,mr):R(Fn,{assets:at,onRetryAssets:T.retry,permission:A.permission,captureMode:U.mode,voice:Pe,tips:b??Xe,summary:fr,startLabel:k,startDisabled:u,onStart:Ge})]}):null,R(Tn,{showCoaching:X!==null,coaching:Pn(X?.reasonCode),attemptsText:X?.attemptsRemaining!==void 0?tn(O,t,X.attemptsRemaining):null,showRetake:X!==null&&!K&&!le||!Se&&a.state==="captured",onRetake:a.retry}),s?.footer]})})}n(xi,"LivenessCapture");export{Pn as a,Nn as b,nt as c,Kn as d,Xe as e,bn as f,$n as g,tt as h,uo as i,xi as j};
|