@sekyro/elements 0.1.0-rc.2 → 0.1.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cdn/chunks/{capture-session-doc-O33KRXH7-X5MKSSBA.js → capture-session-doc-FRBI7OKF-AIBTLOVK.js} +1 -1
- package/dist/cdn/chunks/{chunk-JAIRD73U.js → chunk-5K4YQOZN.js} +1 -1
- package/dist/cdn/chunks/{chunk-HTLQX2R3.js → chunk-5ZNWYB3D.js} +1 -1
- package/dist/cdn/chunks/{chunk-UJSGILV7.js → chunk-AKUFZTNC.js} +1 -1
- package/dist/cdn/chunks/{chunk-WQW232LA.js → chunk-AN2KDTP4.js} +1 -1
- package/dist/cdn/chunks/{chunk-NQHMZQZA.js → chunk-AOM2HJGY.js} +1 -1
- package/dist/cdn/chunks/{chunk-OVRHETMK.js → chunk-COQQVNNG.js} +1 -1
- package/dist/cdn/chunks/{chunk-FAQCPBKF.js → chunk-EWTKC2C2.js} +1 -1
- package/dist/cdn/chunks/chunk-FYPP4Q7V.js +33 -0
- package/dist/cdn/chunks/{chunk-UQ5AELS3.js → chunk-G2RZQTCT.js} +1 -1
- package/dist/cdn/chunks/{chunk-3NAYOW43.js → chunk-GIGTK355.js} +1 -1
- package/dist/cdn/chunks/{chunk-Y7VOIKUK.js → chunk-H22YHQ6V.js} +1 -1
- package/dist/cdn/chunks/{chunk-YF5BWIHV.js → chunk-H5GXVL63.js} +1 -1
- package/dist/cdn/chunks/chunk-HMNCXTZQ.js +3 -0
- package/dist/cdn/chunks/{chunk-P3OIDL7Y.js → chunk-KLODCY6G.js} +1 -1
- package/dist/cdn/chunks/{chunk-4ECYTYEB.js → chunk-LA2MA2UQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-KQQ6BZAH.js → chunk-QOZB3DLY.js} +1 -1
- package/dist/cdn/chunks/chunk-RPCMWL2U.js +1 -0
- package/dist/cdn/chunks/{chunk-OTGSYUHN.js → chunk-SIPFHN7E.js} +1 -1
- package/dist/cdn/chunks/{chunk-M2F5OJOZ.js → chunk-UGP2ZH7W.js} +1 -1
- package/dist/cdn/chunks/{chunk-Y27EXTAY.js → chunk-WPRIGJHG.js} +1 -1
- package/dist/cdn/chunks/{chunk-SVIHEXDZ.js → chunk-X4MIUKLT.js} +1 -1
- package/dist/cdn/chunks/chunk-YRTHQZAW.js +1 -0
- package/dist/cdn/chunks/{create-document-capture-OLKNUVTU-Q3AGV6QB.js → create-document-capture-2YBCDEUB-GYUIXEAL.js} +1 -1
- package/dist/cdn/chunks/{detector-scanic-YCDNLCGV-FH6NWNXC.js → detector-scanic-23DAYT3H-AJXQA7H4.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-UL3ISHNS-E6AP35NA.js +1 -0
- package/dist/cdn/chunks/{eid-view-ERVRHLLD-ONTAYXU7.js → eid-view-FKFEF42L-4OPACR2A.js} +1 -1
- package/dist/cdn/chunks/email-otp-view-NRZCAJJ4-UFM2YDCD.js +1 -0
- package/dist/cdn/chunks/{flow-views-IGQ5MYS2-3UXKITDZ.js → flow-views-N7LBFI55-36234BJJ.js} +1 -1
- package/dist/cdn/chunks/overlay-de-KYSF3MDD-XORYFTYU.js +1 -0
- package/dist/cdn/chunks/overlay-es-36H5G6S5-22UFLFPZ.js +1 -0
- package/dist/cdn/chunks/overlay-pt-EB4UDBFE-CWJXQDCQ.js +1 -0
- package/dist/cdn/chunks/plan-runner-KQM7I4MR-HEXIU27Q.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-TMHG2UX2-N44IPYHU.js → portrait-capture-view-6KZGPAJU-CFUUPI5B.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-XUWQ5LIN-M5WOPF2E.js → portrait-review-view-TBSABVSX-J5ZCIFSX.js} +1 -1
- package/dist/cdn/chunks/proof-of-address-view-3GG3XEQK-7DFCRBNZ.js +1 -0
- package/dist/cdn/chunks/upload-file-EGXXM6TQ-NNVVB5QQ.js +1 -0
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-LREBBPJW.js → chunk-2FHYNKUL.js} +1 -1
- package/dist/{chunk-KXJRO6VZ.js → chunk-A75VY7L7.js} +1 -1
- package/dist/{chunk-SBJNQYEL.js → chunk-APM7FCA2.js} +1 -1
- package/dist/{chunk-S6JGFCOP.js → chunk-CFERAKA2.js} +1 -1
- package/dist/{chunk-LHD2PSUM.js → chunk-JCCTKW23.js} +1 -1
- package/dist/{chunk-GTN3SYJJ.js → chunk-JUB6FRPB.js} +1 -1
- package/dist/chunk-LYFBZCIH.js +33 -0
- package/dist/{chunk-6LR6LY2U.js → chunk-PMIO3U3J.js} +1 -1
- package/dist/{chunk-IFHBX74I.js → chunk-PNTIMH72.js} +1 -1
- package/dist/{chunk-OQUTKFRP.js → chunk-UXPM24JI.js} +1 -1
- package/dist/{chunk-IQ7FLSNW.js → chunk-UZJG5SPC.js} +1 -1
- package/dist/chunk-WBXQX6DQ.js +1 -0
- package/dist/{chunk-INKK6CKB.js → chunk-YPBTBTOU.js} +1 -1
- package/dist/define.cjs +6 -6
- package/dist/define.js +1 -1
- package/dist/document-capture-view-UL3ISHNS-K636D7VR.js +1 -0
- package/dist/{eid-view-ERVRHLLD-NLA6CQL7.js → eid-view-FKFEF42L-ZXQWPIIA.js} +1 -1
- package/dist/email-otp-view-NRZCAJJ4-RANTR7SO.js +1 -0
- package/dist/{flow-views-IGQ5MYS2-DVYTE4D2.js → flow-views-N7LBFI55-DZ3PH2EP.js} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-KYSF3MDD-2ZNXM2N7.js +1 -0
- package/dist/overlay-es-36H5G6S5-VQWD57TO.js +1 -0
- package/dist/overlay-pt-EB4UDBFE-6VWPTFO2.js +1 -0
- package/dist/{portrait-capture-view-TMHG2UX2-4DHDNWRH.js → portrait-capture-view-6KZGPAJU-LAGNB7A4.js} +1 -1
- package/dist/{portrait-review-view-XUWQ5LIN-7GZ3GF2B.js → portrait-review-view-TBSABVSX-MLNZZBL5.js} +1 -1
- package/dist/proof-of-address-view-3GG3XEQK-FWM7OQ4K.js +1 -0
- package/dist/styles.css +15 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-CSM63KBJ.js +0 -3
- package/dist/cdn/chunks/chunk-EPEHFY6J.js +0 -1
- package/dist/cdn/chunks/chunk-GRJNZG6Y.js +0 -33
- package/dist/cdn/chunks/chunk-LNQJGD3J.js +0 -1
- package/dist/cdn/chunks/document-capture-view-GZX5JJ7N-PRYTX37D.js +0 -1
- package/dist/cdn/chunks/email-otp-view-B7UQ5CHL-GWHWAR75.js +0 -1
- package/dist/cdn/chunks/overlay-de-5KYN4JFO-I4ESJMAS.js +0 -1
- package/dist/cdn/chunks/overlay-es-6CAERCCN-SPFAX3SD.js +0 -1
- package/dist/cdn/chunks/overlay-pt-UBGXJ3C3-MWW4QOSN.js +0 -1
- package/dist/cdn/chunks/plan-runner-VKPRZ3AD-VYRGIMQG.js +0 -1
- package/dist/cdn/chunks/upload-file-UYXOHCRG-MBYCMRP2.js +0 -1
- package/dist/chunk-4QKQAQKO.js +0 -1
- package/dist/chunk-GRQ3QAMU.js +0 -33
- package/dist/document-capture-view-GZX5JJ7N-ZW55IE6H.js +0 -1
- package/dist/email-otp-view-B7UQ5CHL-67LKMWBY.js +0 -1
- package/dist/overlay-de-5KYN4JFO-MYA62T4Z.js +0 -1
- package/dist/overlay-es-6CAERCCN-QPH54AX7.js +0 -1
- package/dist/overlay-pt-UBGXJ3C3-VG6FOOCX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pr,d as hr}from"./chunk-LHD2PSUM.js";import{b as gr,c as kt}from"./chunk-GTN3SYJJ.js";import{a as kr}from"./chunk-YZ6YGLNN.js";import{c as bt}from"./chunk-4QKQAQKO.js";import{a as cr,b as ur,c as dr,d as Re}from"./chunk-S6JGFCOP.js";import{F as mr,K as yr,L as vr,a as F,b as de,c as X,m as ar,n as Je,p as ir,q as Xe,r as or,s as lr,t as gt,u as se,v as Ae,w as et,y as fr}from"./chunk-SBJNQYEL.js";import{a as i,c as E,i as s}from"./chunk-SSU37LFQ.js";var _r=E(F(),1),v=E(de(),1),ee=E(de(),1),ye=E(F(),1),q=E(de(),1),_=E(F(),1),y=E(F(),1),st=E(F(),1),fe=E(de(),1),Hr=E(F(),1),Y=E(F(),1),it=E(F(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1),ot=E(F(),1),pe=E(F(),1),Q=E(F(),1),M=E(F(),1),me=E(F(),1),Te=E(F(),1),Nt=E(de(),1),k=E(de(),1);import{subscribeCameraPermission as Un}from"@sekyro/web";import{getLivenessAssetsStatus as jn,preloadLivenessAssets as Tn,subscribeLivenessAssets as Pn}from"@sekyro/web";import{createLivenessCapture as qn}from"@sekyro/web";function ie({className:e,children:t}){return(0,v.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}i(ie,"te");s(ie,"Svg");var Mt="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 Cr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}i(Cr,"cn");s(Cr,"SunIcon");function wr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(wr,"ln");s(wr,"FaceUncoveredIcon");function Sr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Sr,"un");s(Sr,"PhoneEyeLevelIcon");function xr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(xr,"dn");s(xr,"LookStraightIcon");function Nr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Nr,"pn");s(Nr,"CameraCheckIcon");function Mr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}i(Mr,"fn");s(Mr,"CameraAskIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(Lr,"mn");s(Lr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Rr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Rr,"yn");s(Rr,"CheckIcon");function Ar(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Ar,"gn");s(Ar,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Sn={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Cr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(wr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Sr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(xr,{}),"icon")}};function Er({tips:e}){let t=Re(),n=(0,_r.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Sn[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Er,"vn");s(Er,"TipList");var xn=220;function Ir({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=gt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let L=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},xn))},"choose");return(0,q.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,q.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,q.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,q.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,q.jsx)(se,{tone:"danger",children:(0,q.jsx)("span",{children:a})}):null,u==="buttons"?(0,q.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,q.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,q.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,q.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>L(p.id),"onClick"),children:[p.glyph!==void 0?(0,q.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,q.jsxs)("span",{className:"sekyro-card__body",children:[(0,q.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,q.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,q.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Ir,"kn");s(Ir,"ChoiceScreen");var Ur=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary"];function nt(e){return e!==null&&Ur.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var Nn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Nn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Mn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Ln={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function jr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(jr,"wr");s(jr,"speechAvailable");function Ct(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(Ct,"bn");s(Ct,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=Ct(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>Ct(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Tr(e){if(!jr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Tr,"Mn");s(Tr,"speechUsable");function Pr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Pr,"wn");s(Pr,"subscribeVoices");function $e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}i($e,"Ke");s($e,"clipIdentity");function wt(e){e.pause(),e.removeAttribute("src"),e.load()}i(wt,"Sn");s(wt,"release");function Br(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,L)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,L!==void 0&&(C.onend=C.onerror=L),p.speak(C);return}}L?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let L=$e(N);if(o.has(L))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(L,p)}},"warmClips");return{say(d){let N=d.url!==null?$e(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let L=n,p=d.onEnd,j=p!==void 0?()=>{L===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{L===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:L}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Mn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(L??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&wt(e),e=null;for(let d of o.values())wt(d);o.clear()}}}i(Br,"Ln");s(Br,"createVoicePlayer");var Rn="sekyro.voiceGuidance";function qr(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}}i(qr,"xn");s(qr,"readVoicePreference");function Or(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Or,"In");s(Or,"writeVoicePreference");var Ve="capture.tips.summary",An=typeof window<"u"?_.useLayoutEffect:_.useEffect,En=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of Ur){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Vr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Rn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),L=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=Br()),C.current),[]),O=Ln[e],H=a.speechFallback,f=H===void 0||H===!0?!0:H===!1?!1:H.includes(e),D=a.clips??t??En,oe=(0,_.useRef)(!1),le=(0,_.useRef)(D);An(()=>{le.current=D,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let R=qr(o);R!==null&&(S.current=R,u(R))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Pr(()=>j(R=>R+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let R=f&&Tr(O);w(tt(D,e).length>0||R),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(D,Ve,e)!==null||R?"default":"none")},[r,D,c,e,f,O,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let R=tt(D,e);R.length>0&&A().prefetch(R)},[r,l,D,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(R=>{r||(oe.current=!0,A().unlock({lang:O,speech:f,...R?{prefetch:tt(le.current,e)}:{}}))},[r,A,O,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{L.current=!1,N(!1)},[]),B=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{L.current&&B()},[B]),he=(0,_.useCallback)((R,xe)=>{if(r)return;if(L.current){B();return}let ge=A();ge.stop(),L.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:R,lang:O,speech:f,onEnd:G})},[r,B,A,e,O,f,G]),K=(0,_.useCallback)(R=>{r||(R?V(!0):B(),o!==null&&Or(o,R),S.current=R,u(R))},[r,V,B,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((R,xe)=>{if(r||!l)return;L.current&&G();let ge=je(le.current,R,e);A().say({url:ge,text:xe,lang:O,speech:f})},[r,l,e,A,O,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:B,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,B,x,d,he,ve])}i(Vr,"ht");s(Vr,"useVoiceGuidance");function $r(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i($r,"vt");s($r,"useSpeakGuidance");function at(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}i(at,"Pn");s(at,"retryCoachingOf");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Fr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Re(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(Fe[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:Fe[t].tips.map(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Fr,"An");s(Fr,"CapturedPanel");function Rt(){try{return!1}catch{return!1}}i(Rt,"tt");s(Rt,"isDevBuild");var In=(0,Hr.createContext)(null);function Dr({state:e}){let t=Re(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Nr,{}):e==="denied"?(0,we.jsx)(Lr,{}):(0,we.jsx)(Mr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}i(Dr,"Kn");s(Dr,"PermissionRow");function Gr({voice:e}){let t=Re();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Rr,{className:"sekyro-switch__check"}):null})})]})}i(Gr,"Un");s(Gr,"VoiceSwitch");function Kr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Re(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),L=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=L.current;if(L.current=e,f===e)return;let D=p.current;e!=="loading"&&(p.current=!1),zr(I.current)&&(e==="failed"?N.current?.focus():D&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,O=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),H;return e==="failed"?H=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):H=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:O,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ar,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Er,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Dr,{state:n}),(0,U.jsx)(Gr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),H,(0,U.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}i(Kr,"Gn");s(Kr,"PreCaptureScreen");function zr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(zr,"Or");s(zr,"focusIsOurs");function Zr(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>Un(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(Zr,"Fn");s(Zr,"useCameraStatus");function Qr(e){return At(e,"mobileRequired")}i(Qr,"qn");s(Qr,"useMobileRequired");function Wr(e){return At(e,"returning").required}i(Wr,"Dn");s(Wr,"useReturning");function At(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(At,"jn");s(At,"useFlag");function Yr(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}i(Yr,"$n");s(Yr,"useCaptureMode");function Jr(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}i(Jr,"zn");s(Jr,"useBusy");var Bn=s(()=>"idle","serverSnapshot");function St(e){return Tn(e!==void 0?{assetBaseUrl:e}:{})}i(St,"Wn");s(St,"preload");function Xr(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>Pn(h,e),[e]),()=>jn(e),Bn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{St(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{St(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(Xr,"Qn");s(Xr,"useLivenessAssets");var br={progress:0,hint:null,faceDetected:!1};function en(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Rt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(br),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,L]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[O,H]=(0,M.useState)(null),[f,D]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),B=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},$=r!==void 0?r.liveness(ce):qn(ce);o.current=$;let Ne=s(()=>V($.facingMode??null),"readFacing");Ne();let He=[$.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),H(null),D(null),h(br),d(!1),x(!1),L(null),A(null),B.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),L(null),B.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),$.on("gate",b=>{let ke=B.current;B.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),$.on("frozen",({previewDataUrl:b})=>L(b)),$.on("profile",({animations:b})=>j(b==="reduced")),$.on("ramp",({colour:b})=>A(b)),$.on("captured",b=>{H(b),le(null),te.current.onCaptured?.(b)}),$.on("error",b=>{D(b);let ke=r?.reportCaptureIssue;ke!==void 0&&kt(Ee=>ke.call(r,Ee),gr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of He)b?.();o.current=null,$.destroy()}},[r,t,n]);let R=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let $=await ce.setCaptureMode(J).catch(()=>!1)===!0;return $&&V(ce.facingMode??null),$},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:O,error:f,result:oe,facingMode:c,start:R,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(en,"Xn");s(en,"useLivenessHandle");var On=new Set(["national_number"]);function xt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>On.has(n));return t.length>0?{...e,options:t}:null}i(xt,"er");s(xt,"pending");function tn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(xt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(xt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(tn,"tr");s(tn,"useMethodChoice");var Vn=["ar","fr","en"];function rn(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}}i(rn,"oo");s(rn,"isClipUrl");function nn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Vn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!rn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(nn,"so");s(nn,"toVoiceClipMap");function sn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?nn(t):null,[t]);return e===void 0?null:r}i(sn,"nr");s(sn,"useServerVoiceClips");function an({voice:e}){let t=Re();return(0,Nt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Nt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(an,"or");s(an,"VoiceChip");var $n=new Set(["abandoned","not_opened","cancelled","superseded"]),Fn=800;function on(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}i(on,"uo");s(on,"isDefaultTips");function ln(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}i(ln,"po");s(ln,"carriesActivation");function cn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(cn,"fo");s(cn,"isNoticeObject");var Hn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function un(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(un,"yo");s(un,"isCapturing");function dn(e){return e==="captured"||e==="uploading"||e==="checking"}i(dn,"go");s(dn,"isPostCapture");function Dn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:L,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let O=ur(t),H=(0,y.useMemo)(()=>cr(t,r),[t,r,O]),f=(0,y.useMemo)(()=>g=>H[g]??"",[H]),D=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(In),c=en({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:L,onError:p,onStateChange:j}),V=Xr(C,c.state==="idle"&&c.error===null),T=tn(e),G=T.choice!==null,B=Qr(e),ve=Wr(e),he=Jr(e),K=Zr(),z=Yr(e),te=z.session==="choice",R=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=sn(xe?e:void 0),P=Vr({locale:t,defaultClips:ge,options:I}),J=R?"environment":"user",ce=z.settled,$=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),He=(0,y.useRef)(P.unlock);He.current=P.unlock,(0,y.useEffect)(()=>{let g=$.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let Oe of ne)g.removeEventListener(Oe,Le,!0)},"disarm");function Le(Oe){if(Ne.current){Ce();return}ln(Oe)&&(Ne.current=!0,Ce(),He.current())}i(Le,"Re"),s(Le,"onGesture");for(let Oe of ne)g.addEventListener(Oe,Le,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,It=!G&&!B.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),Ut=It&&T.settled&&B.settled&&ce,fn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,jt=It&&Pe&&!Ee.current,ct=(fn||jt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ut||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ut,Pe,V.gate,ke]);let mn=Pe&&!G&&!B.required&&!(jt&&V.gate==="ready"),[Tt,Pt]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Pt(!1);return}let g=!0;return Bt().then(ne=>{g&&Pt(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Ot}=z,Ie=R?"self":"assisted",yn=(0,y.useCallback)(async()=>{await qt(Ie)&&Ot(Ie)},[qt,Ot,Ie]),Vt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Vt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Vt]);let De=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(De!==null)return()=>URL.revokeObjectURL(De)},[De]);let $t=c.frozenPreview??De,Ue=e!==void 0,Z=un(c.state),be=dn(c.state),Ge=Z||be,re=c.result,Ft=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ht=Tt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{yn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Be=be||ut,Dt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":ar(Ze),[vn,Gt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Gt(Qe);return}if(!Z)return;let g=setTimeout(()=>Gt(Qe),Fn);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",Kt=R&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?vn:null,pt=dt?x:Me===null?"":f(Me);$r(P,Me,pt,Z);let zt=(0,y.useRef)(d);zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let qe=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Zt=ht!==void 0,Qt=I===void 0,Wt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Zt||!Qt||Wt.current||!Rt()||(Wt.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."))},[Zt,Qt]);let gn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,qe):P.supported?()=>(0,k.jsx)(an,{voice:qe}):void 0,{summary:ft,summaryPlaying:Yt,toggleSummary:Jt,stopSummary:Xt}=P,We=w!==void 0&&w!=="",er=We?w:f("capture.tips.summary"),tr=We?ft!=="none":ft==="partner"||ft==="default"&&on(h),kn=(0,y.useMemo)(()=>tr?{playing:Yt,toggle:s(()=>Jt(er,{clip:!We}),"toggle"),stop:Xt}:void 0,[tr,Yt,Jt,er,Xt,We]),bn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:qe}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,qe]),_n=cn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=Ft&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=Ft&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Le=or(t,ne);if(Le!==null)return f(Le.key).replace("{time}",Le.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),rr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&$n.has(_e.reason)?f("errors.session_expired"):null),Cn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,nr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Hn.has(Ye)||kt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,nr)})},[W,Ye,nr,e]);let sr=gt(),wn=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(dr,{value:f,children:(0,k.jsxs)("div",{ref:$,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:D,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,B.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(ir(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Cn?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,rr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:rr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Be&&Ue?f("capture.checking"):pt,coached:dt&&!(Be&&Ue),note:Be?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):Kt),settled:Be&&Ue,progress:c.gate.progress,phase:Dt,still:Be?$t:null,live:Ge,modeSwitch:Ht,...Tt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(pr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Dt,draining:c.draining,stillUrl:$t,showChecking:Ue,operatorText:Kt,voicePrompt:gn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(hr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ht})}),wn&&T.choice!==null?(0,k.jsx)(Ir,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,mn?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,_n,a?.intro!==void 0?a.intro(b,bn):(0,k.jsx)(Kr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:qe,tips:h??_t,summary:kn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Fr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?lr(H,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Dn,"_i");s(Dn,"LivenessCapture");var Et=E(F(),1),lt=E(F(),1),m=E(de(),1);import{isInAppBrowser as Jn}from"@sekyro/web/client";var vs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Gn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}i(Gn,"Y");s(Gn,"identityLabel");function Kn(e,t){let[n,r]=(0,Et.useState)(!1),[a,o]=(0,Et.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(kr(u,e.strings))),t?.(u)})},"run")}}i(Kn,"q");s(Kn,"useChoiceAction");function pn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(pn,"O");s(pn,"FaceMark");var zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Zn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(Zn,"te");s(Zn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Wn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=bt(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:Fe[w].tips,I=(0,lt.useContext)(mr)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(pn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(hn,{retry:u,title:Fe[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Qn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(fr,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Wn,"ne");s(Wn,"FaceIntro");var Yn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function hn({retry:e,title:t}){let n=bt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Yn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(yr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(hn,"T");s(hn,"RetryNotice");function Xn(e){return Jn(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(es,"ce");s(es,"androidBrowserIntent");export{Ir as a,Rt as b,In as c,Yr as d,Dn as e,vs as f,Gn as g,Kn as h,Zn as i,Wn as j,Xn as k,es as l};
|
|
1
|
+
import{b as pr,d as hr}from"./chunk-JCCTKW23.js";import{b as gr,c as kt}from"./chunk-JUB6FRPB.js";import{a as kr}from"./chunk-YZ6YGLNN.js";import{c as bt}from"./chunk-WBXQX6DQ.js";import{a as cr,b as ur,c as dr,d as Re}from"./chunk-CFERAKA2.js";import{F as mr,K as yr,L as vr,a as F,b as de,c as X,m as ar,n as Je,p as ir,q as Xe,r as or,s as lr,t as gt,u as se,v as Ae,w as et,y as fr}from"./chunk-APM7FCA2.js";import{a as i,c as E,i as s}from"./chunk-SSU37LFQ.js";var _r=E(F(),1),v=E(de(),1),ee=E(de(),1),ye=E(F(),1),q=E(de(),1),_=E(F(),1),y=E(F(),1),st=E(F(),1),fe=E(de(),1),Hr=E(F(),1),Y=E(F(),1),it=E(F(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1),ot=E(F(),1),pe=E(F(),1),Q=E(F(),1),M=E(F(),1),me=E(F(),1),Te=E(F(),1),Nt=E(de(),1),k=E(de(),1);import{subscribeCameraPermission as Un}from"@sekyro/web";import{getLivenessAssetsStatus as jn,preloadLivenessAssets as Tn,subscribeLivenessAssets as Pn}from"@sekyro/web";import{createLivenessCapture as qn}from"@sekyro/web";function ie({className:e,children:t}){return(0,v.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}i(ie,"te");s(ie,"Svg");var Mt="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 Cr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}i(Cr,"cn");s(Cr,"SunIcon");function wr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(wr,"ln");s(wr,"FaceUncoveredIcon");function Sr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Sr,"un");s(Sr,"PhoneEyeLevelIcon");function xr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(xr,"dn");s(xr,"LookStraightIcon");function Nr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Nr,"pn");s(Nr,"CameraCheckIcon");function Mr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}i(Mr,"fn");s(Mr,"CameraAskIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(Lr,"mn");s(Lr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Rr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Rr,"yn");s(Rr,"CheckIcon");function Ar(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Ar,"gn");s(Ar,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Sn={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Cr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(wr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Sr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(xr,{}),"icon")}};function Er({tips:e}){let t=Re(),n=(0,_r.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Sn[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Er,"vn");s(Er,"TipList");var xn=220;function Ir({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=gt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let L=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},xn))},"choose");return(0,q.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,q.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,q.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,q.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,q.jsx)(se,{tone:"danger",children:(0,q.jsx)("span",{children:a})}):null,u==="buttons"?(0,q.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,q.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,q.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,q.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>L(p.id),"onClick"),children:[p.glyph!==void 0?(0,q.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,q.jsxs)("span",{className:"sekyro-card__body",children:[(0,q.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,q.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,q.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Ir,"kn");s(Ir,"ChoiceScreen");var Ur=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary"];function nt(e){return e!==null&&Ur.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var Nn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Nn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Mn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Ln={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function jr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(jr,"wr");s(jr,"speechAvailable");function Ct(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(Ct,"bn");s(Ct,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=Ct(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>Ct(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Tr(e){if(!jr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Tr,"Mn");s(Tr,"speechUsable");function Pr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Pr,"wn");s(Pr,"subscribeVoices");function $e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}i($e,"Ke");s($e,"clipIdentity");function wt(e){e.pause(),e.removeAttribute("src"),e.load()}i(wt,"Sn");s(wt,"release");function Br(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,L)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,L!==void 0&&(C.onend=C.onerror=L),p.speak(C);return}}L?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let L=$e(N);if(o.has(L))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(L,p)}},"warmClips");return{say(d){let N=d.url!==null?$e(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let L=n,p=d.onEnd,j=p!==void 0?()=>{L===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{L===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:L}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Mn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(L??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&wt(e),e=null;for(let d of o.values())wt(d);o.clear()}}}i(Br,"Ln");s(Br,"createVoicePlayer");var Rn="sekyro.voiceGuidance";function qr(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}}i(qr,"xn");s(qr,"readVoicePreference");function Or(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Or,"In");s(Or,"writeVoicePreference");var Ve="capture.tips.summary",An=typeof window<"u"?_.useLayoutEffect:_.useEffect,En=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of Ur){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Vr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Rn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),L=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=Br()),C.current),[]),O=Ln[e],H=a.speechFallback,f=H===void 0||H===!0?!0:H===!1?!1:H.includes(e),D=a.clips??t??En,oe=(0,_.useRef)(!1),le=(0,_.useRef)(D);An(()=>{le.current=D,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let R=qr(o);R!==null&&(S.current=R,u(R))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Pr(()=>j(R=>R+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let R=f&&Tr(O);w(tt(D,e).length>0||R),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(D,Ve,e)!==null||R?"default":"none")},[r,D,c,e,f,O,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let R=tt(D,e);R.length>0&&A().prefetch(R)},[r,l,D,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(R=>{r||(oe.current=!0,A().unlock({lang:O,speech:f,...R?{prefetch:tt(le.current,e)}:{}}))},[r,A,O,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{L.current=!1,N(!1)},[]),B=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{L.current&&B()},[B]),he=(0,_.useCallback)((R,xe)=>{if(r)return;if(L.current){B();return}let ge=A();ge.stop(),L.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:R,lang:O,speech:f,onEnd:G})},[r,B,A,e,O,f,G]),K=(0,_.useCallback)(R=>{r||(R?V(!0):B(),o!==null&&Or(o,R),S.current=R,u(R))},[r,V,B,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((R,xe)=>{if(r||!l)return;L.current&&G();let ge=je(le.current,R,e);A().say({url:ge,text:xe,lang:O,speech:f})},[r,l,e,A,O,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:B,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,B,x,d,he,ve])}i(Vr,"ht");s(Vr,"useVoiceGuidance");function $r(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i($r,"vt");s($r,"useSpeakGuidance");function at(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}i(at,"Pn");s(at,"retryCoachingOf");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Fr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Re(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(Fe[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:Fe[t].tips.map(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Fr,"An");s(Fr,"CapturedPanel");function Rt(){try{return!1}catch{return!1}}i(Rt,"tt");s(Rt,"isDevBuild");var In=(0,Hr.createContext)(null);function Dr({state:e}){let t=Re(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Nr,{}):e==="denied"?(0,we.jsx)(Lr,{}):(0,we.jsx)(Mr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}i(Dr,"Kn");s(Dr,"PermissionRow");function Gr({voice:e}){let t=Re();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Rr,{className:"sekyro-switch__check"}):null})})]})}i(Gr,"Un");s(Gr,"VoiceSwitch");function Kr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Re(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),L=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=L.current;if(L.current=e,f===e)return;let D=p.current;e!=="loading"&&(p.current=!1),zr(I.current)&&(e==="failed"?N.current?.focus():D&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,O=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),H;return e==="failed"?H=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):H=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:O,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ar,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Er,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Dr,{state:n}),(0,U.jsx)(Gr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),H,(0,U.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}i(Kr,"Gn");s(Kr,"PreCaptureScreen");function zr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(zr,"Or");s(zr,"focusIsOurs");function Zr(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>Un(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(Zr,"Fn");s(Zr,"useCameraStatus");function Qr(e){return At(e,"mobileRequired")}i(Qr,"qn");s(Qr,"useMobileRequired");function Wr(e){return At(e,"returning").required}i(Wr,"Dn");s(Wr,"useReturning");function At(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(At,"jn");s(At,"useFlag");function Yr(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}i(Yr,"$n");s(Yr,"useCaptureMode");function Jr(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}i(Jr,"zn");s(Jr,"useBusy");var Bn=s(()=>"idle","serverSnapshot");function St(e){return Tn(e!==void 0?{assetBaseUrl:e}:{})}i(St,"Wn");s(St,"preload");function Xr(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>Pn(h,e),[e]),()=>jn(e),Bn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{St(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{St(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(Xr,"Qn");s(Xr,"useLivenessAssets");var br={progress:0,hint:null,faceDetected:!1};function en(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Rt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(br),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,L]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[O,H]=(0,M.useState)(null),[f,D]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),B=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},$=r!==void 0?r.liveness(ce):qn(ce);o.current=$;let Ne=s(()=>V($.facingMode??null),"readFacing");Ne();let He=[$.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),H(null),D(null),h(br),d(!1),x(!1),L(null),A(null),B.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),L(null),B.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),$.on("gate",b=>{let ke=B.current;B.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),$.on("frozen",({previewDataUrl:b})=>L(b)),$.on("profile",({animations:b})=>j(b==="reduced")),$.on("ramp",({colour:b})=>A(b)),$.on("captured",b=>{H(b),le(null),te.current.onCaptured?.(b)}),$.on("error",b=>{D(b);let ke=r?.reportCaptureIssue;ke!==void 0&&kt(Ee=>ke.call(r,Ee),gr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of He)b?.();o.current=null,$.destroy()}},[r,t,n]);let R=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let $=await ce.setCaptureMode(J).catch(()=>!1)===!0;return $&&V(ce.facingMode??null),$},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:O,error:f,result:oe,facingMode:c,start:R,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(en,"Xn");s(en,"useLivenessHandle");var On=new Set(["national_number"]);function xt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>On.has(n));return t.length>0?{...e,options:t}:null}i(xt,"er");s(xt,"pending");function tn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(xt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(xt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(tn,"tr");s(tn,"useMethodChoice");var Vn=["ar","fr","en"];function rn(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}}i(rn,"oo");s(rn,"isClipUrl");function nn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Vn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!rn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(nn,"so");s(nn,"toVoiceClipMap");function sn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?nn(t):null,[t]);return e===void 0?null:r}i(sn,"nr");s(sn,"useServerVoiceClips");function an({voice:e}){let t=Re();return(0,Nt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Nt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(an,"or");s(an,"VoiceChip");var $n=new Set(["abandoned","not_opened","cancelled","superseded"]),Fn=800;function on(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}i(on,"uo");s(on,"isDefaultTips");function ln(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}i(ln,"po");s(ln,"carriesActivation");function cn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(cn,"fo");s(cn,"isNoticeObject");var Hn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function un(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(un,"yo");s(un,"isCapturing");function dn(e){return e==="captured"||e==="uploading"||e==="checking"}i(dn,"go");s(dn,"isPostCapture");function Dn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:L,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let O=ur(t),H=(0,y.useMemo)(()=>cr(t,r),[t,r,O]),f=(0,y.useMemo)(()=>g=>H[g]??"",[H]),D=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(In),c=en({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:L,onError:p,onStateChange:j}),V=Xr(C,c.state==="idle"&&c.error===null),T=tn(e),G=T.choice!==null,B=Qr(e),ve=Wr(e),he=Jr(e),K=Zr(),z=Yr(e),te=z.session==="choice",R=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=sn(xe?e:void 0),P=Vr({locale:t,defaultClips:ge,options:I}),J=R?"environment":"user",ce=z.settled,$=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),He=(0,y.useRef)(P.unlock);He.current=P.unlock,(0,y.useEffect)(()=>{let g=$.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let Oe of ne)g.removeEventListener(Oe,Le,!0)},"disarm");function Le(Oe){if(Ne.current){Ce();return}ln(Oe)&&(Ne.current=!0,Ce(),He.current())}i(Le,"Re"),s(Le,"onGesture");for(let Oe of ne)g.addEventListener(Oe,Le,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,It=!G&&!B.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),Ut=It&&T.settled&&B.settled&&ce,fn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,jt=It&&Pe&&!Ee.current,ct=(fn||jt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ut||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ut,Pe,V.gate,ke]);let mn=Pe&&!G&&!B.required&&!(jt&&V.gate==="ready"),[Tt,Pt]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Pt(!1);return}let g=!0;return Bt().then(ne=>{g&&Pt(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Ot}=z,Ie=R?"self":"assisted",yn=(0,y.useCallback)(async()=>{await qt(Ie)&&Ot(Ie)},[qt,Ot,Ie]),Vt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Vt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Vt]);let De=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(De!==null)return()=>URL.revokeObjectURL(De)},[De]);let $t=c.frozenPreview??De,Ue=e!==void 0,Z=un(c.state),be=dn(c.state),Ge=Z||be,re=c.result,Ft=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ht=Tt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{yn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Be=be||ut,Dt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":ar(Ze),[vn,Gt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Gt(Qe);return}if(!Z)return;let g=setTimeout(()=>Gt(Qe),Fn);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",Kt=R&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?vn:null,pt=dt?x:Me===null?"":f(Me);$r(P,Me,pt,Z);let zt=(0,y.useRef)(d);zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let qe=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Zt=ht!==void 0,Qt=I===void 0,Wt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Zt||!Qt||Wt.current||!Rt()||(Wt.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."))},[Zt,Qt]);let gn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,qe):P.supported?()=>(0,k.jsx)(an,{voice:qe}):void 0,{summary:ft,summaryPlaying:Yt,toggleSummary:Jt,stopSummary:Xt}=P,We=w!==void 0&&w!=="",er=We?w:f("capture.tips.summary"),tr=We?ft!=="none":ft==="partner"||ft==="default"&&on(h),kn=(0,y.useMemo)(()=>tr?{playing:Yt,toggle:s(()=>Jt(er,{clip:!We}),"toggle"),stop:Xt}:void 0,[tr,Yt,Jt,er,Xt,We]),bn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:qe}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,qe]),_n=cn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=Ft&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=Ft&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Le=or(t,ne);if(Le!==null)return f(Le.key).replace("{time}",Le.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),rr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&$n.has(_e.reason)?f("errors.session_expired"):null),Cn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,nr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Hn.has(Ye)||kt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,nr)})},[W,Ye,nr,e]);let sr=gt(),wn=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(dr,{value:f,children:(0,k.jsxs)("div",{ref:$,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:D,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,B.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(ir(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Cn?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,rr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:rr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Be&&Ue?f("capture.checking"):pt,coached:dt&&!(Be&&Ue),note:Be?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):Kt),settled:Be&&Ue,progress:c.gate.progress,phase:Dt,still:Be?$t:null,live:Ge,modeSwitch:Ht,...Tt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(pr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Dt,draining:c.draining,stillUrl:$t,showChecking:Ue,operatorText:Kt,voicePrompt:gn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(hr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ht})}),wn&&T.choice!==null?(0,k.jsx)(Ir,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,mn?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,_n,a?.intro!==void 0?a.intro(b,bn):(0,k.jsx)(Kr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:qe,tips:h??_t,summary:kn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Fr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?lr(H,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Dn,"_i");s(Dn,"LivenessCapture");var Et=E(F(),1),lt=E(F(),1),m=E(de(),1);import{isInAppBrowser as Jn}from"@sekyro/web/client";var vs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Gn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}i(Gn,"Y");s(Gn,"identityLabel");function Kn(e,t){let[n,r]=(0,Et.useState)(!1),[a,o]=(0,Et.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(kr(u,e.strings))),t?.(u)})},"run")}}i(Kn,"q");s(Kn,"useChoiceAction");function pn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(pn,"O");s(pn,"FaceMark");var zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Zn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(Zn,"te");s(Zn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Wn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=bt(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:Fe[w].tips,I=(0,lt.useContext)(mr)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(pn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(hn,{retry:u,title:Fe[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Qn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(fr,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Wn,"ne");s(Wn,"FaceIntro");var Yn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function hn({retry:e,title:t}){let n=bt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Yn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(yr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(hn,"T");s(hn,"RetryNotice");function Xn(e){return Jn(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(es,"ce");s(es,"androidBrowserIntent");export{Ir as a,Rt as b,In as c,Yr as d,Dn as e,vs as f,Gn as g,Kn as h,Zn as i,Wn as j,Xn as k,es as l};
|