@sekyro/react 0.1.0-rc.7 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +18 -7
- package/dist/{chunk-Q232JYNO.js → chunk-2CJEADGY.js} +1 -1
- package/dist/{chunk-63NUMQST.js → chunk-2PGJ7P7E.js} +1 -1
- package/dist/chunk-36RC3M4K.js +2 -0
- package/dist/{chunk-AMOZXMUP.js → chunk-4ENKV24I.js} +1 -1
- package/dist/{chunk-4INDRENU.js → chunk-5JPJXBN6.js} +1 -1
- package/dist/{chunk-ADMDZLPM.js → chunk-COU4Y3DB.js} +1 -1
- package/dist/chunk-H2KIOYQU.js +2 -0
- package/dist/{chunk-BENNJ4GV.js → chunk-LZU57LVO.js} +1 -1
- package/dist/chunk-OSS4NHIS.js +2 -0
- package/dist/chunk-PXRIFHY2.js +2 -0
- package/dist/{chunk-P2LX7BBE.js → chunk-R2D6V2R6.js} +1 -1
- package/dist/chunk-Y4PPDNQR.js +2 -0
- package/dist/chunk-ZTN4YV7S.js +2 -0
- package/dist/chunk-ZVSRJKQE.js +2 -0
- package/dist/document-capture-view-IAVBLXBO.js +2 -0
- package/dist/eid-view-FK54R7ER.js +2 -0
- package/dist/email-otp-view-ZVXSJMN5.js +2 -0
- package/dist/flow-views-5VR7NLTE.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/portrait-capture-view-FYUOQWF7.js +2 -0
- package/dist/{theme-BpOuzcWh.d.ts → theme-7Jj6eSH6.d.cts} +25 -8
- package/dist/{theme-BpOuzcWh.d.cts → theme-7Jj6eSH6.d.ts} +25 -8
- package/dist/verification/index.cjs +1 -1
- package/dist/verification/index.d.cts +4 -1
- package/dist/verification/index.d.ts +4 -1
- package/dist/verification/index.js +1 -1
- package/dist/verification.css +2 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/chunk-3MBJZSJL.js +0 -2
- package/dist/chunk-4RUZQW5T.js +0 -2
- package/dist/chunk-5SVCGLYS.js +0 -2
- package/dist/chunk-65JA6YKG.js +0 -2
- package/dist/chunk-B43EDVOK.js +0 -2
- package/dist/chunk-QZAPVO6F.js +0 -2
- package/dist/chunk-YUNPD6ZB.js +0 -2
- package/dist/document-capture-view-PT732PJ2.js +0 -2
- package/dist/eid-view-RFSXIECL.js +0 -2
- package/dist/email-otp-view-3WZH74UT.js +0 -2
- package/dist/flow-views-N6KYXL4N.js +0 -2
- package/dist/portrait-capture-view-HYOEOAF4.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as Yt,c as Zt}from"./chunk-36RC3M4K.js";import{a as n,b as G,f as Ht,g as Gt,h as qt,i as Dt,j as jt,k as $t,l as zt,m as F,n as D,o as Ge}from"./chunk-PXRIFHY2.js";import{useId as nr}from"react";import{Fragment as tr,jsx as R,jsxs as Y}from"react/jsx-runtime";function Z({className:e,children:t}){return R("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(Z,"Svg");var st="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 Wt(e){return Y(Z,{...e,children:[R("circle",{cx:"12",cy:"12",r:"4"}),R("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(Wt,"SunIcon");function Qt(e){return Y(Z,{...e,children:[R("circle",{cx:"12",cy:"12",r:"9"}),R("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(Qt,"FaceUncoveredIcon");function Jt(e){return Y(Z,{...e,children:[R("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),R("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),R("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(Jt,"PhoneEyeLevelIcon");function Xt(e){return Y(Z,{...e,children:[R("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"}),R("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(Xt,"LookStraightIcon");function en(e){return Y(Z,{...e,children:[R("path",{d:st}),R("path",{d:"M9 13l2 2 4-4"})]})}n(en,"CameraCheckIcon");function tn(e){return Y(Z,{...e,children:[R("path",{d:st}),R("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(tn,"CameraAskIcon");function nn(e){return Y(Z,{...e,children:[R("path",{d:st}),R("path",{d:"M3 3l18 18"})]})}n(nn,"CameraBlockedIcon");function he({off:e,className:t}){return Y(Z,{className:t,children:[R("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?R("path",{d:"M4 4l16 16"}):Y(tr,{children:[R("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),R("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(he,"SpeakerIcon");function rn(e){return R(Z,{...e,children:R("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(rn,"CheckIcon");function on(e){return Y(Z,{className:e.className??"sekyro-spinner",children:[R("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),R("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(on,"SpinnerIcon");import{jsx as oe,jsxs as sn}from"react/jsx-runtime";var qe=["light","uncover","eyeLevel","straight"],rr={light:{key:"capture.tips.light",icon:n(()=>oe(Wt,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>oe(Qt,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>oe(Jt,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>oe(Xt,{}),"icon")}};function an({tips:e}){let t=F(),s=nr();return e.length===0?null:sn("section",{className:"sekyro-tips","aria-labelledby":s,"data-testid":"sekyro-tips",children:[oe("p",{className:"sekyro-tips__title",id:s,children:t("capture.tips.title")}),oe("ul",{className:"sekyro-tips__list",children:e.map(o=>{let r=typeof o=="string"?rr[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 sn("li",{className:"sekyro-tips__item",children:[l!=null?oe("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,oe("span",{children:p})]},a)})})]})}n(an,"TipList");import{useEffect as cn,useId as or,useRef as sr,useState as ir}from"react";import{jsx as W,jsxs as De}from"react/jsx-runtime";var ar=220;function ln({title:e,description:t,options:s,busy:o,error:r,focus:a,testId:l,look:p="cards",marked:C,onChoose:S}){let M=or(),I=Ge(),[h,c]=ir(null),m=sr(null);cn(()=>{r!==null&&c(null)},[r]),cn(()=>()=>{m.current!==null&&clearTimeout(m.current)},[]);let g=n(d=>{o||h!==null||(c(d),m.current=setTimeout(()=>{m.current=null,c(null),S(d)},ar))},"choose");return De("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":M,"data-testid":l,children:[De("div",{className:"sekyro-stack sekyro-stack--1",children:[W("h2",{id:M,ref:a?I:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?W("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?W(D,{tone:"danger",children:W("span",{children:r})}):null,p==="buttons"?W("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((d,w)=>W(G,{kind:w===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>S(d.id),children:d.label},d.id))}):W("div",{className:"sekyro-choices",children:s.map(d=>De("button",{type:"button",className:"sekyro-card","aria-pressed":(h??C)===d.id,"aria-busy":o||void 0,disabled:o||h!==null&&h!==d.id,onClick:()=>g(d.id),children:[d.glyph,De("span",{className:"sekyro-card__body",children:[W("span",{className:"sekyro-card__title",children:d.label}),d.sub!==void 0?W("span",{className:"sekyro-card__sub",children:d.sub}):null]}),W("span",{className:"sekyro-radio","aria-hidden":"true"})]},d.id))})]})}n(ln,"ChoiceScreen");var je=["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 ue(e){return e!==null&&je.includes(e)}n(ue,"isVoiceKey");import{useCallback as J,useEffect as de,useLayoutEffect as dr,useMemo as pr,useRef as ke,useState as Ee}from"react";var cr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function ve(e,t,s){let o;try{if(typeof e=="function")o=e(t,s);else{let r=e[s];o=r!=null&&cr(r,t)?r[t]:null}}catch{return null}return typeof o=="string"&&o!==""?o:null}n(ve,"resolveClip");var lr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",pn={ar:"ar-SA",fr:"fr-FR",en:"en-US"};function Q(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}n(Q,"synth");function ur(){return Q()!==null&&typeof SpeechSynthesisUtterance=="function"}n(ur,"speechAvailable");function un(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(un,"baseLang");function fn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=un(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>un(r.lang)===o)}n(fn,"pickVoice");function yn(e){if(!ur())return!1;let t=[];try{t=Q()?.getVoices()??[]}catch{return!0}return t.length===0||fn(t,e)!==void 0}n(yn,"speechUsable");function mn(e){let t=Q();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(mn,"subscribeVoices");function Ne(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(Ne,"clipIdentity");function dn(e){e.pause(),e.removeAttribute("src"),e.load()}n(dn,"release");function gn(){let e=null,t=null,s=0,o=null,r=[],a=new Map,l=n(()=>{r=Q()?.getVoices()??[]},"loadVoices"),p=!1,C=n(()=>{let c=Q();p||c===null||(p=!0,l(),c.addEventListener?.("voiceschanged",l))},"bindVoices"),S=n(()=>(e??(e=new Audio),e),"element"),M=n((c,m,g)=>{let d=Q();if(d!==null&&c!==""&&typeof SpeechSynthesisUtterance=="function"){C();let w=fn(r,m);if(r.length===0||w!==void 0){d.cancel();let f=new SpeechSynthesisUtterance(c);f.lang=m,w!==void 0&&(f.voice=w),f.rate=.95,g!==void 0&&(f.onend=f.onerror=g),d.speak(f);return}}g?.()},"speak"),I=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),Q()?.cancel()},"stop"),h=n(c=>{for(let m of c){let g=Ne(m);if(a.has(g))continue;let d=new Audio;d.preload="auto",d.src=m,a.set(g,d)}},"warmClips");return{say(c){let m=c.url!==null?Ne(c.url):`tts:${c.lang}:${c.text}`;if(m===o)return;o=m,s+=1;let g=s,d=c.onEnd,w=d!==void 0?()=>{g===s&&d()}:void 0;if(Q()?.cancel(),c.url!==null){let f=S();f.pause(),f.muted=!1,f.src=c.url,f.currentTime=0,f.onended=w??null,f.play()?.catch(V=>{g===s&&V?.name!=="AbortError"&&(c.speech?M(c.text,c.lang,w):w?.())});return}c.speech?M(c.text,c.lang,w):w?.()},unlock({lang:c,speech:m,prefetch:g}){let d=S();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let V=Uint8Array.from(atob(lr),x=>x.charCodeAt(0));t=URL.createObjectURL(new Blob([V],{type:"audio/wav"}))}let w=d.paused===!1&&t!==null&&d.src!==t;t!==null&&!w&&(d.muted=!0,d.onended=null,d.src=t,d.play()?.catch(()=>{}));let f=Q();if(m&&f!==null&&typeof SpeechSynthesisUtterance=="function"){C();let V=new SpeechSynthesisUtterance(" ");V.volume=0,V.lang=c,f.speak(V)}h(g??[])},prefetch:h,stop:I,dispose(){I(),p&&Q()?.removeEventListener?.("voiceschanged",l),p=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&dn(e),e=null;for(let c of a.values())dn(c);a.clear()}}}n(gn,"createVoicePlayer");var hn="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 kn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(kn,"writeVoicePreference");var Pe="capture.tips.summary",fr=typeof window<"u"?dr:de,yr=Object.freeze({});function it(e,t){let s=new Set,o=[];for(let r of je){let a=r===Pe?null:ve(e,r,t);a===null||s.has(Ne(a))||(s.add(Ne(a)),o.push(a))}return o}n(it,"resolvedClipUrls");function at({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},a=r.storageKey===void 0?hn:r.storageKey,[l,p]=Ee(r.defaultEnabled??!0),C=ke(l),[S,M]=Ee(!1),[I,h]=Ee("none"),[c,m]=Ee(!1),g=ke(!1),[d,w]=Ee(0),f=ke(null),V=J(()=>(f.current??(f.current=gn()),f.current),[]),x=pn[e],y=r.speechFallback,N=y===void 0||y===!0?!0:y===!1?!1:y.includes(e),T=r.clips??t??yr,B=ke(!1),i=ke(T);fr(()=>{i.current=T,C.current=l}),de(()=>{if(o||a===null)return;let k=vn(a);k!==null&&(C.current=k,p(k))},[o,a]),de(()=>{if(!(o||!N))return mn(()=>w(k=>k+1))},[o,N]);let P=r.clips;de(()=>{if(o)return;let k=N&&yn(x);M(it(T,e).length>0||k),h(P!==void 0&&ve(P,Pe,e)!==null?"partner":ve(T,Pe,e)!==null||k?"default":"none")},[o,T,P,e,N,x,d]),de(()=>{if(o||!l||!B.current)return;let k=it(T,e);k.length>0&&V().prefetch(k)},[o,l,T,e,V]),de(()=>()=>{f.current?.dispose(),f.current=null,B.current=!1},[]);let v=J(k=>{o||(B.current=!0,V().unlock({lang:x,speech:N,...k?{prefetch:it(i.current,e)}:{}}))},[o,V,x,N,e]),$=J(()=>v(C.current),[v]),_=J(()=>{g.current=!1,m(!1)},[]),q=J(()=>{_(),f.current?.stop()},[_]),ie=J(()=>{g.current&&q()},[q]),H=J((k,ae)=>{if(o)return;if(g.current){q();return}let u=V();u.stop(),g.current=!0,m(!0);let fe=ae?.clip===!1?null:ve(i.current,Pe,e);u.say({url:fe,text:k,lang:x,speech:N,onEnd:_})},[o,q,V,e,x,N,_]),E=J(k=>{o||(k?v(!0):q(),a!==null&&kn(a,k),C.current=k,p(k))},[o,v,q,a]),K=J(()=>E(!C.current),[E]),A=J((k,ae)=>{if(o||!l)return;g.current&&_();let u=ve(i.current,k,e);V().say({url:u,text:ae,lang:x,speech:N})},[o,l,e,V,x,N,_]);return pr(()=>({supported:!o&&S,enabled:!o&&l,setEnabled:E,toggle:K,unlock:$,speakKey:A,stop:q,summary:o?"none":I,summaryPlaying:c,toggleSummary:H,stopSummary:ie}),[o,S,l,E,K,$,A,q,I,c,H,ie])}n(at,"useVoiceGuidance");function ct(e,t,s,o){let{speakKey:r,stop:a,enabled:l}=e,p=ke(!1);de(()=>{if(!o||!l){p.current&&a(),p.current=!1;return}p.current=!0,ue(t)&&t!==Pe&&s!==""&&r(t,s)},[o,l,t,s,r,a])}n(ct,"useSpeakGuidance");import{isValidElement as Gr,useCallback as We,useContext as qr,useEffect as se,useMemo as Re,useRef as pe,useState as jn}from"react";import{useEffect as mr,useRef as gr}from"react";import{jsx as be,jsxs as lt}from"react/jsx-runtime";function bn({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=F(),a=gr(null);return mr(()=>{s&&a.current?.focus()},[s]),!e&&!s?null:lt("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?lt("div",{className:"sekyro-stack sekyro-stack--1",children:[be("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),lt("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(G,{ref:a,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(bn,"CapturedPanel");function $e(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n($e,"isDevBuild");import{createContext as hr}from"react";var Cn=hr(null);import{useCallback as wn,useEffect as Mn,useRef as Ce}from"react";import{useId as vr}from"react";import{jsx as ze,jsxs as ut}from"react/jsx-runtime";var kr=["user","environment"];function Sn({value:e,onChange:t}){let s=F(),o=vr();return ut("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:kr.map(r=>ut("label",{className:"sekyro-segmented__option",children:[ze("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),ut("span",{className:"sekyro-segmented__face",children:[ze("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(Sn,"FacingPicker");import{useEffect as br,useState as Cr}from"react";import{jsx as _e,jsxs as Sr}from"react/jsx-runtime";function Vn({state:e}){let t=F(),[s,o]=Cr(!1);br(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?_e(en,{}):e==="denied"?_e(nn,{}):_e(tn,{});return Sr("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[_e("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),_e("span",{children:t(`capture.permission.${e}`)})]})}n(Vn,"PermissionRow");import{jsx as Ye,jsxs as Rn}from"react/jsx-runtime";function Ln({voice:e}){let t=F();if(!e.supported)return null;let s=e.enabled;return Rn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[Rn("span",{className:"sekyro-switch__label",children:[Ye(he,{off:!s}),t("capture.voiceGuidance")]}),Ye("span",{className:"sekyro-switch__track","aria-hidden":"true",children:Ye("span",{className:"sekyro-switch__thumb",children:s?Ye(rn,{className:"sekyro-switch__check"}):null})})]})}n(Ln,"VoiceSwitch");import{Fragment as Rr,jsx as U,jsxs as Se}from"react/jsx-runtime";function In({assets:e,onRetryAssets:t,permission:s,captureMode:o="self",canChooseFacing:r,facing:a,onFacingChange:l,voice:p,tips:C,summary:S,startLabel:M,startDisabled:I,onStart:h}){let c=F(),m=Ce(S?.stop);m.current=S?.stop,Mn(()=>()=>m.current?.(),[]);let g=Ce(null),d=Ce(null),w=Ce(null),f=Ce(e),V=Ce(!1);Mn(()=>{let P=f.current;if(f.current=e,P===e)return;let v=V.current;e!=="loading"&&(V.current=!1),Vr(g.current)&&(e==="failed"?w.current?.focus():v&&d.current?.focus())},[e]);let x=wn(()=>{V.current=!0,t()},[t]),y=e==="loading",N=y||I,T=wn(()=>{N||(m.current?.(),h())},[N,h]),B;e==="failed"?B=Se(D,{tone:"danger",testId:"sekyro-assets-error",children:[U("p",{className:"sekyro-text-body",children:c("fcv2.err.models")}),U(G,{kind:"ghost",ref:w,className:"sekyro-btn--start",onClick:x,"data-testid":"sekyro-assets-retry",children:c("common.retry")})]}):B=Se("div",{className:"sekyro-stack sekyro-stack--1",children:[U(G,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":N?"true":void 0,"aria-busy":y?"true":void 0,onClick:T,children:y?Se(Rr,{children:[U(on,{}),c("capture.preparing.title")]}):M??c("capture.start")}),y?U("p",{className:"sekyro-text-muted",children:c("capture.preparing.hint")}):null]});let i=o==="assisted";return Se("div",{ref:g,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[i?Se("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[U("h2",{className:"sekyro-text-body",children:c("capture.assisted.title")}),U("p",{className:"sekyro-text-muted",children:c("capture.assisted.lead")})]}):null,C!==!1?U(an,{tips:C}):null,S!==void 0?Se(G,{kind:"ghost",className:"sekyro-btn--start",onClick:S.toggle,"data-testid":"sekyro-tips-listen",children:[U(he,{off:!1}),c(S.playing?"capture.tips.stop":"capture.tips.listen")]}):null,U(Vn,{state:s}),i&&r?U(Sn,{value:a,onChange:l}):null,U(Ln,{voice:p}),U("p",{className:"sekyro-text-muted",children:c("capture.securityNote")}),B,U("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(In,"PreCaptureScreen");function Vr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(Vr,"focusIsOurs");import{useEffect as dt,useState as pt}from"react";function xn(e){return En(e,"mobileRequired")}n(xn,"useMobileRequired");function Nn(e){return En(e,"returning").required}n(Nn,"useReturning");function En(e,t){let[s,o]=pt({required:!1,settled:e===void 0});return dt(()=>{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(En,"useFlag");function Pn(e){let[t,s]=pt({mode:"self",settled:e===void 0});return dt(()=>{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(Pn,"useCaptureMode");function _n(e){let[t,s]=pt(!1);return dt(()=>{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(_n,"useBusy");import{getLivenessAssetsStatus as Lr,preloadLivenessAssets as wr,subscribeLivenessAssets as Mr}from"@sekyro/web";import{useCallback as ft,useEffect as An,useRef as Tn,useState as Ir,useSyncExternalStore as xr}from"react";var Nr=n(()=>"idle","serverSnapshot");function Kn(e){return wr(e!==void 0?{assetBaseUrl:e}:{})}n(Kn,"preload");function On(e,t=!0){let s=xr(ft(I=>Mr(I,e),[e]),()=>Lr(e),Nr),[o,r]=Ir(null),a=Tn(!1),l=ft(()=>{Kn(e).then(I=>{a.current&&I==="idle"&&r({base:e})})},[e]);An(()=>(a.current=!0,l(),()=>{a.current=!1}),[l]);let p=Tn(null);An(()=>{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=ft(()=>{Kn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:C}}n(On,"useLivenessAssets");import{createLivenessCapture as Er}from"@sekyro/web";import{useCallback as yt,useEffect as Pr,useRef as Ve,useState as X}from"react";var Fn={progress:0,hint:null,faceDetected:!1};function Un(e){let{videoRef:t,assetBaseUrl:s}=e,r=Ve(e.verification).current,a=Ve(!1);e.verification!==r&&!a.current&&$e()&&(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=Ve(null),[p,C]=X("idle"),[S,M]=X(Fn),[I,h]=X(!1),[c,m]=X(!1),[g,d]=X(null),[w,f]=X(!1),[V,x]=X(null),[y,N]=X(null),[T,B]=X(null),[i,P]=X(null),v=Ve(null),$=Ve("idle"),_=Ve(e);_.current=e,Pr(()=>{let E=t.current;if(E===null)return;let K={video:E,...s!==void 0?{assetBaseUrl:s}:{}},A=r!==void 0?r.liveness(K):Er(K);l.current=A;let k=n(()=>P(A.facingMode??null),"readFacing");k();let ae=[A.on("state",u=>{u==="starting"?(x(null),N(null),M(Fn),m(!1),h(!1),d(null),v.current=null):u==="gating"&&$.current==="recording"&&(m(!1),h(!1),d(null),v.current=null),$.current=u,k(),C(u),_.current.onStateChange?.(u)}),A.on("gate",u=>{let fe=v.current;v.current=u.progress,h(fe!==null&&u.progress<fe-.001&&u.progress>0&&u.progress<1),u.progress>=1&&m(!0),M(u)}),A.on("frozen",({previewDataUrl:u})=>d(u)),A.on("profile",({animations:u})=>f(u==="reduced")),A.on("captured",u=>{x(u),B(null),_.current.onCaptured?.(u)}),A.on("error",u=>{N(u),_.current.onError?.(u)}),r?.on("result",u=>{B(u),_.current.onResult?.(u)})];return()=>{for(let u of ae)u?.();l.current=null,A.destroy()}},[r,t,s]);let q=yt(E=>{l.current?.start(E)},[]),ie=yt(()=>{l.current?.retry()},[]),H=yt(()=>{let E=l.current,K=E?.switchCamera()===!0;return K&&(P(E?.facingMode??null),m(!1),h(!1),d(null),v.current=null),K},[]);return{state:p,gate:S,draining:I,gateLocked:c,frozenPreview:g,reduceMotion:w,artifacts:V,error:y,result:T,facingMode:i,start:q,retry:ie,switchCamera:H}}n(Un,"useLivenessHandle");import{useCallback as _r,useEffect as Ar,useState as Ze}from"react";var Tr=new Set(["national_number"]);function Bn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Tr.has(s));return t.length>0?{...e,options:t}:null}n(Bn,"pending");function Hn(e){let[t,s]=Ze(null),[o,r]=Ze(e===void 0),[a,l]=Ze(!1),[p,C]=Ze(!1);Ar(()=>{if(s(null),e===void 0){r(!0);return}let h=!0,c=e.methodChoice;typeof c=="function"?(r(!1),Promise.resolve().then(()=>c.call(e)).then(g=>{h&&s(Bn(g))},()=>{}).finally(()=>{h&&r(!0)})):r(!0);let m=e.on("method",g=>s(Bn(g)));return()=>{h=!1,m()}},[e]);let S=_r(async h=>{if(e===void 0)return!1;l(!0),C(!1);try{return await e.selectMethod(h),s(null),!0}catch{return C(!0),!1}finally{l(!1)}},[e]),M=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:M==="national_number"&&!p?M:null,settled:o,busy:a,failed:p,select:S}}n(Hn,"useMethodChoice");import{useEffect as Kr,useMemo as Or,useState as Fr}from"react";var Ur=["ar","fr","en"];function Br(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(Br,"isClipUrl");function Hr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of Ur){let r=t[o];if(!(typeof r!="object"||r===null))for(let[a,l]of Object.entries(r))!ue(a)||!Br(l)||((s[o]??(s[o]={}))[a]=l)}return Object.keys(s).length>0?s:null}n(Hr,"toVoiceClipMap");function Gn(e){let[t,s]=Fr(null);Kr(()=>{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(S=>S?.setId===C?.setId?S: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=Or(()=>t!==null?Hr(t):null,[t]);return e===void 0?null:o}n(Gn,"useServerVoiceClips");import{jsx as qn}from"react/jsx-runtime";function Dn({voice:e}){let t=F();return qn(G,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:qn(he,{off:!e.enabled,className:"sekyro-icon"})})}n(Dn,"VoiceChip");import{Fragment as Wr,jsx as L,jsxs as Ae}from"react/jsx-runtime";var Dr=800;function jr(e){return e===void 0||e!==!1&&e.length===qe.length&&qe.every(t=>e.includes(t))}n(jr,"isDefaultTips");function $r(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($r,"carriesActivation");function zr(e){return typeof e=="object"&&e!==null&&!Gr(e)&&"tone"in e&&"text"in e}n(zr,"isNoticeObject");function Yr(e){return e==="starting"||e==="gating"||e==="recording"}n(Yr,"isCapturing");function Zr(e){return e==="captured"||e==="uploading"||e==="checking"}n(Zr,"isPostCapture");function ci({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:a=!1,notice:l,startDisabled:p=!1,startLabel:C,tips:S,tipsSummary:M,coach:I,voice:h,onGuidance:c,onCaptured:m,onResult:g,onError:d,onStateChange:w,assetBaseUrl:f,className:V}){let x=Re(()=>$t(t,o),[t,o]),y=Re(()=>b=>x[b]??"",[x]),N=s??(t==="ar"?"rtl":"ltr"),T=pe(null),B=qr(Cn),i=Un({verification:e,videoRef:T,assetBaseUrl:f,onCaptured:m,onResult:g,onError:d,onStateChange:w}),P=On(f,i.state==="idle"&&i.error===null),v=Hn(e),$=v.choice!==null,_=xn(e),q=Nn(e),ie=_n(e),H=Zt(),E=Pn(e),K=E.mode==="assisted",A=K&&H.canChooseFacing,k=h!==!1&&h?.clips===void 0,ae=Gn(k?e:void 0),u=at({locale:t,defaultClips:ae,options:h}),[fe,Qe]=jn(null),z=K?fe??(H.canChooseFacing?"environment":"user"):"user",mt=E.settled&&(!K||H.facingSettled),gt=pe(null),Te=pe(!1),ht=pe(u.unlock);ht.current=u.unlock,se(()=>{let b=gt.current;if(b===null)return;let le=["pointerup","touchend","click","keydown"],re=n(()=>{for(let xe of le)b.removeEventListener(xe,ge,!0)},"disarm");function ge(xe){if(Te.current){re();return}$r(xe)&&(Te.current=!0,re(),ht.current())}n(ge,"onGesture");for(let xe of le)b.addEventListener(xe,ge,{capture:!0,passive:!0});return re},[]);let vt=We(()=>{Te.current||(Te.current=!0,u.unlock()),i.start({facing:z})},[u.unlock,i.start,z]),kt=We(()=>i.start({facing:z}),[i.start,z]),Ke=pe(!1),Le=i.state==="idle"&&i.error===null,bt=!$&&!_.required&&(a===!0||a==="when-permitted"&&H.permission==="granted"),Ct=bt&&v.settled&&_.settled&&mt,$n=a==="when-permitted"&&!H.permissionSettled&&!Ke.current,St=bt&&Le&&!Ke.current,Je=($n||St||!mt)&&P.gate==="ready"?"loading":P.gate;se(()=>{!Ct||!Le||P.gate!=="ready"||Ke.current||(Ke.current=!0,kt())},[Ct,Le,P.gate,kt]);let zn=Le&&!$&&!_.required&&!(St&&P.gate==="ready"),Vt=We(()=>{i.switchCamera()&&Qe(z==="user"?"environment":"user")},[i.switchCamera,z]),Rt=i.state!=="idle"&&i.facingMode!==null?i.facingMode:z;se(()=>{let b=T.current?.style;Rt==="user"?b?.removeProperty("transform"):b&&(b.transform="none")},[Rt]);let Oe=Re(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);se(()=>{if(Oe!==null)return()=>URL.revokeObjectURL(Oe)},[Oe]);let Lt=i.frozenPreview??Oe,ye=e!==void 0,O=Yr(i.state),ne=Zr(i.state),Fe=O||ne,j=i.result,wt=i.state==="done"&&j!==null,Mt=i.state==="recording"&&i.frozenPreview!==null,Xe=B!==null,we=ne||Mt,It=ne?"checking":Mt?"frozen":i.state==="recording"?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ue=O?i.gate.hint:null,Be=i.state==="starting"?"capture.preparing.title":Ue===null?null:Ue==="center"&&!i.gate.faceDetected?"fcv3.no_face":Ht(Ue),[Yn,xt]=jn(null);se(()=>{if(Be!=="fcv3.no_face"){xt(Be);return}if(!O)return;let b=setTimeout(()=>xt(Be),Dr);return()=>clearTimeout(b)},[Be,O]);let et=O&&typeof I=="string"&&I!=="",Nt=K&&O?y("capture.assisted.stage"):null,ce=O&&!et?Yn:null,tt=et?I:ce===null?"":y(ce);ct(u,ce,tt,O);let Et=pe(c);Et.current=c,se(()=>{if(ue(ce))try{Et.current?.(ce)}catch(b){console.error("[@sekyro/react] onGuidance threw:",b)}},[ce]);let Me=Re(()=>({supported:u.supported,enabled:u.enabled,setEnabled:u.setEnabled,toggle:u.toggle}),[u.supported,u.enabled,u.setEnabled,u.toggle]),nt=r?.voicePrompt,Pt=nt!==void 0,_t=h===void 0,At=pe(!1);se(()=>{!Pt||!_t||At.current||!$e()||(At.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."))},[Pt,_t]);let Zn=nt!==void 0?(b,le,re)=>nt(b,le,re,Me):u.supported?()=>L(Dn,{voice:Me}):void 0,{summary:rt,summaryPlaying:Tt,toggleSummary:Kt,stopSummary:Ot}=u,He=M!==void 0&&M!=="",Ft=He?M:y("capture.tips.summary"),Ut=He?rt!=="none":rt==="partner"||rt==="default"&&jr(S),Wn=Re(()=>Ut?{playing:Tt,toggle:n(()=>Kt(Ft,{clip:!He}),"toggle"),stop:Ot}:void 0,[Ut,Tt,Kt,Ft,Ot,He]),Qn=Re(()=>({assets:Je,retryAssets:P.retry,permission:H.permission,captureMode:E.mode,facing:z,setFacing:Qe,canChooseFacing:A,voice:Me}),[Je,P.retry,H.permission,E.mode,A,z,Me]),Jn=zr(l)?L(D,{tone:l.tone,testId:"sekyro-host-notice",children:L("span",{children:l.text})}):l??null,ee=j!==null&&j.status==="retry"?j:null,te=wt&&j.status==="unavailable"&&!$&&j.reason!=="portrait_required"?j:null,Ie=wt&&(j.status==="approved"||j.status==="rejected"||j.status==="review")?j:null,me=n((b,le)=>{if(b===void 0)return null;if(b==="device_cooldown"){let ge=Dt(t,le);if(ge!==null)return y(ge.key).replace("{time}",ge.time)}let re=qt(b);return re===null?null:y(re)},"reasonText"),Xn=te!==null&&te.reason!==void 0&&te.reason!=="nni_unbound"&&te.reason!=="method_required"&&te.reason!=="mobile_required"&&!(te.reason==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Bt=Ge(),er=$&&v.auto===null&&!O&&!ne&&i.error===null,ot=We(async b=>{await v.select(b)&&i.state==="done"&&i.retry()},[v.select,i.state,i.retry]);return se(()=>{v.auto!==null&&!v.busy&&!O&&!ne&&ot(v.auto)},[v.auto,v.busy,O,ne,ot]),L(zt,{value:y,children:Ae("div",{ref:gt,className:V===void 0?"sekyro-capture":`sekyro-capture ${V}`,dir:N,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[r?.header,ee!==null&&me(ee.reason)!==null&&!(Xe&&Fe)?L(D,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:L("span",{children:me(ee.reason)})}):null,ie&&ne&&!Xe?L(D,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:L("span",{children:y("capture.busy")})}):null,_.required&&Le?L(D,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:L("span",{children:y("reasons.mobile_required")})}):null,i.error!==null?r?.errorPanel!==void 0?r.errorPanel(i.error,i.retry):Ae(D,{tone:"danger",testId:"sekyro-error-notice",children:[L("span",{children:y(Gt(i.error.kind))}),i.error.retryable?L(G,{ref:Bt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:y("common.retry")}):null]}):null,te!==null?Ae(D,{tone:"danger",testId:"sekyro-unavailable-notice",children:[L("span",{children:me(te.reason)??y(te.reason===void 0?"errors.session_expired":"errors.network_error")}),Xn?L(G,{ref:Bt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:y("capture.recordAgain")}):null]}):null,Ie!==null&&me(Ie.reason)!==null?L(D,{tone:Ie.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:L("span",{children:me(Ie.reason,Ie.retryAfter)})}):null,L("div",{className:Fe?void 0:"sekyro-hidden","data-capture-live":Fe?"":void 0,children:Xe?B({videoRef:T,guidance:we&&ye?y("capture.checking"):tt,coached:et&&!(we&&ye),note:we?ye?y(ie?"capture.busy":"capture.checkingHint"):null:ee!==null?me(ee.reason):Nt,settled:we&&ye,progress:i.gate.progress,phase:It,still:we?Lt:null,live:Fe,switchCamera:O&&i.state!=="recording"&&A&&Vt}):L(Yt,{videoRef:T,guidanceText:tt,guidanceHint:Ue,guidanceKey:ce,progress:i.gate.progress,phase:It,draining:i.draining,stillUrl:Lt,showChecking:ye,onSwitchCamera:Vt,canSwitchCamera:K&&O&&i.state!=="recording",operatorText:Nt,voicePrompt:Zn,overlay:r?.stageOverlay,reduceMotion:i.reduceMotion})}),er&&v.choice!==null?L(ln,{title:y("method.title"),description:y("method.description"),options:v.choice.options.map(b=>({id:b,label:y(`method.${b}`)})),busy:v.busy,error:v.failed?y("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:b=>{ot(b)}}):null,zn?Ae(Wr,{children:[q&&r?.header===void 0?Ae("div",{className:"sekyro-stack sekyro-stack--1",children:[L("h2",{className:"sekyro-text-body",children:y("returning.title")}),L("p",{className:"sekyro-text-muted",children:y("returning.description")})]}):null,Jn,r?.intro!==void 0?r.intro(vt,Qn):L(In,{assets:Je,onRetryAssets:P.retry,permission:H.permission,captureMode:E.mode,canChooseFacing:A,facing:z,onFacingChange:Qe,voice:Me,tips:S??qe,summary:Wn,startLabel:C,startDisabled:p,onStart:vt})]}):null,L(bn,{showCoaching:ee!==null,attemptsText:ee?.attemptsRemaining!==void 0?jt(x,t,ee.attemptsRemaining):null,showRetake:ee!==null&&!O&&!ne||!ye&&i.state==="captured",onRetake:i.retry}),r?.footer]})})}n(ci,"LivenessCapture");export{Cn as a,Sn as b,qe as c,ln as d,je as e,Dr as f,ci as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{d as me}from"./chunk-Y4PPDNQR.js";import{a as A}from"./chunk-2CJEADGY.js";import{a as pe,b as he,e as fe,f as ve}from"./chunk-2PGJ7P7E.js";import{a as ge,b as X}from"./chunk-LZU57LVO.js";import{a as h,b as G,h as de}from"./chunk-PXRIFHY2.js";import{useEffect as R,useLayoutEffect as Ue,useRef as Q,useState as S}from"react";var Se={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 ye={"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 ke={"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 we={"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 be={"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 Ce={"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 ze={"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 Be=["locking","capturing"],W=class W{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(Be.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(W,"ScanPresenter");var P=W;import{Fragment as at,jsx as t,jsxs as m}from"react/jsx-runtime";var Fe={en:Ce,fr:ze,ar:be},Ge=450,De=h(n=>e=>me(n.strings[e]??Fe[n.locale][e]??""),"useScanCopy");function Ne({name:n}){return t("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:Se[n]}})}h(Ne,"ScanGlyph");var Xe={en:ke,fr:we,ar:ye};function We(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(We,"mrzInstruction");function Me(n){return n.reason==="unreadable"?"doc.reason_unreadable":n.reason!==void 0&&n.reason!=="side_missing"?de(n.reason):null}h(Me,"reasonOf");function xt({step:n,i18n:e,liveMrz:r,...a}){let[s,u]=S(!1);return s?t(et,{step:n,i18n:e,...r!==void 0?{liveMrz:r}:{},onClose:()=>u(!1)}):t(qe,{step:n,i18n:e,onOpen:()=>u(!0),...a})}h(xt,"DocumentCaptureView");function Qe({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:Ze(-10,-10,248,r+20,16,30)})]})}h(Qe,"ScanMark");function Ze(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,E])=>`M${b} ${T+E*u}V${T+E*w}Q${b} ${T} ${b+f*w} ${T}H${b+f*u}`).join("")}h(Ze,"brackets");function qe({step:n,i18n:e,onOpen:r,onChangeCountry:a,onChangeDocument:s}){let u=De(e),w=n.documentType==="passport",y=Me(n);return m("section",{className:"sekyro-step","data-testid":"sekyro-document",children:[t(Qe,{passport:w}),t(pe,{title:u("native.doc.introTitle"),lead:u("native.doc.introLead")}),y!==null?m(ge,{tone:"warning",children:[t("span",{children:e.t(y)}),t("span",{children:X(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(Ne,{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(he,{children:m(G,{full:!0,onClick:r,children:[t(A,{name:"camera"}),u("native.doc.openCamera")]})})]})}h(qe,"DocumentIntro");function Le(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(Le,"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"},Je=h(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function et({step:n,i18n:e,liveMrz:r,onClose:a}){let s=De(e),u=Q(null),w=Q(null),y=Q(null),[b,T]=S("idle"),[f,E]=S(null),[xe,Z]=S(null),[p,$e]=S({w:0,h:0}),[z,Te]=S({hint:null,locking:!1,card:null,manualShutter:!1}),[q,_e]=S({}),[j,He]=S(null),[J,Re]=S(null),[ee,te]=S(0),[ne,re]=S(null),[O,ae]=S(null),L=n.documentType==="passport",K=L?1.42:1.586;fe(!0),Ue(()=>{let i=u.current;if(i===null)return;let c=h(()=>$e({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=Le(p.w,p.h,K);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=Le(l.clientWidth,l.clientHeight,K);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 P,g={scan:null,feedback:null,gate:null},N=h(d=>{g={...g,...d};let M=g.gate?.guide,Ye={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(Ye,performance.now());Te($=>$.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"),Ve=[c.on("state",T),c.on("feedback",d=>N({feedback:d})),c.on("gate",d=>N({gate:d})),c.on("scan",d=>{E(d),N({scan:d})}),c.on("captured",d=>{_e(M=>({...M,[tt(d.side,L,M)]:d.previewDataUrl})),He(d.previewDataUrl),Re(rt(i))}),c.on("error",Z),c.on("mrz",d=>{d.state==="mismatch"?ae(d.format??null):re(d)})];return c.start().catch(()=>{}),()=>{for(let d of Ve)d();c.destroy(),y.current=null}},[n.issuer,n.documentType]);let k=f?.phase??"framing",D=k==="reading"||k==="result",V=k==="flipCue"||k==="reaskRecto",_=z.locking,se=f?.captured.length??0;R(()=>{_&&te(i=>i+1)},[_]),R(()=>{se>0&&te(i=>i+1)},[se]);let Ae=f?.expected??null;R(()=>{re(null)},[Ae]),R(()=>{if(O===null)return;let i=setTimeout(()=>ae(null),2e3);return()=>clearTimeout(i)},[O]);let oe=V||D?null:We(ne,L),Y=O!==null?O==="TD3"?"dcv3.mrz.looksLikePassport":"dcv3.mrz.looksLikeCard":oe,Ee=Y===null?null:e.strings[Y]??Xe[e.locale][Y],ie=Me(n),le=z.hint===null?null:je[z.hint]??`dcv2.${z.hint}`,Oe=le??(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":ie??(L?"doc.showPage":"doc.showSide")),B=Ee??s(Oe),H=z.card,v=o;if(!_&&H!==null&&H.fill>=.45&&H.fill<=1.25&&!Je()){let i=o.w*H.fill,c=i/K,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 I=o.w*.045,U=28,ce=Math.min(I,U*.6),Ke=[[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]],Ie=_?"is-locked":z.hint!==null?"is-coaching":"",Pe=L?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],ue=o.y+o.h+48,F={insetInlineStart:o.x,insetBlockStart:o.y,inlineSize:o.w,blockSize:o.h,borderRadius:I};return t("section",{className:"sekyro-lm","aria-label":B,"data-testid":"sekyro-document",children:m("div",{ref:u,className:`sekyro-lm-stage${D?" is-reading":""}${V?" 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(at,{children:[D&&J!==null?t("img",{className:"sekyro-lm-scene",src:J,alt:""}):null,D&&j!==null?t("img",{className:"sekyro-lm-frozen",src:j,alt:"",style:F}):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${nt(o,I)}`}),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 ${Ie}`,children:Ke.map(([i,c,l,C],g)=>t("path",{style:{transform:`translate(${i}px, ${c}px) scale(${l}, ${C})`},d:`M0 ${U}V${ce}Q0 0 ${ce} 0H${U}`},g))}),_?t("rect",{className:"sekyro-lm-trace",x:o.x,y:o.y,width:o.w,height:o.h,rx:I,pathLength:"1",style:{animationDuration:`${Ge}ms`}}):null]}),t("div",{className:"sekyro-lm-slot",style:F,"aria-hidden":"true",children:D?t("span",{className:"sekyro-lm-read is-repeating"}):ee>0?t("span",{className:"sekyro-lm-read"},ee):null})]}):null,oe!==null?t("div",{className:"sekyro-lm-slot",style:F,"aria-hidden":"true",children:t("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${L?" is-page":""}${ne?.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(ve,{swapKey:B,className:"sekyro-lm-line",children:B})}),ie!==null&&k==="framing"&&le===null?t("p",{className:"sekyro-lm-attempts",children:X(e,n.attemptsRemaining,n.attemptsExhausted)}):null]}),D?m("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:ue-12},children:[t("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),s("native.scan.putDown")]}):V?t("div",{className:`sekyro-lm-under sekyro-lm-flip${k==="reaskRecto"?" is-toFront":""}`,style:{insetBlockStart:ue-20},"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:m("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(K)},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(Ne,{name:"flashlight"})}):null]}),xe!==null?m("div",{className:"sekyro-lm-error",role:"alert",children:[t("p",{children:e.t("doc.cameraBlocked")}),t("p",{children:e.t("doc.cameraBlockedHint")}),t(G,{onClick:()=>{Z(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:Pe.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:[q[i]!==void 0?t("img",{src:q[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(et,"LumiereScan");function tt(n,e,r){return e?"single":n==="recto"||n==="verso"?n:r.recto===void 0?"recto":"verso"}h(tt,"slotOf");function nt({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(nt,"roundedRect");function rt(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(rt,"sceneSnapshot");export{xt as DocumentCaptureView,Ge as LOCK_TRACE_MS,Le as guideRect,We as mrzInstruction,tt as slotOf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as K}from"./chunk-5JPJXBN6.js";import{a as O,b as U,c as z}from"./chunk-H2KIOYQU.js";import{a as G}from"./chunk-R2D6V2R6.js";import{d as h}from"./chunk-Y4PPDNQR.js";import{a as E}from"./chunk-LZU57LVO.js";import{a,b as f,o as V}from"./chunk-PXRIFHY2.js";import{isValidNni as oe,normalizeNni as _}from"@sekyro/web";import{useEffect as x,useId as re,useRef as W,useState as N}from"react";import{Fragment as R,jsx as i,jsxs as l}from"react/jsx-runtime";var Y={en:U,fr:z,ar:O},$=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 A=o.strings,n=a((t,d)=>h(A[t]??Y[o.locale][t]??"",d),"t"),B=a((t,d)=>{let ne=new Intl.PluralRules(o.locale).select(d),L=`${t}.${ne}`,te=A[L]??Y[o.locale][L]??n(`${t}.other`);return h(te,{count:new Intl.NumberFormat(o.locale).format(d)})},"plural"),y=a(t=>e.providerName?n(`eid.${t}`,{provider:e.providerName}):n(`eid.${t}Generic`),"named"),[C,Q]=N(""),[g,w]=N(""),[c,I]=N(!1),[v,u]=N(null),r=e.phase==="code",P=K(r),s=re(),X=V(),m=a(async t=>{I(!0),u(null);try{await t()}catch(d){u(G(d,o.strings)),J?.(d)}finally{I(!1)}},"run"),D=W(!1);x(()=>{!e.identifierBound||r||e.reason!==void 0||D.current||(D.current=!0,m(()=>e.start()))},[e.identifierBound,r,e.reason]),x(()=>{(e.reason==="eid_code_invalid"||e.codeExpiresAt!==void 0)&&w("")},[e.reason,e.codeExpiresAt,e.codeAttemptsRemaining]);let F=W(r);x(()=>{r&&!F.current&&document.getElementById(`${s}-code`)?.focus(),F.current=r},[r,s]);let k=e.reason==="eid_locked",M=q(e.codeExpiresAt,P),T=r&&e.codeExpiresAt!==void 0&&M===0,S=q(e.resendAvailableAt,P),H=e.resendsRemaining===0||e.reason==="eid_resend_limit",Z=a(t=>{if(t.preventDefault(),r){g.length===$&&!k&&m(()=>e.verify(g));return}if(e.identifierBound){m(()=>e.start());return}let d=_(C);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"),b=e.reason?.startsWith("eid_")?e.reason:void 0,j=l(R,{children:[b!==void 0?l(E,{tone:de.has(b)?"danger":"warning",children:[i("span",{children:n(`reasons.${b}`)}),b==="eid_code_invalid"&&e.codeAttemptsRemaining!==void 0?i("span",{children:B("eid.codeAttemptsRemaining",e.codeAttemptsRemaining)}):null,e.canUseCamera?i(f,{kind:"ghost",disabled:c,onClick:()=>{m(()=>e.useCamera())},children:n("eid.useCamera")}):null]}):null,v!==null?i(E,{tone:"danger",children:i("span",{children:o.t(v)})}):null]}),[ee,ie]=r?[y("codeTitle"),y("codeHelp")]:[y("identifierTitle"),y(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(R,{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:g,disabled:k,onChange:t=>{u(null),w(_(t.target.value).replace(/\D/g,"").slice(0,$))}})]}),l("div",{className:"sekyro-row",children:[e.codeExpiresAt!==void 0?i("span",{className:"sekyro-text-muted",children:T?n("eid.expired"):n("eid.expiresIn",{time:se(M)})}):null,H?i("span",{className:"sekyro-text-muted",children:n("eid.noResendsLeft")}):i(f,{kind:"ghost",disabled:c||S>0||k,onClick:()=>{m(()=>e.resend())},children:S>0?n("eid.resendIn",{seconds:S}):n("eid.resend")})]}),!H&&e.resendsRemaining!==void 0?i("p",{className:"sekyro-text-muted",children:B("eid.resendsRemaining",e.resendsRemaining)}):null,i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:T?n("eid.expired"):""}),i(f,{type:"submit",full:!0,disabled:c||g.length!==$||k,"aria-busy":c||void 0,children:n("eid.verify")})]}):l(R,{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:C,"aria-describedby":`${s}-nni-help`,"aria-invalid":v==="population.invalid"||v==="population.reason_nni_invalid"||void 0,onChange:t=>{u(null),Q(_(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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as R}from"./chunk-4ENKV24I.js";import{a as A}from"./chunk-5JPJXBN6.js";import{a as w}from"./chunk-R2D6V2R6.js";import{d as z}from"./chunk-Y4PPDNQR.js";import{a as V,b as h}from"./chunk-2PGJ7P7E.js";import{a as f,b as $}from"./chunk-LZU57LVO.js";import{a as s,b as _}from"./chunk-PXRIFHY2.js";import{OtpInputError as G}from"@sekyro/web";import{useId as K,useState as O}from"react";var L={"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 P={"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.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 b,jsx as i,jsxs as o}from"react/jsx-runtime";var J={en:P,fr:D,ar:L},H=s((e,n)=>{if(e===void 0)return 0;let d=Date.parse(e)-n;return Number.isFinite(d)?Math.max(0,Math.ceil(d/1e3)):0},"secondsUntil"),Q=s(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss"),X=new Set(["otp_expired","otp_send_failed","otp_rate_limited","email_invalid","email_disposable"]);function ue({step:e,i18n:n,className:d,defaultEmail:S="",onError:W}){let a=s((t,p)=>z(n.strings[t]??J[n.locale][t],p),"t"),[y,M]=O(S),[c,q]=O(""),[r,g]=O(!1),[E,N]=O(null),m=e.phase==="verify",x=A(m),l=K(),k=s(async t=>{g(!0),N(null);try{await t()}catch(p){N(p instanceof G&&p.field==="email"?a("emailOtp.emailInvalid"):n.t(w(p,n.strings))),W?.(p)}finally{g(!1)}},"run"),T=s(t=>{k(()=>e.send(e.needsEmail&&(!t||y!==S)?{email:y}:{}))},"send"),I=s(t=>{k(()=>e.verify(t))},"submitCode"),F=s(t=>{t.preventDefault(),m?I(c):T(!1)},"onSubmit"),C=H(e.codeExpiresAt,x),v=H(e.resendAvailableAt,x),u=m&&e.codeExpiresAt!==void 0&&C===0,[B,U]=a("emailOtp.sentTo").split("{email}"),Y=e.reason==="otp_mismatch"?o(f,{tone:"danger",children:[i("span",{children:a("emailOtp.reason_otp_mismatch")}),i("span",{children:$(n,e.attemptsRemaining,e.attemptsExhausted)})]}):e.reason!==void 0&&X.has(e.reason)?i(f,{tone:"warning",children:i("span",{children:a(`emailOtp.reason_${e.reason}`)})}):null;return o("form",{className:`sekyro-step sekyro-otp${d?` ${d}`:""}`,"aria-labelledby":l,onSubmit:F,noValidate:!0,children:[i(V,{id:l,title:a(m?"emailOtp.verifyTitle":"emailOtp.sendTitle"),lead:m?o(b,{children:[B,i("bdi",{dir:"ltr",className:"sekyro-mono",children:e.sentToMasked}),U]}):a("emailOtp.sendDescription")}),Y,E!==null?i(f,{tone:"danger",children:i("span",{children:E})}):null,m?o(b,{children:[o("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${l}-code`,children:a("emailOtp.codeLabel")}),i(R,{id:`${l}-code`,value:c,invalid:e.reason==="otp_mismatch",onChange:t=>{q(t),t.length===6&&c.length!==6&&!r&&!e.attemptsExhausted&&I(t)}}),i("span",{className:`sekyro-help sekyro-otp-expiry${u?" is-danger":""}`,"aria-hidden":!u||void 0,children:u?a("emailOtp.expired"):a("emailOtp.expiresIn",{time:Q(C)})})]}),i("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:u?a("emailOtp.expired"):""}),o(h,{children:[i(_,{type:"submit",full:!0,disabled:r||c.length!==6,"aria-busy":r||void 0,children:a("emailOtp.verify")}),i("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:r||v>0,onClick:()=>T(!0),children:v>0?a("emailOtp.resendIn",{seconds:v}):a("emailOtp.resend")})]})]}):o(b,{children:[e.needsEmail?o("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${l}-email`,children:a("emailOtp.emailLabel")}),i("input",{id:`${l}-email`,className:"sekyro-input",type:"email",dir:"ltr",inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,placeholder:a("emailOtp.emailPlaceholder"),value:y,"aria-describedby":`${l}-email-help`,onChange:t=>M(t.target.value)}),i("span",{id:`${l}-email-help`,className:"sekyro-help",children:a("emailOtp.emailHelper")})]}):i("p",{className:"sekyro-text-muted",children:a("emailOtp.prefilledNotice")}),i(h,{children:i(_,{type:"submit",full:!0,disabled:r,"aria-busy":r||void 0,children:a("emailOtp.send")})})]})]})}s(ue,"EmailOtpView");export{ue as EmailOtpView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as B,b as F,c as S,d as K}from"./chunk-OSS4NHIS.js";import{d as A,g as T}from"./chunk-ZVSRJKQE.js";import{a as E,b as U,c as H}from"./chunk-H2KIOYQU.js";import"./chunk-R2D6V2R6.js";import{d as z}from"./chunk-Y4PPDNQR.js";import"./chunk-36RC3M4K.js";import{a as q}from"./chunk-2CJEADGY.js";import"./chunk-2PGJ7P7E.js";import{a as I}from"./chunk-LZU57LVO.js";import{a as p,b as v,o as C}from"./chunk-PXRIFHY2.js";import{useEffect as D,useId as O,useMemo as N,useRef as me,useState as V}from"react";var Y={"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.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 G={"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.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 $={"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.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 M=[[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=M.length,oe=0,R=p(e=>(M[e-1]?.[1]??[]).reduce((t,[n,o])=>t+n*o,0),"dataCapacity");function L(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}p(L,"gfMul");function ne(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 i=0;i<e;i+=1)t[i]=L(t[i],n),i+1<e&&(t[i]=t[i]^t[i+1]);n=L(n,2)}return t}p(ne,"rsDivisor");function re(e,t){let n=t.map(()=>0);for(let o of e){let i=o^n.shift();n.push(0),t.forEach((a,s)=>{n[s]=n[s]^L(a,i)})}return n}p(re,"rsRemainder");function ie(e,t){let n=[],o=p((l,m)=>{for(let b=m-1;b>=0;b-=1)n.push(l>>>b&1)},"put");o(4,4),o(e.length,t<10?8:16);for(let l of e)o(l,8);let i=R(t)*8;o(0,Math.min(4,i-n.length)),o(0,(8-n.length%8)%8);let a=[];for(let l=0;l<n.length;l+=8)a.push(n.slice(l,l+8).reduce((m,b)=>m<<1|b,0));for(let l=236;a.length<R(t);l^=253)a.push(l);let[s,r]=M[t-1],c=ne(s),u=[],f=0;for(let[l,m]of r)for(let b=0;b<l;b+=1){let w=a.slice(f,f+m);f+=m,u.push({data:w,ec:re(w,c)})}let h=[],y=Math.max(...u.map(l=>l.data.length));for(let l=0;l<y;l+=1)for(let m of u)l<m.data.length&&h.push(m.data[l]);for(let l=0;l<s;l+=1)for(let m of u)h.push(m.ec[l]);return h}p(ie,"codewords");function ae(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 i=e*4+10;o.length<t;i-=n)o.splice(1,0,i);return o}p(ae,"alignmentPositions");var se=[(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],_=class _{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}};p(_,"Grid");var P=_;function ce(e,t){let n=e.size;for(let a=0;a<n;a+=1)e.set(6,a,a%2===0),e.set(a,6,a%2===0);for(let[a,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=a+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=ae(t),i=o.length-1;if(o.forEach((a,s)=>o.forEach((r,c)=>{if(!(s===0&&c===0||s===0&&c===i||s===i&&c===0))for(let u=-2;u<=2;u+=1)for(let f=-2;f<=2;f+=1)e.set(a+u,r+f,Math.max(Math.abs(u),Math.abs(f))!==1)})),W(e,0),t>=7){let a=t;for(let r=0;r<12;r+=1)a=a<<1^(a>>>11)*7973;let s=t<<12|a;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)}}}p(ce,"drawFunctionPatterns");function W(e,t){let n=e.size,o=oe<<3|t,i=o;for(let r=0;r<10;r+=1)i=i<<1^(i>>>9)*1335;let a=(o<<10|i)^21522,s=p(r=>(a>>>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)}p(W,"drawFormat");function ue(e,t){let n=e.size,o=0;for(let i=n-1;i>=1;i-=2){i===6&&(i=5);for(let a=0;a<n;a+=1)for(let s=0;s<2;s+=1){let r=i-s,u=(i+1&2)===0?n-1-a:a;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)}}}p(ue,"placeData");function le(e,t){let n=se[t];for(let o=0;o<e.size;o+=1)for(let i=0;i<e.size;i+=1)e.fixed[o*e.size+i]!==!0&&n(o,i)&&(e.dark[o*e.size+i]=!e.dark[o*e.size+i])}p(le,"applyMask");function pe(e){let t=e.size,n=0,o=p(a=>{let s=1;for(let r=1;r<=t;r+=1)r<t&&a(r)===a(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,l)=>a(r+l)===y)||c.every((y,l)=>a(r+4+l)===y)))continue;let f=[0,1,2,3].every(y=>!a(r+y))&&c.every((y,l)=>a(r+4+l)===y),h=c.every((y,l)=>a(r+l)===y)&&[7,8,9,10].every(y=>!a(r+y));f&&(n+=40),h&&(n+=40)}},"line");for(let a=0;a<t;a+=1)o(s=>e.get(a,s));for(let a=0;a<t;a+=1)o(s=>e.get(s,a));for(let a=0;a+1<t;a+=1)for(let s=0;s+1<t;s+=1){let r=e.get(a,s);r===e.get(a,s+1)&&r===e.get(a+1,s)&&r===e.get(a+1,s+1)&&(n+=3)}let i=e.dark.filter(Boolean).length;return n+=Math.floor(Math.abs(i*20-t*t*10)/(t*t))*10,n}p(pe,"penalty");function j(e,t={}){let n=new TextEncoder().encode(e),o=1;for(;o<=Q&&!(4+(o<10?8:16)+n.length*8<=R(o)*8);o+=1);if(o>Q)throw new RangeError("text too long for a QR code");let i=ie(n,o),a=p(c=>{let u=new P(o*4+17);return ce(u,o),ue(u,i),le(u,c),W(u,c),u},"build"),s=null;if(t.mask!==void 0)s=a(t.mask);else{let c=Number.POSITIVE_INFINITY;for(let u=0;u<8;u+=1){let f=a(u),h=pe(f);h<c&&(c=h,s=f)}}let r=s;return{size:r.size,get:p((c,u)=>r.get(c,u),"get")}}p(j,"encodeQr");function X(e,t=4){let n=[];for(let o=0;o<e.size;o+=1)for(let i=0;i<e.size;i+=1)e.get(o,i)&&n.push(`M${i+t} ${o+t}h1v1h-1z`);return{size:e.size+t*2,d:n.join("")}}p(X,"qrPath");import{jsx as d,jsxs as k}from"react/jsx-runtime";var de={en:G,fr:$,ar:Y},J={en:U,fr:H,ar:E};function g(e){let t=e.strings;return(n,o)=>z(t[n]??de[e.locale][n]??"",o)}p(g,"flowT");function Z(e,t){let n=g(t);return e.flatMap(o=>{let i=o.service==="phone_otp"?n("contact.phone"):o.service==="email_otp"?n("contact.email"):F(o,t),a=B[o.service];return i===null?[]:[{id:o.id,label:i,...a!==void 0?{glyph:d(q,{name:a})}:{}}]})}p(Z,"labelled");function ee({step:e,i18n:t,onError:n}){let o=g(t),{busy:i,error:a,run:s}=S(t,n),r=e.kind==="contact_choice";return d(A,{title:o(r?"contact.title":"choice.title"),description:o(r?"contact.description":"choice.description"),options:Z(e.choice.options,t),busy:i,error:a,focus:!0,testId:r?"sekyro-contact-choice":"sekyro-choice",onChoose:c=>s(()=>e.choose(c))})}p(ee,"PlanChoiceView");var Ue=ee,He=ee;function Be({step:e,i18n:t,onError:n,onOpen:o}){let i=g(t),{busy:a,error:s,run:r}=S(t,n),c=e,u=e.context.switchable,f=u===void 0?[]:u.options.filter(w=>w.id!==u.current),h=c.kind==="registry"&&c.reason==="nni_not_found"&&c.canUseDocument||c.kind==="eid"&&c.reason?.startsWith("eid_")&&c.canUseCamera,y=f.length===1?f[0]:void 0,l=y!==void 0&&(y.service==="phone_otp"||y.service==="email_otp"),m=l&&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&&(m===void 0||b()===null)||y===void 0&&c.chooseOption===void 0)return null;function b(){return y===void 0?i("choice.switch"):y.service==="phone_otp"||y.service==="email_otp"?i("contact.switch"):c.kind==="registry"&&y.service==="document"?t.t("population.useDocument"):c.kind==="eid"?t.strings["eid.useCamera"]??J[t.locale]["eid.useCamera"]:F(y,t)}return p(b,"labelOf"),k("div",{className:"sekyro-stack sekyro-stack--1",children:[s!==null?d(I,{tone:"danger",children:d("span",{children:s})}):null,d(v,{kind:"ghost",disabled:a,"aria-busy":a||void 0,onClick:()=>m===void 0?o():r(m),"data-testid":l?"sekyro-contact-switch":"sekyro-lane-switch",children:b()})]})}p(Be,"LaneSwitch");function qe({step:e,i18n:t,onError:n,onClose:o}){let i=g(t),{busy:a,error:s,run:r}=S(t,n),c=e.context.switchable,u=e.chooseOption;return c===void 0||u===void 0?null:d(A,{title:i("choice.title"),description:i("choice.description"),options:Z(c.options,t),...c.current!==null?{marked:c.current}:{},busy:a,error:s,focus:!0,testId:"sekyro-lane-choice",onChoose:f=>f===c.current?o():r(()=>u.call(e,f))})}p(qe,"LaneChoiceView");var fe=[["fullName","summary.fullName",!1],["birthDate","summary.birthDate",!0],["birthYear","summary.birthYear",!0],["nationality","summary.nationality",!0],["documentType","summary.documentType",!1],["documentNumberMasked","summary.documentNumber",!0],["nniMasked","summary.nni",!0],["expiryDate","summary.expiryDate",!0]];function ye(e){let[t,n]=V(null);return D(()=>{if(!e.portraitAvailable)return;let o=!0,i=null;return e.portrait().then(a=>{!o||a===null||!a.type.startsWith("image/")||typeof URL.createObjectURL!="function"||(i=URL.createObjectURL(a),n(i))}),()=>{o=!1,i!==null&&URL.revokeObjectURL(i)}},[e.portraitAvailable]),t}p(ye,"usePortraitUrl");function Ke({step:e,i18n:t,onError:n}){let o=g(t),i=O(),a=C(),s=ye(e),{busy:r,error:c,run:u}=S(t,n),f=e.context.orgName,h=["registry","document","chip"].find(m=>m===e.source),y=e.summaryKind==="partial",l=p(m=>t.strings[`doc.type.${m}`]??m,"documentLabel");return k("section",{className:"sekyro-stack sekyro-stack--4","aria-labelledby":i,"data-testid":"sekyro-identity-summary",children:[k("div",{className:"sekyro-stack sekyro-stack--1",children:[d("h2",{id:i,ref:a,tabIndex:-1,className:"sekyro-text-body",children:o("summary.title")}),d("p",{className:"sekyro-text-muted",children:o("summary.description")}),h!==void 0?d("p",{className:"sekyro-text-muted",children:o(`summary.source.${h}`)}):null]}),k("div",{className:"sekyro-summary",children:[s!==null?d("img",{className:"sekyro-summary__portrait",src:s,alt:o("summary.portraitAlt")}):null,d("dl",{className:"sekyro-summary__list",children:fe.map(([m,b,w])=>{let x=e[m];return x===void 0?null:k("div",{className:"sekyro-summary__row",children:[d("dt",{className:"sekyro-text-muted",children:o(m==="fullName"&&y?"summary.name":b)}),d("dd",{children:w?d("bdi",{dir:"ltr",children:x}):m==="documentType"?l(x):x})]},m)})})]}),c!==null?d(I,{tone:"danger",children:d("span",{children:c})}):null,k("div",{className:"sekyro-stack sekyro-stack--3",children:[d(v,{full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>u(()=>e.confirm()),children:o("summary.confirm")}),e.retakeAvailable?d(v,{kind:"ghost",full:!0,disabled:r,onClick:()=>u(()=>e.retake()),children:o(e.retakeTarget==="national_number"?"summary.retakeNationalNumber":"summary.retakeDocument")}):d("p",{className:"sekyro-text-muted",children:o("summary.noRetake",{org:f})})]})]})}p(Ke,"IdentitySummaryView");var he=["glasses","headwear","expression","faceCamera","background","lighting","hair"];function Ye({step:e,i18n:t,livenessProps:n,sekyroIntro:o}){let i=g(t),[a,s]=V(null);D(()=>e.onLivePhoto(m=>{let b=m.update?.coach;s(m.holding||b===void 0?null:t.t(`portrait.coach.${b}`))}),[e,t]);let r=e.instructions==="icao",c=e.icao?.profile==="selfie",u=N(()=>r?he.filter(m=>!c||m!=="background").map(m=>({id:m,text:i(`capture.tipsIcao.${m}`)})):void 0,[r,c,t]),f=N(()=>r&&!c?{...n.strings,"capture.tips.title":i("capture.tipsIcao.title")}:n.strings,[r,c,n.strings,t]),h=c?void 0:i("capture.tipsIcao.title"),y=N(()=>o===!0&&u!==void 0?{...n.slots,intro:p((m,b)=>d(K,{start:m,context:b,tips:u,...h!==void 0?{tipsTitle:h}:{}}),"intro")}:n.slots,[o,u,h,n.slots,t]),l=c?`${(u??[]).map(m=>m.text).join(". ")}.`:i("capture.tipsIcao.summary");return d(T,{...n,...y!==void 0?{slots:y}:{},...f!==void 0?{strings:f}:{},...u!==void 0?{tips:u,tipsSummary:l}:{},coach:a})}p(Ye,"LivePhotoLiveness");function Ge({i18n:e}){let t=g(e);return k(I,{tone:"info",children:[d("strong",{children:t("portrait.retakeOnly")}),d("span",{children:t("portrait.keepCamera")})]})}p(Ge,"PortraitRetakeNotice");function $e({i18n:e,provider:t}){let n=e.strings,o=p(i=>n[i]??J[e.locale][i]??"","pick");return d("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:t?z(o("eid.continueHint"),{provider:t}):o("eid.continueHintGeneric")})}p($e,"EidContinueHint");async function be(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}p(be,"copy");function te({url:e,i18n:t,label:n}){let o=g(t),[i,a]=V("idle"),s=n.startsWith("inApp.")?"inApp":"handoff";return k("div",{className:"sekyro-stack sekyro-stack--1",children:[d(v,{kind:"ghost",onClick:()=>{be(e).then(r=>a(r?"copied":"failed"))},children:o(n)}),d("p",{role:"status","aria-live":"polite",className:"sekyro-text-muted",children:i==="idle"?"":o(`${s}.${i==="copied"?"copied":"copyFailed"}`)})]})}p(te,"CopyLink");function Qe({url:e,i18n:t,refresh:n,footer:o}){let i=g(t),a=O(),s=N(()=>{try{return X(j(e))}catch{return null}},[e]),r=me(n);r.current=n;let c=C();return D(()=>{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":a,"data-testid":"sekyro-handoff",children:[d("h2",{id:a,ref:c,tabIndex:-1,className:"sekyro-text-body",children:t.t("handoff.title")}),d("p",{className:"sekyro-text-muted",children:i("handoff.description")}),s!==null?k("svg",{className:"sekyro-qr",viewBox:`0 0 ${s.size} ${s.size}`,role:"img","aria-label":i("handoff.qrAlt"),shapeRendering:"crispEdges",children:[d("rect",{width:s.size,height:s.size,className:"sekyro-qr__bg"}),d("path",{d:s.d,className:"sekyro-qr__fg"})]}):null,d(te,{url:e,i18n:t,label:"handoff.copyLink"}),d("p",{className:"sekyro-text-muted",children:i("handoff.waiting")}),o??null]})}p(Qe,"HandoffView");function We({url:e,i18n:t,onContinue:n}){let o=g(t),i=O(),a=C();return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":i,"data-testid":"sekyro-in-app",children:[d("h2",{id:i,ref:a,tabIndex:-1,className:"sekyro-text-body",children:o("inApp.title")}),d("p",{className:"sekyro-text-muted",children:o("inApp.description")}),d(te,{url:e,i18n:t,label:"inApp.copyLink"}),d(v,{kind:"ghost",onClick:n,children:o("inApp.continueAnyway")})]})}p(We,"InAppBrowserPrompt");export{Ue as ContactChoiceView,$e as EidContinueHint,He as GenericChoiceView,Qe as HandoffView,Ke as IdentitySummaryView,We as InAppBrowserPrompt,qe as LaneChoiceView,Be as LaneSwitch,Ye as LivePhotoLiveness,Ge as PortraitRetakeNotice};
|