@sekyro/react 0.1.0-rc.11 → 0.1.0-rc.13

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +5 -0
  3. package/dist/chunk-34326C2I.js +2 -0
  4. package/dist/{chunk-JNAKE3DW.js → chunk-4ZN7GIYK.js} +1 -1
  5. package/dist/{chunk-D5WF4UNP.js → chunk-IDZNOWTO.js} +1 -1
  6. package/dist/{chunk-MXPLBQHW.js → chunk-K7YYCJUR.js} +1 -1
  7. package/dist/{chunk-5XYKAT3V.js → chunk-LNZR3RXG.js} +1 -1
  8. package/dist/{chunk-746GPDBD.js → chunk-PTPTDOWD.js} +1 -1
  9. package/dist/chunk-WAVBS3GL.js +2 -0
  10. package/dist/chunk-Y37ZXFOA.js +2 -0
  11. package/dist/{chunk-63LPCEVJ.js → chunk-Z5UFPMM6.js} +1 -1
  12. package/dist/document-capture-view-LR4OLZPG.js +2 -0
  13. package/dist/{eid-view-74CN2XAY.js → eid-view-OZETO2IS.js} +1 -1
  14. package/dist/{email-otp-view-DE624TXY.js → email-otp-view-2I346KUZ.js} +1 -1
  15. package/dist/{flow-views-CO5TQYTP.js → flow-views-KKP7HKFG.js} +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +1 -1
  20. package/dist/{overlay-de-UWA5CZLC.js → overlay-de-UTUY4YEE.js} +1 -1
  21. package/dist/{overlay-es-VCSJQ4KN.js → overlay-es-XQFAQT24.js} +1 -1
  22. package/dist/{overlay-pt-NQMWHKF5.js → overlay-pt-2YEUC3J2.js} +1 -1
  23. package/dist/{portrait-capture-view-Y5W776HP.js → portrait-capture-view-TNKPPDYM.js} +1 -1
  24. package/dist/{theme-DqD8Nyoq.d.cts → theme-qTwMxyZM.d.cts} +23 -4
  25. package/dist/{theme-DqD8Nyoq.d.ts → theme-qTwMxyZM.d.ts} +23 -4
  26. package/dist/verification/index.cjs +1 -1
  27. package/dist/verification/index.d.cts +3 -2
  28. package/dist/verification/index.d.ts +3 -2
  29. package/dist/verification/index.js +1 -1
  30. package/dist/verification.css +3 -0
  31. package/package.json +2 -2
  32. package/sbom.cdx.json +4 -4
  33. package/dist/chunk-ECWKDUB5.js +0 -2
  34. package/dist/chunk-PCNVEJSW.js +0 -2
  35. package/dist/chunk-ZCAZDOMD.js +0 -2
  36. package/dist/document-capture-view-E2USDGQJ.js +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as Jt,c as Xt,d as en}from"./chunk-5XYKAT3V.js";import{a as D,j as Dt,k as qt,l as jt,m as $t,n as zt,o as Yt,p as Zt,q as Wt,r as Qt,s as U,t as j,u as qe}from"./chunk-ECWKDUB5.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as cr}from"react";import{Fragment as ar,jsx as V,jsxs as X}from"react/jsx-runtime";function ee({className:e,children:t}){return V("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(ee,"Svg");var at="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 tn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"4"}),V("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(tn,"SunIcon");function nn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"9"}),V("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(nn,"FaceUncoveredIcon");function rn(e){return X(ee,{...e,children:[V("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),V("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),V("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(rn,"PhoneEyeLevelIcon");function on(e){return X(ee,{...e,children:[V("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"}),V("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(on,"LookStraightIcon");function sn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M9 13l2 2 4-4"})]})}n(sn,"CameraCheckIcon");function an(e){return X(ee,{...e,children:[V("path",{d:at}),V("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(an,"CameraAskIcon");function cn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M3 3l18 18"})]})}n(cn,"CameraBlockedIcon");function ve({off:e,className:t}){return X(ee,{className:t,children:[V("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?V("path",{d:"M4 4l16 16"}):X(ar,{children:[V("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),V("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(ve,"SpeakerIcon");function ln(e){return V(ee,{...e,children:V("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(ln,"CheckIcon");function un(e){return X(ee,{className:e.className??"sekyro-spinner",children:[V("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),V("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(un,"SpinnerIcon");import{jsx as ce,jsxs as dn}from"react/jsx-runtime";var je=["light","uncover","eyeLevel","straight"],lr={light:{key:"capture.tips.light",icon:n(()=>ce(tn,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>ce(nn,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>ce(rn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>ce(on,{}),"icon")}};function pn({tips:e}){let t=U(),s=cr();return e.length===0?null:dn("section",{className:"sekyro-tips","aria-labelledby":s,"data-testid":"sekyro-tips",children:[ce("p",{className:"sekyro-tips__title",id:s,children:t("capture.tips.title")}),ce("ul",{className:"sekyro-tips__list",children:e.map(o=>{let r=typeof o=="string"?lr[o]:void 0,a=typeof o=="string"?o:o.id,l=r!==void 0?r.icon():typeof o=="string"?void 0:o.icon,p=r!==void 0?t(r.key):typeof o=="string"?o:o.text;return dn("li",{className:"sekyro-tips__item",children:[l!=null?ce("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,ce("span",{children:p})]},a)})})]})}n(pn,"TipList");import{useEffect as fn,useId as ur,useRef as dr,useState as pr}from"react";import{jsx as te,jsxs as $e}from"react/jsx-runtime";var fr=220;function mn({title:e,description:t,options:s,busy:o,error:r,focus:a,testId:l,look:p="cards",marked:C,onChoose:b}){let w=ur(),M=qe(),[k,c]=pr(null),g=dr(null);fn(()=>{r!==null&&c(null)},[r]),fn(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);let v=n(u=>{o||k!==null||(c(u),g.current=setTimeout(()=>{g.current=null,c(null),b(u)},fr))},"choose");return $e("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[$e("div",{className:"sekyro-stack sekyro-stack--1",children:[te("h2",{id:w,ref:a?M:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?te("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?te(j,{tone:"danger",children:te("span",{children:r})}):null,p==="buttons"?te("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((u,L)=>te(D,{kind:L===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>b(u.id),children:u.label},u.id))}):te("div",{className:"sekyro-choices",children:s.map(u=>$e("button",{type:"button",className:"sekyro-card","aria-pressed":(k??C)===u.id,"aria-busy":o||void 0,disabled:o||k!==null&&k!==u.id,onClick:()=>v(u.id),children:[u.glyph,$e("span",{className:"sekyro-card__body",children:[te("span",{className:"sekyro-card__title",children:u.label}),u.sub!==void 0?te("span",{className:"sekyro-card__sub",children:u.sub}):null]}),te("span",{className:"sekyro-radio","aria-hidden":"true"})]},u.id))})]})}n(mn,"ChoiceScreen");var ze=["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","capture.tips.summary"];function pe(e){return e!==null&&ze.includes(e)}n(pe,"isVoiceKey");import{useCallback as re,useEffect as fe,useLayoutEffect as hr,useMemo as vr,useRef as Ce,useState as Pe}from"react";var mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function ke(e,t,s){let o;try{if(typeof e=="function")o=e(t,s);else{let r=e[s];o=r!=null&&mr(r,t)?r[t]:null}}catch{return null}return typeof o=="string"&&o!==""?o:null}n(ke,"resolveClip");var yr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",hn={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 gr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(gr,"speechAvailable");function yn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(yn,"baseLang");function vn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=yn(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>yn(r.lang)===o)}n(vn,"pickVoice");function kn(e){if(!gr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||vn(t,e)!==void 0}n(kn,"speechUsable");function Cn(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Cn,"subscribeVoices");function _e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",s=new URL(e,t);return`clip:${s.origin}${s.pathname}`}catch{return`clip:${e}`}}n(_e,"clipIdentity");function gn(e){e.pause(),e.removeAttribute("src"),e.load()}n(gn,"release");function bn(){let e=null,t=null,s=0,o=null,r=[],a=new Map,l=n(()=>{r=ne()?.getVoices()??[]},"loadVoices"),p=!1,C=n(()=>{let c=ne();p||c===null||(p=!0,l(),c.addEventListener?.("voiceschanged",l))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),w=n((c,g,v)=>{let u=ne();if(u!==null&&c!==""&&typeof SpeechSynthesisUtterance=="function"){C();let L=vn(r,g);if(r.length===0||L!==void 0){u.cancel();let m=new SpeechSynthesisUtterance(c);m.lang=g,L!==void 0&&(m.voice=L),m.rate=.95,v!==void 0&&(m.onend=m.onerror=v),u.speak(m);return}}v?.()},"speak"),M=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),k=n(c=>{for(let g of c){let v=_e(g);if(a.has(v))continue;let u=new Audio;u.preload="auto",u.src=g,a.set(v,u)}},"warmClips");return{say(c){let g=c.url!==null?_e(c.url):`tts:${c.lang}:${c.text}`;if(g===o)return;o=g,s+=1;let v=s,u=c.onEnd,L=u!==void 0?()=>{v===s&&u()}:void 0;if(ne()?.cancel(),c.url!==null){let m=b();m.pause(),m.muted=!1,m.src=c.url,m.currentTime=0,m.onended=L??null,m.play()?.catch(S=>{v===s&&S?.name!=="AbortError"&&(c.speech?w(c.text,c.lang,L):L?.())});return}c.speech?w(c.text,c.lang,L):L?.()},unlock({lang:c,speech:g,prefetch:v}){let u=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let S=Uint8Array.from(atob(yr),N=>N.charCodeAt(0));t=URL.createObjectURL(new Blob([S],{type:"audio/wav"}))}let L=u.paused===!1&&t!==null&&u.src!==t;t!==null&&!L&&(u.muted=!0,u.onended=null,u.src=t,u.play()?.catch(()=>{}));let m=ne();if(g&&m!==null&&typeof SpeechSynthesisUtterance=="function"){C();let S=new SpeechSynthesisUtterance(" ");S.volume=0,S.lang=c,m.speak(S)}k(v??[])},prefetch:k,stop:M,dispose(){M(),p&&ne()?.removeEventListener?.("voiceschanged",l),p=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&gn(e),e=null;for(let c of a.values())gn(c);a.clear()}}}n(bn,"createVoicePlayer");var Sn="sekyro.voiceGuidance";function Vn(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(Vn,"readVoicePreference");function Rn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(Rn,"writeVoicePreference");var Ae="capture.tips.summary",kr=typeof window<"u"?hr:fe,Cr=Object.freeze({});function ct(e,t){let s=new Set,o=[];for(let r of ze){let a=r===Ae?null:ke(e,r,t);a===null||s.has(_e(a))||(s.add(_e(a)),o.push(a))}return o}n(ct,"resolvedClipUrls");function lt({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},a=r.storageKey===void 0?Sn:r.storageKey,[l,p]=Pe(r.defaultEnabled??!0),C=Ce(l),[b,w]=Pe(!1),[M,k]=Pe("none"),[c,g]=Pe(!1),v=Ce(!1),[u,L]=Pe(0),m=Ce(null),S=re(()=>(m.current??(m.current=bn()),m.current),[]),N=hn[e],O=r.speechFallback,d=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),G=r.clips??t??Cr,F=Ce(!1),q=Ce(G);kr(()=>{q.current=G,C.current=l}),fe(()=>{if(o||a===null)return;let f=Vn(a);f!==null&&(C.current=f,p(f))},[o,a]),fe(()=>{if(!(o||!d))return Cn(()=>L(f=>f+1))},[o,d]);let i=r.clips;fe(()=>{if(o)return;let f=d&&kn(N);w(ct(G,e).length>0||f),k(i!==void 0&&ke(i,Ae,e)!==null?"partner":ke(G,Ae,e)!==null||f?"default":"none")},[o,G,i,e,d,N,u]),fe(()=>{if(o||!l||!F.current)return;let f=ct(G,e);f.length>0&&S().prefetch(f)},[o,l,G,e,S]),fe(()=>()=>{m.current?.dispose(),m.current=null,F.current=!1},[]);let E=re(f=>{o||(F.current=!0,S().unlock({lang:N,speech:d,...f?{prefetch:ct(q.current,e)}:{}}))},[o,S,N,d,e]),I=re(()=>E(C.current),[E]),_=re(()=>{v.current=!1,g(!1)},[]),A=re(()=>{_(),m.current?.stop()},[_]),Y=re(()=>{v.current&&A()},[A]),ue=re((f,K)=>{if(o)return;if(v.current){A();return}let oe=S();oe.stop(),v.current=!0,g(!0);let x=K?.clip===!1?null:ke(q.current,Ae,e);oe.say({url:x,text:f,lang:N,speech:d,onEnd:_})},[o,A,S,e,N,d,_]),P=re(f=>{o||(f?E(!0):A(),a!==null&&Rn(a,f),C.current=f,p(f))},[o,E,A,a]),Z=re(()=>P(!C.current),[P]),T=re((f,K)=>{if(o||!l)return;v.current&&_();let oe=ke(q.current,f,e);S().say({url:oe,text:K,lang:N,speech:d})},[o,l,e,S,N,d,_]);return vr(()=>({supported:!o&&b,enabled:!o&&l,setEnabled:P,toggle:Z,unlock:I,speakKey:T,stop:A,summary:o?"none":M,summaryPlaying:c,toggleSummary:ue,stopSummary:Y}),[o,b,l,P,Z,I,T,A,M,c,ue,Y])}n(lt,"useVoiceGuidance");function ut(e,t,s,o){let{speakKey:r,stop:a,enabled:l}=e,p=Ce(!1);fe(()=>{if(!o||!l){p.current&&a(),p.current=!1;return}p.current=!0,pe(t)&&t!==Ae&&s!==""&&r(t,s)},[o,l,t,s,r,a])}n(ut,"useSpeakGuidance");import{isValidElement as Yr,useCallback as Je,useContext as Zr,useEffect as le,useMemo as Le,useRef as me,useState as Wn}from"react";import{useEffect as br,useRef as Sr}from"react";import{jsx as be,jsxs as dt}from"react/jsx-runtime";function Ln({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=U(),a=Sr(null);return br(()=>{s&&a.current?.focus()},[s]),!e&&!s?null:dt("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?dt("div",{className:"sekyro-stack sekyro-stack--1",children:[be("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),dt("ul",{className:"sekyro-coaching",children:[be("li",{children:r("capture.retryCoaching.light")}),be("li",{children:r("capture.retryCoaching.eyeLevel")}),be("li",{children:r("capture.retryCoaching.head")})]}),t!==null?be("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:t}):null]}):null,s?be(D,{ref:a,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(Ln,"CapturedPanel");function Ye(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(Ye,"isDevBuild");import{createContext as Vr}from"react";var wn=Vr(null);import{useCallback as En,useEffect as _n,useRef as Se}from"react";import{useId as Rr}from"react";import{jsx as Ze,jsxs as pt}from"react/jsx-runtime";var Lr=["user","environment"];function Mn({value:e,onChange:t}){let s=U(),o=Rr();return pt("fieldset",{className:"sekyro-segmented","data-testid":"sekyro-facing",children:[Ze("legend",{className:"sekyro-segmented__legend",children:s("capture.cameraLabel")}),Ze("div",{className:"sekyro-segmented__options",children:Lr.map(r=>pt("label",{className:"sekyro-segmented__option",children:[Ze("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),pt("span",{className:"sekyro-segmented__face",children:[Ze("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(Mn,"FacingPicker");import{useEffect as wr,useState as Mr}from"react";import{jsx as Te,jsxs as Ir}from"react/jsx-runtime";function In({state:e}){let t=U(),[s,o]=Mr(!1);wr(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?Te(sn,{}):e==="denied"?Te(cn,{}):Te(an,{});return Ir("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Te("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),Te("span",{children:t(`capture.permission.${e}`)})]})}n(In,"PermissionRow");import{jsx as We,jsxs as xn}from"react/jsx-runtime";function Nn({voice:e}){let t=U();if(!e.supported)return null;let s=e.enabled;return xn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[xn("span",{className:"sekyro-switch__label",children:[We(ve,{off:!s}),t("capture.voiceGuidance")]}),We("span",{className:"sekyro-switch__track","aria-hidden":"true",children:We("span",{className:"sekyro-switch__thumb",children:s?We(ln,{className:"sekyro-switch__check"}):null})})]})}n(Nn,"VoiceSwitch");import{Fragment as Nr,jsx as B,jsxs as Ve}from"react/jsx-runtime";function Pn({assets:e,onRetryAssets:t,permission:s,captureMode:o="self",canChooseFacing:r,facing:a,onFacingChange:l,voice:p,tips:C,summary:b,startLabel:w,startDisabled:M,onStart:k}){let c=U(),g=Se(b?.stop);g.current=b?.stop,_n(()=>()=>g.current?.(),[]);let v=Se(null),u=Se(null),L=Se(null),m=Se(e),S=Se(!1);_n(()=>{let i=m.current;if(m.current=e,i===e)return;let E=S.current;e!=="loading"&&(S.current=!1),xr(v.current)&&(e==="failed"?L.current?.focus():E&&u.current?.focus())},[e]);let N=En(()=>{S.current=!0,t()},[t]),O=e==="loading",d=O||M,G=En(()=>{d||(g.current?.(),k())},[d,k]),F;e==="failed"?F=Ve(j,{tone:"danger",testId:"sekyro-assets-error",children:[B("p",{className:"sekyro-text-body",children:c("fcv2.err.models")}),B(D,{kind:"ghost",ref:L,className:"sekyro-btn--start",onClick:N,"data-testid":"sekyro-assets-retry",children:c("common.retry")})]}):F=Ve("div",{className:"sekyro-stack sekyro-stack--1",children:[B(D,{ref:u,full:!0,"data-testid":"sekyro-start","aria-disabled":d?"true":void 0,"aria-busy":O?"true":void 0,onClick:G,children:O?Ve(Nr,{children:[B(un,{}),c("capture.preparing.title")]}):w??c("capture.start")}),O?B("p",{className:"sekyro-text-muted",children:c("capture.preparing.hint")}):null]});let q=o==="assisted";return Ve("div",{ref:v,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[q?Ve("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[B("h2",{className:"sekyro-text-body",children:c("capture.assisted.title")}),B("p",{className:"sekyro-text-muted",children:c("capture.assisted.lead")})]}):null,C!==!1?B(pn,{tips:C}):null,b!==void 0?Ve(D,{kind:"ghost",className:"sekyro-btn--start",onClick:b.toggle,"data-testid":"sekyro-tips-listen",children:[B(ve,{off:!1}),c(b.playing?"capture.tips.stop":"capture.tips.listen")]}):null,B(In,{state:s}),q&&r?B(Mn,{value:a,onChange:l}):null,B(Nn,{voice:p}),B("p",{className:"sekyro-text-muted",children:c("capture.securityNote")}),F,B("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?c("capture.preparing.title"):e==="ready"?c("capture.ready"):""})]})}n(Pn,"PreCaptureScreen");function xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(xr,"focusIsOurs");import{useEffect as ft,useState as mt}from"react";function An(e){return Kn(e,"mobileRequired")}n(An,"useMobileRequired");function Tn(e){return Kn(e,"returning").required}n(Tn,"useReturning");function Kn(e,t){let[s,o]=mt({required:!1,settled:e===void 0});return ft(()=>{let r=e?.[t];if(e===void 0||typeof r!="function"){o({required:!1,settled:!0});return}let a=!0;return o({required:!1,settled:!1}),Promise.resolve().then(()=>r.call(e)).then(l=>{a&&o({required:l===!0,settled:!0})},()=>{a&&o({required:!1,settled:!0})}),()=>{a=!1}},[e,t]),s}n(Kn,"useFlag");function On(e){let[t,s]=mt({mode:"self",settled:e===void 0});return ft(()=>{let o=e?.captureMode;if(e===void 0||typeof o!="function"){s({mode:"self",settled:!0});return}let r=!0;return s({mode:"self",settled:!1}),Promise.resolve().then(()=>o.call(e)).then(a=>{r&&s({mode:a==="assisted"?"assisted":"self",settled:!0})},()=>{r&&s({mode:"self",settled:!0})}),()=>{r=!1}},[e]),t}n(On,"useCaptureMode");function Fn(e){let[t,s]=mt(!1);return ft(()=>{if(s(!1),e===void 0)return;let o=e.on("busy",()=>s(!0)),r=e.on("result",()=>s(!1));return()=>{o(),r()}},[e]),t}n(Fn,"useBusy");import{getLivenessAssetsStatus as Er,preloadLivenessAssets as _r,subscribeLivenessAssets as Pr}from"@sekyro/web";import{useCallback as yt,useEffect as Hn,useRef as Un,useState as Ar,useSyncExternalStore as Tr}from"react";var Kr=n(()=>"idle","serverSnapshot");function Bn(e){return _r(e!==void 0?{assetBaseUrl:e}:{})}n(Bn,"preload");function Gn(e,t=!0){let s=Tr(yt(M=>Pr(M,e),[e]),()=>Er(e),Kr),[o,r]=Ar(null),a=Un(!1),l=yt(()=>{Bn(e).then(M=>{a.current&&M==="idle"&&r({base:e})})},[e]);Hn(()=>(a.current=!0,l(),()=>{a.current=!1}),[l]);let p=Un(null);Hn(()=>{if(s!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,l())},[s,e,l,t]);let C=yt(()=>{Bn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:C}}n(Gn,"useLivenessAssets");import{createLivenessCapture as Or}from"@sekyro/web";import{useCallback as gt,useEffect as Fr,useRef as Re,useState as z}from"react";var Dn={progress:0,hint:null,faceDetected:!1};function qn(e){let{videoRef:t,assetBaseUrl:s}=e,r=Re(e.verification).current,a=Re(!1);e.verification!==r&&!a.current&&Ye()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=Re(null),[p,C]=z("idle"),[b,w]=z(Dn),[M,k]=z(!1),[c,g]=z(!1),[v,u]=z(null),[L,m]=z(!1),[S,N]=z(null),[O,d]=z(null),[G,F]=z(null),[q,i]=z(null),[E,I]=z(null),_=Re(null),A=Re("idle"),Y=Re(e);Y.current=e,Fr(()=>{let T=t.current;if(T===null)return;let f={video:T,...s!==void 0?{assetBaseUrl:s}:{}},K=r!==void 0?r.liveness(f):Or(f);l.current=K;let oe=n(()=>I(K.facingMode??null),"readFacing");oe();let x=[K.on("state",h=>{h==="starting"?(d(null),F(null),w(Dn),g(!1),k(!1),u(null),N(null),_.current=null):h==="gating"&&A.current==="recording"&&(g(!1),k(!1),u(null),_.current=null),A.current=h,oe(),C(h),Y.current.onStateChange?.(h)}),K.on("gate",h=>{let ye=_.current;_.current=h.progress,k(ye!==null&&h.progress<ye-.001&&h.progress>0&&h.progress<1),h.progress>=1&&g(!0),w(h)}),K.on("frozen",({previewDataUrl:h})=>u(h)),K.on("profile",({animations:h})=>m(h==="reduced")),K.on("ramp",({colour:h})=>N(h)),K.on("captured",h=>{d(h),i(null),Y.current.onCaptured?.(h)}),K.on("error",h=>{F(h),Y.current.onError?.(h)}),r?.on("result",h=>{i(h),Y.current.onResult?.(h)})];return()=>{for(let h of x)h?.();l.current=null,K.destroy()}},[r,t,s]);let ue=gt(T=>{l.current?.start(T)},[]),P=gt(()=>{l.current?.retry()},[]),Z=gt(()=>{let T=l.current,f=T?.switchCamera()===!0;return f&&(I(T?.facingMode??null),g(!1),k(!1),u(null),_.current=null),f},[]);return{state:p,gate:b,draining:M,gateLocked:c,frozenPreview:v,reduceMotion:L,rampColour:S,artifacts:O,error:G,result:q,facingMode:E,start:ue,retry:P,switchCamera:Z}}n(qn,"useLivenessHandle");import{useCallback as Hr,useEffect as Ur,useState as Qe}from"react";var Br=new Set(["national_number"]);function jn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Br.has(s));return t.length>0?{...e,options:t}:null}n(jn,"pending");function $n(e){let[t,s]=Qe(null),[o,r]=Qe(e===void 0),[a,l]=Qe(!1),[p,C]=Qe(!1);Ur(()=>{if(s(null),e===void 0){r(!0);return}let k=!0,c=e.methodChoice;typeof c=="function"?(r(!1),Promise.resolve().then(()=>c.call(e)).then(v=>{k&&s(jn(v))},()=>{}).finally(()=>{k&&r(!0)})):r(!0);let g=e.on("method",v=>s(jn(v)));return()=>{k=!1,g()}},[e]);let b=Hr(async k=>{if(e===void 0)return!1;l(!0),C(!1);try{return await e.selectMethod(k),s(null),!0}catch{return C(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!p?w:null,settled:o,busy:a,failed:p,select:b}}n($n,"useMethodChoice");import{useEffect as Gr,useMemo as Dr,useState as qr}from"react";var jr=["ar","fr","en"];function $r(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($r,"isClipUrl");function zr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of jr){let r=t[o];if(!(typeof r!="object"||r===null))for(let[a,l]of Object.entries(r))!pe(a)||!$r(l)||((s[o]??(s[o]={}))[a]=l)}return Object.keys(s).length>0?s:null}n(zr,"toVoiceClipMap");function zn(e){let[t,s]=qr(null);Gr(()=>{if(s(null),e===void 0)return;let r=!0,a=n(p=>{if(!r)return;let C=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;s(b=>b?.setId===C?.setId?b:C)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(a,()=>a(null))}catch{a(null)}let l=e.on("view",p=>a(p.voice));return()=>{r=!1,l()}},[e]);let o=Dr(()=>t!==null?zr(t):null,[t]);return e===void 0?null:o}n(zn,"useServerVoiceClips");import{jsx as Yn}from"react/jsx-runtime";function Zn({voice:e}){let t=U();return Yn(D,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:Yn(ve,{off:!e.enabled,className:"sekyro-icon"})})}n(Zn,"VoiceChip");import{Fragment as Qn,jsx as R,jsxs as we}from"react/jsx-runtime";var Wr=800;function Qr(e){return e===void 0||e!==!1&&e.length===je.length&&je.every(t=>e.includes(t))}n(Qr,"isDefaultTips");function Jr(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(Jr,"carriesActivation");function Xr(e){return typeof e=="object"&&e!==null&&!Yr(e)&&"tone"in e&&"text"in e}n(Xr,"isNoticeObject");function eo(e){return e==="starting"||e==="gating"||e==="recording"}n(eo,"isCapturing");function to(e){return e==="captured"||e==="uploading"||e==="checking"}n(to,"isPostCapture");function mi({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:a=!1,notice:l,startDisabled:p=!1,startLabel:C,tips:b,tipsSummary:w,coach:M,voice:k,onGuidance:c,onCaptured:g,onResult:v,onError:u,onStateChange:L,assetBaseUrl:m,className:S}){let N=Wt(t),O=Le(()=>Zt(t,o),[t,o,N]),d=Le(()=>y=>O[y]??"",[O]),G=s??(t==="ar"?"rtl":"ltr"),F=me(null),q=Zr(wn),i=qn({verification:e,videoRef:F,assetBaseUrl:m,onCaptured:g,onResult:v,onError:u,onStateChange:L}),E=Gn(m,i.state==="idle"&&i.error===null),I=$n(e),_=I.choice!==null,A=An(e),Y=Tn(e),ue=Fn(e),P=Xt(),Z=On(e),T=Z.mode==="assisted",f=T&&P.canChooseFacing,K=k!==!1&&k?.clips===void 0,oe=zn(K?e:void 0),x=lt({locale:t,defaultClips:oe,options:k}),[h,ye]=Wn(null),W=T?h??(P.canChooseFacing?"environment":"user"):"user",ht=Z.settled&&(!T||P.facingSettled),vt=me(null),Ke=me(!1),kt=me(x.unlock);kt.current=x.unlock,le(()=>{let y=vt.current;if(y===null)return;let J=["pointerup","touchend","click","keydown"],ae=n(()=>{for(let Ee of J)y.removeEventListener(Ee,he,!0)},"disarm");function he(Ee){if(Ke.current){ae();return}Jr(Ee)&&(Ke.current=!0,ae(),kt.current())}n(he,"onGesture");for(let Ee of J)y.addEventListener(Ee,he,{capture:!0,passive:!0});return ae},[]);let Ct=Je(()=>{Ke.current||(Ke.current=!0,x.unlock()),i.start({facing:W})},[x.unlock,i.start,W]),bt=Je(()=>i.start({facing:W}),[i.start,W]),Oe=me(!1),Me=i.state==="idle"&&i.error===null,St=!_&&!A.required&&(a===!0||a==="when-permitted"&&P.permission==="granted"),Vt=St&&I.settled&&A.settled&&ht,Jn=a==="when-permitted"&&!P.permissionSettled&&!Oe.current,Rt=St&&Me&&!Oe.current,Xe=(Jn||Rt||!ht)&&E.gate==="ready"?"loading":E.gate;le(()=>{!Vt||!Me||E.gate!=="ready"||Oe.current||(Oe.current=!0,bt())},[Vt,Me,E.gate,bt]);let Xn=Me&&!_&&!A.required&&!(Rt&&E.gate==="ready"),Lt=Je(()=>{i.switchCamera()&&ye(W==="user"?"environment":"user")},[i.switchCamera,W]),wt=i.state!=="idle"&&i.facingMode!==null?i.facingMode:W;le(()=>{let y=F.current?.style;wt==="user"?y?.removeProperty("transform"):y&&(y.transform="none")},[wt]);let Fe=Le(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);le(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Mt=i.frozenPreview??Fe,ge=e!==void 0,H=eo(i.state),ie=to(i.state),He=H||ie,$=i.result,It=i.state==="done"&&$!==null,xt=i.state==="recording"&&i.frozenPreview!==null,et=q!==null,Ie=ie||xt,Nt=ie?"checking":xt?"frozen":i.state==="recording"?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ue=H?i.gate.hint:null,Be=i.state==="starting"?"capture.preparing.title":Ue===null?null:Ue==="center"&&!i.gate.faceDetected?"fcv3.no_face":Dt(Ue),[er,Et]=Wn(null);le(()=>{if(Be!=="fcv3.no_face"){Et(Be);return}if(!H)return;let y=setTimeout(()=>Et(Be),Wr);return()=>clearTimeout(y)},[Be,H]);let tt=H&&typeof M=="string"&&M!=="",_t=T&&H?d("capture.assisted.stage"):null,de=H&&!tt?er:null,nt=tt?M:de===null?"":d(de);ut(x,de,nt,H);let Pt=me(c);Pt.current=c,le(()=>{if(pe(de))try{Pt.current?.(de)}catch(y){console.error("[@sekyro/react] onGuidance threw:",y)}},[de]);let xe=Le(()=>({supported:x.supported,enabled:x.enabled,setEnabled:x.setEnabled,toggle:x.toggle}),[x.supported,x.enabled,x.setEnabled,x.toggle]),rt=r?.voicePrompt,At=rt!==void 0,Tt=k===void 0,Kt=me(!1);le(()=>{!At||!Tt||Kt.current||!Ye()||(Kt.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."))},[At,Tt]);let tr=rt!==void 0?(y,J,ae)=>rt(y,J,ae,xe):x.supported?()=>R(Zn,{voice:xe}):void 0,{summary:ot,summaryPlaying:Ot,toggleSummary:Ft,stopSummary:Ht}=x,Ge=w!==void 0&&w!=="",Ut=Ge?w:d("capture.tips.summary"),Bt=Ge?ot!=="none":ot==="partner"||ot==="default"&&Qr(b),nr=Le(()=>Bt?{playing:Ot,toggle:n(()=>Ft(Ut,{clip:!Ge}),"toggle"),stop:Ht}:void 0,[Bt,Ot,Ft,Ut,Ht,Ge]),rr=Le(()=>({assets:Xe,retryAssets:E.retry,permission:P.permission,permissionSettled:P.permissionSettled,captureMode:Z.mode,facing:W,setFacing:ye,canChooseFacing:f,voice:xe}),[Xe,E.retry,P.permission,P.permissionSettled,Z.mode,f,W,xe]),or=Xr(l)?R(j,{tone:l.tone,testId:"sekyro-host-notice",children:R("span",{children:l.text})}):l??null,se=$!==null&&$.status==="retry"?$:null,Q=It&&$.status==="unavailable"&&!_&&$.reason!=="portrait_required"?$:null,Ne=It&&($.status==="approved"||$.status==="rejected"||$.status==="review")?$:null,De=n((y,J)=>{if(y===void 0)return null;if(y==="device_cooldown"){let he=zt(t,J);if(he!==null)return d(he.key).replace("{time}",he.time)}let ae=$t(y);return ae===null?null:d(ae)},"reasonText"),st=n(y=>{let J=y.retakeHint===void 0?null:qt(y.retakeHint);return J===null?De(y.reason):d(J)},"retryText"),sr=Q!==null&&Q.reason!==void 0&&Q.reason!=="nni_unbound"&&Q.reason!=="id_number_unbound"&&Q.reason!=="method_required"&&Q.reason!=="mobile_required"&&!(Q.reason==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Gt=qe(),ir=_&&I.auto===null&&!H&&!ie&&i.error===null,it=Je(async y=>{await I.select(y)&&i.state==="done"&&i.retry()},[I.select,i.state,i.retry]);return le(()=>{I.auto!==null&&!I.busy&&!H&&!ie&&it(I.auto)},[I.auto,I.busy,H,ie,it]),R(Qt,{value:d,children:we("div",{ref:vt,className:S===void 0?"sekyro-capture":`sekyro-capture ${S}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[r?.header,se!==null&&st(se)!==null&&!(et&&He)?R(j,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:st(se)})}):null,ue&&ie&&!et?R(j,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:d("capture.busy")})}):null,A.required&&Me?R(j,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:d("reasons.mobile_required")})}):null,i.error!==null?r?.errorPanel!==void 0?r.errorPanel(i.error,i.retry):we(j,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:d(jt(i.error.kind))}),i.error.retryable?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("common.retry")}):null]}):null,Q!==null?we(j,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:De(Q.reason)??d(Q.reason===void 0?"errors.session_expired":"errors.network_error")}),sr?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("capture.recordAgain")}):null]}):null,Ne!==null&&De(Ne.reason)!==null?R(j,{tone:Ne.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:De(Ne.reason,Ne.retryAfter)})}):null,R("div",{className:He?void 0:"sekyro-hidden","data-capture-live":He?"":void 0,children:et?q({videoRef:F,guidance:Ie&&ge?d("capture.checking"):nt,coached:tt&&!(Ie&&ge),note:Ie?ge?d(ue?"capture.busy":"capture.checkingHint"):null:se!==null?st(se):_t,settled:Ie&&ge,progress:i.gate.progress,phase:Nt,still:Ie?Mt:null,live:He,switchCamera:H&&i.state!=="recording"&&f&&Lt,ramp:i.rampColour===null?null:{colour:i.rampColour}}):R(Jt,{videoRef:F,guidanceText:nt,guidanceHint:Ue,guidanceKey:de,progress:i.gate.progress,phase:Nt,draining:i.draining,stillUrl:Mt,showChecking:ge,onSwitchCamera:Lt,canSwitchCamera:T&&H&&i.state!=="recording",operatorText:_t,voicePrompt:tr,overlay:y=>we(Qn,{children:[r?.stageOverlay?.(y),R(en,{colour:i.rampColour})]}),reduceMotion:i.reduceMotion})}),ir&&I.choice!==null?R(mn,{title:d("method.title"),description:d("method.description"),options:I.choice.options.map(y=>({id:y,label:d(`method.${y}`)})),busy:I.busy,error:I.failed?d("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:y=>{it(y)}}):null,Xn?we(Qn,{children:[Y&&r?.header===void 0?we("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:d("returning.title")}),R("p",{className:"sekyro-text-muted",children:d("returning.description")})]}):null,or,r?.intro!==void 0?r.intro(Ct,rr):R(Pn,{assets:Xe,onRetryAssets:E.retry,permission:P.permission,captureMode:Z.mode,canChooseFacing:f,facing:W,onFacingChange:ye,voice:xe,tips:b??je,summary:nr,startLabel:C,startDisabled:p,onStart:Ct})]}):null,R(Ln,{showCoaching:se!==null,attemptsText:se?.attemptsRemaining!==void 0?Yt(O,t,se.attemptsRemaining):null,showRetake:se!==null&&!H&&!ie||!ge&&i.state==="captured",onRetake:i.retry}),r?.footer]})})}n(mi,"LivenessCapture");export{wn as a,Mn as b,je as c,mn as d,ze as e,Wr as f,mi as g};
2
+ import{a as Jt,c as Xt,d as en}from"./chunk-LNZR3RXG.js";import{a as D,j as Dt,k as qt,l as jt,m as $t,n as zt,o as Yt,p as Zt,q as Wt,r as Qt,s as U,t as j,u as qe}from"./chunk-34326C2I.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as cr}from"react";import{Fragment as ar,jsx as V,jsxs as X}from"react/jsx-runtime";function ee({className:e,children:t}){return V("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(ee,"Svg");var at="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 tn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"4"}),V("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(tn,"SunIcon");function nn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"9"}),V("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(nn,"FaceUncoveredIcon");function rn(e){return X(ee,{...e,children:[V("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),V("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),V("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(rn,"PhoneEyeLevelIcon");function on(e){return X(ee,{...e,children:[V("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"}),V("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(on,"LookStraightIcon");function sn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M9 13l2 2 4-4"})]})}n(sn,"CameraCheckIcon");function an(e){return X(ee,{...e,children:[V("path",{d:at}),V("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(an,"CameraAskIcon");function cn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M3 3l18 18"})]})}n(cn,"CameraBlockedIcon");function ve({off:e,className:t}){return X(ee,{className:t,children:[V("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?V("path",{d:"M4 4l16 16"}):X(ar,{children:[V("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),V("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(ve,"SpeakerIcon");function ln(e){return V(ee,{...e,children:V("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(ln,"CheckIcon");function un(e){return X(ee,{className:e.className??"sekyro-spinner",children:[V("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),V("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(un,"SpinnerIcon");import{jsx as ce,jsxs as dn}from"react/jsx-runtime";var je=["light","uncover","eyeLevel","straight"],lr={light:{key:"capture.tips.light",icon:n(()=>ce(tn,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>ce(nn,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>ce(rn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>ce(on,{}),"icon")}};function pn({tips:e}){let t=U(),s=cr();return e.length===0?null:dn("section",{className:"sekyro-tips","aria-labelledby":s,"data-testid":"sekyro-tips",children:[ce("p",{className:"sekyro-tips__title",id:s,children:t("capture.tips.title")}),ce("ul",{className:"sekyro-tips__list",children:e.map(o=>{let r=typeof o=="string"?lr[o]:void 0,a=typeof o=="string"?o:o.id,l=r!==void 0?r.icon():typeof o=="string"?void 0:o.icon,p=r!==void 0?t(r.key):typeof o=="string"?o:o.text;return dn("li",{className:"sekyro-tips__item",children:[l!=null?ce("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,ce("span",{children:p})]},a)})})]})}n(pn,"TipList");import{useEffect as fn,useId as ur,useRef as dr,useState as pr}from"react";import{jsx as te,jsxs as $e}from"react/jsx-runtime";var fr=220;function mn({title:e,description:t,options:s,busy:o,error:r,focus:a,testId:l,look:p="cards",marked:C,onChoose:b}){let w=ur(),M=qe(),[k,c]=pr(null),g=dr(null);fn(()=>{r!==null&&c(null)},[r]),fn(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);let v=n(u=>{o||k!==null||(c(u),g.current=setTimeout(()=>{g.current=null,c(null),b(u)},fr))},"choose");return $e("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[$e("div",{className:"sekyro-stack sekyro-stack--1",children:[te("h2",{id:w,ref:a?M:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?te("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?te(j,{tone:"danger",children:te("span",{children:r})}):null,p==="buttons"?te("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((u,L)=>te(D,{kind:L===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>b(u.id),children:u.label},u.id))}):te("div",{className:"sekyro-choices",children:s.map(u=>$e("button",{type:"button",className:"sekyro-card","aria-pressed":(k??C)===u.id,"aria-busy":o||void 0,disabled:o||k!==null&&k!==u.id,onClick:()=>v(u.id),children:[u.glyph,$e("span",{className:"sekyro-card__body",children:[te("span",{className:"sekyro-card__title",children:u.label}),u.sub!==void 0?te("span",{className:"sekyro-card__sub",children:u.sub}):null]}),te("span",{className:"sekyro-radio","aria-hidden":"true"})]},u.id))})]})}n(mn,"ChoiceScreen");var ze=["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","capture.tips.summary"];function pe(e){return e!==null&&ze.includes(e)}n(pe,"isVoiceKey");import{useCallback as re,useEffect as fe,useLayoutEffect as hr,useMemo as vr,useRef as Ce,useState as Pe}from"react";var mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function ke(e,t,s){let o;try{if(typeof e=="function")o=e(t,s);else{let r=e[s];o=r!=null&&mr(r,t)?r[t]:null}}catch{return null}return typeof o=="string"&&o!==""?o:null}n(ke,"resolveClip");var yr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",hn={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 gr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(gr,"speechAvailable");function yn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(yn,"baseLang");function vn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=yn(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>yn(r.lang)===o)}n(vn,"pickVoice");function kn(e){if(!gr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||vn(t,e)!==void 0}n(kn,"speechUsable");function Cn(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Cn,"subscribeVoices");function _e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",s=new URL(e,t);return`clip:${s.origin}${s.pathname}`}catch{return`clip:${e}`}}n(_e,"clipIdentity");function gn(e){e.pause(),e.removeAttribute("src"),e.load()}n(gn,"release");function bn(){let e=null,t=null,s=0,o=null,r=[],a=new Map,l=n(()=>{r=ne()?.getVoices()??[]},"loadVoices"),p=!1,C=n(()=>{let c=ne();p||c===null||(p=!0,l(),c.addEventListener?.("voiceschanged",l))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),w=n((c,g,v)=>{let u=ne();if(u!==null&&c!==""&&typeof SpeechSynthesisUtterance=="function"){C();let L=vn(r,g);if(r.length===0||L!==void 0){u.cancel();let m=new SpeechSynthesisUtterance(c);m.lang=g,L!==void 0&&(m.voice=L),m.rate=.95,v!==void 0&&(m.onend=m.onerror=v),u.speak(m);return}}v?.()},"speak"),M=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),k=n(c=>{for(let g of c){let v=_e(g);if(a.has(v))continue;let u=new Audio;u.preload="auto",u.src=g,a.set(v,u)}},"warmClips");return{say(c){let g=c.url!==null?_e(c.url):`tts:${c.lang}:${c.text}`;if(g===o)return;o=g,s+=1;let v=s,u=c.onEnd,L=u!==void 0?()=>{v===s&&u()}:void 0;if(ne()?.cancel(),c.url!==null){let m=b();m.pause(),m.muted=!1,m.src=c.url,m.currentTime=0,m.onended=L??null,m.play()?.catch(S=>{v===s&&S?.name!=="AbortError"&&(c.speech?w(c.text,c.lang,L):L?.())});return}c.speech?w(c.text,c.lang,L):L?.()},unlock({lang:c,speech:g,prefetch:v}){let u=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let S=Uint8Array.from(atob(yr),N=>N.charCodeAt(0));t=URL.createObjectURL(new Blob([S],{type:"audio/wav"}))}let L=u.paused===!1&&t!==null&&u.src!==t;t!==null&&!L&&(u.muted=!0,u.onended=null,u.src=t,u.play()?.catch(()=>{}));let m=ne();if(g&&m!==null&&typeof SpeechSynthesisUtterance=="function"){C();let S=new SpeechSynthesisUtterance(" ");S.volume=0,S.lang=c,m.speak(S)}k(v??[])},prefetch:k,stop:M,dispose(){M(),p&&ne()?.removeEventListener?.("voiceschanged",l),p=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&gn(e),e=null;for(let c of a.values())gn(c);a.clear()}}}n(bn,"createVoicePlayer");var Sn="sekyro.voiceGuidance";function Vn(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(Vn,"readVoicePreference");function Rn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(Rn,"writeVoicePreference");var Ae="capture.tips.summary",kr=typeof window<"u"?hr:fe,Cr=Object.freeze({});function ct(e,t){let s=new Set,o=[];for(let r of ze){let a=r===Ae?null:ke(e,r,t);a===null||s.has(_e(a))||(s.add(_e(a)),o.push(a))}return o}n(ct,"resolvedClipUrls");function lt({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},a=r.storageKey===void 0?Sn:r.storageKey,[l,p]=Pe(r.defaultEnabled??!0),C=Ce(l),[b,w]=Pe(!1),[M,k]=Pe("none"),[c,g]=Pe(!1),v=Ce(!1),[u,L]=Pe(0),m=Ce(null),S=re(()=>(m.current??(m.current=bn()),m.current),[]),N=hn[e],O=r.speechFallback,d=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),G=r.clips??t??Cr,F=Ce(!1),q=Ce(G);kr(()=>{q.current=G,C.current=l}),fe(()=>{if(o||a===null)return;let f=Vn(a);f!==null&&(C.current=f,p(f))},[o,a]),fe(()=>{if(!(o||!d))return Cn(()=>L(f=>f+1))},[o,d]);let i=r.clips;fe(()=>{if(o)return;let f=d&&kn(N);w(ct(G,e).length>0||f),k(i!==void 0&&ke(i,Ae,e)!==null?"partner":ke(G,Ae,e)!==null||f?"default":"none")},[o,G,i,e,d,N,u]),fe(()=>{if(o||!l||!F.current)return;let f=ct(G,e);f.length>0&&S().prefetch(f)},[o,l,G,e,S]),fe(()=>()=>{m.current?.dispose(),m.current=null,F.current=!1},[]);let E=re(f=>{o||(F.current=!0,S().unlock({lang:N,speech:d,...f?{prefetch:ct(q.current,e)}:{}}))},[o,S,N,d,e]),I=re(()=>E(C.current),[E]),_=re(()=>{v.current=!1,g(!1)},[]),A=re(()=>{_(),m.current?.stop()},[_]),Y=re(()=>{v.current&&A()},[A]),ue=re((f,K)=>{if(o)return;if(v.current){A();return}let oe=S();oe.stop(),v.current=!0,g(!0);let x=K?.clip===!1?null:ke(q.current,Ae,e);oe.say({url:x,text:f,lang:N,speech:d,onEnd:_})},[o,A,S,e,N,d,_]),P=re(f=>{o||(f?E(!0):A(),a!==null&&Rn(a,f),C.current=f,p(f))},[o,E,A,a]),Z=re(()=>P(!C.current),[P]),T=re((f,K)=>{if(o||!l)return;v.current&&_();let oe=ke(q.current,f,e);S().say({url:oe,text:K,lang:N,speech:d})},[o,l,e,S,N,d,_]);return vr(()=>({supported:!o&&b,enabled:!o&&l,setEnabled:P,toggle:Z,unlock:I,speakKey:T,stop:A,summary:o?"none":M,summaryPlaying:c,toggleSummary:ue,stopSummary:Y}),[o,b,l,P,Z,I,T,A,M,c,ue,Y])}n(lt,"useVoiceGuidance");function ut(e,t,s,o){let{speakKey:r,stop:a,enabled:l}=e,p=Ce(!1);fe(()=>{if(!o||!l){p.current&&a(),p.current=!1;return}p.current=!0,pe(t)&&t!==Ae&&s!==""&&r(t,s)},[o,l,t,s,r,a])}n(ut,"useSpeakGuidance");import{isValidElement as Yr,useCallback as Je,useContext as Zr,useEffect as le,useMemo as Le,useRef as me,useState as Wn}from"react";import{useEffect as br,useRef as Sr}from"react";import{jsx as be,jsxs as dt}from"react/jsx-runtime";function Ln({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=U(),a=Sr(null);return br(()=>{s&&a.current?.focus()},[s]),!e&&!s?null:dt("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?dt("div",{className:"sekyro-stack sekyro-stack--1",children:[be("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),dt("ul",{className:"sekyro-coaching",children:[be("li",{children:r("capture.retryCoaching.light")}),be("li",{children:r("capture.retryCoaching.eyeLevel")}),be("li",{children:r("capture.retryCoaching.head")})]}),t!==null?be("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:t}):null]}):null,s?be(D,{ref:a,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(Ln,"CapturedPanel");function Ye(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(Ye,"isDevBuild");import{createContext as Vr}from"react";var wn=Vr(null);import{useCallback as En,useEffect as _n,useRef as Se}from"react";import{useId as Rr}from"react";import{jsx as Ze,jsxs as pt}from"react/jsx-runtime";var Lr=["user","environment"];function Mn({value:e,onChange:t}){let s=U(),o=Rr();return pt("fieldset",{className:"sekyro-segmented","data-testid":"sekyro-facing",children:[Ze("legend",{className:"sekyro-segmented__legend",children:s("capture.cameraLabel")}),Ze("div",{className:"sekyro-segmented__options",children:Lr.map(r=>pt("label",{className:"sekyro-segmented__option",children:[Ze("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),pt("span",{className:"sekyro-segmented__face",children:[Ze("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(Mn,"FacingPicker");import{useEffect as wr,useState as Mr}from"react";import{jsx as Te,jsxs as Ir}from"react/jsx-runtime";function In({state:e}){let t=U(),[s,o]=Mr(!1);wr(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?Te(sn,{}):e==="denied"?Te(cn,{}):Te(an,{});return Ir("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Te("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),Te("span",{children:t(`capture.permission.${e}`)})]})}n(In,"PermissionRow");import{jsx as We,jsxs as xn}from"react/jsx-runtime";function Nn({voice:e}){let t=U();if(!e.supported)return null;let s=e.enabled;return xn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[xn("span",{className:"sekyro-switch__label",children:[We(ve,{off:!s}),t("capture.voiceGuidance")]}),We("span",{className:"sekyro-switch__track","aria-hidden":"true",children:We("span",{className:"sekyro-switch__thumb",children:s?We(ln,{className:"sekyro-switch__check"}):null})})]})}n(Nn,"VoiceSwitch");import{Fragment as Nr,jsx as B,jsxs as Ve}from"react/jsx-runtime";function Pn({assets:e,onRetryAssets:t,permission:s,captureMode:o="self",canChooseFacing:r,facing:a,onFacingChange:l,voice:p,tips:C,summary:b,startLabel:w,startDisabled:M,onStart:k}){let c=U(),g=Se(b?.stop);g.current=b?.stop,_n(()=>()=>g.current?.(),[]);let v=Se(null),u=Se(null),L=Se(null),m=Se(e),S=Se(!1);_n(()=>{let i=m.current;if(m.current=e,i===e)return;let E=S.current;e!=="loading"&&(S.current=!1),xr(v.current)&&(e==="failed"?L.current?.focus():E&&u.current?.focus())},[e]);let N=En(()=>{S.current=!0,t()},[t]),O=e==="loading",d=O||M,G=En(()=>{d||(g.current?.(),k())},[d,k]),F;e==="failed"?F=Ve(j,{tone:"danger",testId:"sekyro-assets-error",children:[B("p",{className:"sekyro-text-body",children:c("fcv2.err.models")}),B(D,{kind:"ghost",ref:L,className:"sekyro-btn--start",onClick:N,"data-testid":"sekyro-assets-retry",children:c("common.retry")})]}):F=Ve("div",{className:"sekyro-stack sekyro-stack--1",children:[B(D,{ref:u,full:!0,"data-testid":"sekyro-start","aria-disabled":d?"true":void 0,"aria-busy":O?"true":void 0,onClick:G,children:O?Ve(Nr,{children:[B(un,{}),c("capture.preparing.title")]}):w??c("capture.start")}),O?B("p",{className:"sekyro-text-muted",children:c("capture.preparing.hint")}):null]});let q=o==="assisted";return Ve("div",{ref:v,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[q?Ve("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[B("h2",{className:"sekyro-text-body",children:c("capture.assisted.title")}),B("p",{className:"sekyro-text-muted",children:c("capture.assisted.lead")})]}):null,C!==!1?B(pn,{tips:C}):null,b!==void 0?Ve(D,{kind:"ghost",className:"sekyro-btn--start",onClick:b.toggle,"data-testid":"sekyro-tips-listen",children:[B(ve,{off:!1}),c(b.playing?"capture.tips.stop":"capture.tips.listen")]}):null,B(In,{state:s}),q&&r?B(Mn,{value:a,onChange:l}):null,B(Nn,{voice:p}),B("p",{className:"sekyro-text-muted",children:c("capture.securityNote")}),F,B("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?c("capture.preparing.title"):e==="ready"?c("capture.ready"):""})]})}n(Pn,"PreCaptureScreen");function xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(xr,"focusIsOurs");import{useEffect as ft,useState as mt}from"react";function An(e){return Kn(e,"mobileRequired")}n(An,"useMobileRequired");function Tn(e){return Kn(e,"returning").required}n(Tn,"useReturning");function Kn(e,t){let[s,o]=mt({required:!1,settled:e===void 0});return ft(()=>{let r=e?.[t];if(e===void 0||typeof r!="function"){o({required:!1,settled:!0});return}let a=!0;return o({required:!1,settled:!1}),Promise.resolve().then(()=>r.call(e)).then(l=>{a&&o({required:l===!0,settled:!0})},()=>{a&&o({required:!1,settled:!0})}),()=>{a=!1}},[e,t]),s}n(Kn,"useFlag");function On(e){let[t,s]=mt({mode:"self",settled:e===void 0});return ft(()=>{let o=e?.captureMode;if(e===void 0||typeof o!="function"){s({mode:"self",settled:!0});return}let r=!0;return s({mode:"self",settled:!1}),Promise.resolve().then(()=>o.call(e)).then(a=>{r&&s({mode:a==="assisted"?"assisted":"self",settled:!0})},()=>{r&&s({mode:"self",settled:!0})}),()=>{r=!1}},[e]),t}n(On,"useCaptureMode");function Fn(e){let[t,s]=mt(!1);return ft(()=>{if(s(!1),e===void 0)return;let o=e.on("busy",()=>s(!0)),r=e.on("result",()=>s(!1));return()=>{o(),r()}},[e]),t}n(Fn,"useBusy");import{getLivenessAssetsStatus as Er,preloadLivenessAssets as _r,subscribeLivenessAssets as Pr}from"@sekyro/web";import{useCallback as yt,useEffect as Hn,useRef as Un,useState as Ar,useSyncExternalStore as Tr}from"react";var Kr=n(()=>"idle","serverSnapshot");function Bn(e){return _r(e!==void 0?{assetBaseUrl:e}:{})}n(Bn,"preload");function Gn(e,t=!0){let s=Tr(yt(M=>Pr(M,e),[e]),()=>Er(e),Kr),[o,r]=Ar(null),a=Un(!1),l=yt(()=>{Bn(e).then(M=>{a.current&&M==="idle"&&r({base:e})})},[e]);Hn(()=>(a.current=!0,l(),()=>{a.current=!1}),[l]);let p=Un(null);Hn(()=>{if(s!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,l())},[s,e,l,t]);let C=yt(()=>{Bn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:C}}n(Gn,"useLivenessAssets");import{createLivenessCapture as Or}from"@sekyro/web";import{useCallback as gt,useEffect as Fr,useRef as Re,useState as z}from"react";var Dn={progress:0,hint:null,faceDetected:!1};function qn(e){let{videoRef:t,assetBaseUrl:s}=e,r=Re(e.verification).current,a=Re(!1);e.verification!==r&&!a.current&&Ye()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=Re(null),[p,C]=z("idle"),[b,w]=z(Dn),[M,k]=z(!1),[c,g]=z(!1),[v,u]=z(null),[L,m]=z(!1),[S,N]=z(null),[O,d]=z(null),[G,F]=z(null),[q,i]=z(null),[E,I]=z(null),_=Re(null),A=Re("idle"),Y=Re(e);Y.current=e,Fr(()=>{let T=t.current;if(T===null)return;let f={video:T,...s!==void 0?{assetBaseUrl:s}:{}},K=r!==void 0?r.liveness(f):Or(f);l.current=K;let oe=n(()=>I(K.facingMode??null),"readFacing");oe();let x=[K.on("state",h=>{h==="starting"?(d(null),F(null),w(Dn),g(!1),k(!1),u(null),N(null),_.current=null):h==="gating"&&A.current==="recording"&&(g(!1),k(!1),u(null),_.current=null),A.current=h,oe(),C(h),Y.current.onStateChange?.(h)}),K.on("gate",h=>{let ye=_.current;_.current=h.progress,k(ye!==null&&h.progress<ye-.001&&h.progress>0&&h.progress<1),h.progress>=1&&g(!0),w(h)}),K.on("frozen",({previewDataUrl:h})=>u(h)),K.on("profile",({animations:h})=>m(h==="reduced")),K.on("ramp",({colour:h})=>N(h)),K.on("captured",h=>{d(h),i(null),Y.current.onCaptured?.(h)}),K.on("error",h=>{F(h),Y.current.onError?.(h)}),r?.on("result",h=>{i(h),Y.current.onResult?.(h)})];return()=>{for(let h of x)h?.();l.current=null,K.destroy()}},[r,t,s]);let ue=gt(T=>{l.current?.start(T)},[]),P=gt(()=>{l.current?.retry()},[]),Z=gt(()=>{let T=l.current,f=T?.switchCamera()===!0;return f&&(I(T?.facingMode??null),g(!1),k(!1),u(null),_.current=null),f},[]);return{state:p,gate:b,draining:M,gateLocked:c,frozenPreview:v,reduceMotion:L,rampColour:S,artifacts:O,error:G,result:q,facingMode:E,start:ue,retry:P,switchCamera:Z}}n(qn,"useLivenessHandle");import{useCallback as Hr,useEffect as Ur,useState as Qe}from"react";var Br=new Set(["national_number"]);function jn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Br.has(s));return t.length>0?{...e,options:t}:null}n(jn,"pending");function $n(e){let[t,s]=Qe(null),[o,r]=Qe(e===void 0),[a,l]=Qe(!1),[p,C]=Qe(!1);Ur(()=>{if(s(null),e===void 0){r(!0);return}let k=!0,c=e.methodChoice;typeof c=="function"?(r(!1),Promise.resolve().then(()=>c.call(e)).then(v=>{k&&s(jn(v))},()=>{}).finally(()=>{k&&r(!0)})):r(!0);let g=e.on("method",v=>s(jn(v)));return()=>{k=!1,g()}},[e]);let b=Hr(async k=>{if(e===void 0)return!1;l(!0),C(!1);try{return await e.selectMethod(k),s(null),!0}catch{return C(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!p?w:null,settled:o,busy:a,failed:p,select:b}}n($n,"useMethodChoice");import{useEffect as Gr,useMemo as Dr,useState as qr}from"react";var jr=["ar","fr","en"];function $r(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($r,"isClipUrl");function zr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of jr){let r=t[o];if(!(typeof r!="object"||r===null))for(let[a,l]of Object.entries(r))!pe(a)||!$r(l)||((s[o]??(s[o]={}))[a]=l)}return Object.keys(s).length>0?s:null}n(zr,"toVoiceClipMap");function zn(e){let[t,s]=qr(null);Gr(()=>{if(s(null),e===void 0)return;let r=!0,a=n(p=>{if(!r)return;let C=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;s(b=>b?.setId===C?.setId?b:C)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(a,()=>a(null))}catch{a(null)}let l=e.on("view",p=>a(p.voice));return()=>{r=!1,l()}},[e]);let o=Dr(()=>t!==null?zr(t):null,[t]);return e===void 0?null:o}n(zn,"useServerVoiceClips");import{jsx as Yn}from"react/jsx-runtime";function Zn({voice:e}){let t=U();return Yn(D,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:Yn(ve,{off:!e.enabled,className:"sekyro-icon"})})}n(Zn,"VoiceChip");import{Fragment as Qn,jsx as R,jsxs as we}from"react/jsx-runtime";var Wr=800;function Qr(e){return e===void 0||e!==!1&&e.length===je.length&&je.every(t=>e.includes(t))}n(Qr,"isDefaultTips");function Jr(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(Jr,"carriesActivation");function Xr(e){return typeof e=="object"&&e!==null&&!Yr(e)&&"tone"in e&&"text"in e}n(Xr,"isNoticeObject");function eo(e){return e==="starting"||e==="gating"||e==="recording"}n(eo,"isCapturing");function to(e){return e==="captured"||e==="uploading"||e==="checking"}n(to,"isPostCapture");function mi({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:a=!1,notice:l,startDisabled:p=!1,startLabel:C,tips:b,tipsSummary:w,coach:M,voice:k,onGuidance:c,onCaptured:g,onResult:v,onError:u,onStateChange:L,assetBaseUrl:m,className:S}){let N=Wt(t),O=Le(()=>Zt(t,o),[t,o,N]),d=Le(()=>y=>O[y]??"",[O]),G=s??(t==="ar"?"rtl":"ltr"),F=me(null),q=Zr(wn),i=qn({verification:e,videoRef:F,assetBaseUrl:m,onCaptured:g,onResult:v,onError:u,onStateChange:L}),E=Gn(m,i.state==="idle"&&i.error===null),I=$n(e),_=I.choice!==null,A=An(e),Y=Tn(e),ue=Fn(e),P=Xt(),Z=On(e),T=Z.mode==="assisted",f=T&&P.canChooseFacing,K=k!==!1&&k?.clips===void 0,oe=zn(K?e:void 0),x=lt({locale:t,defaultClips:oe,options:k}),[h,ye]=Wn(null),W=T?h??(P.canChooseFacing?"environment":"user"):"user",ht=Z.settled&&(!T||P.facingSettled),vt=me(null),Ke=me(!1),kt=me(x.unlock);kt.current=x.unlock,le(()=>{let y=vt.current;if(y===null)return;let J=["pointerup","touchend","click","keydown"],ae=n(()=>{for(let Ee of J)y.removeEventListener(Ee,he,!0)},"disarm");function he(Ee){if(Ke.current){ae();return}Jr(Ee)&&(Ke.current=!0,ae(),kt.current())}n(he,"onGesture");for(let Ee of J)y.addEventListener(Ee,he,{capture:!0,passive:!0});return ae},[]);let Ct=Je(()=>{Ke.current||(Ke.current=!0,x.unlock()),i.start({facing:W})},[x.unlock,i.start,W]),bt=Je(()=>i.start({facing:W}),[i.start,W]),Oe=me(!1),Me=i.state==="idle"&&i.error===null,St=!_&&!A.required&&(a===!0||a==="when-permitted"&&P.permission==="granted"),Vt=St&&I.settled&&A.settled&&ht,Jn=a==="when-permitted"&&!P.permissionSettled&&!Oe.current,Rt=St&&Me&&!Oe.current,Xe=(Jn||Rt||!ht)&&E.gate==="ready"?"loading":E.gate;le(()=>{!Vt||!Me||E.gate!=="ready"||Oe.current||(Oe.current=!0,bt())},[Vt,Me,E.gate,bt]);let Xn=Me&&!_&&!A.required&&!(Rt&&E.gate==="ready"),Lt=Je(()=>{i.switchCamera()&&ye(W==="user"?"environment":"user")},[i.switchCamera,W]),wt=i.state!=="idle"&&i.facingMode!==null?i.facingMode:W;le(()=>{let y=F.current?.style;wt==="user"?y?.removeProperty("transform"):y&&(y.transform="none")},[wt]);let Fe=Le(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);le(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Mt=i.frozenPreview??Fe,ge=e!==void 0,H=eo(i.state),ie=to(i.state),He=H||ie,$=i.result,It=i.state==="done"&&$!==null,xt=i.state==="recording"&&i.frozenPreview!==null,et=q!==null,Ie=ie||xt,Nt=ie?"checking":xt?"frozen":i.state==="recording"?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ue=H?i.gate.hint:null,Be=i.state==="starting"?"capture.preparing.title":Ue===null?null:Ue==="center"&&!i.gate.faceDetected?"fcv3.no_face":Dt(Ue),[er,Et]=Wn(null);le(()=>{if(Be!=="fcv3.no_face"){Et(Be);return}if(!H)return;let y=setTimeout(()=>Et(Be),Wr);return()=>clearTimeout(y)},[Be,H]);let tt=H&&typeof M=="string"&&M!=="",_t=T&&H?d("capture.assisted.stage"):null,de=H&&!tt?er:null,nt=tt?M:de===null?"":d(de);ut(x,de,nt,H);let Pt=me(c);Pt.current=c,le(()=>{if(pe(de))try{Pt.current?.(de)}catch(y){console.error("[@sekyro/react] onGuidance threw:",y)}},[de]);let xe=Le(()=>({supported:x.supported,enabled:x.enabled,setEnabled:x.setEnabled,toggle:x.toggle}),[x.supported,x.enabled,x.setEnabled,x.toggle]),rt=r?.voicePrompt,At=rt!==void 0,Tt=k===void 0,Kt=me(!1);le(()=>{!At||!Tt||Kt.current||!Ye()||(Kt.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."))},[At,Tt]);let tr=rt!==void 0?(y,J,ae)=>rt(y,J,ae,xe):x.supported?()=>R(Zn,{voice:xe}):void 0,{summary:ot,summaryPlaying:Ot,toggleSummary:Ft,stopSummary:Ht}=x,Ge=w!==void 0&&w!=="",Ut=Ge?w:d("capture.tips.summary"),Bt=Ge?ot!=="none":ot==="partner"||ot==="default"&&Qr(b),nr=Le(()=>Bt?{playing:Ot,toggle:n(()=>Ft(Ut,{clip:!Ge}),"toggle"),stop:Ht}:void 0,[Bt,Ot,Ft,Ut,Ht,Ge]),rr=Le(()=>({assets:Xe,retryAssets:E.retry,permission:P.permission,permissionSettled:P.permissionSettled,captureMode:Z.mode,facing:W,setFacing:ye,canChooseFacing:f,voice:xe}),[Xe,E.retry,P.permission,P.permissionSettled,Z.mode,f,W,xe]),or=Xr(l)?R(j,{tone:l.tone,testId:"sekyro-host-notice",children:R("span",{children:l.text})}):l??null,se=$!==null&&$.status==="retry"?$:null,Q=It&&$.status==="unavailable"&&!_&&$.reason!=="portrait_required"?$:null,Ne=It&&($.status==="approved"||$.status==="rejected"||$.status==="review")?$:null,De=n((y,J)=>{if(y===void 0)return null;if(y==="device_cooldown"){let he=zt(t,J);if(he!==null)return d(he.key).replace("{time}",he.time)}let ae=$t(y);return ae===null?null:d(ae)},"reasonText"),st=n(y=>{let J=y.retakeHint===void 0?null:qt(y.retakeHint);return J===null?De(y.reason):d(J)},"retryText"),sr=Q!==null&&Q.reason!==void 0&&Q.reason!=="nni_unbound"&&Q.reason!=="id_number_unbound"&&Q.reason!=="method_required"&&Q.reason!=="mobile_required"&&!(Q.reason==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Gt=qe(),ir=_&&I.auto===null&&!H&&!ie&&i.error===null,it=Je(async y=>{await I.select(y)&&i.state==="done"&&i.retry()},[I.select,i.state,i.retry]);return le(()=>{I.auto!==null&&!I.busy&&!H&&!ie&&it(I.auto)},[I.auto,I.busy,H,ie,it]),R(Qt,{value:d,children:we("div",{ref:vt,className:S===void 0?"sekyro-capture":`sekyro-capture ${S}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[r?.header,se!==null&&st(se)!==null&&!(et&&He)?R(j,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:st(se)})}):null,ue&&ie&&!et?R(j,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:d("capture.busy")})}):null,A.required&&Me?R(j,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:d("reasons.mobile_required")})}):null,i.error!==null?r?.errorPanel!==void 0?r.errorPanel(i.error,i.retry):we(j,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:d(jt(i.error.kind))}),i.error.retryable?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("common.retry")}):null]}):null,Q!==null?we(j,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:De(Q.reason)??d(Q.reason===void 0?"errors.session_expired":"errors.network_error")}),sr?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("capture.recordAgain")}):null]}):null,Ne!==null&&De(Ne.reason)!==null?R(j,{tone:Ne.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:De(Ne.reason,Ne.retryAfter)})}):null,R("div",{className:He?void 0:"sekyro-hidden","data-capture-live":He?"":void 0,children:et?q({videoRef:F,guidance:Ie&&ge?d("capture.checking"):nt,coached:tt&&!(Ie&&ge),note:Ie?ge?d(ue?"capture.busy":"capture.checkingHint"):null:se!==null?st(se):_t,settled:Ie&&ge,progress:i.gate.progress,phase:Nt,still:Ie?Mt:null,live:He,switchCamera:H&&i.state!=="recording"&&f&&Lt,ramp:i.rampColour===null?null:{colour:i.rampColour}}):R(Jt,{videoRef:F,guidanceText:nt,guidanceHint:Ue,guidanceKey:de,progress:i.gate.progress,phase:Nt,draining:i.draining,stillUrl:Mt,showChecking:ge,onSwitchCamera:Lt,canSwitchCamera:T&&H&&i.state!=="recording",operatorText:_t,voicePrompt:tr,overlay:y=>we(Qn,{children:[r?.stageOverlay?.(y),R(en,{colour:i.rampColour})]}),reduceMotion:i.reduceMotion})}),ir&&I.choice!==null?R(mn,{title:d("method.title"),description:d("method.description"),options:I.choice.options.map(y=>({id:y,label:d(`method.${y}`)})),busy:I.busy,error:I.failed?d("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:y=>{it(y)}}):null,Xn?we(Qn,{children:[Y&&r?.header===void 0?we("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:d("returning.title")}),R("p",{className:"sekyro-text-muted",children:d("returning.description")})]}):null,or,r?.intro!==void 0?r.intro(Ct,rr):R(Pn,{assets:Xe,onRetryAssets:E.retry,permission:P.permission,captureMode:Z.mode,canChooseFacing:f,facing:W,onFacingChange:ye,voice:xe,tips:b??je,summary:nr,startLabel:C,startDisabled:p,onStart:Ct})]}):null,R(Ln,{showCoaching:se!==null,attemptsText:se?.attemptsRemaining!==void 0?Yt(O,t,se.attemptsRemaining):null,showRetake:se!==null&&!H&&!ie||!ge&&i.state==="captured",onRetake:i.retry}),r?.footer]})})}n(mi,"LivenessCapture");export{Ye as a,wn as b,Mn as c,je as d,mn as e,ze as f,Wr as g,mi as h};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{a as A}from"./chunk-PYAJMHZH.js";import{a as ge,b as Se,e as ye,f as ke}from"./chunk-PTPTDOWD.js";import{d as ve}from"./chunk-WAVBS3GL.js";import{a as we,b as Z}from"./chunk-K7YYCJUR.js";import{a as Q,l as he,m as fe}from"./chunk-34326C2I.js";import{a as h}from"./chunk-2KED7D2Q.js";import{useEffect as R,useLayoutEffect as Fe,useRef as j,useState as S}from"react";var be={image:'<path d="M2 12C2 7.29 2 4.93 3.46 3.46C4.93 2 7.29 2 12 2C16.71 2 19.07 2 20.54 3.46C22 4.93 22 7.29 22 12C22 16.71 22 19.07 20.54 20.54C19.07 22 16.71 22 12 22C7.29 22 4.93 22 3.46 20.54C2 19.07 2 16.71 2 12Z" stroke="currentColor"/><path d="M14 8A2 2 0 1 0 18 8A2 2 0 1 0 14 8Z" stroke="currentColor"/><path d="M2 12.5L3.75 10.97C4.66 10.17 6.04 10.22 6.89 11.07L11.18 15.36C11.87 16.05 12.95 16.14 13.75 15.58L14.04 15.37C15.19 14.57 16.74 14.66 17.78 15.6L21 18.5" stroke="currentColor" stroke-linecap="round"/>',flashlight:'<path d="M9 11.66V19C9 19.93 9 20.4 9.15 20.77C9.36 21.26 9.74 21.64 10.23 21.85C10.6 22 11.07 22 12 22C12.93 22 13.4 22 13.77 21.85C14.26 21.64 14.64 21.26 14.85 20.77C15 20.4 15 19.93 15 19V11.66C15 10.84 15 10.43 15.15 10.06C15.3 9.7 15.59 9.41 16.17 8.83L16.17 8.83L19.41 5.59C19.7 5.3 19.85 5.15 19.92 4.97C20 4.78 20 4.58 20 4.17V4C20 3.06 20 2.59 19.71 2.29C19.41 2 18.94 2 18 2H6C5.06 2 4.59 2 4.29 2.29C4 2.59 4 3.06 4 4V4.17C4 4.58 4 4.78 4.08 4.97C4.15 5.15 4.3 5.3 4.59 5.59L7.83 8.83C8.41 9.41 8.7 9.7 8.85 10.06C9 10.43 9 10.84 9 11.66Z" stroke="currentColor" stroke-linecap="round"/><path d="M15 10H9" stroke="currentColor" stroke-linecap="round"/><path d="M12 13V15" stroke="currentColor" stroke-linecap="round"/><path d="M4.5 5H19.5" stroke="currentColor" stroke-linecap="round"/>'};var Ce={"dcv3.mrz.searching":"ضع صفحة جواز السفر كاملة داخل الإطار","dcv3.mrz.showMrzSide":"اعرض الوجه الذي يحتوي على سطرين أو ثلاثة أسطر من الحروف","dcv3.mrz.reading":"جارٍ قراءة الوثيقة… ثبّتها","dcv3.mrz.moveCloser":"اقترب حتى تملأ أسطر الحروف الإطار","dcv3.mrz.turnSideways":"أدر هاتفك أفقيًا لقراءة أسطر الحروف","dcv3.mrz.glare":"أمِل الوثيقة لإزالة الانعكاس","dcv3.mrz.holdStill":"لا تتحرك","dcv3.mrz.valid":"تمت قراءة الوثيقة. جارٍ التقاط الصورة","dcv3.mrz.looksLikePassport":"يبدو أن هذا جواز سفر","dcv3.mrz.looksLikeCard":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"};var E={"dcv3.mrz.searching":"Fit the whole passport page in the frame","dcv3.mrz.showMrzSide":"Show the side with the two or three lines of characters","dcv3.mrz.reading":"Reading the document… hold it steady","dcv3.mrz.moveCloser":"Move closer so the lines of characters fill the frame","dcv3.mrz.turnSideways":"Turn your phone sideways to read the lines of characters","dcv3.mrz.glare":"Tilt the document to remove the reflection","dcv3.mrz.holdStill":"Hold still","dcv3.mrz.valid":"Document read. Taking the photo","dcv3.mrz.looksLikePassport":"This looks like a passport","dcv3.mrz.looksLikeCard":"This looks like an identity card or residence permit"};var ze={"dcv3.mrz.searching":"Cadrez toute la page du passeport","dcv3.mrz.showMrzSide":"Montrez la face avec les deux ou trois lignes de caractères","dcv3.mrz.reading":"Lecture du document… tenez-le immobile","dcv3.mrz.moveCloser":"Rapprochez-vous pour que les lignes de caractères remplissent le cadre","dcv3.mrz.turnSideways":"Tournez votre téléphone à l’horizontale pour lire les lignes de caractères","dcv3.mrz.glare":"Inclinez le document pour supprimer le reflet","dcv3.mrz.holdStill":"Ne bougez plus","dcv3.mrz.valid":"Document lu. Prise de la photo","dcv3.mrz.looksLikePassport":"Ceci ressemble à un passeport","dcv3.mrz.looksLikeCard":"Ceci ressemble à une carte d’identité ou un titre de séjour"};var Le={"native.doc.introTitle":"سنلتقط صورة لوثيقتك","native.doc.introLead":"ستُفتح كاميرا هاتفك، وتُلتقط الصورة تلقائيًا بمجرد أن تكون الوثيقة داخل الإطار.","native.doc.tip.flat":"ضع الوثيقة مسطحة على سطح داكن.","native.doc.tip.glare":"تجنّب انعكاسات المصابيح أو الشمس.","native.doc.tip.frame":"أبقِ الوثيقة كاملة داخل الإطار.","native.doc.openCamera":"افتح الكاميرا","native.doc.changeDocument":"تغيير الوثيقة","native.scan.closer":"اقترب قليلًا","native.scan.farther":"ابتعد قليلًا","native.scan.glare":"أمِل البطاقة قليلًا","native.scan.dark":"الإضاءة ضعيفة. شغّل المصباح.","native.scan.blurry":"الصورة غير واضحة. ثبّت الهاتف.","native.scan.holdStill":"لا تتحرك","native.scan.reading":"جارٍ التحقق من وثيقتك…","native.scan.putDown":"يمكنك وضع وثيقتك جانبًا.","native.scan.retry":"لنحاول مرة أخرى"};var O={"native.doc.introTitle":"We'll photograph your document","native.doc.introLead":"Your phone's camera will open. The photo is taken by itself as soon as the document is well framed.","native.doc.tip.flat":"Lay the document flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lamps or sunlight.","native.doc.tip.frame":"Keep the whole document in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","native.scan.closer":"Move a little closer","native.scan.farther":"Move back a little","native.scan.glare":"Tilt the card a little","native.scan.dark":"Too dark. Turn on the light.","native.scan.blurry":"Blurry image. Hold the phone still.","native.scan.holdStill":"Hold still","native.scan.reading":"Checking your document…","native.scan.putDown":"You can put your document down.","native.scan.retry":"Let's try that again"};var De={"native.doc.introTitle":"Nous allons photographier votre pièce","native.doc.introLead":"La caméra de votre téléphone va s'ouvrir. La photo est prise automatiquement dès que la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat, sur une surface sombre.","native.doc.tip.glare":"Évitez les reflets de lampe ou de soleil.","native.doc.tip.frame":"Gardez toute la pièce dans le cadre.","native.doc.openCamera":"Ouvrir la caméra","native.doc.changeDocument":"Changer de document","native.scan.closer":"Approchez un peu","native.scan.farther":"Reculez un peu","native.scan.glare":"Inclinez un peu la carte","native.scan.dark":"Trop sombre. Allumez la lampe.","native.scan.blurry":"Image floue. Tenez le téléphone immobile.","native.scan.holdStill":"Ne bougez plus","native.scan.reading":"Vérification de votre document…","native.scan.putDown":"Vous pouvez poser votre pièce.","native.scan.retry":"Réessayons"};var Ue=["locking","capturing"],q=class q{constructor(){this.shown={hint:null,locking:!1,card:null,manualShutter:!1};this.candidate=null;this.candidateSince=0;this.hintShownAt=0;this.lockLostAt=null;this.detectedSince=null;this.lostSince=null;this.shutterSince=null}present(e,r){return this.presentHint(e,r),this.presentLock(e,r),this.presentCard(e,r),this.shutterSince=e.manualShutter?this.shutterSince??r:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&r-this.shutterSince>=1e3},this.shown}presentHint(e,r){let a=e.phase==="framing"&&!(e.hint==="blurry"&&e.card===null)?e.hint:null;if(e.phase!=="framing"){this.shown={...this.shown,hint:null},this.candidate=null;return}if(a!==this.candidate&&(this.candidate=a,this.candidateSince=r),a===this.shown.hint)return;let s=r-this.candidateSince>=(a===null?0:350),u=this.shown.hint===null||r-this.hintShownAt>=1200;s&&u&&(this.shown={...this.shown,hint:a},this.hintShownAt=r)}presentLock(e,r){if(Ue.includes(e.phase)){this.shown={...this.shown,locking:!0},this.lockLostAt=null;return}if(this.shown.locking){if(e.phase!=="framing"){this.shown={...this.shown,locking:!1},this.lockLostAt=null;return}this.lockLostAt??(this.lockLostAt=r),r-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(e,r){let a=e.card;if(a===null||e.phase!=="framing"){if(e.phase!=="framing"){this.shown={...this.shown,card:null},this.detectedSince=null,this.lostSince=null;return}this.detectedSince=null,this.lostSince??(this.lostSince=r),r-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=r),r-this.detectedSince<250)return;let s=this.shown.card;if(s===null){this.shown={...this.shown,card:{...a}};return}let u=.35;this.shown={...this.shown,card:{fill:s.fill+(a.fill-s.fill)*u,offsetX:s.offsetX+(a.offsetX-s.offsetX)*u,offsetY:s.offsetY+(a.offsetY-s.offsetY)*u}}}};h(q,"ScanPresenter");var Y=q;import{Fragment as st,jsx as t,jsxs as m}from"react/jsx-runtime";var Ge={en:O,fr:De,ar:Le,es:O,pt:O,de:O},Xe=450,Me=h(n=>e=>ve(n.strings[e]??Ge[n.locale][e]??""),"useScanCopy");function xe({name:n}){return t("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:be[n]}})}h(xe,"ScanGlyph");var We={en:E,fr:ze,ar:Ce,es:E,pt:E,de:E};function Qe(n,e){return n===null||n.state==="fallback"||n.state==="mismatch"?null:n.state==="searching"?e?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":n.state==="valid"?"dcv3.mrz.valid":n.coach!==void 0?`dcv3.mrz.${n.coach}`:"dcv3.mrz.reading"}h(Qe,"mrzInstruction");function $e(n){return n.reason==="unreadable"?"doc.reason_unreadable":n.reason!==void 0&&n.reason!=="side_missing"?fe(n.reason):null}h($e,"reasonOf");function $t({step:n,i18n:e,liveMrz:r,...a}){let[s,u]=S(!1);return s?t(tt,{step:n,i18n:e,...r!==void 0?{liveMrz:r}:{},onClose:()=>u(!1)}):t(je,{step:n,i18n:e,onOpen:()=>u(!0),...a})}h($t,"DocumentCaptureView");function Ze({passport:n}){let r=Math.round(228/(n?1.42:1.586));return m("svg",{className:"sekyro-mark sekyro-mark--card",viewBox:`-12 -12 252 ${r+24}`,"aria-hidden":"true",focusable:"false",children:[t("defs",{children:t("clipPath",{id:"sekyro-card-clip",children:t("rect",{width:228,height:r,rx:"12.5"})})}),t("rect",{className:"sekyro-mark__card",width:228,height:r,rx:"12.5"}),t("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:r*.52,rx:"6"}),[0,1,2].map(a=>t("rect",{className:"sekyro-mark__text",x:"88",y:23+a*r*.12,width:100-a*20,height:"6",rx:"3"},a)),[0,1].map(a=>t("rect",{className:"sekyro-mark__text",x:"17",y:r*.74+a*9,width:194,height:"4",rx:"2"},a)),t("g",{clipPath:"url(#sekyro-card-clip)",children:t("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:t("rect",{x:"-1",width:"2",height:r,className:"sekyro-mark__beam"})})}),t("path",{className:"sekyro-mark__brackets",d:qe(-10,-10,248,r+20,16,30)})]})}h(Ze,"ScanMark");function qe(n,e,r,a,s,u){let w=Math.min(s,u*.6);return[[n,e,1,1],[n+r,e,-1,1],[n,e+a,1,-1],[n+r,e+a,-1,-1]].map(([b,T,f,K])=>`M${b} ${T+K*u}V${T+K*w}Q${b} ${T} ${b+f*w} ${T}H${b+f*u}`).join("")}h(qe,"brackets");function je({step:n,i18n:e,onOpen:r,onChangeCountry:a,onChangeDocument:s}){let u=Me(e),w=n.documentType==="passport",y=$e(n);return m("section",{className:"sekyro-step","data-testid":"sekyro-document",children:[t(Ze,{passport:w}),t(ge,{title:u("native.doc.introTitle"),lead:u("native.doc.introLead")}),y!==null?m(we,{tone:"warning",children:[t("span",{children:e.t(y)}),t("span",{children:Z(e,n.attemptsRemaining,n.attemptsExhausted)})]}):null,m("ul",{className:"sekyro-tiprows",children:[m("li",{children:[t(A,{name:w?"passport":"card"}),u("native.doc.tip.flat")]}),m("li",{children:[t(A,{name:"light"}),u("native.doc.tip.glare")]}),m("li",{children:[t(xe,{name:"image"}),u("native.doc.tip.frame")]})]}),s!==void 0||a!==void 0?m("div",{className:"sekyro-links",children:[s!==void 0?t("button",{type:"button",className:"sekyro-link",onClick:s,children:u("native.doc.changeDocument")}):null,a!==void 0?t("button",{type:"button",className:"sekyro-link",onClick:a,children:e.t("native.doc.changeCountry")}):null]}):null,t(Se,{children:m(Q,{full:!0,onClick:r,children:[t(A,{name:"camera"}),u("native.doc.openCamera")]})})]})}h(je,"DocumentIntro");function Ne(n,e,r){let a=n*.88,s=a/r;return{x:(n-a)/2,y:e*.42-s/2,w:a,h:s}}h(Ne,"guideRect");var Je={too_far:"native.scan.closer",too_close:"native.scan.farther",focus_far:"native.scan.farther",glare:"native.scan.glare",too_bright:"native.scan.glare",too_dark:"native.scan.dark",blurry:"native.scan.blurry"},et=h(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function tt({step:n,i18n:e,liveMrz:r,onClose:a}){let s=Me(e),u=j(null),w=j(null),y=j(null),[b,T]=S("idle"),[f,K]=S(null),[B,J]=S(null),[p,Te]=S({w:0,h:0}),[z,_e]=S({hint:null,locking:!1,card:null,manualShutter:!1}),[ee,He]=S({}),[te,Re]=S(null),[ne,Ae]=S(null),[re,ae]=S(0),[se,oe]=S(null),[I,ie]=S(null),L=n.documentType==="passport",P=L?1.42:1.586;ye(!0),Fe(()=>{let i=u.current;if(i===null)return;let c=h(()=>Te({w:i.clientWidth,h:i.clientHeight}),"measure");if(c(),typeof ResizeObserver>"u")return;let l=new ResizeObserver(c);return l.observe(i),()=>l.disconnect()},[]);let o=Ne(p.w,p.h,P);R(()=>{p.w===0||p.h===0||y.current?.setGuide?.({viewAspect:p.w/p.h,rect:{x:o.x/p.w,y:o.y/p.h,width:o.w/p.w,height:o.h/p.h}})},[p.w,p.h,o.x,o.y,o.w,o.h]),R(()=>{let i=w.current;if(i===null)return;let c=n.capture({video:i,...r!==void 0?{liveMrz:r}:{}});y.current=c;let l=u.current;if(l!==null&&l.clientWidth>0&&l.clientHeight>0){let d=Ne(l.clientWidth,l.clientHeight,P);c.setGuide?.({viewAspect:l.clientWidth/l.clientHeight,rect:{x:d.x/l.clientWidth,y:d.y/l.clientHeight,width:d.w/l.clientWidth,height:d.h/l.clientHeight}})}let C=new Y,g={scan:null,feedback:null,gate:null},N=h(d=>{g={...g,...d};let M=g.gate?.guide,Be={phase:g.scan?.phase??"framing",hint:g.feedback?.reticle==="coaching"?g.feedback.key:null,card:M?.detected?{fill:M.fill,offsetX:M.offsetX,offsetY:M.offsetY}:null,manualShutter:g.scan?.manualShutter??!1},x=C.present(Be,performance.now());_e($=>$.hint===x.hint&&$.locking===x.locking&&$.manualShutter===x.manualShutter&&$.card?.fill===x.card?.fill&&$.card?.offsetX===x.card?.offsetX&&$.card?.offsetY===x.card?.offsetY?$:x)},"present"),Ye=[c.on("state",T),c.on("feedback",d=>N({feedback:d})),c.on("gate",d=>N({gate:d})),c.on("scan",d=>{K(d),N({scan:d})}),c.on("captured",d=>{He(M=>({...M,[nt(d.side,L,M)]:d.previewDataUrl})),Re(d.previewDataUrl),Ae(at(i))}),c.on("error",J),c.on("mrz",d=>{d.state==="mismatch"?ie(d.format??null):oe(d)})];return c.start().catch(()=>{}),()=>{for(let d of Ye)d();c.destroy(),y.current=null}},[n.issuer,n.documentType]);let k=f?.phase??"framing",D=k==="reading"||k==="result",U=k==="flipCue"||k==="reaskRecto",_=z.locking,le=f?.captured.length??0;R(()=>{_&&ae(i=>i+1)},[_]),R(()=>{le>0&&ae(i=>i+1)},[le]);let Ee=f?.expected??null;R(()=>{oe(null)},[Ee]),R(()=>{if(I===null)return;let i=setTimeout(()=>ie(null),2e3);return()=>clearTimeout(i)},[I]);let ce=U||D?null:Qe(se,L),F=I!==null?I==="TD3"?"dcv3.mrz.looksLikePassport":"dcv3.mrz.looksLikeCard":ce,Oe=F===null?null:e.strings[F]??We[e.locale][F],ue=$e(n),de=z.hint===null?null:Je[z.hint]??`dcv2.${z.hint}`,Ke=de??(k==="flipCue"?f?.notice==="same_face"?"doc.sameFace":"doc.flip":k==="reaskRecto"?"doc.reaskRecto":D?"native.scan.reading":k==="locking"||k==="capturing"||_?"native.scan.holdStill":f?.notice==="reread"?"doc.reread":f?.notice==="technical"?"native.scan.retry":f?.notice==="blurry"?"native.scan.blurry":ue??(L?"doc.showPage":"doc.showSide")),G=Oe??s(Ke),H=z.card,v=o;if(!_&&H!==null&&H.fill>=.45&&H.fill<=1.25&&!et()){let i=o.w*H.fill,c=i/P,l=o.x+o.w/2+o.w*Math.max(-.25,Math.min(.25,H.offsetX)),C=o.y+o.h/2+o.h*Math.max(-.25,Math.min(.25,H.offsetY));v={x:l-i/2,y:C-c/2,w:i,h:c}}let V=o.w*.045,X=28,me=Math.min(V,X*.6),Ie=[[v.x,v.y,1,1],[v.x+v.w,v.y,-1,1],[v.x,v.y+v.h,1,-1],[v.x+v.w,v.y+v.h,-1,-1]],Pe=_?"is-locked":z.hint!==null?"is-coaching":"",Ve=L?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],pe=o.y+o.h+48,W={insetInlineStart:o.x,insetBlockStart:o.y,inlineSize:o.w,blockSize:o.h,borderRadius:V};return t("section",{className:"sekyro-lm","aria-label":G,"data-testid":"sekyro-document",children:m("div",{ref:u,className:`sekyro-lm-stage${D?" is-reading":""}${U?" is-flip":""}`,style:{"--sekyro-guide-w":`${o.w}px`},children:[t("video",{ref:w,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:i=>{let c=i.currentTarget,l=c.getBoundingClientRect(),C=Math.max(l.width/(c.videoWidth||1),l.height/(c.videoHeight||1)),g=c.videoWidth*C,N=c.videoHeight*C;g>0&&N>0&&y.current?.focusAt((i.clientX-l.left+(g-l.width)/2)/g,(i.clientY-l.top+(N-l.height)/2)/N)}}),p.w>0?m(st,{children:[D&&ne!==null?t("img",{className:"sekyro-lm-scene",src:ne,alt:""}):null,D&&te!==null?t("img",{className:"sekyro-lm-frozen",src:te,alt:"",style:W}):null,m("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${p.w} ${p.h}`,"aria-hidden":"true",focusable:"false",children:[m("defs",{children:[m("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),t("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),m("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),t("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),t("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${p.w}V${p.h}H0Z${rt(o,V)}`}),t("rect",{width:p.w,height:Math.max(0,o.y),fill:"url(#sekyro-lm-top)"}),t("rect",{y:o.y+o.h,width:p.w,height:Math.max(0,p.h-o.y-o.h),fill:"url(#sekyro-lm-bottom)"}),t("g",{className:`sekyro-lm-brackets ${Pe}`,children:Ie.map(([i,c,l,C],g)=>t("path",{style:{transform:`translate(${i}px, ${c}px) scale(${l}, ${C})`},d:`M0 ${X}V${me}Q0 0 ${me} 0H${X}`},g))}),_?t("rect",{className:"sekyro-lm-trace",x:o.x,y:o.y,width:o.w,height:o.h,rx:V,pathLength:"1",style:{animationDuration:`${Xe}ms`}}):null]}),t("div",{className:"sekyro-lm-slot",style:W,"aria-hidden":"true",children:D?t("span",{className:"sekyro-lm-read is-repeating"}):re>0?t("span",{className:"sekyro-lm-read"},re):null})]}):null,ce!==null?t("div",{className:"sekyro-lm-slot",style:W,"aria-hidden":"true",children:t("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${L?" is-page":""}${se?.state==="valid"?" is-valid":""}`})}):null,m("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:o.y-64},children:[t("div",{role:"status","aria-live":"polite",children:t(ke,{swapKey:G,className:"sekyro-lm-line",children:G})}),ue!==null&&k==="framing"&&de===null?t("p",{className:"sekyro-lm-attempts",children:Z(e,n.attemptsRemaining,n.attemptsExhausted)}):null]}),D?m("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:pe-12},children:[t("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),s("native.scan.putDown")]}):U?t("div",{className:`sekyro-lm-under sekyro-lm-flip${k==="reaskRecto"?" is-toFront":""}`,style:{insetBlockStart:pe-20},"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:m("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(P)},children:[t("span",{className:"sekyro-lm-flip-front"}),t("span",{className:"sekyro-lm-flip-back"})]})}):null,m("div",{className:"sekyro-lm-controls",children:[m("div",{className:"sekyro-lm-bar",children:[t("button",{type:"button",className:"sekyro-glass","aria-label":e.t("native.close"),onClick:a,children:t(A,{name:"close"})}),f?.torchAvailable?t("button",{type:"button",className:`sekyro-glass${f.torch?" is-on":""}`,"aria-label":e.t("doc.torchOn"),"aria-pressed":f.torch,onClick:()=>y.current?.setTorch(!f.torch),children:t(xe,{name:"flashlight"})}):null]}),B!==null?m("div",{className:"sekyro-lm-error",role:"alert",children:[t("p",{children:e.t("doc.cameraBlocked")}),t("p",{children:e.t(B.kind==="permission"?"doc.cameraBlockedHint":he(B.kind))}),t(Q,{onClick:()=>{J(null),y.current?.retry()},children:e.t("doc.retryCamera")})]}):null,z.manualShutter?t("button",{type:"button",className:"sekyro-shutter","aria-label":e.t("doc.shutter"),onClick:()=>y.current?.shutter()}):null,t("ol",{className:"sekyro-lm-tray",children:Ve.map(({side:i,label:c})=>{let l=f?.captured.includes(i)??!1;return m("li",{className:l?"is-done":void 0,"aria-current":!l&&(L||f?.expected===i)?"step":void 0,children:[l?m("span",{className:"sekyro-lm-thumb",children:[ee[i]!==void 0?t("img",{src:ee[i],alt:""}):null,t("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:t("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,s(c)]},i)})})]}),b==="uploading"||b==="checking"?t("span",{className:"sekyro-visually-hidden",role:"status",children:b==="uploading"?e.t("doc.uploading"):s("native.scan.reading")}):null]})})}h(tt,"LumiereScan");function nt(n,e,r){return e?"single":n==="recto"||n==="verso"?n:r.recto===void 0?"recto":"verso"}h(nt,"slotOf");function rt({x:n,y:e,w:r,h:a},s){return`M${n+s} ${e}H${n+r-s}Q${n+r} ${e} ${n+r} ${e+s}V${e+a-s}Q${n+r} ${e+a} ${n+r-s} ${e+a}H${n+s}Q${n} ${e+a} ${n} ${e+a-s}V${e+s}Q${n} ${e} ${n+s} ${e}Z`}h(rt,"roundedRect");function at(n){let e=Math.round(n.videoWidth/4),r=Math.round(n.videoHeight/4);if(e===0||r===0||typeof document>"u")return null;try{let a=document.createElement("canvas");a.width=e,a.height=r;let s=a.getContext("2d");return s===null?null:(s.drawImage(n,0,0,e,r),a.toDataURL("image/jpeg",.7))}catch{return null}}h(at,"sceneSnapshot");export{$t as DocumentCaptureView,Xe as LOCK_TRACE_MS,Ne as guideRect,Qe as mrzInstruction,nt as slotOf};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as O}from"./chunk-YY76AMUA.js";import{a as U,b as y,c as z}from"./chunk-H2KIOYQU.js";import{a as K}from"./chunk-VRDPGOXM.js";import{d as E}from"./chunk-PCNVEJSW.js";import{a as _}from"./chunk-MXPLBQHW.js";import{a as f,u as G}from"./chunk-ECWKDUB5.js";import{a}from"./chunk-2KED7D2Q.js";import{isValidNni as oe,normalizeNni as x}from"@sekyro/web";import{useEffect as $,useId as re,useRef as W,useState as S}from"react";import{Fragment as A,jsx as i,jsxs as l}from"react/jsx-runtime";var Y={en:y,fr:z,ar:U,es:y,pt:y,de:y},R=6,de=new Set(["eid_identifier_invalid","eid_code_invalid","eid_locked","eid_not_enrolled"]),q=a((e,o)=>{if(e===void 0)return 0;let p=Date.parse(e)-o;return Number.isFinite(p)?Math.max(0,Math.ceil(p/1e3)):0},"secondsUntil"),se=a(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss");function be({step:e,i18n:o,className:p,onError:J}){let B=o.strings,n=a((t,d)=>E(B[t]??Y[o.locale][t]??"",d),"t"),C=a((t,d)=>{let ne=new Intl.PluralRules(o.locale).select(d),V=`${t}.${ne}`,te=B[V]??Y[o.locale][V]??n(`${t}.other`);return E(te,{count:new Intl.NumberFormat(o.locale).format(d)})},"plural"),g=a(t=>e.providerName?n(`eid.${t}`,{provider:e.providerName}):n(`eid.${t}Generic`),"named"),[w,Q]=S(""),[v,I]=S(""),[c,P]=S(!1),[k,u]=S(null),r=e.phase==="code",D=O(r),s=re(),X=G(),m=a(async t=>{P(!0),u(null);try{await t()}catch(d){u(K(d,o.strings)),J?.(d)}finally{P(!1)}},"run"),F=W(!1);$(()=>{!e.identifierBound||r||e.reason!==void 0||F.current||(F.current=!0,m(()=>e.start()))},[e.identifierBound,r,e.reason]),$(()=>{(e.reason==="eid_code_invalid"||e.codeExpiresAt!==void 0)&&I("")},[e.reason,e.codeExpiresAt,e.codeAttemptsRemaining]);let M=W(r);$(()=>{r&&!M.current&&document.getElementById(`${s}-code`)?.focus(),M.current=r},[r,s]);let b=e.reason==="eid_locked",T=q(e.codeExpiresAt,D),H=r&&e.codeExpiresAt!==void 0&&T===0,h=q(e.resendAvailableAt,D),L=e.resendsRemaining===0||e.reason==="eid_resend_limit",Z=a(t=>{if(t.preventDefault(),r){v.length===R&&!b&&m(()=>e.verify(v));return}if(e.identifierBound){m(()=>e.start());return}let d=x(w);if(e.country==="MR"){if(!/^\d{10}$/.test(d))return u("population.invalid");if(!oe(d))return u("population.reason_nni_invalid")}m(()=>e.start(d))},"onSubmit"),N=e.reason?.startsWith("eid_")?e.reason:void 0,j=l(A,{children:[N!==void 0?l(_,{tone:de.has(N)?"danger":"warning",children:[i("span",{children:n(`reasons.${N}`)}),N==="eid_code_invalid"&&e.codeAttemptsRemaining!==void 0?i("span",{children:C("eid.codeAttemptsRemaining",e.codeAttemptsRemaining)}):null,e.canUseCamera?i(f,{kind:"ghost",disabled:c,onClick:()=>{m(()=>e.useCamera())},children:n("eid.useCamera")}):null]}):null,k!==null?i(_,{tone:"danger",children:i("span",{children:o.t(k)})}):null]}),[ee,ie]=r?[g("codeTitle"),g("codeHelp")]:[g("identifierTitle"),g(e.identifierBound?"boundDescription":"identifierDescription")];return l("form",{className:`sekyro-stack sekyro-stack--4 sekyro-otp${p?` ${p}`:""}`,"aria-labelledby":s,onSubmit:Z,noValidate:!0,"data-testid":"sekyro-eid",children:[l("div",{className:"sekyro-stack sekyro-stack--1",children:[i("h2",{id:s,ref:X,tabIndex:-1,className:"sekyro-text-body",children:ee}),i("p",{className:"sekyro-text-muted",children:ie}),e.afterPass==="continue"?i("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:e.providerName?n("eid.continueHint",{provider:e.providerName}):n("eid.continueHintGeneric")}):null]}),j,r?l(A,{children:[l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${s}-code`,children:n("eid.codeLabel")}),i("input",{id:`${s}-code`,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:v,disabled:b,onChange:t=>{u(null),I(x(t.target.value).replace(/\D/g,"").slice(0,R))}})]}),l("div",{className:"sekyro-row",children:[e.codeExpiresAt!==void 0?i("span",{className:"sekyro-text-muted",children:H?n("eid.expired"):n("eid.expiresIn",{time:se(T)})}):null,L?i("span",{className:"sekyro-text-muted",children:n("eid.noResendsLeft")}):i(f,{kind:"ghost",disabled:c||h>0||b,onClick:()=>{m(()=>e.resend())},children:h>0?n("eid.resendIn",{seconds:h}):n("eid.resend")})]}),!L&&e.resendsRemaining!==void 0?i("p",{className:"sekyro-text-muted",children:C("eid.resendsRemaining",e.resendsRemaining)}):null,i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:H?n("eid.expired"):""}),i(f,{type:"submit",full:!0,disabled:c||v.length!==R||b,"aria-busy":c||void 0,children:n("eid.verify")})]}):l(A,{children:[e.identifierBound?null:l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${s}-nni`,children:o.t("population.label")}),i("input",{id:`${s}-nni`,className:"sekyro-input sekyro-mono",dir:"ltr",inputMode:"numeric",autoComplete:"off",placeholder:o.t("population.placeholder"),value:w,"aria-describedby":`${s}-nni-help`,"aria-invalid":k==="population.invalid"||k==="population.reason_nni_invalid"||void 0,onChange:t=>{u(null),Q(x(t.target.value).replace(/\D/g,"").slice(0,10))}}),i("span",{id:`${s}-nni-help`,className:"sekyro-help",children:o.t("population.helper")})]}),i(f,{type:"submit",full:!0,disabled:c,"aria-busy":c||void 0,children:n("eid.start")})]})]})}a(be,"EidView");export{be as EidView};
2
+ import{a as O}from"./chunk-YY76AMUA.js";import{a as U,b as y,c as z}from"./chunk-H2KIOYQU.js";import{a as K}from"./chunk-VRDPGOXM.js";import{d as E}from"./chunk-WAVBS3GL.js";import{a as _}from"./chunk-K7YYCJUR.js";import{a as f,u as G}from"./chunk-34326C2I.js";import{a}from"./chunk-2KED7D2Q.js";import{isValidNni as oe,normalizeNni as x}from"@sekyro/web";import{useEffect as $,useId as re,useRef as W,useState as S}from"react";import{Fragment as A,jsx as i,jsxs as l}from"react/jsx-runtime";var Y={en:y,fr:z,ar:U,es:y,pt:y,de:y},R=6,de=new Set(["eid_identifier_invalid","eid_code_invalid","eid_locked","eid_not_enrolled"]),q=a((e,o)=>{if(e===void 0)return 0;let p=Date.parse(e)-o;return Number.isFinite(p)?Math.max(0,Math.ceil(p/1e3)):0},"secondsUntil"),se=a(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss");function be({step:e,i18n:o,className:p,onError:J}){let B=o.strings,n=a((t,d)=>E(B[t]??Y[o.locale][t]??"",d),"t"),C=a((t,d)=>{let ne=new Intl.PluralRules(o.locale).select(d),V=`${t}.${ne}`,te=B[V]??Y[o.locale][V]??n(`${t}.other`);return E(te,{count:new Intl.NumberFormat(o.locale).format(d)})},"plural"),g=a(t=>e.providerName?n(`eid.${t}`,{provider:e.providerName}):n(`eid.${t}Generic`),"named"),[w,Q]=S(""),[v,I]=S(""),[c,P]=S(!1),[k,u]=S(null),r=e.phase==="code",D=O(r),s=re(),X=G(),m=a(async t=>{P(!0),u(null);try{await t()}catch(d){u(K(d,o.strings)),J?.(d)}finally{P(!1)}},"run"),F=W(!1);$(()=>{!e.identifierBound||r||e.reason!==void 0||F.current||(F.current=!0,m(()=>e.start()))},[e.identifierBound,r,e.reason]),$(()=>{(e.reason==="eid_code_invalid"||e.codeExpiresAt!==void 0)&&I("")},[e.reason,e.codeExpiresAt,e.codeAttemptsRemaining]);let M=W(r);$(()=>{r&&!M.current&&document.getElementById(`${s}-code`)?.focus(),M.current=r},[r,s]);let b=e.reason==="eid_locked",T=q(e.codeExpiresAt,D),H=r&&e.codeExpiresAt!==void 0&&T===0,h=q(e.resendAvailableAt,D),L=e.resendsRemaining===0||e.reason==="eid_resend_limit",Z=a(t=>{if(t.preventDefault(),r){v.length===R&&!b&&m(()=>e.verify(v));return}if(e.identifierBound){m(()=>e.start());return}let d=x(w);if(e.country==="MR"){if(!/^\d{10}$/.test(d))return u("population.invalid");if(!oe(d))return u("population.reason_nni_invalid")}m(()=>e.start(d))},"onSubmit"),N=e.reason?.startsWith("eid_")?e.reason:void 0,j=l(A,{children:[N!==void 0?l(_,{tone:de.has(N)?"danger":"warning",children:[i("span",{children:n(`reasons.${N}`)}),N==="eid_code_invalid"&&e.codeAttemptsRemaining!==void 0?i("span",{children:C("eid.codeAttemptsRemaining",e.codeAttemptsRemaining)}):null,e.canUseCamera?i(f,{kind:"ghost",disabled:c,onClick:()=>{m(()=>e.useCamera())},children:n("eid.useCamera")}):null]}):null,k!==null?i(_,{tone:"danger",children:i("span",{children:o.t(k)})}):null]}),[ee,ie]=r?[g("codeTitle"),g("codeHelp")]:[g("identifierTitle"),g(e.identifierBound?"boundDescription":"identifierDescription")];return l("form",{className:`sekyro-stack sekyro-stack--4 sekyro-otp${p?` ${p}`:""}`,"aria-labelledby":s,onSubmit:Z,noValidate:!0,"data-testid":"sekyro-eid",children:[l("div",{className:"sekyro-stack sekyro-stack--1",children:[i("h2",{id:s,ref:X,tabIndex:-1,className:"sekyro-text-body",children:ee}),i("p",{className:"sekyro-text-muted",children:ie}),e.afterPass==="continue"?i("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:e.providerName?n("eid.continueHint",{provider:e.providerName}):n("eid.continueHintGeneric")}):null]}),j,r?l(A,{children:[l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${s}-code`,children:n("eid.codeLabel")}),i("input",{id:`${s}-code`,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:v,disabled:b,onChange:t=>{u(null),I(x(t.target.value).replace(/\D/g,"").slice(0,R))}})]}),l("div",{className:"sekyro-row",children:[e.codeExpiresAt!==void 0?i("span",{className:"sekyro-text-muted",children:H?n("eid.expired"):n("eid.expiresIn",{time:se(T)})}):null,L?i("span",{className:"sekyro-text-muted",children:n("eid.noResendsLeft")}):i(f,{kind:"ghost",disabled:c||h>0||b,onClick:()=>{m(()=>e.resend())},children:h>0?n("eid.resendIn",{seconds:h}):n("eid.resend")})]}),!L&&e.resendsRemaining!==void 0?i("p",{className:"sekyro-text-muted",children:C("eid.resendsRemaining",e.resendsRemaining)}):null,i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:H?n("eid.expired"):""}),i(f,{type:"submit",full:!0,disabled:c||v.length!==R||b,"aria-busy":c||void 0,children:n("eid.verify")})]}):l(A,{children:[e.identifierBound?null:l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${s}-nni`,children:o.t("population.label")}),i("input",{id:`${s}-nni`,className:"sekyro-input sekyro-mono",dir:"ltr",inputMode:"numeric",autoComplete:"off",placeholder:o.t("population.placeholder"),value:w,"aria-describedby":`${s}-nni-help`,"aria-invalid":k==="population.invalid"||k==="population.reason_nni_invalid"||void 0,onChange:t=>{u(null),Q(x(t.target.value).replace(/\D/g,"").slice(0,10))}}),i("span",{id:`${s}-nni-help`,className:"sekyro-help",children:o.t("population.helper")})]}),i(f,{type:"submit",full:!0,disabled:c,"aria-busy":c||void 0,children:n("eid.start")})]})]})}a(be,"EidView");export{be as EidView};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as R}from"./chunk-EZ5TVL6P.js";import{a as L}from"./chunk-YY76AMUA.js";import{a as $,b}from"./chunk-746GPDBD.js";import{a as V}from"./chunk-VRDPGOXM.js";import{d as w}from"./chunk-PCNVEJSW.js";import{a as O,b as A}from"./chunk-MXPLBQHW.js";import{a as h}from"./chunk-ECWKDUB5.js";import{a as s}from"./chunk-2KED7D2Q.js";import{OtpInputError as G}from"@sekyro/web";import{useId as K,useState as y}from"react";var P={"emailOtp.reason_otp_daily_cap_reached":"لا يمكننا إرسال رمز إلى بريدك الإلكتروني اليوم. اختر طريقة أخرى للتحقق إن كانت متاحة، أو حاول مرة أخرى لاحقًا.","emailOtp.sendTitle":"تحقّق من بريدك الإلكتروني","emailOtp.sendDescription":"سنرسل إليك عبر البريد الإلكتروني رمزًا يُستخدم مرة واحدة لتأكيد أن هذا العنوان يخصّك","emailOtp.prefilledNotice":"سنرسل رمز تحقّق إلى بريدك الإلكتروني المسجّل.","emailOtp.emailLabel":"البريد الإلكتروني","emailOtp.emailHelper":"سنرسل رمزًا يُستخدم مرة واحدة إلى هذا العنوان","emailOtp.emailPlaceholder":"عنوان بريدك الإلكتروني","emailOtp.emailInvalid":"أدخل عنوان بريد إلكتروني صالحًا","emailOtp.send":"أرسل لي رمزًا عبر البريد الإلكتروني","emailOtp.verifyTitle":"أدخل رمز التحقّق","emailOtp.verifyDescription":"أدخل الرمز المكوّن من 6 أرقام الذي أرسلناه إلى بريدك الإلكتروني لإتمام التحقّق من عنوانك","emailOtp.sentTo":"أرسلنا رمزًا مكوّنًا من 6 أرقام إلى {email}","emailOtp.codeLabel":"رمز التحقّق","emailOtp.codeHelper":"أدخل الرمز المكوّن من 6 أرقام الوارد في الرسالة","emailOtp.verify":"تحقّق من الرمز","emailOtp.resend":"إعادة إرسال الرمز","emailOtp.resendIn":"إعادة إرسال الرمز خلال {seconds} ثانية","emailOtp.expiresIn":"ينتهي الرمز خلال {time}","emailOtp.expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد","emailOtp.reason_otp_mismatch":"الرمز غير صحيح. تحقّق منه وأعد إدخاله","emailOtp.reason_otp_expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد للمتابعة","emailOtp.reason_otp_send_failed":"تعذّر إرسال الرسالة. أعد المحاولة بعد قليل","emailOtp.reason_otp_rate_limited":"طلبت رموزًا كثيرة. انتظر قليلًا ثم أعد المحاولة","emailOtp.reason_email_invalid":"لا يمكننا الإرسال إلى هذا العنوان. تحقّق منه أو أدخل عنوانًا آخر","emailOtp.reason_email_disposable":"استخدم بريدًا إلكترونيًا دائمًا، وليس عنوانًا مؤقتًا"};var c={"emailOtp.reason_otp_daily_cap_reached":"We can't email you a code today. Choose another way to verify if one is offered, or try again later.","emailOtp.sendTitle":"Verify your email address","emailOtp.sendDescription":"We'll email you a one-time code to confirm this address is yours","emailOtp.prefilledNotice":"We'll send a verification code to your registered email address.","emailOtp.emailLabel":"Email address","emailOtp.emailHelper":"We'll send a one-time code to this address","emailOtp.emailPlaceholder":"Your email address","emailOtp.emailInvalid":"Enter a valid email address","emailOtp.send":"Email me a code","emailOtp.verifyTitle":"Enter the verification code","emailOtp.verifyDescription":"Type the 6-digit code we emailed you to finish verifying your address","emailOtp.sentTo":"We sent a 6-digit code to {email}","emailOtp.codeLabel":"Verification code","emailOtp.codeHelper":"Enter the 6-digit code from the email","emailOtp.verify":"Verify code","emailOtp.resend":"Resend code","emailOtp.resendIn":"Resend code in {seconds}s","emailOtp.expiresIn":"Code expires in {time}","emailOtp.expired":"That code has expired. Resend a new one","emailOtp.reason_otp_mismatch":"That code was incorrect. Check it and enter it again","emailOtp.reason_otp_expired":"That code has expired. Resend a new code to continue","emailOtp.reason_otp_send_failed":"We couldn't send the email. Try again in a moment","emailOtp.reason_otp_rate_limited":"Too many codes requested. Wait a moment, then try again","emailOtp.reason_email_invalid":"We can't send to this address. Check it or enter another one","emailOtp.reason_email_disposable":"Use a permanent email address, not a temporary one"};var D={"emailOtp.reason_otp_daily_cap_reached":"Nous ne pouvons pas vous envoyer de code par e-mail aujourd'hui. Choisissez une autre méthode si elle est proposée, ou réessayez plus tard.","emailOtp.sendTitle":"Vérifiez votre adresse e-mail","emailOtp.sendDescription":"Nous vous enverrons par e-mail un code à usage unique pour confirmer que cette adresse vous appartient","emailOtp.prefilledNotice":"Nous enverrons un code de vérification à votre adresse e-mail enregistrée.","emailOtp.emailLabel":"Adresse e-mail","emailOtp.emailHelper":"Nous enverrons un code à usage unique à cette adresse","emailOtp.emailPlaceholder":"Votre adresse e-mail","emailOtp.emailInvalid":"Saisissez une adresse e-mail valide","emailOtp.send":"M'envoyer un code par e-mail","emailOtp.verifyTitle":"Saisissez le code de vérification","emailOtp.verifyDescription":"Saisissez le code à 6 chiffres que nous vous avons envoyé par e-mail pour finaliser la vérification de votre adresse","emailOtp.sentTo":"Nous avons envoyé un code à 6 chiffres à {email}","emailOtp.codeLabel":"Code de vérification","emailOtp.codeHelper":"Saisissez le code à 6 chiffres reçu par e-mail","emailOtp.verify":"Vérifier le code","emailOtp.resend":"Renvoyer le code","emailOtp.resendIn":"Renvoyer le code dans {seconds} s","emailOtp.expiresIn":"Le code expire dans {time}","emailOtp.expired":"Ce code a expiré. Renvoyez-en un nouveau","emailOtp.reason_otp_mismatch":"Ce code est incorrect. Vérifiez-le et saisissez-le à nouveau","emailOtp.reason_otp_expired":"Ce code a expiré. Renvoyez un nouveau code pour continuer","emailOtp.reason_otp_send_failed":"Nous n'avons pas pu envoyer l'e-mail. Réessayez dans un instant","emailOtp.reason_otp_rate_limited":"Trop de codes demandés. Patientez un instant, puis réessayez","emailOtp.reason_email_invalid":"Nous ne pouvons pas envoyer à cette adresse. Vérifiez-la ou saisissez-en une autre","emailOtp.reason_email_disposable":"Utilisez une adresse e-mail permanente, pas une adresse temporaire"};import{Fragment as S,jsx as i,jsxs as l}from"react/jsx-runtime";var j={en:c,fr:D,ar:P,es:c,pt:c,de:c},W=s((e,r)=>{if(e===void 0)return 0;let d=Date.parse(e)-r;return Number.isFinite(d)?Math.max(0,Math.ceil(d/1e3)):0},"secondsUntil"),J=s(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss"),Q=new Set(["otp_expired","otp_send_failed","otp_rate_limited","email_invalid","email_disposable","otp_daily_cap_reached"]);function ue({step:e,i18n:r,className:d,defaultEmail:g="",onError:H}){let a=s((t,p)=>w(r.strings[t]??j[r.locale][t],p),"t"),[v,M]=y(g),[u,q]=y(""),[n,E]=y(!1),[N,x]=y(null),m=e.phase==="verify",k=L(m),o=K(),T=s(async t=>{E(!0),x(null);try{await t()}catch(p){x(p instanceof G&&p.field==="email"?a("emailOtp.emailInvalid"):r.t(V(p,r.strings))),H?.(p)}finally{E(!1)}},"run"),C=s(t=>{T(()=>e.send(e.needsEmail&&(!t||v!==g)?{email:v}:{}))},"send"),z=s(t=>{T(()=>e.verify(t))},"submitCode"),F=s(t=>{t.preventDefault(),m?z(u):C(!1)},"onSubmit"),I=W(e.codeExpiresAt,k),_=W(e.resendAvailableAt,k),f=m&&e.codeExpiresAt!==void 0&&I===0,[B,U]=a("emailOtp.sentTo").split("{email}"),Y=e.reason==="otp_mismatch"?l(O,{tone:"danger",children:[i("span",{children:a("emailOtp.reason_otp_mismatch")}),i("span",{children:A(r,e.attemptsRemaining,e.attemptsExhausted)})]}):e.reason!==void 0&&Q.has(e.reason)?i(O,{tone:"warning",children:i("span",{children:a(`emailOtp.reason_${e.reason}`)})}):null;return l("form",{className:`sekyro-step sekyro-otp${d?` ${d}`:""}`,"aria-labelledby":o,onSubmit:F,noValidate:!0,children:[i($,{id:o,title:a(m?"emailOtp.verifyTitle":"emailOtp.sendTitle"),lead:m?l(S,{children:[B,i("bdi",{dir:"ltr",className:"sekyro-mono",children:e.sentToMasked}),U]}):a("emailOtp.sendDescription")}),Y,N!==null?i(O,{tone:"danger",children:i("span",{children:N})}):null,m?l(S,{children:[l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${o}-code`,children:a("emailOtp.codeLabel")}),i(R,{id:`${o}-code`,value:u,invalid:e.reason==="otp_mismatch",onChange:t=>{q(t),t.length===6&&u.length!==6&&!n&&!e.attemptsExhausted&&z(t)}}),i("span",{className:`sekyro-help sekyro-otp-expiry${f?" is-danger":""}`,"aria-hidden":!f||void 0,children:f?a("emailOtp.expired"):a("emailOtp.expiresIn",{time:J(I)})})]}),i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:f?a("emailOtp.expired"):""}),l(b,{children:[i(h,{type:"submit",full:!0,disabled:n||u.length!==6,"aria-busy":n||void 0,children:a("emailOtp.verify")}),i("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:n||_>0,onClick:()=>C(!0),children:_>0?a("emailOtp.resendIn",{seconds:_}):a("emailOtp.resend")})]})]}):l(S,{children:[e.needsEmail?l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${o}-email`,children:a("emailOtp.emailLabel")}),i("input",{id:`${o}-email`,className:"sekyro-input",type:"email",dir:"ltr",inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,placeholder:a("emailOtp.emailPlaceholder"),value:v,"aria-describedby":`${o}-email-help`,onChange:t=>M(t.target.value)}),i("span",{id:`${o}-email-help`,className:"sekyro-help",children:a("emailOtp.emailHelper")})]}):i("p",{className:"sekyro-text-muted",children:a("emailOtp.prefilledNotice")}),i(b,{children:i(h,{type:"submit",full:!0,disabled:n,"aria-busy":n||void 0,children:a("emailOtp.send")})})]})]})}s(ue,"EmailOtpView");export{ue as EmailOtpView};
2
+ import{a as R}from"./chunk-EZ5TVL6P.js";import{a as L}from"./chunk-YY76AMUA.js";import{a as $,b}from"./chunk-PTPTDOWD.js";import{a as V}from"./chunk-VRDPGOXM.js";import{d as w}from"./chunk-WAVBS3GL.js";import{a as O,b as A}from"./chunk-K7YYCJUR.js";import{a as h}from"./chunk-34326C2I.js";import{a as s}from"./chunk-2KED7D2Q.js";import{OtpInputError as G}from"@sekyro/web";import{useId as K,useState as y}from"react";var P={"emailOtp.reason_otp_daily_cap_reached":"لا يمكننا إرسال رمز إلى بريدك الإلكتروني اليوم. اختر طريقة أخرى للتحقق إن كانت متاحة، أو حاول مرة أخرى لاحقًا.","emailOtp.sendTitle":"تحقّق من بريدك الإلكتروني","emailOtp.sendDescription":"سنرسل إليك عبر البريد الإلكتروني رمزًا يُستخدم مرة واحدة لتأكيد أن هذا العنوان يخصّك","emailOtp.prefilledNotice":"سنرسل رمز تحقّق إلى بريدك الإلكتروني المسجّل.","emailOtp.emailLabel":"البريد الإلكتروني","emailOtp.emailHelper":"سنرسل رمزًا يُستخدم مرة واحدة إلى هذا العنوان","emailOtp.emailPlaceholder":"عنوان بريدك الإلكتروني","emailOtp.emailInvalid":"أدخل عنوان بريد إلكتروني صالحًا","emailOtp.send":"أرسل لي رمزًا عبر البريد الإلكتروني","emailOtp.verifyTitle":"أدخل رمز التحقّق","emailOtp.verifyDescription":"أدخل الرمز المكوّن من 6 أرقام الذي أرسلناه إلى بريدك الإلكتروني لإتمام التحقّق من عنوانك","emailOtp.sentTo":"أرسلنا رمزًا مكوّنًا من 6 أرقام إلى {email}","emailOtp.codeLabel":"رمز التحقّق","emailOtp.codeHelper":"أدخل الرمز المكوّن من 6 أرقام الوارد في الرسالة","emailOtp.verify":"تحقّق من الرمز","emailOtp.resend":"إعادة إرسال الرمز","emailOtp.resendIn":"إعادة إرسال الرمز خلال {seconds} ثانية","emailOtp.expiresIn":"ينتهي الرمز خلال {time}","emailOtp.expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد","emailOtp.reason_otp_mismatch":"الرمز غير صحيح. تحقّق منه وأعد إدخاله","emailOtp.reason_otp_expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد للمتابعة","emailOtp.reason_otp_send_failed":"تعذّر إرسال الرسالة. أعد المحاولة بعد قليل","emailOtp.reason_otp_rate_limited":"طلبت رموزًا كثيرة. انتظر قليلًا ثم أعد المحاولة","emailOtp.reason_email_invalid":"لا يمكننا الإرسال إلى هذا العنوان. تحقّق منه أو أدخل عنوانًا آخر","emailOtp.reason_email_disposable":"استخدم بريدًا إلكترونيًا دائمًا، وليس عنوانًا مؤقتًا"};var c={"emailOtp.reason_otp_daily_cap_reached":"We can't email you a code today. Choose another way to verify if one is offered, or try again later.","emailOtp.sendTitle":"Verify your email address","emailOtp.sendDescription":"We'll email you a one-time code to confirm this address is yours","emailOtp.prefilledNotice":"We'll send a verification code to your registered email address.","emailOtp.emailLabel":"Email address","emailOtp.emailHelper":"We'll send a one-time code to this address","emailOtp.emailPlaceholder":"Your email address","emailOtp.emailInvalid":"Enter a valid email address","emailOtp.send":"Email me a code","emailOtp.verifyTitle":"Enter the verification code","emailOtp.verifyDescription":"Type the 6-digit code we emailed you to finish verifying your address","emailOtp.sentTo":"We sent a 6-digit code to {email}","emailOtp.codeLabel":"Verification code","emailOtp.codeHelper":"Enter the 6-digit code from the email","emailOtp.verify":"Verify code","emailOtp.resend":"Resend code","emailOtp.resendIn":"Resend code in {seconds}s","emailOtp.expiresIn":"Code expires in {time}","emailOtp.expired":"That code has expired. Resend a new one","emailOtp.reason_otp_mismatch":"That code was incorrect. Check it and enter it again","emailOtp.reason_otp_expired":"That code has expired. Resend a new code to continue","emailOtp.reason_otp_send_failed":"We couldn't send the email. Try again in a moment","emailOtp.reason_otp_rate_limited":"Too many codes requested. Wait a moment, then try again","emailOtp.reason_email_invalid":"We can't send to this address. Check it or enter another one","emailOtp.reason_email_disposable":"Use a permanent email address, not a temporary one"};var D={"emailOtp.reason_otp_daily_cap_reached":"Nous ne pouvons pas vous envoyer de code par e-mail aujourd'hui. Choisissez une autre méthode si elle est proposée, ou réessayez plus tard.","emailOtp.sendTitle":"Vérifiez votre adresse e-mail","emailOtp.sendDescription":"Nous vous enverrons par e-mail un code à usage unique pour confirmer que cette adresse vous appartient","emailOtp.prefilledNotice":"Nous enverrons un code de vérification à votre adresse e-mail enregistrée.","emailOtp.emailLabel":"Adresse e-mail","emailOtp.emailHelper":"Nous enverrons un code à usage unique à cette adresse","emailOtp.emailPlaceholder":"Votre adresse e-mail","emailOtp.emailInvalid":"Saisissez une adresse e-mail valide","emailOtp.send":"M'envoyer un code par e-mail","emailOtp.verifyTitle":"Saisissez le code de vérification","emailOtp.verifyDescription":"Saisissez le code à 6 chiffres que nous vous avons envoyé par e-mail pour finaliser la vérification de votre adresse","emailOtp.sentTo":"Nous avons envoyé un code à 6 chiffres à {email}","emailOtp.codeLabel":"Code de vérification","emailOtp.codeHelper":"Saisissez le code à 6 chiffres reçu par e-mail","emailOtp.verify":"Vérifier le code","emailOtp.resend":"Renvoyer le code","emailOtp.resendIn":"Renvoyer le code dans {seconds} s","emailOtp.expiresIn":"Le code expire dans {time}","emailOtp.expired":"Ce code a expiré. Renvoyez-en un nouveau","emailOtp.reason_otp_mismatch":"Ce code est incorrect. Vérifiez-le et saisissez-le à nouveau","emailOtp.reason_otp_expired":"Ce code a expiré. Renvoyez un nouveau code pour continuer","emailOtp.reason_otp_send_failed":"Nous n'avons pas pu envoyer l'e-mail. Réessayez dans un instant","emailOtp.reason_otp_rate_limited":"Trop de codes demandés. Patientez un instant, puis réessayez","emailOtp.reason_email_invalid":"Nous ne pouvons pas envoyer à cette adresse. Vérifiez-la ou saisissez-en une autre","emailOtp.reason_email_disposable":"Utilisez une adresse e-mail permanente, pas une adresse temporaire"};import{Fragment as S,jsx as i,jsxs as l}from"react/jsx-runtime";var j={en:c,fr:D,ar:P,es:c,pt:c,de:c},W=s((e,r)=>{if(e===void 0)return 0;let d=Date.parse(e)-r;return Number.isFinite(d)?Math.max(0,Math.ceil(d/1e3)):0},"secondsUntil"),J=s(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss"),Q=new Set(["otp_expired","otp_send_failed","otp_rate_limited","email_invalid","email_disposable","otp_daily_cap_reached"]);function ue({step:e,i18n:r,className:d,defaultEmail:g="",onError:H}){let a=s((t,p)=>w(r.strings[t]??j[r.locale][t],p),"t"),[v,M]=y(g),[u,q]=y(""),[n,E]=y(!1),[N,x]=y(null),m=e.phase==="verify",k=L(m),o=K(),T=s(async t=>{E(!0),x(null);try{await t()}catch(p){x(p instanceof G&&p.field==="email"?a("emailOtp.emailInvalid"):r.t(V(p,r.strings))),H?.(p)}finally{E(!1)}},"run"),C=s(t=>{T(()=>e.send(e.needsEmail&&(!t||v!==g)?{email:v}:{}))},"send"),z=s(t=>{T(()=>e.verify(t))},"submitCode"),F=s(t=>{t.preventDefault(),m?z(u):C(!1)},"onSubmit"),I=W(e.codeExpiresAt,k),_=W(e.resendAvailableAt,k),f=m&&e.codeExpiresAt!==void 0&&I===0,[B,U]=a("emailOtp.sentTo").split("{email}"),Y=e.reason==="otp_mismatch"?l(O,{tone:"danger",children:[i("span",{children:a("emailOtp.reason_otp_mismatch")}),i("span",{children:A(r,e.attemptsRemaining,e.attemptsExhausted)})]}):e.reason!==void 0&&Q.has(e.reason)?i(O,{tone:"warning",children:i("span",{children:a(`emailOtp.reason_${e.reason}`)})}):null;return l("form",{className:`sekyro-step sekyro-otp${d?` ${d}`:""}`,"aria-labelledby":o,onSubmit:F,noValidate:!0,children:[i($,{id:o,title:a(m?"emailOtp.verifyTitle":"emailOtp.sendTitle"),lead:m?l(S,{children:[B,i("bdi",{dir:"ltr",className:"sekyro-mono",children:e.sentToMasked}),U]}):a("emailOtp.sendDescription")}),Y,N!==null?i(O,{tone:"danger",children:i("span",{children:N})}):null,m?l(S,{children:[l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${o}-code`,children:a("emailOtp.codeLabel")}),i(R,{id:`${o}-code`,value:u,invalid:e.reason==="otp_mismatch",onChange:t=>{q(t),t.length===6&&u.length!==6&&!n&&!e.attemptsExhausted&&z(t)}}),i("span",{className:`sekyro-help sekyro-otp-expiry${f?" is-danger":""}`,"aria-hidden":!f||void 0,children:f?a("emailOtp.expired"):a("emailOtp.expiresIn",{time:J(I)})})]}),i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:f?a("emailOtp.expired"):""}),l(b,{children:[i(h,{type:"submit",full:!0,disabled:n||u.length!==6,"aria-busy":n||void 0,children:a("emailOtp.verify")}),i("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:n||_>0,onClick:()=>C(!0),children:_>0?a("emailOtp.resendIn",{seconds:_}):a("emailOtp.resend")})]})]}):l(S,{children:[e.needsEmail?l("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${o}-email`,children:a("emailOtp.emailLabel")}),i("input",{id:`${o}-email`,className:"sekyro-input",type:"email",dir:"ltr",inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,placeholder:a("emailOtp.emailPlaceholder"),value:v,"aria-describedby":`${o}-email-help`,onChange:t=>M(t.target.value)}),i("span",{id:`${o}-email-help`,className:"sekyro-help",children:a("emailOtp.emailHelper")})]}):i("p",{className:"sekyro-text-muted",children:a("emailOtp.prefilledNotice")}),i(b,{children:i(h,{type:"submit",full:!0,disabled:n,"aria-busy":n||void 0,children:a("emailOtp.send")})})]})]})}s(ue,"EmailOtpView");export{ue as EmailOtpView};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as U,b as R,c as N,d as Y}from"./chunk-D5WF4UNP.js";import{a as K}from"./chunk-PYAJMHZH.js";import{d as M,g as B}from"./chunk-63LPCEVJ.js";import"./chunk-5XYKAT3V.js";import"./chunk-746GPDBD.js";import{a as E,b as I,c as H}from"./chunk-H2KIOYQU.js";import"./chunk-VRDPGOXM.js";import{d as P}from"./chunk-PCNVEJSW.js";import{a as x}from"./chunk-MXPLBQHW.js";import{a as w,u as S}from"./chunk-ECWKDUB5.js";import{a as m}from"./chunk-2KED7D2Q.js";import{HostedApiError as fe}from"@sekyro/web";import{detectIsMobile as J}from"@sekyro/web/core";import{useEffect as q,useId as F,useMemo as C,useRef as ye,useState as _}from"react";var $={"consent.human.terms.intro":"تؤكد Sekyro AI أن شخصًا حقيقيًا يُجري هذه الخطوة، نيابةً عن الجهة التي طلبتها.","consent.human.terms.data":"تلتقط Sekyro AI تسجيلًا قصيرًا لوجهك.","consent.human.terms.processing":"يُفحص هذا التسجيل للتأكد من أنك شخص حقيقي وحاضر، وقد يُقارَن بالوجوه التي سبق التحقق منها لدى هذه الجهة.","consent.human.terms.sharing":"تُبلَّغ الجهة التي طلبت هذا التحقق بنتيجته.","consent.human.terms.retention":"تُخزَّن بياناتك مشفّرة ولا يُحتفظ بها إلا للمدة التي يقتضيها القانون وإعدادات الجهة. لممارسة حقوقك المتعلقة بحماية البيانات، تواصل مع الجهة التي طلبت هذا التحقق.","capture.noCamera.title":"تتطلب هذه الخطوة كاميرا","capture.noCamera.body":"اسمح بالوصول إلى الكاميرا وحاول مرة أخرى، أو تابع على هاتف مزوّد بكاميرا.","capture.noCamera.continue":"المتابعة بدون كاميرا","capture.noCamera.deniedTitle":"اسمح بالوصول إلى الكاميرا للمتابعة","capture.noCamera.deniedBody":"حظر متصفحك الوصول إلى الكاميرا في هذه الصفحة. اسمح به من إعدادات الموقع ثم أعد المحاولة.","choice.title":"كيف تريد المتابعة؟","choice.description":"اختر خيارًا واحدًا.","choice.switch":"استخدم خيارًا آخر","contact.title":"كيف تريد استلام الرمز؟","contact.description":"اختر خيارًا واحدًا.","contact.phone":"عبر الهاتف (واتساب أو رسالة نصية)","contact.email":"عبر البريد الإلكتروني","contact.switch":"استخدم خيارًا آخر","summary.title":"تحقق من بياناتك","summary.description":"تأكد من أن هذه بياناتك قبل الصورة الحية.","summary.fullName":"الاسم الكامل","summary.birthDate":"تاريخ الميلاد","summary.nationality":"الجنسية","summary.documentType":"الوثيقة","summary.documentNumber":"رقم الوثيقة","summary.nni":"الرقم الوطني للتعريف الموريتاني (NNI)","summary.id_number":"رقم الهوية","summary.expiryDate":"تاريخ الانتهاء","summary.portraitAlt":"الصورة المسجلة","summary.source.registry":"من سجل الحالة المدنية","summary.source.document":"مقروءة من وثيقتك","summary.source.chip":"مقروءة من شريحة وثيقتك","summary.name":"الاسم","summary.birthYear":"سنة الميلاد","summary.confirm":"تأكيد ومتابعة","summary.retakeDocument":"مسح وثيقتي مرة أخرى","summary.retakeNationalNumber":"إدخال رقمي مرة أخرى","summary.noRetake":"لم يعد بإمكانك إعادة المحاولة. تواصل مع {org} إذا كانت هذه البيانات غير صحيحة","capture.tipsIcao.title":"لصورة الهوية:","capture.tipsIcao.glasses":"انزع نظارتك","capture.tipsIcao.headwear":"انزع القبعة. يُقبل غطاء الرأس الديني إذا كان الوجه ظاهرًا بالكامل","capture.tipsIcao.expression":"حافظ على تعبير محايد وفمك مغلق","capture.tipsIcao.faceCamera":"انظر مباشرة إلى الكاميرا وعيناك مفتوحتان","capture.tipsIcao.background":"قف أمام خلفية سادة فاتحة اللون","capture.tipsIcao.lighting":"استخدم إضاءة متساوية على وجهك: دون ظلال","capture.tipsIcao.hair":"أبعد شعرك عن وجهك وعينيك","capture.tipsIcao.summary":"قف أمام جدار سادة فاتح اللون مع إضاءة متساوية على وجهك. انزع نظارتك وأي قبعة. أبعد شعرك عن وجهك، وانظر مباشرة إلى الكاميرا وعيناك مفتوحتان، وحافظ على تعبير محايد وفمك مغلق، وابقَ ثابتًا.","portrait.retakeOnly":"نجح التحقق الحي. الصورة فقط تحتاج إلى محاولة أخرى","portrait.keepCamera":"ابقَ أمام الكاميرا","handoff.description":"امسح الرمز بهاتفك للمتابعة","handoff.qrAlt":"رمز QR يفتح عملية التحقق هذه على هاتفك","handoff.copyLink":"نسخ الرابط","handoff.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة من متصفحك بدلًا من ذلك","handoff.waiting":"ستنتقل هذه الصفحة تلقائيًا بعد أن تُكمل الخطوة على هاتفك","inApp.title":"افتح هذه الصفحة في متصفحك","inApp.description":"لا تعمل الكاميرا جيدًا داخل هذا التطبيق. افتح الرابط في Chrome أو Safari للمتابعة.","inApp.copyLink":"نسخ الرابط","inApp.copied":"تم نسخ الرابط. الصقه في متصفحك","inApp.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة بدلًا من ذلك","inApp.continueAnyway":"المتابعة هنا على أي حال"};var A={"consent.human.terms.intro":"Sekyro AI confirms that a real person is completing this step, on behalf of the organization that asked for it.","consent.human.terms.data":"Sekyro AI collects a short capture of your face.","consent.human.terms.processing":"The capture is checked to confirm that you are a real person who is present. It may be compared with faces already verified for this organization.","consent.human.terms.sharing":"The organization that requested this verification learns its outcome.","consent.human.terms.retention":"Your data is stored encrypted and kept only as long as the law and the organization's settings require. To exercise your data-protection rights, contact the organization that requested this verification.","capture.noCamera.title":"This step needs a camera","capture.noCamera.body":"Allow camera access and try again, or continue on a phone with a camera.","capture.noCamera.continue":"Continue without a camera","capture.noCamera.deniedTitle":"Allow camera access to continue","capture.noCamera.deniedBody":"Your browser blocked the camera for this page. Allow it in the site settings, then try again.","choice.title":"How do you want to continue?","choice.description":"Choose one option.","choice.switch":"Use another option","contact.title":"How do you want to get your code?","contact.description":"Choose one option.","contact.phone":"By phone (WhatsApp or SMS)","contact.email":"By email","contact.switch":"Use another option","summary.title":"Check your details","summary.description":"Make sure this is you before the live photo.","summary.fullName":"Full name","summary.birthDate":"Date of birth","summary.nationality":"Nationality","summary.documentType":"Document","summary.documentNumber":"Document number","summary.nni":"Mauritanian national ID number (NNI)","summary.id_number":"ID number","summary.expiryDate":"Expiry date","summary.portraitAlt":"Photo on record","summary.source.registry":"From the civil registry","summary.source.document":"Read from your document","summary.source.chip":"Read from your document's chip","summary.name":"Name","summary.birthYear":"Year of birth","summary.confirm":"Confirm and continue","summary.retakeDocument":"Scan my document again","summary.retakeNationalNumber":"Enter my number again","summary.noRetake":"You can't try again. Contact {org} if these details are wrong","capture.tipsIcao.title":"For your ID photo:","capture.tipsIcao.glasses":"Remove your glasses","capture.tipsIcao.headwear":"Remove hats and caps. A religious head covering is fine if your whole face shows","capture.tipsIcao.expression":"Keep a neutral expression with your mouth closed","capture.tipsIcao.faceCamera":"Look straight at the camera with your eyes open","capture.tipsIcao.background":"Stand in front of a plain, light background","capture.tipsIcao.lighting":"Use even light on your face: no shadows","capture.tipsIcao.hair":"Keep your hair away from your face and eyes","capture.tipsIcao.summary":"Stand in front of a plain, light wall with even light on your face. Remove your glasses and any hat. Keep your hair off your face, look straight at the camera with your eyes open, keep a neutral expression with your mouth closed, and hold still.","portrait.retakeOnly":"Your live check passed. Only the photo needs another try","portrait.keepCamera":"Stay in front of the camera","handoff.description":"Scan with your phone to continue","handoff.qrAlt":"QR code that opens this verification on your phone","handoff.copyLink":"Copy link","handoff.copyFailed":"We couldn't copy the link. Copy this page's address from your browser instead","handoff.waiting":"This page moves on by itself once you finish on your phone","inApp.title":"Open this page in your browser","inApp.description":"The camera doesn't work well inside this app. Open the link in Chrome or Safari to continue.","inApp.copyLink":"Copy link","inApp.copied":"Link copied. Paste it in your browser","inApp.copyFailed":"We couldn't copy the link. Copy this page's address instead","inApp.continueAnyway":"Continue here anyway"};var G={"consent.human.terms.intro":"Sekyro AI confirme qu'une personne réelle effectue cette étape, pour le compte de l'organisme qui l'a demandée.","consent.human.terms.data":"Sekyro AI recueille une courte capture de votre visage.","consent.human.terms.processing":"La capture est analysée pour confirmer que vous êtes une personne réelle et présente. Elle peut être comparée aux visages déjà vérifiés pour cet organisme.","consent.human.terms.sharing":"L'organisme qui a demandé cette vérification est informé de son résultat.","consent.human.terms.retention":"Vos données sont stockées chiffrées et conservées uniquement pendant la durée exigée par la loi et les paramètres de l'organisme. Pour exercer vos droits en matière de protection des données, contactez l'organisme qui a demandé cette vérification.","capture.noCamera.title":"Cette étape nécessite une caméra","capture.noCamera.body":"Autorisez l'accès à la caméra et réessayez, ou continuez sur un téléphone équipé d'une caméra.","capture.noCamera.continue":"Continuer sans caméra","capture.noCamera.deniedTitle":"Autorisez l'accès à la caméra pour continuer","capture.noCamera.deniedBody":"Votre navigateur a bloqué la caméra pour cette page. Autorisez-la dans les paramètres du site, puis réessayez.","choice.title":"Comment voulez-vous continuer ?","choice.description":"Choisissez une option.","choice.switch":"Utiliser une autre option","contact.title":"Comment voulez-vous recevoir votre code ?","contact.description":"Choisissez une option.","contact.phone":"Par téléphone (WhatsApp ou SMS)","contact.email":"Par e-mail","contact.switch":"Utiliser une autre option","summary.title":"Vérifiez vos informations","summary.description":"Assurez-vous qu'il s'agit bien de vous avant la photo en direct.","summary.fullName":"Nom complet","summary.birthDate":"Date de naissance","summary.nationality":"Nationalité","summary.documentType":"Document","summary.documentNumber":"Numéro du document","summary.nni":"Numéro national d'identification mauritanien (NNI)","summary.id_number":"Numéro d'identité","summary.expiryDate":"Date d'expiration","summary.portraitAlt":"Photo enregistrée","summary.source.registry":"Issu de l'état civil","summary.source.document":"Lu sur votre document","summary.source.chip":"Lu sur la puce de votre document","summary.name":"Nom","summary.birthYear":"Année de naissance","summary.confirm":"Confirmer et continuer","summary.retakeDocument":"Scanner à nouveau mon document","summary.retakeNationalNumber":"Saisir à nouveau mon numéro","summary.noRetake":"Vous ne pouvez plus réessayer. Contactez {org} si ces informations sont incorrectes","capture.tipsIcao.title":"Pour votre photo d'identité :","capture.tipsIcao.glasses":"Retirez vos lunettes","capture.tipsIcao.headwear":"Retirez chapeau et casquette. Un couvre-chef religieux est accepté si tout le visage est visible","capture.tipsIcao.expression":"Gardez une expression neutre, la bouche fermée","capture.tipsIcao.faceCamera":"Regardez la caméra bien en face, les yeux ouverts","capture.tipsIcao.background":"Placez-vous devant un fond uni et clair","capture.tipsIcao.lighting":"Éclairez votre visage de façon uniforme : sans ombres","capture.tipsIcao.hair":"Dégagez vos cheveux du visage et des yeux","capture.tipsIcao.summary":"Placez-vous devant un mur uni et clair, le visage éclairé de façon uniforme. Retirez vos lunettes et tout chapeau. Dégagez vos cheveux du visage, regardez la caméra bien en face, les yeux ouverts, gardez une expression neutre, la bouche fermée, et ne bougez plus.","portrait.retakeOnly":"Votre vérification en direct est validée. Seule la photo est à refaire","portrait.keepCamera":"Restez face à la caméra","handoff.description":"Scannez avec votre téléphone pour continuer","handoff.qrAlt":"Code QR qui ouvre cette vérification sur votre téléphone","handoff.copyLink":"Copier le lien","handoff.copyFailed":"Nous n'avons pas pu copier le lien. Copiez plutôt l'adresse de cette page depuis votre navigateur","handoff.waiting":"Cette page avancera d’elle-même une fois l’étape terminée sur votre téléphone","inApp.title":"Ouvrez cette page dans votre navigateur","inApp.description":"La caméra fonctionne mal dans cette application. Ouvrez le lien dans Chrome ou Safari pour continuer.","inApp.copyLink":"Copier le lien","inApp.copied":"Lien copié. Collez-le dans votre navigateur","inApp.copyFailed":"Impossible de copier le lien. Copiez plutôt l'adresse de cette page","inApp.continueAnyway":"Continuer ici quand même"};var D=[[10,[[1,16]]],[16,[[1,28]]],[26,[[1,44]]],[18,[[2,32]]],[24,[[2,43]]],[16,[[4,27]]],[18,[[4,31]]],[22,[[2,38],[2,39]]],[22,[[3,36],[2,37]]],[26,[[4,43],[1,44]]],[30,[[1,50],[4,51]]],[22,[[6,36],[2,37]]],[22,[[8,37],[1,38]]],[24,[[4,40],[5,41]]],[24,[[5,41],[5,42]]],[28,[[7,45],[3,46]]],[28,[[10,46],[1,47]]],[26,[[9,43],[4,44]]],[26,[[3,44],[11,45]]],[26,[[3,41],[13,42]]]],Q=D.length,re=0,L=m(e=>(D[e-1]?.[1]??[]).reduce((t,[n,o])=>t+n*o,0),"dataCapacity");function T(e,t){let n=0;for(let o=7;o>=0;o-=1)n=n<<1^(n>>>7)*285,n^=(t>>>o&1)*e;return n&255}m(T,"gfMul");function ae(e){let t=new Array(e).fill(0);t[e-1]=1;let n=1;for(let o=0;o<e;o+=1){for(let a=0;a<e;a+=1)t[a]=T(t[a],n),a+1<e&&(t[a]=t[a]^t[a+1]);n=T(n,2)}return t}m(ae,"rsDivisor");function ie(e,t){let n=t.map(()=>0);for(let o of e){let a=o^n.shift();n.push(0),t.forEach((i,s)=>{n[s]=n[s]^T(i,a)})}return n}m(ie,"rsRemainder");function se(e,t){let n=[],o=m((p,d)=>{for(let b=d-1;b>=0;b-=1)n.push(p>>>b&1)},"put");o(4,4),o(e.length,t<10?8:16);for(let p of e)o(p,8);let a=L(t)*8;o(0,Math.min(4,a-n.length)),o(0,(8-n.length%8)%8);let i=[];for(let p=0;p<n.length;p+=8)i.push(n.slice(p,p+8).reduce((d,b)=>d<<1|b,0));for(let p=236;i.length<L(t);p^=253)i.push(p);let[s,r]=D[t-1],c=ae(s),u=[],f=0;for(let[p,d]of r)for(let b=0;b<p;b+=1){let v=i.slice(f,f+d);f+=d,u.push({data:v,ec:ie(v,c)})}let h=[],y=Math.max(...u.map(p=>p.data.length));for(let p=0;p<y;p+=1)for(let d of u)p<d.data.length&&h.push(d.data[p]);for(let p=0;p<s;p+=1)for(let d of u)h.push(d.ec[p]);return h}m(se,"codewords");function ce(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=Math.ceil((e*4+4)/(t*2-2))*2,o=[6];for(let a=e*4+10;o.length<t;a-=n)o.splice(1,0,a);return o}m(ce,"alignmentPositions");var ue=[(e,t)=>(e+t)%2===0,e=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0],O=class O{constructor(t){this.size=t,this.dark=new Array(t*t).fill(!1),this.fixed=new Array(t*t).fill(!1)}set(t,n,o){this.dark[t*this.size+n]=o,this.fixed[t*this.size+n]=!0}get(t,n){return this.dark[t*this.size+n]===!0}};m(O,"Grid");var V=O;function le(e,t){let n=e.size;for(let i=0;i<n;i+=1)e.set(6,i,i%2===0),e.set(i,6,i%2===0);for(let[i,s]of[[3,3],[3,n-4],[n-4,3]])for(let r=-4;r<=4;r+=1)for(let c=-4;c<=4;c+=1){let u=i+r,f=s+c;if(u<0||u>=n||f<0||f>=n)continue;let h=Math.max(Math.abs(r),Math.abs(c));e.set(u,f,h!==2&&h!==4)}let o=ce(t),a=o.length-1;if(o.forEach((i,s)=>o.forEach((r,c)=>{if(!(s===0&&c===0||s===0&&c===a||s===a&&c===0))for(let u=-2;u<=2;u+=1)for(let f=-2;f<=2;f+=1)e.set(i+u,r+f,Math.max(Math.abs(u),Math.abs(f))!==1)})),W(e,0),t>=7){let i=t;for(let r=0;r<12;r+=1)i=i<<1^(i>>>11)*7973;let s=t<<12|i;for(let r=0;r<18;r+=1){let c=(s>>>r&1)===1,u=n-11+r%3,f=Math.floor(r/3);e.set(u,f,c),e.set(f,u,c)}}}m(le,"drawFunctionPatterns");function W(e,t){let n=e.size,o=re<<3|t,a=o;for(let r=0;r<10;r+=1)a=a<<1^(a>>>9)*1335;let i=(o<<10|a)^21522,s=m(r=>(i>>>r&1)===1,"bit");for(let r=0;r<=5;r+=1)e.set(r,8,s(r));e.set(7,8,s(6)),e.set(8,8,s(7)),e.set(8,7,s(8));for(let r=9;r<15;r+=1)e.set(8,14-r,s(r));for(let r=0;r<8;r+=1)e.set(8,n-1-r,s(r));for(let r=8;r<15;r+=1)e.set(n-15+r,8,s(r));e.set(n-8,8,!0)}m(W,"drawFormat");function me(e,t){let n=e.size,o=0;for(let a=n-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<n;i+=1)for(let s=0;s<2;s+=1){let r=a-s,u=(a+1&2)===0?n-1-i:i;e.fixed[u*n+r]!==!0&&(o<t.length*8&&(e.dark[u*n+r]=(t[o>>>3]>>>7-(o&7)&1)===1),o+=1)}}}m(me,"placeData");function pe(e,t){let n=ue[t];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.fixed[o*e.size+a]!==!0&&n(o,a)&&(e.dark[o*e.size+a]=!e.dark[o*e.size+a])}m(pe,"applyMask");function de(e){let t=e.size,n=0,o=m(i=>{let s=1;for(let r=1;r<=t;r+=1)r<t&&i(r)===i(r-1)?s+=1:(s>=5&&(n+=3+(s-5)),s=1);for(let r=0;r+10<t;r+=1){let c=[!0,!1,!0,!0,!0,!1,!0];if(!(c.every((y,p)=>i(r+p)===y)||c.every((y,p)=>i(r+4+p)===y)))continue;let f=[0,1,2,3].every(y=>!i(r+y))&&c.every((y,p)=>i(r+4+p)===y),h=c.every((y,p)=>i(r+p)===y)&&[7,8,9,10].every(y=>!i(r+y));f&&(n+=40),h&&(n+=40)}},"line");for(let i=0;i<t;i+=1)o(s=>e.get(i,s));for(let i=0;i<t;i+=1)o(s=>e.get(s,i));for(let i=0;i+1<t;i+=1)for(let s=0;s+1<t;s+=1){let r=e.get(i,s);r===e.get(i,s+1)&&r===e.get(i+1,s)&&r===e.get(i+1,s+1)&&(n+=3)}let a=e.dark.filter(Boolean).length;return n+=Math.floor(Math.abs(a*20-t*t*10)/(t*t))*10,n}m(de,"penalty");function j(e,t={}){let n=new TextEncoder().encode(e),o=1;for(;o<=Q&&!(4+(o<10?8:16)+n.length*8<=L(o)*8);o+=1);if(o>Q)throw new RangeError("text too long for a QR code");let a=se(n,o),i=m(c=>{let u=new V(o*4+17);return le(u,o),me(u,a),pe(u,c),W(u,c),u},"build"),s=null;if(t.mask!==void 0)s=i(t.mask);else{let c=Number.POSITIVE_INFINITY;for(let u=0;u<8;u+=1){let f=i(u),h=de(f);h<c&&(c=h,s=f)}}let r=s;return{size:r.size,get:m((c,u)=>r.get(c,u),"get")}}m(j,"encodeQr");function X(e,t=4){let n=[];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.get(o,a)&&n.push(`M${a+t} ${o+t}h1v1h-1z`);return{size:e.size+t*2,d:n.join("")}}m(X,"qrPath");import{Fragment as Ce,jsx as l,jsxs as k}from"react/jsx-runtime";var he={en:A,fr:G,ar:$,es:A,pt:A,de:A},Z={en:I,fr:H,ar:E,es:I,pt:I,de:I};function g(e){let t=e.strings;return(n,o)=>P(t[n]??he[e.locale][n]??"",o)}m(g,"flowT");function ee(e,t){let n=g(t);return e.flatMap(o=>{let a=o.service==="phone_otp"?n("contact.phone"):o.service==="email_otp"?n("contact.email"):R(o,t),i=U[o.service];return a===null?[]:[{id:o.id,label:a,...i!==void 0?{glyph:l(K,{name:i})}:{}}]})}m(ee,"labelled");function te({step:e,i18n:t,onError:n}){let o=g(t),{busy:a,error:i,run:s}=N(t,n),r=e.kind==="contact_choice";return l(M,{title:o(r?"contact.title":"choice.title"),description:o(r?"contact.description":"choice.description"),options:ee(e.choice.options,t),busy:a,error:i,focus:!0,testId:r?"sekyro-contact-choice":"sekyro-choice",onChoose:c=>s(()=>e.choose(c))})}m(te,"PlanChoiceView");var Ge=te,Qe=te;function We({step:e,i18n:t,onError:n,onOpen:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e,u=e.context.switchable,f=u===void 0?[]:u.options.filter(v=>v.id!==u.current),h=c.kind==="registry"&&(c.reason==="nni_not_found"||c.reason==="registry_record_not_found")&&c.canUseDocument||c.kind==="eid"&&c.reason?.startsWith("eid_")&&c.canUseCamera,y=f.length===1?f[0]:void 0,p=y!==void 0&&(y.service==="phone_otp"||y.service==="email_otp"),d=p&&c.canSwitch&&c.switchTo!==void 0?()=>c.switchTo.call(e):c.chooseOption===void 0||y===void 0?void 0:()=>c.chooseOption.call(e,y.id);if(f.length===0||h||y!==void 0&&(d===void 0||b()===null)||y===void 0&&c.chooseOption===void 0)return null;function b(){return y===void 0?a("choice.switch"):y.service==="phone_otp"||y.service==="email_otp"?a("contact.switch"):c.kind==="registry"&&y.service==="document"?t.t("population.useDocument"):c.kind==="eid"?t.strings["eid.useCamera"]??Z[t.locale]["eid.useCamera"]:R(y,t)}return m(b,"labelOf"),k("div",{className:"sekyro-stack sekyro-stack--1",children:[s!==null?l(x,{tone:"danger",children:l("span",{children:s})}):null,l(w,{kind:"ghost",disabled:i,"aria-busy":i||void 0,onClick:()=>d===void 0?o():r(d),"data-testid":p?"sekyro-contact-switch":"sekyro-lane-switch",children:b()})]})}m(We,"LaneSwitch");function je({step:e,i18n:t,onError:n,onClose:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e.context.switchable,u=e.chooseOption;return c===void 0||u===void 0?null:l(M,{title:a("choice.title"),description:a("choice.description"),options:ee(c.options,t),...c.current!==null?{marked:c.current}:{},busy:i,error:s,focus:!0,testId:"sekyro-lane-choice",onChoose:f=>f===c.current?o():r(()=>u.call(e,f))})}m(je,"LaneChoiceView");var be=[["fullName","summary.fullName",!1],["birthDate","summary.birthDate",!0],["birthYear","summary.birthYear",!0],["nationality","summary.nationality",!0],["documentType","summary.documentType",!1],["documentNumberMasked","summary.documentNumber",!0],["idNumberMasked","summary.id_number",!0],["expiryDate","summary.expiryDate",!0]];function ke(e){let[t,n]=_(null);return q(()=>{if(!e.portraitAvailable)return;let o=!0,a=null;return e.portrait().then(i=>{!o||i===null||!i.type.startsWith("image/")||typeof URL.createObjectURL!="function"||(a=URL.createObjectURL(i),n(a))}),()=>{o=!1,a!==null&&URL.revokeObjectURL(a)}},[e.portraitAvailable]),t}m(ke,"usePortraitUrl");function Xe({step:e,i18n:t,onError:n}){let o=g(t),a=F(),i=S(),s=ke(e),{busy:r,error:c,run:u}=N(t,n),f=e.context.orgName,h=["registry","document","chip"].find(d=>d===e.source),y=e.summaryKind==="partial",p=m(d=>t.strings[`doc.type.${d}`]??d,"documentLabel");return k("section",{className:"sekyro-stack sekyro-stack--4","aria-labelledby":a,"data-testid":"sekyro-identity-summary",children:[k("div",{className:"sekyro-stack sekyro-stack--1",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("summary.title")}),l("p",{className:"sekyro-text-muted",children:o("summary.description")}),h!==void 0?l("p",{className:"sekyro-text-muted",children:o(`summary.source.${h}`)}):null]}),k("div",{className:"sekyro-summary",children:[s!==null?l("img",{className:"sekyro-summary__portrait",src:s,alt:o("summary.portraitAlt")}):null,l("dl",{className:"sekyro-summary__list",children:be.map(([d,b,v])=>{let z=d==="idNumberMasked"?e.idNumberMasked??e.nniMasked:e[d];return z===void 0?null:k("div",{className:"sekyro-summary__row",children:[l("dt",{className:"sekyro-text-muted",children:o(d==="fullName"&&y?"summary.name":b)}),l("dd",{children:v?l("bdi",{dir:"ltr",children:z}):d==="documentType"?p(z):z})]},d)})})]}),c!==null?l(x,{tone:"danger",children:l("span",{children:c})}):null,k("div",{className:"sekyro-stack sekyro-stack--3",children:[l(w,{full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>u(()=>e.confirm()),children:o("summary.confirm")}),e.retakeAvailable?l(w,{kind:"ghost",full:!0,disabled:r,onClick:()=>u(()=>e.retake()),children:o(e.retakeTarget==="national_number"?"summary.retakeNationalNumber":"summary.retakeDocument")}):l("p",{className:"sekyro-text-muted",children:o("summary.noRetake",{org:f})})]})]})}m(Xe,"IdentitySummaryView");var ge=["glasses","headwear","expression","faceCamera","background","lighting","hair"];function Je({step:e,i18n:t,livenessProps:n,sekyroIntro:o}){let a=g(t),[i,s]=_(null);q(()=>e.onLivePhoto(d=>{let b=d.update?.coach;s(d.holding||b===void 0?null:t.t(`portrait.coach.${b}`))}),[e,t]);let r=e.instructions==="icao",c=e.icao?.profile==="selfie",u=C(()=>r?ge.filter(d=>!c||d!=="background").map(d=>({id:d,text:a(`capture.tipsIcao.${d}`)})):void 0,[r,c,t]),f=C(()=>r&&!c?{...n.strings,"capture.tips.title":a("capture.tipsIcao.title")}:n.strings,[r,c,n.strings,t]),h=c?void 0:a("capture.tipsIcao.title"),y=C(()=>o===!0&&u!==void 0?{...n.slots,intro:m((d,b)=>l(Y,{start:d,context:b,tips:u,...h!==void 0?{tipsTitle:h}:{}}),"intro")}:n.slots,[o,u,h,n.slots,t]),p=c?`${(u??[]).map(d=>d.text).join(". ")}.`:a("capture.tipsIcao.summary");return l(B,{...n,...y!==void 0?{slots:y}:{},...f!==void 0?{strings:f}:{},...u!==void 0?{tips:u,tipsSummary:p}:{},coach:i})}m(Je,"LivePhotoLiveness");function Ze({i18n:e}){let t=g(e);return k(x,{tone:"info",children:[l("strong",{children:t("portrait.retakeOnly")}),l("span",{children:t("portrait.keepCamera")})]})}m(Ze,"PortraitRetakeNotice");function et({i18n:e,provider:t}){let n=e.strings,o=m(a=>n[a]??Z[e.locale][a]??"","pick");return l("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:t?P(o("eid.continueHint"),{provider:t}):o("eid.continueHintGeneric")})}m(et,"EidContinueHint");async function we(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}m(we,"copy");function oe({url:e,i18n:t,label:n}){let o=g(t),[a,i]=_("idle"),s=n.startsWith("inApp.")?"inApp":"handoff";return k("div",{className:"sekyro-stack sekyro-stack--1",children:[l(w,{kind:"ghost",onClick:()=>{we(e).then(r=>i(r?"copied":"failed"))},children:o(n)}),l("p",{role:"status","aria-live":"polite",className:"sekyro-text-muted",children:a==="idle"?"":o(`${s}.${a==="copied"?"copied":"copyFailed"}`)})]})}m(oe,"CopyLink");function ne({url:e,i18n:t,refresh:n,footer:o}){let a=g(t),i=F(),s=C(()=>{try{return X(j(e))}catch{return null}},[e]),r=ye(n);r.current=n;let c=S();return q(()=>{let u=setInterval(()=>{(typeof document>"u"||document.visibilityState!=="hidden")&&r.current?.().catch(()=>{})},5e3);return()=>clearInterval(u)},[]),k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":i,"data-testid":"sekyro-handoff",children:[l("h2",{id:i,ref:c,tabIndex:-1,className:"sekyro-text-body",children:t.t("handoff.title")}),l("p",{className:"sekyro-text-muted",children:a("handoff.description")}),s!==null?k("svg",{className:"sekyro-qr",viewBox:`0 0 ${s.size} ${s.size}`,role:"img","aria-label":a("handoff.qrAlt"),shapeRendering:"crispEdges",children:[l("rect",{width:s.size,height:s.size,className:"sekyro-qr__bg"}),l("path",{d:s.d,className:"sekyro-qr__fg"})]}):null,l(oe,{url:e,i18n:t,label:"handoff.copyLink"}),l("p",{className:"sekyro-text-muted",children:a("handoff.waiting")}),o??null]})}m(ne,"HandoffView");var ve=["intro","data","processing","sharing","retention"];function tt({i18n:e}){let t=g(e);return l(Ce,{children:ve.map(n=>l("p",{children:t(`consent.human.terms.${n}`)},n))})}m(tt,"HumanConsentTerms");function ot({url:e,i18n:t}){return C(()=>!J(),[])?l(ne,{url:e,i18n:t}):null}m(ot,"DesktopHandoffView");function nt({i18n:e,cause:t,onRetry:n,onContinue:o,handoffUrl:a}){let i=g(e),s=F(),r=S(),[c,u]=_("idle"),f=C(()=>a!==void 0&&!J(),[a]),h=t==="denied",y=m(()=>{o!==void 0&&(u("busy"),o(t).then(()=>u("idle"),p=>u(p instanceof fe&&p.code==="check_out_of_order"?"idle":"failed")))},"end");return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":s,"data-testid":"sekyro-no-camera","data-cause":t,children:[f&&a!==void 0?l(ne,{url:a,i18n:e}):null,l("h2",{id:s,ref:r,tabIndex:-1,className:"sekyro-text-body",children:i(h?"capture.noCamera.deniedTitle":"capture.noCamera.title")}),l("p",{className:"sekyro-text-muted",children:i(h?"capture.noCamera.deniedBody":"capture.noCamera.body")}),c==="failed"?l(x,{tone:"danger",children:l("span",{children:e.t("errors.network_error")})}):null,l(w,{kind:h?"primary":"ghost",onClick:n,children:e.t("common.retry")}),o!==void 0?l(w,{kind:"ghost",disabled:c==="busy","aria-busy":c==="busy"||void 0,onClick:y,children:i("capture.noCamera.continue")}):null]})}m(nt,"NoCameraView");function rt({url:e,i18n:t,onContinue:n}){let o=g(t),a=F(),i=S();return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":a,"data-testid":"sekyro-in-app",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("inApp.title")}),l("p",{className:"sekyro-text-muted",children:o("inApp.description")}),l(oe,{url:e,i18n:t,label:"inApp.copyLink"}),l(w,{kind:"ghost",onClick:n,children:o("inApp.continueAnyway")})]})}m(rt,"InAppBrowserPrompt");export{Ge as ContactChoiceView,ot as DesktopHandoffView,et as EidContinueHint,Qe as GenericChoiceView,ne as HandoffView,tt as HumanConsentTerms,Xe as IdentitySummaryView,rt as InAppBrowserPrompt,je as LaneChoiceView,We as LaneSwitch,Je as LivePhotoLiveness,nt as NoCameraView,Ze as PortraitRetakeNotice};
2
+ import{a as U,b as R,c as N,d as Y}from"./chunk-IDZNOWTO.js";import{a as K}from"./chunk-PYAJMHZH.js";import{e as M,h as B}from"./chunk-Z5UFPMM6.js";import"./chunk-LNZR3RXG.js";import"./chunk-PTPTDOWD.js";import{a as E,b as I,c as H}from"./chunk-H2KIOYQU.js";import"./chunk-VRDPGOXM.js";import{d as P}from"./chunk-WAVBS3GL.js";import{a as x}from"./chunk-K7YYCJUR.js";import{a as w,u as S}from"./chunk-34326C2I.js";import{a as m}from"./chunk-2KED7D2Q.js";import{HostedApiError as fe}from"@sekyro/web";import{detectIsMobile as J}from"@sekyro/web/core";import{useEffect as q,useId as F,useMemo as C,useRef as ye,useState as _}from"react";var $={"consent.human.terms.intro":"تؤكد Sekyro AI أن شخصًا حقيقيًا يُجري هذه الخطوة، نيابةً عن الجهة التي طلبتها.","consent.human.terms.data":"تلتقط Sekyro AI تسجيلًا قصيرًا لوجهك.","consent.human.terms.processing":"يُفحص هذا التسجيل للتأكد من أنك شخص حقيقي وحاضر، وقد يُقارَن بالوجوه التي سبق التحقق منها لدى هذه الجهة.","consent.human.terms.sharing":"تُبلَّغ الجهة التي طلبت هذا التحقق بنتيجته.","consent.human.terms.retention":"تُخزَّن بياناتك مشفّرة ولا يُحتفظ بها إلا للمدة التي يقتضيها القانون وإعدادات الجهة. لممارسة حقوقك المتعلقة بحماية البيانات، تواصل مع الجهة التي طلبت هذا التحقق.","capture.noCamera.title":"تتطلب هذه الخطوة كاميرا","capture.noCamera.body":"اسمح بالوصول إلى الكاميرا وحاول مرة أخرى، أو تابع على هاتف مزوّد بكاميرا.","capture.noCamera.continue":"المتابعة بدون كاميرا","capture.noCamera.deniedTitle":"اسمح بالوصول إلى الكاميرا للمتابعة","capture.noCamera.deniedBody":"حظر متصفحك الوصول إلى الكاميرا في هذه الصفحة. اسمح به من إعدادات الموقع ثم أعد المحاولة.","choice.title":"كيف تريد المتابعة؟","choice.description":"اختر خيارًا واحدًا.","choice.switch":"استخدم خيارًا آخر","contact.title":"كيف تريد استلام الرمز؟","contact.description":"اختر خيارًا واحدًا.","contact.phone":"عبر الهاتف (واتساب أو رسالة نصية)","contact.email":"عبر البريد الإلكتروني","contact.switch":"استخدم خيارًا آخر","summary.title":"تحقق من بياناتك","summary.description":"تأكد من أن هذه بياناتك قبل الصورة الحية.","summary.fullName":"الاسم الكامل","summary.birthDate":"تاريخ الميلاد","summary.nationality":"الجنسية","summary.documentType":"الوثيقة","summary.documentNumber":"رقم الوثيقة","summary.nni":"الرقم الوطني للتعريف الموريتاني (NNI)","summary.id_number":"رقم الهوية","summary.expiryDate":"تاريخ الانتهاء","summary.portraitAlt":"الصورة المسجلة","summary.source.registry":"من سجل الحالة المدنية","summary.source.document":"مقروءة من وثيقتك","summary.source.chip":"مقروءة من شريحة وثيقتك","summary.name":"الاسم","summary.birthYear":"سنة الميلاد","summary.confirm":"تأكيد ومتابعة","summary.retakeDocument":"مسح وثيقتي مرة أخرى","summary.retakeNationalNumber":"إدخال رقمي مرة أخرى","summary.noRetake":"لم يعد بإمكانك إعادة المحاولة. تواصل مع {org} إذا كانت هذه البيانات غير صحيحة","capture.tipsIcao.title":"لصورة الهوية:","capture.tipsIcao.glasses":"انزع نظارتك","capture.tipsIcao.headwear":"انزع القبعة. يُقبل غطاء الرأس الديني إذا كان الوجه ظاهرًا بالكامل","capture.tipsIcao.expression":"حافظ على تعبير محايد وفمك مغلق","capture.tipsIcao.faceCamera":"انظر مباشرة إلى الكاميرا وعيناك مفتوحتان","capture.tipsIcao.background":"قف أمام خلفية سادة فاتحة اللون","capture.tipsIcao.lighting":"استخدم إضاءة متساوية على وجهك: دون ظلال","capture.tipsIcao.hair":"أبعد شعرك عن وجهك وعينيك","capture.tipsIcao.summary":"قف أمام جدار سادة فاتح اللون مع إضاءة متساوية على وجهك. انزع نظارتك وأي قبعة. أبعد شعرك عن وجهك، وانظر مباشرة إلى الكاميرا وعيناك مفتوحتان، وحافظ على تعبير محايد وفمك مغلق، وابقَ ثابتًا.","portrait.retakeOnly":"نجح التحقق الحي. الصورة فقط تحتاج إلى محاولة أخرى","portrait.keepCamera":"ابقَ أمام الكاميرا","handoff.description":"امسح الرمز بهاتفك للمتابعة","handoff.qrAlt":"رمز QR يفتح عملية التحقق هذه على هاتفك","handoff.copyLink":"نسخ الرابط","handoff.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة من متصفحك بدلًا من ذلك","handoff.waiting":"ستنتقل هذه الصفحة تلقائيًا بعد أن تُكمل الخطوة على هاتفك","inApp.title":"افتح هذه الصفحة في متصفحك","inApp.description":"لا تعمل الكاميرا جيدًا داخل هذا التطبيق. افتح الرابط في Chrome أو Safari للمتابعة.","inApp.copyLink":"نسخ الرابط","inApp.copied":"تم نسخ الرابط. الصقه في متصفحك","inApp.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة بدلًا من ذلك","inApp.continueAnyway":"المتابعة هنا على أي حال"};var A={"consent.human.terms.intro":"Sekyro AI confirms that a real person is completing this step, on behalf of the organization that asked for it.","consent.human.terms.data":"Sekyro AI collects a short capture of your face.","consent.human.terms.processing":"The capture is checked to confirm that you are a real person who is present. It may be compared with faces already verified for this organization.","consent.human.terms.sharing":"The organization that requested this verification learns its outcome.","consent.human.terms.retention":"Your data is stored encrypted and kept only as long as the law and the organization's settings require. To exercise your data-protection rights, contact the organization that requested this verification.","capture.noCamera.title":"This step needs a camera","capture.noCamera.body":"Allow camera access and try again, or continue on a phone with a camera.","capture.noCamera.continue":"Continue without a camera","capture.noCamera.deniedTitle":"Allow camera access to continue","capture.noCamera.deniedBody":"Your browser blocked the camera for this page. Allow it in the site settings, then try again.","choice.title":"How do you want to continue?","choice.description":"Choose one option.","choice.switch":"Use another option","contact.title":"How do you want to get your code?","contact.description":"Choose one option.","contact.phone":"By phone (WhatsApp or SMS)","contact.email":"By email","contact.switch":"Use another option","summary.title":"Check your details","summary.description":"Make sure this is you before the live photo.","summary.fullName":"Full name","summary.birthDate":"Date of birth","summary.nationality":"Nationality","summary.documentType":"Document","summary.documentNumber":"Document number","summary.nni":"Mauritanian national ID number (NNI)","summary.id_number":"ID number","summary.expiryDate":"Expiry date","summary.portraitAlt":"Photo on record","summary.source.registry":"From the civil registry","summary.source.document":"Read from your document","summary.source.chip":"Read from your document's chip","summary.name":"Name","summary.birthYear":"Year of birth","summary.confirm":"Confirm and continue","summary.retakeDocument":"Scan my document again","summary.retakeNationalNumber":"Enter my number again","summary.noRetake":"You can't try again. Contact {org} if these details are wrong","capture.tipsIcao.title":"For your ID photo:","capture.tipsIcao.glasses":"Remove your glasses","capture.tipsIcao.headwear":"Remove hats and caps. A religious head covering is fine if your whole face shows","capture.tipsIcao.expression":"Keep a neutral expression with your mouth closed","capture.tipsIcao.faceCamera":"Look straight at the camera with your eyes open","capture.tipsIcao.background":"Stand in front of a plain, light background","capture.tipsIcao.lighting":"Use even light on your face: no shadows","capture.tipsIcao.hair":"Keep your hair away from your face and eyes","capture.tipsIcao.summary":"Stand in front of a plain, light wall with even light on your face. Remove your glasses and any hat. Keep your hair off your face, look straight at the camera with your eyes open, keep a neutral expression with your mouth closed, and hold still.","portrait.retakeOnly":"Your live check passed. Only the photo needs another try","portrait.keepCamera":"Stay in front of the camera","handoff.description":"Scan with your phone to continue","handoff.qrAlt":"QR code that opens this verification on your phone","handoff.copyLink":"Copy link","handoff.copyFailed":"We couldn't copy the link. Copy this page's address from your browser instead","handoff.waiting":"This page moves on by itself once you finish on your phone","inApp.title":"Open this page in your browser","inApp.description":"The camera doesn't work well inside this app. Open the link in Chrome or Safari to continue.","inApp.copyLink":"Copy link","inApp.copied":"Link copied. Paste it in your browser","inApp.copyFailed":"We couldn't copy the link. Copy this page's address instead","inApp.continueAnyway":"Continue here anyway"};var G={"consent.human.terms.intro":"Sekyro AI confirme qu'une personne réelle effectue cette étape, pour le compte de l'organisme qui l'a demandée.","consent.human.terms.data":"Sekyro AI recueille une courte capture de votre visage.","consent.human.terms.processing":"La capture est analysée pour confirmer que vous êtes une personne réelle et présente. Elle peut être comparée aux visages déjà vérifiés pour cet organisme.","consent.human.terms.sharing":"L'organisme qui a demandé cette vérification est informé de son résultat.","consent.human.terms.retention":"Vos données sont stockées chiffrées et conservées uniquement pendant la durée exigée par la loi et les paramètres de l'organisme. Pour exercer vos droits en matière de protection des données, contactez l'organisme qui a demandé cette vérification.","capture.noCamera.title":"Cette étape nécessite une caméra","capture.noCamera.body":"Autorisez l'accès à la caméra et réessayez, ou continuez sur un téléphone équipé d'une caméra.","capture.noCamera.continue":"Continuer sans caméra","capture.noCamera.deniedTitle":"Autorisez l'accès à la caméra pour continuer","capture.noCamera.deniedBody":"Votre navigateur a bloqué la caméra pour cette page. Autorisez-la dans les paramètres du site, puis réessayez.","choice.title":"Comment voulez-vous continuer ?","choice.description":"Choisissez une option.","choice.switch":"Utiliser une autre option","contact.title":"Comment voulez-vous recevoir votre code ?","contact.description":"Choisissez une option.","contact.phone":"Par téléphone (WhatsApp ou SMS)","contact.email":"Par e-mail","contact.switch":"Utiliser une autre option","summary.title":"Vérifiez vos informations","summary.description":"Assurez-vous qu'il s'agit bien de vous avant la photo en direct.","summary.fullName":"Nom complet","summary.birthDate":"Date de naissance","summary.nationality":"Nationalité","summary.documentType":"Document","summary.documentNumber":"Numéro du document","summary.nni":"Numéro national d'identification mauritanien (NNI)","summary.id_number":"Numéro d'identité","summary.expiryDate":"Date d'expiration","summary.portraitAlt":"Photo enregistrée","summary.source.registry":"Issu de l'état civil","summary.source.document":"Lu sur votre document","summary.source.chip":"Lu sur la puce de votre document","summary.name":"Nom","summary.birthYear":"Année de naissance","summary.confirm":"Confirmer et continuer","summary.retakeDocument":"Scanner à nouveau mon document","summary.retakeNationalNumber":"Saisir à nouveau mon numéro","summary.noRetake":"Vous ne pouvez plus réessayer. Contactez {org} si ces informations sont incorrectes","capture.tipsIcao.title":"Pour votre photo d'identité :","capture.tipsIcao.glasses":"Retirez vos lunettes","capture.tipsIcao.headwear":"Retirez chapeau et casquette. Un couvre-chef religieux est accepté si tout le visage est visible","capture.tipsIcao.expression":"Gardez une expression neutre, la bouche fermée","capture.tipsIcao.faceCamera":"Regardez la caméra bien en face, les yeux ouverts","capture.tipsIcao.background":"Placez-vous devant un fond uni et clair","capture.tipsIcao.lighting":"Éclairez votre visage de façon uniforme : sans ombres","capture.tipsIcao.hair":"Dégagez vos cheveux du visage et des yeux","capture.tipsIcao.summary":"Placez-vous devant un mur uni et clair, le visage éclairé de façon uniforme. Retirez vos lunettes et tout chapeau. Dégagez vos cheveux du visage, regardez la caméra bien en face, les yeux ouverts, gardez une expression neutre, la bouche fermée, et ne bougez plus.","portrait.retakeOnly":"Votre vérification en direct est validée. Seule la photo est à refaire","portrait.keepCamera":"Restez face à la caméra","handoff.description":"Scannez avec votre téléphone pour continuer","handoff.qrAlt":"Code QR qui ouvre cette vérification sur votre téléphone","handoff.copyLink":"Copier le lien","handoff.copyFailed":"Nous n'avons pas pu copier le lien. Copiez plutôt l'adresse de cette page depuis votre navigateur","handoff.waiting":"Cette page avancera d’elle-même une fois l’étape terminée sur votre téléphone","inApp.title":"Ouvrez cette page dans votre navigateur","inApp.description":"La caméra fonctionne mal dans cette application. Ouvrez le lien dans Chrome ou Safari pour continuer.","inApp.copyLink":"Copier le lien","inApp.copied":"Lien copié. Collez-le dans votre navigateur","inApp.copyFailed":"Impossible de copier le lien. Copiez plutôt l'adresse de cette page","inApp.continueAnyway":"Continuer ici quand même"};var D=[[10,[[1,16]]],[16,[[1,28]]],[26,[[1,44]]],[18,[[2,32]]],[24,[[2,43]]],[16,[[4,27]]],[18,[[4,31]]],[22,[[2,38],[2,39]]],[22,[[3,36],[2,37]]],[26,[[4,43],[1,44]]],[30,[[1,50],[4,51]]],[22,[[6,36],[2,37]]],[22,[[8,37],[1,38]]],[24,[[4,40],[5,41]]],[24,[[5,41],[5,42]]],[28,[[7,45],[3,46]]],[28,[[10,46],[1,47]]],[26,[[9,43],[4,44]]],[26,[[3,44],[11,45]]],[26,[[3,41],[13,42]]]],Q=D.length,re=0,L=m(e=>(D[e-1]?.[1]??[]).reduce((t,[n,o])=>t+n*o,0),"dataCapacity");function T(e,t){let n=0;for(let o=7;o>=0;o-=1)n=n<<1^(n>>>7)*285,n^=(t>>>o&1)*e;return n&255}m(T,"gfMul");function ae(e){let t=new Array(e).fill(0);t[e-1]=1;let n=1;for(let o=0;o<e;o+=1){for(let a=0;a<e;a+=1)t[a]=T(t[a],n),a+1<e&&(t[a]=t[a]^t[a+1]);n=T(n,2)}return t}m(ae,"rsDivisor");function ie(e,t){let n=t.map(()=>0);for(let o of e){let a=o^n.shift();n.push(0),t.forEach((i,s)=>{n[s]=n[s]^T(i,a)})}return n}m(ie,"rsRemainder");function se(e,t){let n=[],o=m((p,d)=>{for(let b=d-1;b>=0;b-=1)n.push(p>>>b&1)},"put");o(4,4),o(e.length,t<10?8:16);for(let p of e)o(p,8);let a=L(t)*8;o(0,Math.min(4,a-n.length)),o(0,(8-n.length%8)%8);let i=[];for(let p=0;p<n.length;p+=8)i.push(n.slice(p,p+8).reduce((d,b)=>d<<1|b,0));for(let p=236;i.length<L(t);p^=253)i.push(p);let[s,r]=D[t-1],c=ae(s),u=[],f=0;for(let[p,d]of r)for(let b=0;b<p;b+=1){let v=i.slice(f,f+d);f+=d,u.push({data:v,ec:ie(v,c)})}let h=[],y=Math.max(...u.map(p=>p.data.length));for(let p=0;p<y;p+=1)for(let d of u)p<d.data.length&&h.push(d.data[p]);for(let p=0;p<s;p+=1)for(let d of u)h.push(d.ec[p]);return h}m(se,"codewords");function ce(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=Math.ceil((e*4+4)/(t*2-2))*2,o=[6];for(let a=e*4+10;o.length<t;a-=n)o.splice(1,0,a);return o}m(ce,"alignmentPositions");var ue=[(e,t)=>(e+t)%2===0,e=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0],O=class O{constructor(t){this.size=t,this.dark=new Array(t*t).fill(!1),this.fixed=new Array(t*t).fill(!1)}set(t,n,o){this.dark[t*this.size+n]=o,this.fixed[t*this.size+n]=!0}get(t,n){return this.dark[t*this.size+n]===!0}};m(O,"Grid");var V=O;function le(e,t){let n=e.size;for(let i=0;i<n;i+=1)e.set(6,i,i%2===0),e.set(i,6,i%2===0);for(let[i,s]of[[3,3],[3,n-4],[n-4,3]])for(let r=-4;r<=4;r+=1)for(let c=-4;c<=4;c+=1){let u=i+r,f=s+c;if(u<0||u>=n||f<0||f>=n)continue;let h=Math.max(Math.abs(r),Math.abs(c));e.set(u,f,h!==2&&h!==4)}let o=ce(t),a=o.length-1;if(o.forEach((i,s)=>o.forEach((r,c)=>{if(!(s===0&&c===0||s===0&&c===a||s===a&&c===0))for(let u=-2;u<=2;u+=1)for(let f=-2;f<=2;f+=1)e.set(i+u,r+f,Math.max(Math.abs(u),Math.abs(f))!==1)})),W(e,0),t>=7){let i=t;for(let r=0;r<12;r+=1)i=i<<1^(i>>>11)*7973;let s=t<<12|i;for(let r=0;r<18;r+=1){let c=(s>>>r&1)===1,u=n-11+r%3,f=Math.floor(r/3);e.set(u,f,c),e.set(f,u,c)}}}m(le,"drawFunctionPatterns");function W(e,t){let n=e.size,o=re<<3|t,a=o;for(let r=0;r<10;r+=1)a=a<<1^(a>>>9)*1335;let i=(o<<10|a)^21522,s=m(r=>(i>>>r&1)===1,"bit");for(let r=0;r<=5;r+=1)e.set(r,8,s(r));e.set(7,8,s(6)),e.set(8,8,s(7)),e.set(8,7,s(8));for(let r=9;r<15;r+=1)e.set(8,14-r,s(r));for(let r=0;r<8;r+=1)e.set(8,n-1-r,s(r));for(let r=8;r<15;r+=1)e.set(n-15+r,8,s(r));e.set(n-8,8,!0)}m(W,"drawFormat");function me(e,t){let n=e.size,o=0;for(let a=n-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<n;i+=1)for(let s=0;s<2;s+=1){let r=a-s,u=(a+1&2)===0?n-1-i:i;e.fixed[u*n+r]!==!0&&(o<t.length*8&&(e.dark[u*n+r]=(t[o>>>3]>>>7-(o&7)&1)===1),o+=1)}}}m(me,"placeData");function pe(e,t){let n=ue[t];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.fixed[o*e.size+a]!==!0&&n(o,a)&&(e.dark[o*e.size+a]=!e.dark[o*e.size+a])}m(pe,"applyMask");function de(e){let t=e.size,n=0,o=m(i=>{let s=1;for(let r=1;r<=t;r+=1)r<t&&i(r)===i(r-1)?s+=1:(s>=5&&(n+=3+(s-5)),s=1);for(let r=0;r+10<t;r+=1){let c=[!0,!1,!0,!0,!0,!1,!0];if(!(c.every((y,p)=>i(r+p)===y)||c.every((y,p)=>i(r+4+p)===y)))continue;let f=[0,1,2,3].every(y=>!i(r+y))&&c.every((y,p)=>i(r+4+p)===y),h=c.every((y,p)=>i(r+p)===y)&&[7,8,9,10].every(y=>!i(r+y));f&&(n+=40),h&&(n+=40)}},"line");for(let i=0;i<t;i+=1)o(s=>e.get(i,s));for(let i=0;i<t;i+=1)o(s=>e.get(s,i));for(let i=0;i+1<t;i+=1)for(let s=0;s+1<t;s+=1){let r=e.get(i,s);r===e.get(i,s+1)&&r===e.get(i+1,s)&&r===e.get(i+1,s+1)&&(n+=3)}let a=e.dark.filter(Boolean).length;return n+=Math.floor(Math.abs(a*20-t*t*10)/(t*t))*10,n}m(de,"penalty");function j(e,t={}){let n=new TextEncoder().encode(e),o=1;for(;o<=Q&&!(4+(o<10?8:16)+n.length*8<=L(o)*8);o+=1);if(o>Q)throw new RangeError("text too long for a QR code");let a=se(n,o),i=m(c=>{let u=new V(o*4+17);return le(u,o),me(u,a),pe(u,c),W(u,c),u},"build"),s=null;if(t.mask!==void 0)s=i(t.mask);else{let c=Number.POSITIVE_INFINITY;for(let u=0;u<8;u+=1){let f=i(u),h=de(f);h<c&&(c=h,s=f)}}let r=s;return{size:r.size,get:m((c,u)=>r.get(c,u),"get")}}m(j,"encodeQr");function X(e,t=4){let n=[];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.get(o,a)&&n.push(`M${a+t} ${o+t}h1v1h-1z`);return{size:e.size+t*2,d:n.join("")}}m(X,"qrPath");import{Fragment as Ce,jsx as l,jsxs as k}from"react/jsx-runtime";var he={en:A,fr:G,ar:$,es:A,pt:A,de:A},Z={en:I,fr:H,ar:E,es:I,pt:I,de:I};function g(e){let t=e.strings;return(n,o)=>P(t[n]??he[e.locale][n]??"",o)}m(g,"flowT");function ee(e,t){let n=g(t);return e.flatMap(o=>{let a=o.service==="phone_otp"?n("contact.phone"):o.service==="email_otp"?n("contact.email"):R(o,t),i=U[o.service];return a===null?[]:[{id:o.id,label:a,...i!==void 0?{glyph:l(K,{name:i})}:{}}]})}m(ee,"labelled");function te({step:e,i18n:t,onError:n}){let o=g(t),{busy:a,error:i,run:s}=N(t,n),r=e.kind==="contact_choice";return l(M,{title:o(r?"contact.title":"choice.title"),description:o(r?"contact.description":"choice.description"),options:ee(e.choice.options,t),busy:a,error:i,focus:!0,testId:r?"sekyro-contact-choice":"sekyro-choice",onChoose:c=>s(()=>e.choose(c))})}m(te,"PlanChoiceView");var Ge=te,Qe=te;function We({step:e,i18n:t,onError:n,onOpen:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e,u=e.context.switchable,f=u===void 0?[]:u.options.filter(v=>v.id!==u.current),h=c.kind==="registry"&&(c.reason==="nni_not_found"||c.reason==="registry_record_not_found")&&c.canUseDocument||c.kind==="eid"&&c.reason?.startsWith("eid_")&&c.canUseCamera,y=f.length===1?f[0]:void 0,p=y!==void 0&&(y.service==="phone_otp"||y.service==="email_otp"),d=p&&c.canSwitch&&c.switchTo!==void 0?()=>c.switchTo.call(e):c.chooseOption===void 0||y===void 0?void 0:()=>c.chooseOption.call(e,y.id);if(f.length===0||h||y!==void 0&&(d===void 0||b()===null)||y===void 0&&c.chooseOption===void 0)return null;function b(){return y===void 0?a("choice.switch"):y.service==="phone_otp"||y.service==="email_otp"?a("contact.switch"):c.kind==="registry"&&y.service==="document"?t.t("population.useDocument"):c.kind==="eid"?t.strings["eid.useCamera"]??Z[t.locale]["eid.useCamera"]:R(y,t)}return m(b,"labelOf"),k("div",{className:"sekyro-stack sekyro-stack--1",children:[s!==null?l(x,{tone:"danger",children:l("span",{children:s})}):null,l(w,{kind:"ghost",disabled:i,"aria-busy":i||void 0,onClick:()=>d===void 0?o():r(d),"data-testid":p?"sekyro-contact-switch":"sekyro-lane-switch",children:b()})]})}m(We,"LaneSwitch");function je({step:e,i18n:t,onError:n,onClose:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e.context.switchable,u=e.chooseOption;return c===void 0||u===void 0?null:l(M,{title:a("choice.title"),description:a("choice.description"),options:ee(c.options,t),...c.current!==null?{marked:c.current}:{},busy:i,error:s,focus:!0,testId:"sekyro-lane-choice",onChoose:f=>f===c.current?o():r(()=>u.call(e,f))})}m(je,"LaneChoiceView");var be=[["fullName","summary.fullName",!1],["birthDate","summary.birthDate",!0],["birthYear","summary.birthYear",!0],["nationality","summary.nationality",!0],["documentType","summary.documentType",!1],["documentNumberMasked","summary.documentNumber",!0],["idNumberMasked","summary.id_number",!0],["expiryDate","summary.expiryDate",!0]];function ke(e){let[t,n]=_(null);return q(()=>{if(!e.portraitAvailable)return;let o=!0,a=null;return e.portrait().then(i=>{!o||i===null||!i.type.startsWith("image/")||typeof URL.createObjectURL!="function"||(a=URL.createObjectURL(i),n(a))}),()=>{o=!1,a!==null&&URL.revokeObjectURL(a)}},[e.portraitAvailable]),t}m(ke,"usePortraitUrl");function Xe({step:e,i18n:t,onError:n}){let o=g(t),a=F(),i=S(),s=ke(e),{busy:r,error:c,run:u}=N(t,n),f=e.context.orgName,h=["registry","document","chip"].find(d=>d===e.source),y=e.summaryKind==="partial",p=m(d=>t.strings[`doc.type.${d}`]??d,"documentLabel");return k("section",{className:"sekyro-stack sekyro-stack--4","aria-labelledby":a,"data-testid":"sekyro-identity-summary",children:[k("div",{className:"sekyro-stack sekyro-stack--1",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("summary.title")}),l("p",{className:"sekyro-text-muted",children:o("summary.description")}),h!==void 0?l("p",{className:"sekyro-text-muted",children:o(`summary.source.${h}`)}):null]}),k("div",{className:"sekyro-summary",children:[s!==null?l("img",{className:"sekyro-summary__portrait",src:s,alt:o("summary.portraitAlt")}):null,l("dl",{className:"sekyro-summary__list",children:be.map(([d,b,v])=>{let z=d==="idNumberMasked"?e.idNumberMasked??e.nniMasked:e[d];return z===void 0?null:k("div",{className:"sekyro-summary__row",children:[l("dt",{className:"sekyro-text-muted",children:o(d==="fullName"&&y?"summary.name":b)}),l("dd",{children:v?l("bdi",{dir:"ltr",children:z}):d==="documentType"?p(z):z})]},d)})})]}),c!==null?l(x,{tone:"danger",children:l("span",{children:c})}):null,k("div",{className:"sekyro-stack sekyro-stack--3",children:[l(w,{full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>u(()=>e.confirm()),children:o("summary.confirm")}),e.retakeAvailable?l(w,{kind:"ghost",full:!0,disabled:r,onClick:()=>u(()=>e.retake()),children:o(e.retakeTarget==="national_number"?"summary.retakeNationalNumber":"summary.retakeDocument")}):l("p",{className:"sekyro-text-muted",children:o("summary.noRetake",{org:f})})]})]})}m(Xe,"IdentitySummaryView");var ge=["glasses","headwear","expression","faceCamera","background","lighting","hair"];function Je({step:e,i18n:t,livenessProps:n,sekyroIntro:o}){let a=g(t),[i,s]=_(null);q(()=>e.onLivePhoto(d=>{let b=d.update?.coach;s(d.holding||b===void 0?null:t.t(`portrait.coach.${b}`))}),[e,t]);let r=e.instructions==="icao",c=e.icao?.profile==="selfie",u=C(()=>r?ge.filter(d=>!c||d!=="background").map(d=>({id:d,text:a(`capture.tipsIcao.${d}`)})):void 0,[r,c,t]),f=C(()=>r&&!c?{...n.strings,"capture.tips.title":a("capture.tipsIcao.title")}:n.strings,[r,c,n.strings,t]),h=c?void 0:a("capture.tipsIcao.title"),y=C(()=>o===!0&&u!==void 0?{...n.slots,intro:m((d,b)=>l(Y,{start:d,context:b,tips:u,...h!==void 0?{tipsTitle:h}:{}}),"intro")}:n.slots,[o,u,h,n.slots,t]),p=c?`${(u??[]).map(d=>d.text).join(". ")}.`:a("capture.tipsIcao.summary");return l(B,{...n,...y!==void 0?{slots:y}:{},...f!==void 0?{strings:f}:{},...u!==void 0?{tips:u,tipsSummary:p}:{},coach:i})}m(Je,"LivePhotoLiveness");function Ze({i18n:e}){let t=g(e);return k(x,{tone:"info",children:[l("strong",{children:t("portrait.retakeOnly")}),l("span",{children:t("portrait.keepCamera")})]})}m(Ze,"PortraitRetakeNotice");function et({i18n:e,provider:t}){let n=e.strings,o=m(a=>n[a]??Z[e.locale][a]??"","pick");return l("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:t?P(o("eid.continueHint"),{provider:t}):o("eid.continueHintGeneric")})}m(et,"EidContinueHint");async function we(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}m(we,"copy");function oe({url:e,i18n:t,label:n}){let o=g(t),[a,i]=_("idle"),s=n.startsWith("inApp.")?"inApp":"handoff";return k("div",{className:"sekyro-stack sekyro-stack--1",children:[l(w,{kind:"ghost",onClick:()=>{we(e).then(r=>i(r?"copied":"failed"))},children:o(n)}),l("p",{role:"status","aria-live":"polite",className:"sekyro-text-muted",children:a==="idle"?"":o(`${s}.${a==="copied"?"copied":"copyFailed"}`)})]})}m(oe,"CopyLink");function ne({url:e,i18n:t,refresh:n,footer:o}){let a=g(t),i=F(),s=C(()=>{try{return X(j(e))}catch{return null}},[e]),r=ye(n);r.current=n;let c=S();return q(()=>{let u=setInterval(()=>{(typeof document>"u"||document.visibilityState!=="hidden")&&r.current?.().catch(()=>{})},5e3);return()=>clearInterval(u)},[]),k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":i,"data-testid":"sekyro-handoff",children:[l("h2",{id:i,ref:c,tabIndex:-1,className:"sekyro-text-body",children:t.t("handoff.title")}),l("p",{className:"sekyro-text-muted",children:a("handoff.description")}),s!==null?k("svg",{className:"sekyro-qr",viewBox:`0 0 ${s.size} ${s.size}`,role:"img","aria-label":a("handoff.qrAlt"),shapeRendering:"crispEdges",children:[l("rect",{width:s.size,height:s.size,className:"sekyro-qr__bg"}),l("path",{d:s.d,className:"sekyro-qr__fg"})]}):null,l(oe,{url:e,i18n:t,label:"handoff.copyLink"}),l("p",{className:"sekyro-text-muted",children:a("handoff.waiting")}),o??null]})}m(ne,"HandoffView");var ve=["intro","data","processing","sharing","retention"];function tt({i18n:e}){let t=g(e);return l(Ce,{children:ve.map(n=>l("p",{children:t(`consent.human.terms.${n}`)},n))})}m(tt,"HumanConsentTerms");function ot({url:e,i18n:t}){return C(()=>!J(),[])?l(ne,{url:e,i18n:t}):null}m(ot,"DesktopHandoffView");function nt({i18n:e,cause:t,onRetry:n,onContinue:o,handoffUrl:a}){let i=g(e),s=F(),r=S(),[c,u]=_("idle"),f=C(()=>a!==void 0&&!J(),[a]),h=t==="denied",y=m(()=>{o!==void 0&&(u("busy"),o(t).then(()=>u("idle"),p=>u(p instanceof fe&&p.code==="check_out_of_order"?"idle":"failed")))},"end");return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":s,"data-testid":"sekyro-no-camera","data-cause":t,children:[f&&a!==void 0?l(ne,{url:a,i18n:e}):null,l("h2",{id:s,ref:r,tabIndex:-1,className:"sekyro-text-body",children:i(h?"capture.noCamera.deniedTitle":"capture.noCamera.title")}),l("p",{className:"sekyro-text-muted",children:i(h?"capture.noCamera.deniedBody":"capture.noCamera.body")}),c==="failed"?l(x,{tone:"danger",children:l("span",{children:e.t("errors.network_error")})}):null,l(w,{kind:h?"primary":"ghost",onClick:n,children:e.t("common.retry")}),o!==void 0?l(w,{kind:"ghost",disabled:c==="busy","aria-busy":c==="busy"||void 0,onClick:y,children:i("capture.noCamera.continue")}):null]})}m(nt,"NoCameraView");function rt({url:e,i18n:t,onContinue:n}){let o=g(t),a=F(),i=S();return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":a,"data-testid":"sekyro-in-app",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("inApp.title")}),l("p",{className:"sekyro-text-muted",children:o("inApp.description")}),l(oe,{url:e,i18n:t,label:"inApp.copyLink"}),l(w,{kind:"ghost",onClick:n,children:o("inApp.continueAnyway")})]})}m(rt,"InAppBrowserPrompt");export{Ge as ContactChoiceView,ot as DesktopHandoffView,et as EidContinueHint,Qe as GenericChoiceView,ne as HandoffView,tt as HumanConsentTerms,Xe as IdentitySummaryView,rt as InAppBrowserPrompt,je as LaneChoiceView,We as LaneSwitch,Je as LivePhotoLiveness,nt as NoCameraView,Ze as PortraitRetakeNotice};