@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
package/dist/chunk-QZAPVO6F.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as Ft,b as Bt,c as E}from"./chunk-65JA6YKG.js";import{a as n,b as T,f as Kt,g as Ot,h as Ut,i as Gt,j as Ht,k as D,l as $e}from"./chunk-4RUZQW5T.js";import{useId as nr}from"react";import{Fragment as tr,jsx as I,jsxs as z}from"react/jsx-runtime";function W({className:e,children:t}){return I("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(W,"Svg");var it="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 Dt(e){return z(W,{...e,children:[I("circle",{cx:"12",cy:"12",r:"4"}),I("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(Dt,"SunIcon");function $t(e){return z(W,{...e,children:[I("circle",{cx:"12",cy:"12",r:"9"}),I("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n($t,"FaceUncoveredIcon");function qt(e){return z(W,{...e,children:[I("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),I("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),I("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(qt,"PhoneEyeLevelIcon");function jt(e){return z(W,{...e,children:[I("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"}),I("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(jt,"LookStraightIcon");function zt(e){return z(W,{...e,children:[I("path",{d:it}),I("path",{d:"M9 13l2 2 4-4"})]})}n(zt,"CameraCheckIcon");function Wt(e){return z(W,{...e,children:[I("path",{d:it}),I("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(Wt,"CameraAskIcon");function Yt(e){return z(W,{...e,children:[I("path",{d:it}),I("path",{d:"M3 3l18 18"})]})}n(Yt,"CameraBlockedIcon");function ge({off:e,className:t}){return z(W,{...t!==void 0?{className:t}:{},children:[I("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?I("path",{d:"M4 4l16 16"}):z(tr,{children:[I("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),I("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(ge,"SpeakerIcon");function Zt(e){return I(W,{...e,children:I("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(Zt,"CheckIcon");function Xt(e){return z(W,{className:e.className??"sekyro-spinner",children:[I("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),I("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(Xt,"SpinnerIcon");import{jsx as oe,jsxs as Qt}from"react/jsx-runtime";var qe=["light","uncover","eyeLevel","straight"],rr={light:{key:"capture.tips.light",icon:n(()=>oe(Dt,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>oe($t,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>oe(qt,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>oe(jt,{}),"icon")}};function Jt({tips:e}){let t=E(),s=nr();return e.length===0?null:Qt("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,i=typeof o=="string"?o:o.id,c=r!==void 0?r.icon():typeof o=="string"?void 0:o.icon,d=r!==void 0?t(r.key):typeof o=="string"?o:o.text;return Qt("li",{className:"sekyro-tips__item",children:[c!=null?oe("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,oe("span",{children:d})]},i)})})]})}n(Jt,"TipList");import{useEffect as en,useId as or,useRef as sr,useState as ir}from"react";import{jsx as Y,jsxs as je}from"react/jsx-runtime";var ar=220;function tn({title:e,description:t,options:s,busy:o,error:r,focus:i,testId:c,look:d="cards",marked:y,onChoose:V}){let C=or(),R=$e(),[p,l]=ir(null),m=sr(null);en(()=>{r!==null&&l(null)},[r]),en(()=>()=>{m.current!==null&&clearTimeout(m.current)},[]);let k=n(u=>{o||p!==null||(l(u),m.current=setTimeout(()=>{m.current=null,l(null),V(u)},ar))},"choose");return je("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":C,"data-testid":c,children:[je("div",{className:"sekyro-stack sekyro-stack--1",children:[Y("h2",{id:C,ref:i?R:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?Y("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?Y(D,{tone:"danger",children:Y("span",{children:r})}):null,d==="buttons"?Y("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((u,b)=>Y(T,{kind:b===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>V(u.id),children:u.label},u.id))}):Y("div",{className:"sekyro-choices",children:s.map(u=>je("button",{type:"button",className:"sekyro-card","aria-pressed":(p??y)===u.id,"aria-busy":o||void 0,disabled:o||p!==null&&p!==u.id,onClick:()=>k(u.id),children:[u.glyph,je("span",{className:"sekyro-card__body",children:[Y("span",{className:"sekyro-card__title",children:u.label}),u.sub!==void 0?Y("span",{className:"sekyro-card__sub",children:u.sub}):null]}),Y("span",{className:"sekyro-radio","aria-hidden":"true"})]},u.id))})]})}n(tn,"ChoiceScreen");var ze=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","capture.tips.summary"];function le(e){return e!==null&&ze.includes(e)}n(le,"isVoiceKey");import{useCallback as X,useEffect as ue,useLayoutEffect as dr,useMemo as pr,useRef as ke,useState as Le}from"react";var cr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function he(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(he,"resolveClip");var lr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",on={ar:"ar-SA",fr:"fr-FR",en:"en-US"};function Z(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}n(Z,"synth");function ur(){return Z()!==null&&typeof SpeechSynthesisUtterance=="function"}n(ur,"speechAvailable");function nn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(nn,"baseLang");function sn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=nn(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>nn(r.lang)===o)}n(sn,"pickVoice");function an(e){if(!ur())return!1;let t=[];try{t=Z()?.getVoices()??[]}catch{return!0}return t.length===0||sn(t,e)!==void 0}n(an,"speechUsable");function cn(e){let t=Z();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(cn,"subscribeVoices");function xe(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(xe,"clipIdentity");function rn(e){e.pause(),e.removeAttribute("src"),e.load()}n(rn,"release");function ln(){let e=null,t=null,s=0,o=null,r=[],i=new Map,c=n(()=>{r=Z()?.getVoices()??[]},"loadVoices"),d=!1,y=n(()=>{let l=Z();d||l===null||(d=!0,c(),l.addEventListener?.("voiceschanged",c))},"bindVoices"),V=n(()=>(e??(e=new Audio),e),"element"),C=n((l,m,k)=>{let u=Z();if(u!==null&&l!==""&&typeof SpeechSynthesisUtterance=="function"){y();let b=sn(r,m);if(r.length===0||b!==void 0){u.cancel();let g=new SpeechSynthesisUtterance(l);g.lang=m,b!==void 0&&(g.voice=b),g.rate=.95,k!==void 0&&(g.onend=g.onerror=k),u.speak(g);return}}k?.()},"speak"),R=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),Z()?.cancel()},"stop"),p=n(l=>{for(let m of l){let k=xe(m);if(i.has(k))continue;let u=new Audio;u.preload="auto",u.src=m,i.set(k,u)}},"warmClips");return{say(l){let m=l.url!==null?xe(l.url):`tts:${l.lang}:${l.text}`;if(m===o)return;o=m,s+=1;let k=s,u=l.onEnd,b=u!==void 0?()=>{k===s&&u()}:void 0;if(Z()?.cancel(),l.url!==null){let g=V();g.pause(),g.muted=!1,g.src=l.url,g.currentTime=0,g.onended=b??null,g.play()?.catch(S=>{k===s&&S?.name!=="AbortError"&&(l.speech?C(l.text,l.lang,b):b?.())});return}l.speech?C(l.text,l.lang,b):b?.()},unlock({lang:l,speech:m,prefetch:k}){let u=V();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let S=Uint8Array.from(atob(lr),L=>L.charCodeAt(0));t=URL.createObjectURL(new Blob([S],{type:"audio/wav"}))}let b=u.paused===!1&&t!==null&&u.src!==t;t!==null&&!b&&(u.muted=!0,u.onended=null,u.src=t,u.play()?.catch(()=>{}));let g=Z();if(m&&g!==null&&typeof SpeechSynthesisUtterance=="function"){y();let S=new SpeechSynthesisUtterance(" ");S.volume=0,S.lang=l,g.speak(S)}p(k??[])},prefetch:p,stop:R,dispose(){R(),d&&Z()?.removeEventListener?.("voiceschanged",c),d=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&rn(e),e=null;for(let l of i.values())rn(l);i.clear()}}}n(ln,"createVoicePlayer");var un="sekyro.voiceGuidance";function dn(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(dn,"readVoicePreference");function pn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(pn,"writeVoicePreference");var Ne="capture.tips.summary",fr=typeof window<"u"?dr:ue,yr=Object.freeze({});function at(e,t){let s=new Set,o=[];for(let r of ze){let i=r===Ne?null:he(e,r,t);i===null||s.has(xe(i))||(s.add(xe(i)),o.push(i))}return o}n(at,"resolvedClipUrls");function ct({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},i=r.storageKey===void 0?un:r.storageKey,[c,d]=Le(r.defaultEnabled??!0),y=ke(c),[V,C]=Le(!1),[R,p]=Le("none"),[l,m]=Le(!1),k=ke(!1),[u,b]=Le(0),g=ke(null),S=X(()=>(g.current??(g.current=ln()),g.current),[]),L=on[e],K=r.speechFallback,h=K===void 0||K===!0?!0:K===!1?!1:K.includes(e),M=r.clips??t??yr,F=ke(!1),O=ke(M);fr(()=>{O.current=M,y.current=c}),ue(()=>{if(o||i===null)return;let f=dn(i);f!==null&&(y.current=f,d(f))},[o,i]),ue(()=>{if(!(o||!h))return cn(()=>b(f=>f+1))},[o,h]);let a=r.clips;ue(()=>{if(o)return;let f=h&&an(L);C(at(M,e).length>0||f),p(a!==void 0&&he(a,Ne,e)!==null?"partner":he(M,Ne,e)!==null||f?"default":"none")},[o,M,a,e,h,L,u]),ue(()=>{if(o||!c||!F.current)return;let f=at(M,e);f.length>0&&S().prefetch(f)},[o,c,M,e,S]),ue(()=>()=>{g.current?.dispose(),g.current=null,F.current=!1},[]);let A=X(f=>{o||(F.current=!0,S().unlock({lang:L,speech:h,...f?{prefetch:at(O.current,e)}:{}}))},[o,S,L,h,e]),N=X(()=>A(y.current),[A]),H=X(()=>{k.current=!1,m(!1)},[]),w=X(()=>{H(),g.current?.stop()},[H]),se=X(()=>{k.current&&w()},[w]),U=X((f,q)=>{if(o)return;if(k.current){w();return}let te=S();te.stop(),k.current=!0,m(!0);let Ke=q?.clip===!1?null:he(O.current,Ne,e);te.say({url:Ke,text:f,lang:L,speech:h,onEnd:H})},[o,w,S,e,L,h,H]),P=X(f=>{o||(f?A(!0):w(),i!==null&&pn(i,f),y.current=f,d(f))},[o,A,w,i]),v=X(()=>P(!y.current),[P]),ie=X((f,q)=>{if(o||!c)return;k.current&&H();let te=he(O.current,f,e);S().say({url:te,text:q,lang:L,speech:h})},[o,c,e,S,L,h,H]);return pr(()=>({supported:!o&&V,enabled:!o&&c,setEnabled:P,toggle:v,unlock:N,speakKey:ie,stop:w,summary:o?"none":R,summaryPlaying:l,toggleSummary:U,stopSummary:se}),[o,V,c,P,v,N,ie,w,R,l,U,se])}n(ct,"useVoiceGuidance");function lt(e,t,s,o){let{speakKey:r,stop:i,enabled:c}=e,d=ke(!1);ue(()=>{if(!o||!c){d.current&&i(),d.current=!1;return}d.current=!0,le(t)&&t!==Ne&&s!==""&&r(t,s)},[o,c,t,s,r,i])}n(lt,"useSpeakGuidance");import{isValidElement as Yr,useCallback as Qe,useContext as Zr,useEffect as de,useMemo as be,useRef as pe,useState as qn}from"react";import{jsx as we,jsxs as fn}from"react/jsx-runtime";var mr=Array.from({length:56},(e,t)=>{let s=t/56*2*Math.PI-Math.PI/2,o=Math.cos(s),r=Math.sin(s);return{id:`tick-${t}`,frac:t/55,x1:150+108*o,y1:150+108*r,x2:150+138*o,y2:150+138*r,style:{transitionDelay:`${t*6}ms`}}});function gr(e,t,s,o){return s?"var(--sekyro-color-success)":e?o?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":t<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":t<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}n(gr,"tickColor");var hr="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function yn({progress:e,phase:t,draining:s=!1}){let o=Math.min(1,Math.max(0,e)),r=Math.round(o*56),i=t==="checking",c=t==="recording",d=t==="frozen",y=i||d,V=i||c||d,C=t==="locked"||V,R=s&&!C;return fn("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":t,"data-filled":r,"data-recording":c?"":void 0,"data-draining":R?"":void 0,children:[we("path",{fillRule:"evenodd",d:hr,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":y?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),fn("g",{className:t==="locked"?"sekyro-capture-settle":void 0,children:[we("g",{className:y?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:mr.map((p,l)=>we("line",{x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,stroke:gr(l<r,p.frac,C,R),strokeWidth:3,strokeLinecap:"round",style:p.style,className:"sekyro-arc__tick"},p.id))}),we("g",{className:t==="seeking"?"sekyro-capture-breathe":void 0,children:we("circle",{cx:150,cy:150,r:100,fill:"none",stroke:C?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:C?3.5:2.5,className:V?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}n(yn,"CaptureArc");import{jsx as G,jsxs as Ee}from"react/jsx-runtime";function mn({videoRef:e,guidanceText:t,guidanceHint:s,guidanceKey:o,progress:r,phase:i,draining:c=!1,stillUrl:d,showChecking:y,onSwitchCamera:V,canSwitchCamera:C,voicePrompt:R,overlay:p,reduceMotion:l=!1}){let m=E(),k=i==="checking",b=k||i==="frozen",g=b&&y?m("capture.checking"):t,S=R?.(s,g,o);return Ee("div",{className:l?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[G("video",{ref:e,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&b?G("img",{src:d,alt:m("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,G(yn,{progress:r,phase:i,draining:c}),p?.(e),S!=null&&!b?G("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:S}):null,C?G(T,{kind:"chip",onClick:V,"aria-label":m("capture.switchCamera"),className:"sekyro-stage__corner-end","data-testid":"sekyro-switch-camera",children:G(kr,{})}):null,k&&y?Ee("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[G(vr,{}),m("capture.cameraOff")]}):null,Ee("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[G("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:g},g),b&&y?G("span",{className:"sekyro-stage__guidance-hint",children:m("capture.checkingHint")}):null]})]})}n(mn,"CaptureStage");function kr(){return Ee("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[G("path",{d:"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"}),G("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),G("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}n(kr,"FlipCameraIcon");function vr(){return Ee("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[G("path",{d:"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"}),G("path",{d:"M3 3l18 18"})]})}n(vr,"CameraOffIcon");import{useEffect as Cr,useRef as br}from"react";import{jsx as ve,jsxs as ut}from"react/jsx-runtime";function gn({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=E(),i=br(null);return Cr(()=>{s&&i.current?.focus()},[s]),!e&&!s?null:ut("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?ut("div",{className:"sekyro-stack sekyro-stack--1",children:[ve("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),ut("ul",{className:"sekyro-coaching",children:[ve("li",{children:r("capture.retryCoaching.light")}),ve("li",{children:r("capture.retryCoaching.eyeLevel")}),ve("li",{children:r("capture.retryCoaching.head")})]}),t!==null?ve("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:t}):null]}):null,s?ve(T,{ref:i,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(gn,"CapturedPanel");function We(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(We,"isDevBuild");import{createContext as Sr}from"react";var hn=Sr(null);import{useCallback as Sn,useEffect as Vn,useRef as Ce}from"react";import{useId as Vr}from"react";import{jsx as Ye,jsxs as dt}from"react/jsx-runtime";var Rr=["user","environment"];function kn({value:e,onChange:t}){let s=E(),o=Vr();return dt("fieldset",{className:"sekyro-segmented","data-testid":"sekyro-facing",children:[Ye("legend",{className:"sekyro-segmented__legend",children:s("capture.cameraLabel")}),Ye("div",{className:"sekyro-segmented__options",children:Rr.map(r=>dt("label",{className:"sekyro-segmented__option",children:[Ye("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),dt("span",{className:"sekyro-segmented__face",children:[Ye("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(kn,"FacingPicker");import{useEffect as _r,useState as Ir}from"react";import{jsx as Me,jsxs as xr}from"react/jsx-runtime";function vn({state:e}){let t=E(),[s,o]=Ir(!1);_r(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?Me(zt,{}):e==="denied"?Me(Yt,{}):Me(Wt,{});return xr("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Me("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),Me("span",{children:t(`capture.permission.${e}`)})]})}n(vn,"PermissionRow");import{jsx as Ze,jsxs as Cn}from"react/jsx-runtime";function bn({voice:e}){let t=E();if(!e.supported)return null;let s=e.enabled;return Cn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[Cn("span",{className:"sekyro-switch__label",children:[Ze(ge,{off:!s}),t("capture.voiceGuidance")]}),Ze("span",{className:"sekyro-switch__track","aria-hidden":"true",children:Ze("span",{className:"sekyro-switch__thumb",children:s?Ze(Zt,{className:"sekyro-switch__check"}):null})})]})}n(bn,"VoiceSwitch");import{Fragment as Nr,jsx as $,jsxs as Ae}from"react/jsx-runtime";function Rn({assets:e,onRetryAssets:t,permission:s,canChooseFacing:o,facing:r,onFacingChange:i,voice:c,tips:d,summary:y,startLabel:V,startDisabled:C,onStart:R}){let p=E(),l=Ce(y?.stop);l.current=y?.stop,Vn(()=>()=>l.current?.(),[]);let m=Ce(null),k=Ce(null),u=Ce(null),b=Ce(e),g=Ce(!1);Vn(()=>{let F=b.current;if(b.current=e,F===e)return;let O=g.current;e!=="loading"&&(g.current=!1),Lr(m.current)&&(e==="failed"?u.current?.focus():O&&k.current?.focus())},[e]);let S=Sn(()=>{g.current=!0,t()},[t]),L=e==="loading",K=L||C,h=Sn(()=>{K||(l.current?.(),R())},[K,R]),M;return e==="failed"?M=Ae(D,{tone:"danger",testId:"sekyro-assets-error",children:[$("p",{className:"sekyro-text-body",children:p("fcv2.err.models")}),$(T,{kind:"ghost",ref:u,className:"sekyro-btn--start",onClick:S,"data-testid":"sekyro-assets-retry",children:p("common.retry")})]}):M=Ae("div",{className:"sekyro-stack sekyro-stack--1",children:[$(T,{ref:k,full:!0,"data-testid":"sekyro-start","aria-disabled":K?"true":void 0,"aria-busy":L?"true":void 0,onClick:h,children:L?Ae(Nr,{children:[$(Xt,{}),p("capture.preparing.title")]}):V??p("capture.start")}),L?$("p",{className:"sekyro-text-muted",children:p("capture.preparing.hint")}):null]}),Ae("div",{ref:m,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[d!==!1?$(Jt,{tips:d}):null,y!==void 0?Ae(T,{kind:"ghost",className:"sekyro-btn--start",onClick:y.toggle,"data-testid":"sekyro-tips-listen",children:[$(ge,{off:!1}),p(y.playing?"capture.tips.stop":"capture.tips.listen")]}):null,$(vn,{state:s}),o?$(kn,{value:r,onChange:i}):null,$(bn,{voice:c}),$("p",{className:"sekyro-text-muted",children:p("capture.securityNote")}),M,$("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?p("capture.preparing.title"):e==="ready"?p("capture.ready"):""})]})}n(Rn,"PreCaptureScreen");function Lr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(Lr,"focusIsOurs");import{hasMultipleCameras as wr,subscribeCameraPermission as Er}from"@sekyro/web";import{useEffect as _n,useState as In}from"react";function xn(){let[e,t]=In({state:"unknown",settled:!1}),[s,o]=In(!1);return _n(()=>Er(r=>t({state:r,settled:!0})),[]),_n(()=>{let r=!0;return wr().then(i=>{r&&o(i)}),()=>{r=!1}},[]),{permission:e.state,permissionSettled:e.settled,canChooseFacing:s}}n(xn,"useCameraStatus");import{useEffect as Ln,useState as Nn}from"react";function wn(e){return Mn(e,"mobileRequired")}n(wn,"useMobileRequired");function En(e){return Mn(e,"returning").required}n(En,"useReturning");function Mn(e,t){let[s,o]=Nn({required:!1,settled:e===void 0});return Ln(()=>{let r=e?.[t];if(e===void 0||typeof r!="function"){o({required:!1,settled:!0});return}let i=!0;return o({required:!1,settled:!1}),Promise.resolve().then(()=>r.call(e)).then(c=>{i&&o({required:c===!0,settled:!0})},()=>{i&&o({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),s}n(Mn,"useFlag");function An(e){let[t,s]=Nn(!1);return Ln(()=>{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(An,"useBusy");import{getLivenessAssetsStatus as Mr,preloadLivenessAssets as Ar,subscribeLivenessAssets as Pr}from"@sekyro/web";import{useCallback as pt,useEffect as Pn,useRef as Tn,useState as Tr,useSyncExternalStore as Kr}from"react";var Or=n(()=>"idle","serverSnapshot");function Kn(e){return Ar(e!==void 0?{assetBaseUrl:e}:{})}n(Kn,"preload");function On(e,t=!0){let s=Kr(pt(R=>Pr(R,e),[e]),()=>Mr(e),Or),[o,r]=Tr(null),i=Tn(!1),c=pt(()=>{Kn(e).then(R=>{i.current&&R==="idle"&&r({base:e})})},[e]);Pn(()=>(i.current=!0,c(),()=>{i.current=!1}),[c]);let d=Tn(null);Pn(()=>{if(s!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[s,e,c,t]);let y=pt(()=>{Kn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:y}}n(On,"useLivenessAssets");import{createLivenessCapture as Ur}from"@sekyro/web";import{useCallback as ft,useEffect as Gr,useRef as Pe,useState as ee}from"react";var Un={progress:0,hint:null,faceDetected:!1};function Gn(e){let{videoRef:t,assetBaseUrl:s}=e,r=Pe(e.verification).current,i=Pe(!1);e.verification!==r&&!i.current&&We()&&(i.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 c=Pe(null),[d,y]=ee("idle"),[V,C]=ee(Un),[R,p]=ee(!1),[l,m]=ee(!1),[k,u]=ee(null),[b,g]=ee(!1),[S,L]=ee(null),[K,h]=ee(null),[M,F]=ee(null),O=Pe(null),a=Pe(e);a.current=e,Gr(()=>{let w=t.current;if(w===null)return;let se={video:w,...s!==void 0?{assetBaseUrl:s}:{}},U=r!==void 0?r.liveness(se):Ur(se);c.current=U;let P=[U.on("state",v=>{v==="starting"&&(L(null),h(null),C(Un),m(!1),p(!1),u(null),O.current=null),y(v),a.current.onStateChange?.(v)}),U.on("gate",v=>{let ie=O.current;O.current=v.progress,p(ie!==null&&v.progress<ie-.001&&v.progress>0&&v.progress<1),v.progress>=1&&m(!0),C(v)}),U.on("frozen",({previewDataUrl:v})=>u(v)),U.on("profile",({animations:v})=>g(v==="reduced")),U.on("captured",v=>{L(v),F(null),a.current.onCaptured?.(v)}),U.on("error",v=>{h(v),a.current.onError?.(v)}),r?.on("result",v=>{F(v),a.current.onResult?.(v)})];return()=>{for(let v of P)v?.();c.current=null,U.destroy()}},[r,t,s]);let A=ft(w=>{c.current?.start(w)},[]),N=ft(()=>{c.current?.retry()},[]),H=ft(()=>{m(!1),p(!1),u(null),O.current=null,c.current?.switchCamera()},[]);return{state:d,gate:V,draining:R,gateLocked:l,frozenPreview:k,reduceMotion:b,artifacts:S,error:K,result:M,start:A,retry:N,switchCamera:H}}n(Gn,"useLivenessHandle");import{useCallback as Hr,useEffect as Fr,useState as Xe}from"react";var Br=new Set(["national_number"]);function Hn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Br.has(s));return t.length>0?{...e,options:t}:null}n(Hn,"pending");function Fn(e){let[t,s]=Xe(null),[o,r]=Xe(e===void 0),[i,c]=Xe(!1),[d,y]=Xe(!1);Fr(()=>{if(s(null),e===void 0){r(!0);return}let p=!0,l=e.methodChoice;typeof l=="function"?(r(!1),Promise.resolve().then(()=>l.call(e)).then(k=>{p&&s(Hn(k))},()=>{}).finally(()=>{p&&r(!0)})):r(!0);let m=e.on("method",k=>s(Hn(k)));return()=>{p=!1,m()}},[e]);let V=Hr(async p=>{if(e===void 0)return!1;c(!0),y(!1);try{return await e.selectMethod(p),s(null),!0}catch{return y(!0),!1}finally{c(!1)}},[e]),C=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:C==="national_number"&&!d?C:null,settled:o,busy:i,failed:d,select:V}}n(Fn,"useMethodChoice");import{useEffect as Dr,useMemo as $r,useState as qr}from"react";var jr=["ar","fr","en"];function zr(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(zr,"isClipUrl");function Wr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of jr){let r=t[o];if(!(typeof r!="object"||r===null))for(let[i,c]of Object.entries(r))!le(i)||!zr(c)||((s[o]??(s[o]={}))[i]=c)}return Object.keys(s).length>0?s:null}n(Wr,"toVoiceClipMap");function Bn(e){let[t,s]=qr(null);Dr(()=>{if(s(null),e===void 0)return;let r=!0,i=n(d=>{if(!r)return;let y=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;s(V=>V?.setId===y?.setId?V:y)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let c=e.on("view",d=>i(d.voice));return()=>{r=!1,c()}},[e]);let o=$r(()=>t!==null?Wr(t):null,[t]);return e===void 0?null:o}n(Bn,"useServerVoiceClips");import{jsx as Dn}from"react/jsx-runtime";function $n({voice:e}){let t=E();return Dn(T,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:Dn(ge,{off:!e.enabled,className:"sekyro-icon"})})}n($n,"VoiceChip");import{Fragment as ro,jsx as x,jsxs as Te}from"react/jsx-runtime";var Xr=800;function Qr(e){return e===void 0||e!==!1&&e.length===qe.length&&qe.every(t=>e.includes(t))}n(Qr,"isDefaultTips");function Jr(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}n(Jr,"carriesActivation");function eo(e){return typeof e=="object"&&e!==null&&!Yr(e)&&"tone"in e&&"text"in e}n(eo,"isNoticeObject");function to(e){return e==="starting"||e==="gating"||e==="recording"}n(to,"isCapturing");function no(e){return e==="captured"||e==="uploading"||e==="checking"}n(no,"isPostCapture");function Li({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:i=!1,notice:c,startDisabled:d=!1,startLabel:y,tips:V,tipsSummary:C,coach:R,defaultFacing:p,voice:l,onGuidance:m,onCaptured:k,onResult:u,onError:b,onStateChange:g,assetBaseUrl:S,className:L}){let K=be(()=>Ft(t,o),[t,o]),h=be(()=>_=>K[_]??"",[K]),M=s??(t==="ar"?"rtl":"ltr"),F=pe(null),O=Zr(hn),a=Gn({verification:e,videoRef:F,assetBaseUrl:S,onCaptured:k,onResult:u,onError:b,onStateChange:g}),A=On(S,a.state==="idle"&&a.error===null),N=Fn(e),H=N.choice!==null,w=wn(e),se=En(e),U=An(e),P=xn(),v=l!==!1&&l?.clips===void 0,ie=Bn(v?e:void 0),f=ct({locale:t,defaultClips:ie,options:l}),[q,te]=qn(p??"user"),Ke=pe(null),Oe=pe(!1),yt=pe(f.unlock);yt.current=f.unlock,de(()=>{let _=Ke.current;if(_===null)return;let ce=["pointerup","touchend","click","keydown"],re=n(()=>{for(let Ie of ce)_.removeEventListener(Ie,me,!0)},"disarm");function me(Ie){if(Oe.current){re();return}Jr(Ie)&&(Oe.current=!0,re(),yt.current())}n(me,"onGesture");for(let Ie of ce)_.addEventListener(Ie,me,{capture:!0,passive:!0});return re},[]);let mt=Qe(()=>{Oe.current||(Oe.current=!0,f.unlock()),a.start({facing:q})},[f.unlock,a.start,q]),gt=Qe(()=>a.start({facing:q}),[a.start,q]),Ue=pe(!1),Se=a.state==="idle"&&a.error===null,ht=!H&&!w.required&&(i===!0||i==="when-permitted"&&P.permission==="granted"),kt=ht&&N.settled&&w.settled,jn=i==="when-permitted"&&!P.permissionSettled&&!Ue.current,vt=ht&&Se&&!Ue.current,Je=(jn||vt)&&A.gate==="ready"?"loading":A.gate;de(()=>{!kt||!Se||A.gate!=="ready"||Ue.current||(Ue.current=!0,gt())},[kt,Se,A.gate,gt]);let zn=Se&&!H&&!w.required&&!(vt&&A.gate==="ready"),Wn=Qe(()=>{te(_=>_==="user"?"environment":"user"),a.switchCamera()},[a.switchCamera]),Ge=be(()=>a.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(a.artifacts.keyframe):null,[a.artifacts]);de(()=>{if(Ge!==null)return()=>URL.revokeObjectURL(Ge)},[Ge]);let Ct=a.frozenPreview??Ge,fe=e!==void 0,B=to(a.state),ne=no(a.state),He=B||ne,j=a.result,bt=a.state==="done"&&j!==null,St=a.state==="recording"&&a.frozenPreview!==null,et=O!==null,Ve=ne||St,Vt=ne?"checking":St?"frozen":a.state==="recording"?"recording":a.gateLocked||a.gate.progress>=1?"locked":a.gate.faceDetected?"aligning":"seeking",Fe=B?a.gate.hint:null,Be=a.state==="starting"?"capture.preparing.title":Fe===null?null:Fe==="center"&&!a.gate.faceDetected?"fcv3.no_face":Kt(Fe),[Yn,Rt]=qn(null);de(()=>{if(Be!=="fcv3.no_face"){Rt(Be);return}if(!B)return;let _=setTimeout(()=>Rt(Be),Xr);return()=>clearTimeout(_)},[Be,B]);let tt=B&&typeof R=="string"&&R!=="",ae=B&&!tt?Yn:null,nt=tt?R:ae===null?"":h(ae);lt(f,ae,nt,B);let _t=pe(m);_t.current=m,de(()=>{if(le(ae))try{_t.current?.(ae)}catch(_){console.error("[@sekyro/react] onGuidance threw:",_)}},[ae]);let Re=be(()=>({supported:f.supported,enabled:f.enabled,setEnabled:f.setEnabled,toggle:f.toggle}),[f.supported,f.enabled,f.setEnabled,f.toggle]),rt=r?.voicePrompt,It=rt!==void 0,xt=l===void 0,Lt=pe(!1);de(()=>{!It||!xt||Lt.current||!We()||(Lt.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."))},[It,xt]);let Zn=rt!==void 0?(_,ce,re)=>rt(_,ce,re,Re):f.supported?()=>x($n,{voice:Re}):void 0,{summary:ot,summaryPlaying:Nt,toggleSummary:wt,stopSummary:Et}=f,De=C!==void 0&&C!=="",Mt=De?C:h("capture.tips.summary"),At=De?ot!=="none":ot==="partner"||ot==="default"&&Qr(V),Pt=be(()=>At?{playing:Nt,toggle:n(()=>wt(Mt,{clip:!De}),"toggle"),stop:Et}:void 0,[At,Nt,wt,Mt,Et,De]),Xn=be(()=>({assets:Je,retryAssets:A.retry,permission:P.permission,facing:q,setFacing:te,canChooseFacing:P.canChooseFacing,voice:Re}),[Je,A.retry,P.permission,P.canChooseFacing,q,Re]),Qn=eo(c)?x(D,{tone:c.tone,testId:"sekyro-host-notice",children:x("span",{children:c.text})}):c??null,Q=j!==null&&j.status==="retry"?j:null,J=bt&&j.status==="unavailable"&&!H&&j.reason!=="portrait_required"?j:null,_e=bt&&(j.status==="approved"||j.status==="rejected"||j.status==="review")?j:null,ye=n((_,ce)=>{if(_===void 0)return null;if(_==="device_cooldown"){let me=Gt(t,ce);if(me!==null)return h(me.key).replace("{time}",me.time)}let re=Ut(_);return re===null?null:h(re)},"reasonText"),Jn=J!==null&&J.reason!==void 0&&J.reason!=="nni_unbound"&&J.reason!=="method_required"&&J.reason!=="mobile_required"&&!(J.reason==="no_recorder"&&a.artifacts?.degraded==="NO_RECORDER"),Tt=$e(),er=H&&N.auto===null&&!B&&!ne&&a.error===null,st=Qe(async _=>{await N.select(_)&&a.state==="done"&&a.retry()},[N.select,a.state,a.retry]);return de(()=>{N.auto!==null&&!N.busy&&!B&&!ne&&st(N.auto)},[N.auto,N.busy,B,ne,st]),x(Bt,{value:h,children:Te("div",{ref:Ke,className:L===void 0?"sekyro-capture":`sekyro-capture ${L}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":a.state,children:[r?.header,Q!==null&&ye(Q.reason)!==null&&!(et&&He)?x(D,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:x("span",{children:ye(Q.reason)})}):null,U&&ne&&!et?x(D,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:x("span",{children:h("capture.busy")})}):null,w.required&&Se?x(D,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:x("span",{children:h("reasons.mobile_required")})}):null,a.error!==null?r?.errorPanel!==void 0?r.errorPanel(a.error,a.retry):Te(D,{tone:"danger",testId:"sekyro-error-notice",children:[x("span",{children:h(Ot(a.error.kind))}),a.error.retryable?x(T,{ref:Tt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:h("common.retry")}):null]}):null,J!==null?Te(D,{tone:"danger",testId:"sekyro-unavailable-notice",children:[x("span",{children:ye(J.reason)??h(J.reason===void 0?"errors.session_expired":"errors.network_error")}),Jn?x(T,{ref:Tt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:h("capture.recordAgain")}):null]}):null,_e!==null&&ye(_e.reason)!==null?x(D,{tone:_e.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:x("span",{children:ye(_e.reason,_e.retryAfter)})}):null,x("div",{className:He?void 0:"sekyro-hidden","data-capture-live":He?"":void 0,children:et?O({videoRef:F,guidance:Ve&&fe?h("capture.checking"):nt,coached:tt&&!(Ve&&fe),note:Ve?fe?h(U?"capture.busy":"capture.checkingHint"):null:Q!==null?ye(Q.reason):null,settled:Ve&&fe,progress:a.gate.progress,phase:Vt,still:Ve?Ct:null,live:He}):x(mn,{videoRef:F,guidanceText:nt,guidanceHint:Fe,guidanceKey:ae,progress:a.gate.progress,phase:Vt,draining:a.draining,stillUrl:Ct,showChecking:fe,onSwitchCamera:Wn,canSwitchCamera:B&&a.state!=="recording",voicePrompt:Zn,overlay:r?.stageOverlay,reduceMotion:a.reduceMotion})}),er&&N.choice!==null?x(tn,{title:h("method.title"),description:h("method.description"),options:N.choice.options.map(_=>({id:_,label:h(`method.${_}`)})),busy:N.busy,error:N.failed?h("errors.network_error"):null,focus:a.state==="done",testId:"sekyro-method",look:"buttons",onChoose:_=>{st(_)}}):null,zn?Te(ro,{children:[se&&r?.header===void 0?Te("div",{className:"sekyro-stack sekyro-stack--1",children:[x("h2",{className:"sekyro-text-body",children:h("returning.title")}),x("p",{className:"sekyro-text-muted",children:h("returning.description")})]}):null,Qn,r?.intro!==void 0?r.intro(mt,Xn):x(Rn,{assets:Je,onRetryAssets:A.retry,permission:P.permission,canChooseFacing:P.canChooseFacing,facing:q,onFacingChange:te,voice:Re,tips:V??qe,...Pt!==void 0?{summary:Pt}:{},...y!==void 0?{startLabel:y}:{},startDisabled:d,onStart:mt})]}):null,x(gn,{showCoaching:Q!==null,attemptsText:Q?.attemptsRemaining!==void 0?Ht(K,t,Q.attemptsRemaining):null,showRetake:Q!==null&&!B&&!ne||!fe&&a.state==="captured",onRetake:a.retry}),r?.footer]})})}n(Li,"LivenessCapture");export{hn as a,qe as b,tn as c,ze as d,Xr as e,Li as f};
|
package/dist/chunk-YUNPD6ZB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var e={"eid.identifierTitle":"التحقق عبر {provider}","eid.identifierTitleGeneric":"التحقق عبر هويتك الرقمية الوطنية","eid.identifierDescription":"أدخل رقمك الوطني. سيعرض لك تطبيق {provider} رمزًا.","eid.identifierDescriptionGeneric":"أدخل رقمك الوطني. سيعرض لك تطبيق الهوية الرقمية رمزًا.","eid.boundDescription":"سيعرض لك تطبيق {provider} رمزًا.","eid.boundDescriptionGeneric":"سيعرض لك تطبيق الهوية الرقمية رمزًا.","eid.start":"احصل على رمزي","eid.codeTitle":"أدخل رمز {provider}","eid.codeTitleGeneric":"أدخل الرمز من تطبيق الهوية الرقمية","eid.codeHelp":"افتح تطبيق {provider} لرؤية رمزك","eid.codeHelpGeneric":"افتح تطبيق الهوية الرقمية الوطنية لرؤية رمزك","eid.codeLabel":"الرمز","eid.verify":"تحقّق من الرمز","eid.resend":"احصل على رمز جديد","eid.resendIn":"رمز جديد خلال {seconds} ثانية","eid.noResendsLeft":"لم يعد بإمكانك طلب رمز جديد","eid.expiresIn":"ينتهي الرمز خلال {time}","eid.expired":"انتهت صلاحية الرمز — اطلب رمزًا جديدًا","eid.useCamera":"التحقق بالكاميرا بدلًا من ذلك","reasons.eid_identifier_invalid":"تحقّق من رقمك الوطني وأعد إدخاله","reasons.eid_code_invalid":"الرمز غير صحيح — تحقّق منه وأعد إدخاله","reasons.eid_code_expired":"انتهت صلاحية رمزك — اطلب رمزًا جديدًا للمتابعة","reasons.eid_locked":"أُدخلت رموز غير صحيحة عدة مرات — تم قفل الدخول بالهوية الرقمية لهذا التحقق","reasons.eid_not_enrolled":"هذا الرقم الوطني غير مفعّل للدخول بالهوية الرقمية","reasons.eid_unavailable":"الدخول بالهوية الرقمية غير متاح حاليًا — أعد المحاولة بعد قليل","reasons.eid_resend_too_soon":"انتظر قليلًا قبل طلب رمز جديد","reasons.eid_resend_limit":"لا يمكنك طلب رموز أخرى — أدخل آخر رمز وصلك","eid.continueHint":"بعد {provider}، ستلتقط صورة حية سريعة.","eid.continueHintGeneric":"بعد الهوية الرقمية الوطنية، ستلتقط صورة حية سريعة.","eid.resendsRemaining.zero":"لا يمكنك طلب رمز جديد","eid.resendsRemaining.one":"يمكنك طلب رمز جديد واحد","eid.resendsRemaining.two":"يمكنك طلب رمزين جديدين","eid.resendsRemaining.few":"يمكنك طلب {count} رموز جديدة","eid.resendsRemaining.many":"يمكنك طلب {count} رمزًا جديدًا","eid.resendsRemaining.other":"يمكنك طلب {count} رمز جديد","eid.codeAttemptsRemaining.zero":"لم تتبقَّ أي محاولة","eid.codeAttemptsRemaining.one":"تبقّت محاولة واحدة","eid.codeAttemptsRemaining.two":"تبقّت محاولتان","eid.codeAttemptsRemaining.few":"تبقّت {count} محاولات","eid.codeAttemptsRemaining.many":"تبقّت {count} محاولة","eid.codeAttemptsRemaining.other":"تبقّت {count} محاولة"};var n={"eid.identifierTitle":"Verify with {provider}","eid.identifierTitleGeneric":"Verify with your national eID","eid.identifierDescription":"Enter your national number. {provider} will show you a code in its app.","eid.identifierDescriptionGeneric":"Enter your national number. Your national eID app will show you a code.","eid.boundDescription":"{provider} will show you a code in its app.","eid.boundDescriptionGeneric":"Your national eID app will show you a code.","eid.start":"Get my code","eid.codeTitle":"Enter your {provider} code","eid.codeTitleGeneric":"Enter the code from your eID app","eid.codeHelp":"Open the {provider} app to see your code","eid.codeHelpGeneric":"Open your national eID app to see your code","eid.codeLabel":"Code","eid.verify":"Verify code","eid.resend":"Get a new code","eid.resendIn":"Get a new code in {seconds}s","eid.noResendsLeft":"You can't get more codes","eid.expiresIn":"Code expires in {time}","eid.expired":"This code has expired — get a new code","eid.useCamera":"Verify with my camera instead","reasons.eid_identifier_invalid":"Check your national number and enter it again","reasons.eid_code_invalid":"That code is incorrect — check it and enter it again","reasons.eid_code_expired":"Your code has expired — get a new code to continue","reasons.eid_locked":"Too many incorrect codes — eID sign-in is locked for this verification","reasons.eid_not_enrolled":"This national number isn't set up for eID sign-in","reasons.eid_unavailable":"eID sign-in isn't available right now — try again in a moment","reasons.eid_resend_too_soon":"Wait a moment before asking for a new code","reasons.eid_resend_limit":"You can't get more codes — enter the last code you received","eid.continueHint":"After {provider}, you'll take a quick live photo.","eid.continueHintGeneric":"After your national eID, you'll take a quick live photo.","eid.resendsRemaining.one":"{count} new code left","eid.resendsRemaining.other":"{count} new codes left","eid.codeAttemptsRemaining.one":"{count} try left","eid.codeAttemptsRemaining.other":"{count} tries left"};var d={"eid.identifierTitle":"Vérifier avec {provider}","eid.identifierTitleGeneric":"Vérifier avec votre eID national","eid.identifierDescription":"Saisissez votre numéro national. {provider} vous affichera un code dans son application.","eid.identifierDescriptionGeneric":"Saisissez votre numéro national. Votre application eID vous affichera un code.","eid.boundDescription":"{provider} vous affichera un code dans son application.","eid.boundDescriptionGeneric":"Votre application eID vous affichera un code.","eid.start":"Recevoir mon code","eid.codeTitle":"Saisissez votre code {provider}","eid.codeTitleGeneric":"Saisissez le code de votre application eID","eid.codeHelp":"Ouvrez l'application {provider} pour voir votre code","eid.codeHelpGeneric":"Ouvrez votre application eID nationale pour voir votre code","eid.codeLabel":"Code","eid.verify":"Vérifier le code","eid.resend":"Recevoir un nouveau code","eid.resendIn":"Nouveau code dans {seconds} s","eid.noResendsLeft":"Vous ne pouvez plus demander de nouveau code","eid.expiresIn":"Le code expire dans {time}","eid.expired":"Ce code a expiré — demandez un nouveau code","eid.useCamera":"Vérifier plutôt avec ma caméra","reasons.eid_identifier_invalid":"Vérifiez votre numéro national et saisissez-le à nouveau","reasons.eid_code_invalid":"Ce code est incorrect — vérifiez-le et saisissez-le à nouveau","reasons.eid_code_expired":"Votre code a expiré — demandez un nouveau code pour continuer","reasons.eid_locked":"Trop de codes incorrects — la connexion eID est bloquée pour cette vérification","reasons.eid_not_enrolled":"Ce numéro national n'est pas activé pour la connexion eID","reasons.eid_unavailable":"La connexion eID n'est pas disponible pour le moment — réessayez dans un instant","reasons.eid_resend_too_soon":"Patientez un instant avant de demander un nouveau code","reasons.eid_resend_limit":"Vous ne pouvez plus demander de code — saisissez le dernier code reçu","eid.continueHint":"Après {provider}, vous prendrez une photo rapide en direct.","eid.continueHintGeneric":"Après votre eID nationale, vous prendrez une photo rapide en direct.","eid.resendsRemaining.one":"{count} nouveau code possible","eid.resendsRemaining.other":"{count} nouveaux codes possibles","eid.codeAttemptsRemaining.one":"{count} essai restant","eid.codeAttemptsRemaining.other":"{count} essais restants"};export{e as a,n as b,d as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{d as me}from"./chunk-5SVCGLYS.js";import"./chunk-65JA6YKG.js";import{a as A}from"./chunk-Q232JYNO.js";import{a as pe,b as he,e as fe,f as ve}from"./chunk-63NUMQST.js";import{a as Se,b as X}from"./chunk-BENNJ4GV.js";import{a as h,b as G,h as de}from"./chunk-4RUZQW5T.js";import{useEffect as R,useLayoutEffect as Ue,useRef as Q,useState as g}from"react";var ge={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:ge[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]=g(!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(([C,_,f,E])=>`M${C} ${_+E*u}V${_+E*w}Q${C} ${_} ${C+f*w} ${_}H${C+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(Se,{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),[C,_]=g("idle"),[f,E]=g(null),[xe,Z]=g(null),[p,$e]=g({w:0,h:0}),[z,_e]=g({hint:null,locking:!1,card:null,manualShutter:!1}),[q,Te]=g({}),[j,He]=g(null),[J,Re]=g(null),[ee,te]=g(0),[ne,re]=g(null),[O,ae]=g(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 b=new P,S={scan:null,feedback:null,gate:null},N=h(d=>{S={...S,...d};let M=S.gate?.guide,Ye={phase:S.scan?.phase??"framing",hint:S.feedback?.reticle==="coaching"?S.feedback.key:null,card:M?.detected?{fill:M.fill,offsetX:M.offsetX,offsetY:M.offsetY}:null,manualShutter:S.scan?.manualShutter??!1},x=b.present(Ye,performance.now());_e($=>$.hint===x.hint&&$.locking===x.locking&&$.manualShutter===x.manualShutter&&$.card?.fill===x.card?.fill&&$.card?.offsetX===x.card?.offsetX&&$.card?.offsetY===x.card?.offsetY?$:x)},"present"),Ve=[c.on("state",_),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=>{Te(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",T=z.locking,se=f?.captured.length??0;R(()=>{T&&te(i=>i+1)},[T]),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"||T?"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(!T&&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)),b=o.y+o.h/2+o.h*Math.max(-.25,Math.min(.25,H.offsetY));v={x:l-i/2,y:b-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=T?"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(),b=Math.max(l.width/(c.videoWidth||1),l.height/(c.videoHeight||1)),S=c.videoWidth*b,N=c.videoHeight*b;S>0&&N>0&&y.current?.focusAt((i.clientX-l.left+(S-l.width)/2)/S,(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,b],S)=>t("path",{style:{transform:`translate(${i}px, ${c}px) scale(${l}, ${b})`},d:`M0 ${U}V${ce}Q0 0 ${ce} 0H${U}`},S))}),T?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)})})]}),C==="uploading"||C==="checking"?t("span",{className:"sekyro-visually-hidden",role:"status",children:e.t("doc.uploading")}):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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as K}from"./chunk-4INDRENU.js";import{a as O,b as U,c as z}from"./chunk-YUNPD6ZB.js";import{a as G}from"./chunk-P2LX7BBE.js";import{d as h}from"./chunk-5SVCGLYS.js";import"./chunk-65JA6YKG.js";import{a as E}from"./chunk-BENNJ4GV.js";import{a,b as f,l as V}from"./chunk-4RUZQW5T.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as w}from"./chunk-AMOZXMUP.js";import{a as D}from"./chunk-4INDRENU.js";import{a as $}from"./chunk-P2LX7BBE.js";import{d as C}from"./chunk-5SVCGLYS.js";import"./chunk-65JA6YKG.js";import{a as A,b as h}from"./chunk-63NUMQST.js";import{a as f,b as L}from"./chunk-BENNJ4GV.js";import{a as s,b as _}from"./chunk-4RUZQW5T.js";import{OtpInputError as K}from"@sekyro/web";import{useId as Y,useState as O}from"react";var P={"emailOtp.sendTitle":"تحقّق من بريدك الإلكتروني","emailOtp.sendDescription":"سنرسل إليك عبر البريد الإلكتروني رمزًا يُستخدم مرة واحدة لتأكيد أن هذا العنوان يخصّك","emailOtp.prefilledNotice":"سنرسل رمز تحقّق إلى بريدك الإلكتروني المسجّل.","emailOtp.emailLabel":"البريد الإلكتروني","emailOtp.emailHelper":"سنرسل رمزًا يُستخدم مرة واحدة إلى هذا العنوان","emailOtp.emailPlaceholder":"name@example.com","emailOtp.emailInvalid":"أدخل عنوان بريد إلكتروني صالحًا، مثل name@example.com","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 V={"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":"name@example.com","emailOtp.emailInvalid":"Enter a valid email address, for example name@example.com","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 H={"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":"nom@exemple.com","emailOtp.emailInvalid":"Saisissez une adresse e-mail valide, par exemple nom@exemple.com","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:V,fr:H,ar:P},R=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)=>C(n.strings[t]??J[n.locale][t],p),"t"),[y,M]=O(S),[c,q]=O(""),[r,g]=O(!1),[x,E]=O(null),m=e.phase==="verify",N=D(m),l=Y(),k=s(async t=>{g(!0),E(null);try{await t()}catch(p){E(p instanceof K&&p.field==="email"?a("emailOtp.emailInvalid"):n.t($(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"),z=R(e.codeExpiresAt,N),v=R(e.resendAvailableAt,N),u=m&&e.codeExpiresAt!==void 0&&z===0,[B,U]=a("emailOtp.sentTo").split("{email}"),G=e.reason==="otp_mismatch"?o(f,{tone:"danger",children:[i("span",{children:a("emailOtp.reason_otp_mismatch")}),i("span",{children:L(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(A,{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")}),G,x!==null?i(f,{tone:"danger",children:i("span",{children:x})}):null,m?o(b,{children:[o("div",{className:"sekyro-field",children:[i("label",{className:"sekyro-label",htmlFor:`${l}-code`,children:a("emailOtp.codeLabel")}),i(w,{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(z)})})]}),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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as B,b as F,c as S,d as K}from"./chunk-B43EDVOK.js";import{c as A,f as T}from"./chunk-QZAPVO6F.js";import{a as E,b as H,c as U}from"./chunk-YUNPD6ZB.js";import"./chunk-P2LX7BBE.js";import{d as z}from"./chunk-5SVCGLYS.js";import"./chunk-65JA6YKG.js";import{a as q}from"./chunk-Q232JYNO.js";import"./chunk-63NUMQST.js";import{a as C}from"./chunk-BENNJ4GV.js";import{a as p,b as v,l as I}from"./chunk-4RUZQW5T.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":"National 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 (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:H,fr:U,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 He=ee,Ue=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(C,{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=I(),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(C,{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(C,{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=I();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=I();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{He as ContactChoiceView,$e as EidContinueHint,Ue as GenericChoiceView,Qe as HandoffView,Ke as IdentitySummaryView,We as InAppBrowserPrompt,qe as LaneChoiceView,Be as LaneSwitch,Ye as LivePhotoLiveness,Ge as PortraitRetakeNotice};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as H}from"./chunk-3MBJZSJL.js";import"./chunk-Q232JYNO.js";import{c as F}from"./chunk-63NUMQST.js";import{a as c,b as x}from"./chunk-BENNJ4GV.js";import{a as l,b as g,l as w}from"./chunk-4RUZQW5T.js";import{useContext as V,useEffect as A,useRef as B,useState as k}from"react";import{jsx as t,jsxs as i}from"react/jsx-runtime";var h=["pose","eyes","mouth","lighting","background","resolution"];function J({step:r,i18n:p,assetBaseUrl:S}){let{t:e}=p,C=B(null),u=B(null),[o,G]=k("idle"),[d,L]=k(null),[v,N]=k(null),R=w(),P=V(F);A(()=>{let a=C.current;if(a===null)return;let n=r.capture({video:a,...S!==void 0?{assetBaseUrl:S}:{}});u.current=n;let y=[n.on("state",G),n.on("gate",L),n.on("error",N)];return n.start().catch(()=>{}),()=>{for(let U of y)U();n.destroy(),u.current=null}},[]);let E=o==="uploading"||o==="checking",s=o==="done",T=s&&r.reason!==void 0&&!r.uploadFailed,M=o==="starting"||o==="idle"?"portrait.starting":o==="captured"?"portrait.taken":o==="uploading"?"portrait.uploading":o==="checking"?"portrait.checking":`portrait.coach.${d?.coach??"no_face"}`,I=(r.report??[]).filter(a=>!a.pass),m=r.reason!==void 0?`reasons.${r.reason}`:null,K=l(()=>{N(null),u.current?.retry()},"retake"),f=l(a=>{let n=d?.criteria.find(y=>y.criterion===a);return n!==void 0&&(n.held||n.waived)},"met"),$=d?.ready||o==="captured"||E?1:h.filter(f).length/h.length,b=m!==null&&(o==="gating"||T);return i(H,{testId:"sekyro-portrait",video:t("video",{ref:C,className:"sekyro-lm-video sekyro-fc-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true"}),instruction:e(M),progress:$,closeLabel:e("native.close"),...P!==void 0?{onClose:P}:{},children:[t("h2",{ref:R,tabIndex:-1,className:"sekyro-visually-hidden",children:e(r.reason!==void 0?"portrait.retryTitle":"session.steps.portrait.title")}),b||v!==null||s&&(r.uploadFailed||!r.attemptsExhausted)?i("div",{className:"sekyro-fc-panel",children:[b?i(c,{tone:"warning",children:[t("span",{children:p.strings[m]!==void 0?e(m):e("portrait.retryTitle")}),I.length>0?i("span",{children:[e("portrait.reportTitle"),": ",I.map(a=>e(`portrait.report.${a.criterion}`)).join(", ")]}):null,t("span",{children:x(p,r.attemptsRemaining,r.attemptsExhausted)})]}):null,v!==null?i(c,{tone:"danger",children:[t("span",{children:e("portrait.cameraBlocked")}),t("span",{children:e("portrait.cameraBlockedHint")}),t(g,{kind:"ghost",onClick:K,children:e("portrait.retryCamera")})]}):null,r.uploadFailed&&s?t(c,{tone:"danger",children:t("span",{children:e("portrait.uploadFailed")})}):null,s&&!r.attemptsExhausted?t(g,{full:!0,onClick:K,disabled:E,children:e("portrait.retake")}):null]}):null,t("ul",{className:"sekyro-fc-checks","aria-label":e("portrait.checksLabel"),children:h.map(a=>i("li",{className:f(a)?"is-met":void 0,children:[t("span",{className:"sekyro-fc-mark","aria-hidden":"true",children:t("svg",{viewBox:"0 0 18 18",children:t("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})}),t("span",{children:e(`portrait.criteria.${a}`)}),t("span",{className:"sekyro-visually-hidden",children:e(f(a)?"portrait.met":"portrait.notMet")})]},a))})]})}l(J,"PortraitCaptureView");export{J as PortraitCaptureView};
|