@sekyro/elements 0.1.0-rc.31 → 0.1.0-rc.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cdn/chunks/{capture-session-doc-2JNGYSH6-GFUM3RZY.js → capture-session-doc-2GJ726S6-2H3IPQT3.js} +1 -1
  3. package/dist/cdn/chunks/{chunk-V6PELUV7.js → chunk-647NLEGV.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-5OPKZZON.js → chunk-B4B5NNWF.js} +1 -1
  5. package/dist/cdn/chunks/{chunk-JICBF2XL.js → chunk-C4H77SCY.js} +1 -1
  6. package/dist/cdn/chunks/{chunk-7V3YMJPI.js → chunk-DCDSAYG4.js} +1 -1
  7. package/dist/cdn/chunks/{chunk-DO66BOHU.js → chunk-ERJRG52Z.js} +1 -1
  8. package/dist/cdn/chunks/{chunk-HTIKUYTU.js → chunk-F3BSTTXB.js} +1 -1
  9. package/dist/cdn/chunks/{chunk-AKU6DWJM.js → chunk-G4FFU5ST.js} +1 -1
  10. package/dist/cdn/chunks/chunk-GP6QFI3S.js +33 -0
  11. package/dist/cdn/chunks/chunk-HOEI5HQR.js +1 -0
  12. package/dist/cdn/chunks/{chunk-XVHJIXFH.js → chunk-HVC5SOWQ.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-EB2QC3GA.js → chunk-K3XSP444.js} +1 -1
  14. package/dist/cdn/chunks/{chunk-5AGMJYMI.js → chunk-L2THMRAZ.js} +1 -1
  15. package/dist/cdn/chunks/{chunk-SYUAQ7BF.js → chunk-LK5ZZB5W.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-PWGUNXYH.js → chunk-MZETEVSB.js} +1 -1
  17. package/dist/cdn/chunks/chunk-PQGILDKC.js +1 -0
  18. package/dist/cdn/chunks/chunk-QYOVP3SU.js +1 -0
  19. package/dist/cdn/chunks/{chunk-SOCYEC7N.js → chunk-S67OYV2K.js} +1 -1
  20. package/dist/cdn/chunks/chunk-WX5XRIRN.js +1 -0
  21. package/dist/cdn/chunks/{chunk-4MHDMYKP.js → chunk-XVONSDHT.js} +1 -1
  22. package/dist/cdn/chunks/chunk-XY3RKF2D.js +3 -0
  23. package/dist/cdn/chunks/{create-document-capture-DNJSSCWA-M73L4ODE.js → create-document-capture-NUZAIYUH-XUGCJ7DH.js} +1 -1
  24. package/dist/cdn/chunks/document-capture-view-HKEUWRPE-RG7TBRYZ.js +1 -0
  25. package/dist/cdn/chunks/{eid-view-XM5VHPPM-6KKXEHDA.js → eid-view-Y5OFAHVC-J7PHT73P.js} +1 -1
  26. package/dist/cdn/chunks/{email-otp-view-RQV5WU3T-TP222TAL.js → email-otp-view-ZEVLA5UZ-EEPZQDQ2.js} +1 -1
  27. package/dist/cdn/chunks/flow-views-ARNNXDI4-DG6547SK.js +1 -0
  28. package/dist/cdn/chunks/{form-view-Z7ODA3GO-2R5H32O2.js → form-view-PQQO4VIK-UMDKNDGI.js} +1 -1
  29. package/dist/cdn/chunks/overlay-de-QAMFKRTE-YSXFO53C.js +1 -0
  30. package/dist/cdn/chunks/overlay-es-5RUP36SI-HFW77Y5Z.js +1 -0
  31. package/dist/cdn/chunks/overlay-pt-7EUG7TIT-FUKZ7M5O.js +1 -0
  32. package/dist/cdn/chunks/plan-runner-BFNZHO4C-7RPJM7XJ.js +1 -0
  33. package/dist/cdn/chunks/portrait-capture-view-EKCFW3YQ-RBLI5X5Y.js +1 -0
  34. package/dist/cdn/chunks/portrait-review-view-NKIVRFCL-UAYMHF4D.js +1 -0
  35. package/dist/cdn/chunks/proof-of-address-view-HYTT7NHY-2DKOEB3I.js +1 -0
  36. package/dist/cdn/define.js +1 -1
  37. package/dist/cdn/index.js +1 -1
  38. package/dist/{chunk-W4G27O4B.js → chunk-25BK7D5W.js} +1 -1
  39. package/dist/chunk-2Z5FHSRB.js +33 -0
  40. package/dist/{chunk-3DAPWPSR.js → chunk-73ETQUUL.js} +1 -1
  41. package/dist/{chunk-YHNEYMR2.js → chunk-B7CZCSMF.js} +1 -1
  42. package/dist/{chunk-BA2AJKJM.js → chunk-ENB7AFED.js} +1 -1
  43. package/dist/{chunk-QEDULGVW.js → chunk-FV5OWBNU.js} +1 -1
  44. package/dist/{chunk-SVNDR2JE.js → chunk-HFOCTDYM.js} +1 -1
  45. package/dist/{chunk-WQIU4I3K.js → chunk-N2BPYCKG.js} +1 -1
  46. package/dist/{chunk-35LCXJCF.js → chunk-N3WQ4QSD.js} +1 -1
  47. package/dist/chunk-NAURWQ6C.js +1 -0
  48. package/dist/{chunk-A5EHF3BR.js → chunk-RV6PEFNT.js} +1 -1
  49. package/dist/{chunk-CMJWPBX6.js → chunk-TC5736OF.js} +1 -1
  50. package/dist/chunk-Y7JBM2YL.js +1 -0
  51. package/dist/define.cjs +5 -5
  52. package/dist/define.js +1 -1
  53. package/dist/document-capture-view-HKEUWRPE-KB4IVUEE.js +1 -0
  54. package/dist/{eid-view-XM5VHPPM-XKR4NZTZ.js → eid-view-Y5OFAHVC-NUZ7QUBA.js} +1 -1
  55. package/dist/{email-otp-view-RQV5WU3T-JY72E4XM.js → email-otp-view-ZEVLA5UZ-LAXHM22A.js} +1 -1
  56. package/dist/flow-views-ARNNXDI4-YXYLG7SQ.js +1 -0
  57. package/dist/{form-view-Z7ODA3GO-2ONECUO5.js → form-view-PQQO4VIK-H7PE6SJF.js} +1 -1
  58. package/dist/index.cjs +5 -5
  59. package/dist/index.d.cts +8 -0
  60. package/dist/index.d.ts +8 -0
  61. package/dist/index.js +1 -1
  62. package/dist/overlay-de-QAMFKRTE-Q37YV6YD.js +1 -0
  63. package/dist/overlay-es-5RUP36SI-N7N3ULGK.js +1 -0
  64. package/dist/overlay-pt-7EUG7TIT-5S423QBY.js +1 -0
  65. package/dist/portrait-capture-view-EKCFW3YQ-7UBYR6BX.js +1 -0
  66. package/dist/portrait-review-view-NKIVRFCL-IP7ZWZ6B.js +1 -0
  67. package/dist/proof-of-address-view-HYTT7NHY-QFJ33FM2.js +1 -0
  68. package/dist/styles.css +3 -1
  69. package/package.json +2 -2
  70. package/sbom.cdx.json +4 -4
  71. package/dist/cdn/chunks/chunk-44UA2IDQ.js +0 -1
  72. package/dist/cdn/chunks/chunk-6T7VBPLY.js +0 -3
  73. package/dist/cdn/chunks/chunk-EGCT7K5E.js +0 -1
  74. package/dist/cdn/chunks/chunk-LBEHJATK.js +0 -1
  75. package/dist/cdn/chunks/chunk-PRZX4CTP.js +0 -33
  76. package/dist/cdn/chunks/chunk-Y6MS7VVL.js +0 -1
  77. package/dist/cdn/chunks/chunk-ZWGMVZWP.js +0 -1
  78. package/dist/cdn/chunks/document-capture-view-RFBBBM3S-MO6WL377.js +0 -1
  79. package/dist/cdn/chunks/flow-views-GYVML5BT-MTJUSGHX.js +0 -1
  80. package/dist/cdn/chunks/overlay-de-ZQRK2WPD-YEE555KF.js +0 -1
  81. package/dist/cdn/chunks/overlay-es-XSQAIH32-DCYWAHRS.js +0 -1
  82. package/dist/cdn/chunks/overlay-pt-2LMQDJ4F-EWEOFJ27.js +0 -1
  83. package/dist/cdn/chunks/plan-runner-JXCJC5MM-BF6RMCBJ.js +0 -1
  84. package/dist/cdn/chunks/portrait-capture-view-ZBOXEM6H-LSOMBP5R.js +0 -1
  85. package/dist/cdn/chunks/portrait-review-view-BWCMLEID-JA7RWO6C.js +0 -1
  86. package/dist/cdn/chunks/proof-of-address-view-LW5RYD5I-Q3UXH6YT.js +0 -1
  87. package/dist/chunk-H7LR746C.js +0 -33
  88. package/dist/chunk-JGYTOIH7.js +0 -1
  89. package/dist/chunk-JREXIOVU.js +0 -1
  90. package/dist/chunk-YLWJXCPT.js +0 -1
  91. package/dist/document-capture-view-RFBBBM3S-ZNPUP6QX.js +0 -1
  92. package/dist/flow-views-GYVML5BT-WVKFYYSN.js +0 -1
  93. package/dist/overlay-de-ZQRK2WPD-FMRJWQQX.js +0 -1
  94. package/dist/overlay-es-XSQAIH32-VTIW3L6E.js +0 -1
  95. package/dist/overlay-pt-2LMQDJ4F-BB366XXI.js +0 -1
  96. package/dist/portrait-capture-view-ZBOXEM6H-PNCYH3WV.js +0 -1
  97. package/dist/portrait-review-view-BWCMLEID-MAO4RY74.js +0 -1
  98. package/dist/proof-of-address-view-LW5RYD5I-RDTH7FUR.js +0 -1
@@ -1 +1 @@
1
- import{b as Cr,d as _r}from"./chunk-QEDULGVW.js";import{b as Sr,c as xt}from"./chunk-CMJWPBX6.js";import{a as xr}from"./chunk-XXCBLQ53.js";import{c as at}from"./chunk-JGYTOIH7.js";import{a as vr,b as kr,c as br,d as Le}from"./chunk-YHNEYMR2.js";import{F as wr,K as wt,L as St,a as Z,b as de,c as J,m as fr,n as $e,p as mr,q as nt,r as yr,s as gr,t as Ct,u as le,v as me,w as De,y as _t}from"./chunk-BA2AJKJM.js";import{a as l,c as T,i as a}from"./chunk-SSU37LFQ.js";var Nr=T(Z(),1),g=T(de(),1),ne=T(de(),1),ve=T(Z(),1),G=T(de(),1),_=T(Z(),1),y=T(Z(),1),ot=T(Z(),1),ye=T(de(),1),Qr=T(Z(),1),ee=T(Z(),1),ct=T(Z(),1),Se=T(de(),1),xe=T(de(),1),P=T(de(),1),ut=T(Z(),1),pe=T(Z(),1),Y=T(Z(),1),E=T(Z(),1),ge=T(Z(),1),He=T(Z(),1),Et=T(de(),1),k=T(de(),1);import{subscribeCameraPermission as $n}from"@sekyro/web";import{getLivenessAssetsStatus as Dn,preloadLivenessAssets as Gn,subscribeLivenessAssets as Kn}from"@sekyro/web";import{createLivenessCapture as Zn}from"@sekyro/web";function ce({className:e,children:t}){return(0,g.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})}l(ce,"ne");a(ce,"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 Mr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,g.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"})]})}l(Mr,"pn");a(Mr,"SunIcon");function Ar(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,g.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Ar,"fn");a(Ar,"FaceUncoveredIcon");function Lr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,g.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,g.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Lr,"mn");a(Lr,"PhoneEyeLevelIcon");function Er(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.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,g.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Er,"yn");a(Er,"LookStraightIcon");function Ir(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Ir,"gn");a(Ir,"CameraCheckIcon");function Ur(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.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"})]})}l(Ur,"hn");a(Ur,"CameraAskIcon");function jr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.jsx)("path",{d:"M3 3l18 18"})]})}l(jr,"vn");a(jr,"CameraBlockedIcon");function it({off:e,className:t}){return(0,g.jsxs)(ce,{className:t,children:[(0,g.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,g.jsx)("path",{d:"M4 4l16 16"}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,g.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(it,"Ve");a(it,"SpeakerIcon");function Tr(e){return(0,g.jsx)(ce,{...e,children:(0,g.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Tr,"Cn");a(Tr,"CheckIcon");function Hr(e){return(0,g.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,g.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Hr,"kn");a(Hr,"SpinnerIcon");var Rt=["light","uncover","eyeLevel","straight"],jn={light:{key:"capture.tips.light",icon:a(()=>(0,ne.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:a(()=>(0,ne.jsx)(Ar,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:a(()=>(0,ne.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:a(()=>(0,ne.jsx)(Er,{}),"icon")}};function Or({tips:e}){let t=Le(),n=(0,Nr.useId)();return e.length===0?null:(0,ne.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ne.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ne.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?jn[r]:void 0,i=typeof r=="string"?r:r.id,c=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,p=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return(0,ne.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,ne.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,ne.jsx)("span",{children:p})]},i)})})]})}l(Or,"Sn");a(Or,"TipList");var Tn=220;function Pr({title:e,description:t,options:n,busy:r,error:s,focus:i,testId:c,look:p="cards",marked:w,onChoose:h}){let m=(0,ve.useId)(),R=Ct(),[x,U]=(0,ve.useState)(null),M=(0,ve.useRef)(null);(0,ve.useEffect)(()=>{s!==null&&U(null)},[s]),(0,ve.useEffect)(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);let B=a(A=>{r||x!==null||(U(A),M.current=setTimeout(()=>{M.current=null,U(null),h(A)},Tn))},"choose");return(0,G.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":m,"data-testid":c,children:[(0,G.jsxs)("div",{className:p==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,G.jsx)("h2",{id:m,ref:i?R:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,G.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?(0,G.jsx)(le,{tone:"danger",children:(0,G.jsx)("span",{children:s})}):null,p==="buttons"?(0,G.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,te)=>(0,G.jsx)(J,{kind:te===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>h(A.id),"onClick"),children:A.label},A.id))}):(0,G.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,G.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(x??w)===A.id,"aria-busy":r||void 0,disabled:r||x!==null&&x!==A.id,onClick:l(()=>B(A.id),"onClick"),children:[A.glyph!==void 0?(0,G.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,G.jsxs)("span",{className:"sekyro-card__body",children:[(0,G.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,G.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,G.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Pr,"Vn");a(Pr,"ChoiceScreen");var Br=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function lt(e){return e!==null&&Br.includes(e)}l(lt,"he");a(lt,"isVoiceKey");var Hn=a((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 s=e[n];r=s!=null&&Hn(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"we");a(je,"resolveClip");var On="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Pn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");a(oe,"synth");function qr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(qr,"Ir");a(qr,"speechAvailable");function Nt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(Nt,"wn");a(Nt,"baseLang");function Ut(e,t){let n=a(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=Nt(t);return e.find(s=>n(s.lang)===n(t))??e.find(s=>Nt(s.lang)===r)}l(Ut,"_n");a(Ut,"pickVoice");function Vr(e){if(!qr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Ut(t,e)!==void 0}l(Vr,"In");a(Vr,"speechUsable");function Fr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"xn");a(Fr,"subscribeVoices");function Ke(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}`}}l(Ke,"He");a(Ke,"clipIdentity");function Mt(e){e.pause(),e.removeAttribute("src"),e.load()}l(Mt,"Mn");a(Mt,"release");function $r(){let e=null,t=null,n=0,r=null,s=null,i=null,c=!1,p=null,w=[],h=new Map,m=a(()=>{w=oe()?.getVoices()??[]},"loadVoices"),R=!1,x=a(()=>{let f=oe();R||f===null||(R=!0,m(),f.addEventListener?.("voiceschanged",m))},"bindVoices"),U=a(()=>(e??(e=new Audio),e),"element"),M=a((f,N,S,b)=>{let u=oe();if(u!==null&&f!==""&&typeof SpeechSynthesisUtterance=="function"){x();let L=Ut(w,N);if(w.length===0||L!==void 0){u.cancel();let j=new SpeechSynthesisUtterance(f);j.lang=N,L!==void 0&&(j.voice=L),j.rate=.95,S!==void 0&&(j.onend=S),(S!==void 0||b!==void 0)&&(j.onerror=F=>{b!==void 0&&F.error==="not-allowed"?b():S?.()}),u.speak(j);return}}S?.()},"speak"),B=a(()=>{n+=1,r=null,s=i=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=a(f=>{for(let N of f){let S=Ke(N);if(h.has(S))continue;let b=new Audio;b.preload="auto",b.src=N,h.set(S,b)}},"warmClips"),te=a((f,N,S)=>{let b={utterance:f,generation:N,end:S};p=b;let u=a(()=>N===n&&p===b,"live"),L=a(()=>{u()&&(s=b)},"block");if(oe()?.cancel(),f.url!==null){let j=U();j.pause(),j.muted=!1,j.src=f.url,j.currentTime=0,j.onended=S??null;let F=a(()=>{i===b&&(i=null)},"settled"),o=j.play();if(o===void 0)return;i=b,o.then(F,H=>{if(F(),!u())return;let O=H?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return L();f.speech?M(f.text,f.lang,S,L):S?.()}});return}f.speech?M(f.text,f.lang,S,L):S?.()},"start");return{say(f){let N=f.url!==null?Ke(f.url):`tts:${f.lang}:${f.text}`;if(N===r)return;r=N,s=i=null,n+=1;let S=n,b=f.onEnd;te(f,S,b!==void 0?()=>{S===n&&b()}:void 0)},unlock({lang:f,speech:N,prefetch:S}){let b=s??(c?null:i);c=!0;let u=b!==null&&b.generation===n?b:null;s=i=null,u!==null&&te(u.utterance,u.generation,u.end);let L=U();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let H=Uint8Array.from(atob(On),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([H],{type:"audio/wav"}))}let j=L.paused===!1&&t!==null&&L.src!==t;t!==null&&!j&&(u===null||u.utterance.url===null)&&(L.muted=!0,L.onended=null,L.src=t,L.play()?.catch(()=>{}));let F=oe(),o=u!==null&&u.utterance.url===null;if(N&&!o&&F!==null&&typeof SpeechSynthesisUtterance=="function"){x();let H=new SpeechSynthesisUtterance(" ");H.volume=0,H.lang=f,F.speak(H)}A(S??[])},prefetch:A,stop:B,dispose(){B(),R&&oe()?.removeEventListener?.("voiceschanged",m),R=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Mt(e),e=null;for(let f of h.values())Mt(f);h.clear()}}}l($r,"En");a($r,"createVoicePlayer");var Bn="sekyro.voiceGuidance";function Dr(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}}l(Dr,"Nn");a(Dr,"readVoicePreference");function Gr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Gr,"Pn");a(Gr,"writeVoicePreference");var Ge="capture.tips.summary",qn=typeof window<"u"?_.useLayoutEffect:_.useEffect,Vn=Object.freeze({});function st(e,t){let n=new Set,r=[];for(let s of Br){let i=s===Ge?null:je(e,s,t);i===null||n.has(Ke(i))||(n.add(Ke(i)),r.push(i))}return r}l(st,"vt");a(st,"resolvedClipUrls");function Kr({locale:e,defaultClips:t,options:n}){let r=n===!1,s=r?{}:n??{},i=s.storageKey===void 0?Bn:s.storageKey,[c,p]=(0,_.useState)(s.defaultEnabled??!0),w=(0,_.useRef)(c),[h,m]=(0,_.useState)(!1),[R,x]=(0,_.useState)("none"),[U,M]=(0,_.useState)(!1),B=(0,_.useRef)(!1),[A,te]=(0,_.useState)(0),f=(0,_.useRef)(null),N=(0,_.useCallback)(()=>(f.current??(f.current=$r()),f.current),[]),S=Pn[e],b=s.speechFallback,u=b===void 0||b===!0?!0:b===!1?!1:b.includes(e),L=s.clips??t??Vn,j=(0,_.useRef)(!1),F=(0,_.useRef)(L);qn(()=>{F.current=L,w.current=c}),(0,_.useEffect)(()=>{if(r||i===null)return;let I=Dr(i);I!==null&&(w.current=I,p(I))},[r,i]),(0,_.useEffect)(()=>{if(!(r||!u))return Fr(()=>te(I=>I+1))},[r,u]);let o=s.clips;(0,_.useEffect)(()=>{if(r)return;let I=u&&Vr(S);m(st(L,e).length>0||I),x(o!==void 0&&je(o,Ge,e)!==null?"partner":je(L,Ge,e)!==null||I?"default":"none")},[r,L,o,e,u,S,A]),(0,_.useEffect)(()=>{if(r||!c||!j.current)return;let I=st(L,e);I.length>0&&N().prefetch(I)},[r,c,L,e,N]),(0,_.useEffect)(()=>()=>{f.current?.dispose(),f.current=null,j.current=!1},[]);let H=(0,_.useCallback)(I=>{r||(j.current=!0,N().unlock({lang:S,speech:u,...I?{prefetch:st(F.current,e)}:{}}))},[r,N,S,u,e]),O=(0,_.useCallback)(()=>H(w.current),[H]),W=(0,_.useCallback)(()=>{B.current=!1,M(!1)},[]),$=(0,_.useCallback)(()=>{W(),f.current?.stop()},[W]),ke=(0,_.useCallback)(()=>{B.current&&$()},[$]),he=(0,_.useCallback)((I,Re)=>{if(r)return;if(B.current){$();return}let be=N();be.stop(),B.current=!0,M(!0);let q=Re?.clip===!1?null:je(F.current,Ge,e);be.say({url:q,text:I,lang:S,speech:u,onEnd:W})},[r,$,N,e,S,u,W]),Q=(0,_.useCallback)(I=>{r||(I?H(!0):$(),i!==null&&Gr(i,I),w.current=I,p(I))},[r,H,$,i]),X=(0,_.useCallback)(()=>Q(!w.current),[Q]),ae=(0,_.useCallback)((I,Re)=>{if(r||!c)return;B.current&&W();let be=je(F.current,I,e);N().say({url:be,text:Re,lang:S,speech:u})},[r,c,e,N,S,u,W]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&c,setEnabled:Q,toggle:X,unlock:O,speakKey:ae,stop:$,summary:r?"none":R,summaryPlaying:U,toggleSummary:he,stopSummary:ke}),[r,h,c,Q,X,O,ae,$,R,U,he,ke])}l(Kr,"Ct");a(Kr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:s,stop:i,enabled:c}=e,p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){p.current&&i(),p.current=!1;return}p.current=!0,lt(t)&&t!==Ge&&n!==""&&s(t,n)},[r,c,t,n,s,i])}l(zr,"kt");a(zr,"useSpeakGuidance");function ze(e,t){let n=Zr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(ze,"On");a(ze,"retryCoachingOf");function Zr(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"}}l(Zr,"Kr");a(Zr,"coachingOfReason");var Te={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["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 Wr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:s}){let i=Le(),c=(0,ot.useRef)(null);return(0,ot.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,ye.jsx)("p",{className:"sekyro-text-body",children:i(Te[t].title)}),(0,ye.jsx)("ul",{className:"sekyro-coaching",children:Te[t].tips.map(p=>(0,ye.jsx)("li",{children:i(p)},p))}),n!==null?(0,ye.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,ye.jsx)(J,{ref:c,className:"sekyro-btn--start",onClick:s,children:i("capture.recordAgain")}):null]})}l(Wr,"Hn");a(Wr,"CapturedPanel");function jt(){try{return!1}catch{return!1}}l(jt,"rt");a(jt,"isDevBuild");var Fn=(0,Qr.createContext)(null);function Xr({state:e}){let t=Le(),[n,r]=(0,ct.useState)(!1);(0,ct.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?(0,Se.jsx)(Ir,{}):e==="denied"?(0,Se.jsx)(jr,{}):(0,Se.jsx)(Ur,{});return(0,Se.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,Se.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),(0,Se.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Xr,"Gn");a(Xr,"PermissionRow");function Jr({voice:e}){let t=Le();if(!e.supported)return null;let n=e.enabled;return(0,xe.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,xe.jsxs)("span",{className:"sekyro-switch__label",children:[(0,xe.jsx)(it,{off:!n}),t("capture.voiceGuidance")]}),(0,xe.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,xe.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,xe.jsx)(Tr,{className:"sekyro-switch__check"}):null})})]})}l(Jr,"Fn");a(Jr,"VoiceSwitch");function Yr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:s,tips:i,summary:c,startLabel:p,startDisabled:w,onStart:h}){let m=Le(),R=(0,ee.useRef)(c?.stop);R.current=c?.stop,(0,ee.useEffect)(()=>()=>R.current?.(),[]);let x=(0,ee.useRef)(null),U=(0,ee.useRef)(null),M=(0,ee.useRef)(null),B=(0,ee.useRef)(e),A=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{let u=B.current;if(B.current=e,u===e)return;let L=A.current;e!=="loading"&&(A.current=!1),en(x.current)&&(e==="failed"?M.current?.focus():L&&U.current?.focus())},[e]);let te=(0,ee.useCallback)(()=>{A.current=!0,t()},[t]),f=e==="loading",N=f||w,S=(0,ee.useCallback)(()=>{N||(R.current?.(),h())},[N,h]),b;return e==="failed"?b=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:m("fcv2.err.models")}),(0,P.jsx)(J,{kind:"ghost",ref:M,className:"sekyro-btn--start",onClick:te,"data-testid":"sekyro-assets-retry",children:m("common.retry")})]}):b=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(J,{ref:U,full:!0,"data-testid":"sekyro-start","aria-disabled":N?"true":void 0,"aria-busy":f?"true":void 0,onClick:S,children:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Hr,{}),m("capture.preparing.title")]}):p??m("capture.start")}),f?(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:x,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:m("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.assisted.lead")})]}):null,i!==!1?(0,P.jsx)(Or,{tips:i}):null,c!==void 0?(0,P.jsxs)(J,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(it,{off:!1}),m(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Xr,{state:n}),(0,P.jsx)(Jr,{voice:s}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.securityNote")}),b,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?m("capture.preparing.title"):e==="ready"?m("capture.ready"):""})]})}l(Yr,"jn");a(Yr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(en,"Br");a(en,"focusIsOurs");function tn(){let[e,t]=(0,ut.useState)({state:"unknown",settled:!1});return(0,ut.useEffect)(()=>$n(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(tn,"Yn");a(tn,"useCameraStatus");function rn(e){return Tt(e,"mobileRequired")}l(rn,"$n");a(rn,"useMobileRequired");function nn(e){return Tt(e,"returning").required}l(nn,"zn");a(nn,"useReturning");function Tt(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(c=>{i&&r({required:c===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}l(Tt,"Zn");a(Tt,"useFlag");function an(e){let t=a(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let i=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:c,settled:!0});return}let p=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(w=>{let h=e.captureChoice??null;p&&r({session:h!==null&&w===h?"choice":w==="assisted"||w==="choice"?w:"self",choice:h,settled:!0})},()=>{p&&r({session:"self",choice:null,settled:!0})}),()=>{p=!1}},[e]);let s=(0,pe.useCallback)(i=>{e?.chooseCaptureMode?.(i),r(c=>({...c,choice:i}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:s}}l(an,"Wn");a(an,"useCaptureMode");function sn(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)),s=e.on("result",()=>n(!1));return()=>{r(),s()}},[e]),t}l(sn,"Qn");a(sn,"useBusy");var zn=a(()=>"idle","serverSnapshot");function At(e){return Gn(e!==void 0?{assetBaseUrl:e}:{})}l(At,"er");a(At,"preload");function ln(e,t=!0){let n=(0,Y.useSyncExternalStore)((0,Y.useCallback)(h=>Kn(h,e),[e]),()=>Dn(e),zn),[r,s]=(0,Y.useState)(null),i=(0,Y.useRef)(!1),c=(0,Y.useCallback)(()=>{At(e).then(h=>{i.current&&h==="idle"&&s({base:e})})},[e]);(0,Y.useEffect)(()=>(i.current=!0,c(),()=>{i.current=!1}),[c]);let p=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(n!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,c())},[n,e,c,t]);let w=(0,Y.useCallback)(()=>{At(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:w}}l(ln,"tr");a(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,s=(0,E.useRef)(!1);e.verification!==r&&!s.current&&jt()&&(s.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let i=(0,E.useRef)(null),[c,p]=(0,E.useState)("idle"),[w,h]=(0,E.useState)(Rr),[m,R]=(0,E.useState)(!1),[x,U]=(0,E.useState)(!1),[M,B]=(0,E.useState)(null),[A,te]=(0,E.useState)(!1),[f,N]=(0,E.useState)(null),[S,b]=(0,E.useState)(null),[u,L]=(0,E.useState)(null),[j,F]=(0,E.useState)(null),[o,H]=(0,E.useState)(null),[O,W]=(0,E.useState)(!1),$=(0,E.useRef)(null),ke=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Q,X]=(0,E.useState)(0),ae=(0,E.useRef)(e);ae.current=e,(0,E.useEffect)(()=>{let re=t.current;if(re===null)return;let ue={video:re,...n!==void 0?{assetBaseUrl:n}:{}},K=r!==void 0?r.liveness(ue):Zn(ue);i.current=K;let Ne=a(()=>H(K.facingMode??null),"readFacing");Ne();let Ze=[K.on("state",C=>{C==="mode_switch"?W(!0):C!=="starting"&&C!=="gating"&&W(!1),C==="starting"?(ke.current!=="starting"&&(he.current+=1,X(Math.max(0,he.current))),b(null),L(null),h(Rr),U(!1),R(!1),B(null),N(null),$.current=null):C==="gating"&&ke.current==="recording"&&(U(!1),R(!1),B(null),$.current=null),ke.current=C,Ne(),p(C),ae.current.onStateChange?.(C)}),K.on("gate",C=>{let Ce=$.current;$.current=C.progress,R(Ce!==null&&C.progress<Ce-.001&&C.progress>0&&C.progress<1),C.progress>=1&&U(!0),h(C)}),K.on("frozen",({previewDataUrl:C})=>B(C)),K.on("profile",({animations:C})=>te(C==="reduced")),K.on("ramp",({colour:C})=>N(C)),K.on("captured",C=>{b(C),F(null),ae.current.onCaptured?.(C)}),K.on("error",C=>{L(C);let Ce=r?.reportCaptureIssue;Ce!==void 0&&xt(Ee=>Ce.call(r,Ee),Sr("liveness",C,Math.max(0,he.current))),ae.current.onError?.(C)}),r?.on("result",C=>{F(C),ae.current.onResult?.(C)})];return()=>{for(let C of Ze)C?.();i.current=null,K.destroy()}},[r,t,n]);let I=(0,E.useCallback)(()=>{i.current?.start()},[]),Re=(0,E.useCallback)(()=>{i.current?.retry()},[]),be=(0,E.useCallback)(async()=>{let re=i.current;return re===null||typeof re.canSwitchCaptureMode!="function"?!1:await re.canSwitchCaptureMode().catch(()=>!1)===!0},[]),q=(0,E.useCallback)(async re=>{let ue=i.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let K=await ue.setCaptureMode(re).catch(()=>!1)===!0;return K&&H(ue.facingMode??null),K},[]);return{state:c,gate:w,draining:m,gateLocked:x,frozenPreview:M,reduceMotion:A,rampColour:f,artifacts:S,error:u,result:j,facingMode:o,start:I,retry:Re,canSwitchCaptureMode:be,setCaptureMode:q,modeRestarted:O,attempt:Q}}l(on,"rr");a(on,"useLivenessHandle");var Wn=new Set(["national_number"]);function Lt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Wn.has(n));return t.length>0?{...e,options:t}:null}l(Lt,"or");a(Lt,"pending");function cn(e){let[t,n]=(0,ge.useState)(null),[r,s]=(0,ge.useState)(e===void 0),[i,c]=(0,ge.useState)(!1),[p,w]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{if(n(null),e===void 0){s(!0);return}let R=!0,x=e.methodChoice;typeof x=="function"?(s(!1),Promise.resolve().then(()=>x.call(e)).then(M=>{R&&n(Lt(M))},()=>{}).finally(()=>{R&&s(!0)})):s(!0);let U=e.on("method",M=>n(Lt(M)));return()=>{R=!1,U()}},[e]);let h=(0,ge.useCallback)(async R=>{if(e===void 0)return!1;c(!0),w(!1);try{return await e.selectMethod(R),n(null),!0}catch{return w(!0),!1}finally{c(!1)}},[e]),m=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:m==="national_number"&&!p?m:null,settled:r,busy:i,failed:p,select:h}}l(cn,"sr");a(cn,"useMethodChoice");var Qn=["ar","fr","en"];function un(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}}l(un,"co");a(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Qn){let s=t[r];if(!(typeof s!="object"||s===null))for(let[i,c]of Object.entries(s))!lt(i)||!un(c)||((n[r]??(n[r]={}))[i]=c)}return Object.keys(n).length>0?n:null}l(dn,"lo");a(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,He.useState)(null);(0,He.useEffect)(()=>{if(n(null),e===void 0)return;let s=!0,i=a(p=>{if(!s)return;let w=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;n(h=>h?.setId===w?.setId?h:w)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let c=e.on("view",p=>i(p.voice));return()=>{s=!1,c()}},[e]);let r=(0,He.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}l(pn,"ir");a(pn,"useServerVoiceClips");function hn({voice:e}){let t=Le();return(0,Et.jsx)(J,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Et.jsx)(it,{off:!e.enabled,className:"sekyro-icon"})})}l(hn,"cr");a(hn,"VoiceChip");var Xn=new Set(["abandoned","not_opened","cancelled","superseded"]),Jn=800,Yn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===Rt.length&&Rt.every(t=>e.includes(t))}l(fn,"go");a(fn,"isDefaultTips");function mn(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}l(mn,"ho");a(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}l(yn,"vo");a(yn,"isNoticeObject");var ea=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(gn,"ko");a(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}l(vn,"bo");a(vn,"isPostCapture");function ta({verification:e,locale:t,dir:n,strings:r,slots:s,autoStart:i=!1,notice:c,startDisabled:p=!1,startLabel:w,tips:h,tipsSummary:m,coach:R,voice:x,onGuidance:U,onCaptured:M,onResult:B,onError:A,onStateChange:te,assetBaseUrl:f,className:N}){let S=kr(t),b=(0,y.useMemo)(()=>vr(t,r),[t,r,S]),u=(0,y.useMemo)(()=>v=>b[v]??"",[b]),L=n??(t==="ar"?"rtl":"ltr"),j=(0,y.useRef)(null),F=(0,y.useContext)(Fn),o=on({verification:e,videoRef:j,assetBaseUrl:f,onCaptured:M,onResult:B,onError:A,onStateChange:te}),H=ln(f,o.state==="idle"&&o.error===null),O=cn(e),W=O.choice!==null,$=rn(e),ke=nn(e),he=sn(e),Q=tn(),X=an(e),ae=X.session==="choice",I=X.mode==="assisted",Re=x!==!1&&x?.clips===void 0,be=pn(Re?e:void 0),q=Kr({locale:t,defaultClips:be,options:x}),re=I?"environment":"user",ue=X.settled,K=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),Ze=(0,y.useRef)(q.unlock);Ze.current=q.unlock,(0,y.useEffect)(()=>{let v=K.current;if(v===null)return;let ie=["pointerup","touchend","click","keydown"],we=a(()=>{for(let Fe of ie)v.removeEventListener(Fe,Ae,!0)},"disarm");function Ae(Fe){if(Ne.current){we();return}mn(Fe)&&(Ne.current=!0,we(),Ze.current())}l(Ae,"Re"),a(Ae,"onGesture");for(let Fe of ie)v.addEventListener(Fe,Ae,{capture:!0,passive:!0});return we},[]);let C=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,q.unlock()),o.start()},[q.unlock,o.start]),Ce=(0,y.useCallback)(()=>o.start(),[o.start]),Ee=(0,y.useRef)(!1),Oe=o.state==="idle"&&o.error===null,Bt=!W&&!$.required&&(i===!0||i==="when-permitted"&&Q.permission==="granted"),qt=Bt&&O.settled&&$.settled&&ue,xn=i==="when-permitted"&&!Q.permissionSettled&&!Ee.current,Vt=Bt&&Oe&&!Ee.current,pt=(xn||Vt||!ue)&&H.gate==="ready"?"loading":H.gate;(0,y.useEffect)(()=>{!qt||!Oe||H.gate!=="ready"||Ee.current||(Ee.current=!0,Ce())},[qt,Oe,H.gate,Ce]);let Rn=Oe&&!W&&!$.required&&!(Vt&&H.gate==="ready"),[Ft,$t]=(0,y.useState)(!1),{canSwitchCaptureMode:Dt,setCaptureMode:Gt}=o;(0,y.useEffect)(()=>{if(!X.settled||!ae){$t(!1);return}let v=!0;return Dt().then(ie=>{v&&$t(ie)}),()=>{v=!1}},[X.settled,ae,Dt]);let{choose:Kt}=X,Ie=I?"self":"assisted",Nn=(0,y.useCallback)(async()=>{await Gt(Ie)&&Kt(Ie)},[Gt,Kt,Ie]),zt=o.state!=="idle"&&o.facingMode!==null?o.facingMode:re;(0,y.useEffect)(()=>{let v=j.current?.style;zt==="user"?v?.removeProperty("transform"):v&&(v.transform="none")},[zt]);let We=(0,y.useMemo)(()=>o.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(o.artifacts.keyframe):null,[o.artifacts]);(0,y.useEffect)(()=>{if(We!==null)return()=>URL.revokeObjectURL(We)},[We]);let Zt=o.frozenPreview??We,Ue=e!==void 0,D=gn(o.state),fe=vn(o.state),Pe=D||fe,se=o.result,Wt=o.state==="done"&&se!==null,Qe=D&&o.rampColour!==null,ht=o.state==="recording"&&o.frozenPreview!==null&&!Qe,Be=F!==null,Qt=Ft&&D&&!ht?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:a(()=>{Nn()},"onSwitch")}:null,Xe=o.modeRestarted&&D?u("capture.modeSwitch.restarted"):null,qe=fe||ht,Xt=fe?"checking":ht?"frozen":o.state==="recording"||Qe?"recording":o.gateLocked||o.gate.progress>=1?"locked":o.gate.faceDetected?"aligning":"seeking",Je=D?o.gate.hint:null,Ye=o.state==="starting"?"capture.preparing.title":Je===null?null:Je==="center"&&!o.gate.faceDetected?"fcv3.no_face":fr(Je),[Mn,Jt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Ye!=="fcv3.no_face"){Jt(Ye);return}if(!D)return;let v=setTimeout(()=>Jt(Ye),Jn);return()=>clearTimeout(v)},[Ye,D]);let ft=D&&!Qe&&typeof R=="string"&&R!=="",Yt=I&&D?u("capture.assisted.stage"):null,Me=D&&!ft?Qe?Yn:Mn:null,mt=ft?R:Me===null?"":u(Me);zr(q,Me,mt,D);let er=(0,y.useRef)(U);er.current=U,(0,y.useEffect)(()=>{if(lt(Me))try{er.current?.(Me)}catch(v){console.error("[@sekyro/react] onGuidance threw:",v)}},[Me]);let Ve=(0,y.useMemo)(()=>({supported:q.supported,enabled:q.enabled,setEnabled:q.setEnabled,toggle:q.toggle}),[q.supported,q.enabled,q.setEnabled,q.toggle]),yt=s?.voicePrompt,tr=yt!==void 0,rr=x===void 0,nr=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!tr||!rr||nr.current||!jt()||(nr.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."))},[tr,rr]);let An=yt!==void 0?(v,ie,we)=>yt(v,ie,we,Ve):q.supported?()=>(0,k.jsx)(hn,{voice:Ve}):void 0,{summary:gt,summaryPlaying:ar,toggleSummary:sr,stopSummary:ir}=q,et=m!==void 0&&m!=="",lr=et?m:u("capture.tips.summary"),or=et?gt!=="none":gt==="partner"||gt==="default"&&fn(h),Ln=(0,y.useMemo)(()=>or?{playing:ar,toggle:a(()=>sr(lr,{clip:!et}),"toggle"),stop:ir}:void 0,[or,ar,sr,lr,ir,et]),cr=(0,y.useMemo)(()=>({assets:pt,retryAssets:H.retry,permission:Q.permission,permissionSettled:Q.permissionSettled,captureMode:X.mode,facing:re,voice:Ve}),[pt,H.retry,Q.permission,Q.permissionSettled,X.mode,re,Ve]),En=yn(c)?(0,k.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:c.text})}):c??null,V=se!==null&&se.status==="retry"?se:null,tt=V!==null&&s?.intro!==void 0&&!D&&!fe&&o.error===null,ur=V===null?void 0:{reason:String(V.reasonCode??""),...V.retakeHint!==void 0?{retakeHint:V.retakeHint}:{},...V.attemptsRemaining!==void 0?{attemptsRemaining:V.attemptsRemaining}:{}},z=Wt&&se.status==="unavailable"&&!W&&se.reasonCode!=="portrait_required"?se:null,_e=Wt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,vt=a((v,ie)=>{if(v===void 0)return null;if(v==="device_cooldown"){let Ae=yr(t,ie);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let we=nt(v);return we===null?null:u(we)},"reasonText"),kt=a(v=>{let ie=v.retakeHint===void 0?null:$e(v.retakeHint);return ie===null?vt(v.reasonCode):u(ie)},"retryText"),dr=_e===null?null:vt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Xn.has(_e.reason)?u("errors.session_expired"):null),In=z!==null&&z.reasonCode!==void 0&&z.reasonCode!=="nni_unbound"&&z.reasonCode!=="id_number_unbound"&&z.reasonCode!=="method_required"&&z.reasonCode!=="mobile_required"&&!(z.reasonCode==="no_recorder"&&o.artifacts?.degraded==="NO_RECORDER"),rt=z?.reasonCode,pr=o.attempt;(0,y.useEffect)(()=>{z===null||rt===void 0||e?.reportCaptureIssue===void 0||ea.has(rt)||xt(v=>e.reportCaptureIssue?.(v),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:rt,attempt:Math.min(1e3,pr)})},[z,rt,pr,e]);let hr=Ct(),Un=W&&O.auto===null&&!D&&!fe&&o.error===null,bt=(0,y.useCallback)(async v=>{await O.select(v)&&o.state==="done"&&o.retry()},[O.select,o.state,o.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!D&&!fe&&bt(O.auto)},[O.auto,O.busy,D,fe,bt]),(0,k.jsx)(br,{value:u,children:(0,k.jsxs)("div",{ref:K,className:N===void 0?"sekyro-capture":`sekyro-capture ${N}`,dir:L,lang:t,"data-testid":"sekyro-liveness-capture","data-state":o.state,children:[s?.header,V!==null&&kt(V)!==null&&!(Be&&Pe)&&!tt?(0,k.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:kt(V)})}):null,Xe!==null&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Xe})}):null,he&&fe&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:u("reasons.mobile_required")})}):null,o.error!==null?s?.errorPanel!==void 0?s.errorPanel(o.error,o.retry):(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:u(mr(o.error))}),o.error.retryable?(0,k.jsx)(J,{ref:hr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u("common.retry")}):null]}):null,z!==null?(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:(z.reasonCode==="attestation"&&z.attestationError==="clock_wrong"?u("errors.device_clock"):vt(z.reasonCode))??u(z.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),In?(0,k.jsx)(J,{ref:hr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u(z.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,dr!==null&&_e!==null?(0,k.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:dr})}):null,(0,k.jsx)("div",{className:Pe?void 0:"sekyro-hidden","data-capture-live":Pe?"":void 0,children:Be?F({videoRef:j,guidance:qe&&Ue?u("capture.checking"):mt,coached:ft&&!(qe&&Ue),note:qe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:Xe??Yt,settled:qe&&Ue,progress:o.gate.progress,phase:Xt,still:qe?Zt:null,live:Pe,modeSwitch:Qt,...Ft||V!==null?{status:Xe??(V!==null&&D?kt(V):null)}:{},ramp:o.rampColour===null?null:{colour:o.rampColour}}):(0,k.jsx)(Cr,{videoRef:j,guidanceText:mt,guidanceHint:Je,guidanceKey:Me,progress:o.gate.progress,phase:Xt,draining:o.draining,stillUrl:Zt,showChecking:Ue,operatorText:Yt,voicePrompt:An,overlay:l(v=>(0,k.jsxs)(k.Fragment,{children:[s?.stageOverlay?.(v),(0,k.jsx)(_r,{colour:o.rampColour})]}),"overlay"),reduceMotion:o.reduceMotion,modeSwitch:Qt})}),Un&&O.choice!==null?(0,k.jsx)(Pr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(v=>({id:v,label:u(`method.${v}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:o.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(v=>{bt(v)},"onChoose")}):null,tt&&s?.intro!==void 0&&ur!==void 0?s.intro(o.retry,{...cr,retry:ur}):null,Rn?(0,k.jsxs)(k.Fragment,{children:[ke&&s?.header===void 0&&s?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,En,s?.intro!==void 0?s.intro(C,cr):(0,k.jsx)(Yr,{assets:pt,onRetryAssets:H.retry,permission:Q.permission,captureMode:X.mode,voice:Ve,tips:h??Rt,summary:Ln,startLabel:w,startDisabled:p,onStart:C})]}):null,(0,k.jsx)(Wr,{showCoaching:V!==null&&!(Be&&Pe)&&!tt,coaching:ze(V?.reasonCode,V?.retakeHint),attemptsText:V?.attemptsRemaining!==void 0?gr(b,t,V.attemptsRemaining):null,showRetake:V!==null&&!D&&!fe&&!tt||!Ue&&o.state==="captured",onRetake:o.retry}),s?.footer]})})}l(ta,"Ni");a(ta,"LivenessCapture");var Ht=T(Z(),1),dt=T(Z(),1),d=T(de(),1);import{methodNameOf as kn}from"@sekyro/web";import{isInAppBrowser as ca}from"@sekyro/web/client";var Aa={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function ra(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return kn(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return kn(e,t.locale)??t.t("method.nationalEid");default:return null}}l(ra,"J");a(ra,"identityLabel");function na(e,t){let[n,r]=(0,Ht.useState)(!1),[s,i]=(0,Ht.useState)(null);return{busy:n,error:s,run:a(c=>{r(!0),i(null),c().then(()=>r(!1),p=>{r(!1),i(e.t(xr(p,e.strings))),t?.(p)})},"run")}}l(na,"Q");a(na,"useChoiceAction");function Ot(){let e=`sekyro-face-light-${(0,dt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,d.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("mask",{id:e,children:(0,d.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,d.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,d.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Ot,"O");a(Ot,"FaceMark");var aa={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function sa(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}}l(sa,"le");a(sa,"faceIntroRetryOf");var Cn={"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 ia({start:e,context:t,tips:n,tipsTitle:r,human:s=!1,returning:i=!1,notice:c,retry:p}){let w=at(),{t:h}=w,m=p??wn(t),R=(0,dt.useContext)(wr)?.busy===!0;if(m!==void 0&&c===void 0&&t.captureMode!=="assisted")return(0,d.jsx)(Sn,{retry:m,start:e,context:t,disabled:R});let x=m===void 0?"face":ze(m.reason,m.retakeHint),U=x==="face"?null:Te[x].tips;return(0,d.jsxs)("section",{className:"sekyro-step",children:[(0,d.jsx)(Ot,{}),t.captureMode==="assisted"?(0,d.jsx)(De,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,d.jsx)(De,{title:h("returning.heading"),lead:h("returning.description")}):(0,d.jsx)(De,{title:h(s?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(s?"native.face.humanIntroLead":"native.face.introLead")}),m!==void 0?(0,d.jsx)(_n,{retry:m,title:Te[x].title}):null,r!==void 0&&U===null?(0,d.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:U!==null?U.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:Cn[M]??"face"}),h(M)]},M)):n!==void 0?n.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:aa[M.id]??"face"}),M.text]},M.id)):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"light"}),h("capture.tips.light")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,d.jsx)(J,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,c!==void 0?null:(0,d.jsx)(_t,{children:(0,d.jsxs)(J,{full:!0,disabled:t.assets!=="ready"||R,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,d.jsx)(me,{name:"camera"}),h("capture.start")]})})]})}l(ia,"ue");a(ia,"FaceIntro");var la=new Set(["match_inconclusive","no_face_source","below_threshold"]);function Pt(e){return e==="probe_not_from_liveness"?"capture.retrySamePerson.message":e==="faces_differ"?"reasons.faces_differ":la.has(e)?"capture.retryMatch.message":nt(e)}l(Pt,"F");a(Pt,"retryReasonKey");function _n({retry:e,title:t}){let n=at(),r=e.retakeHint===void 0?null:$e(e.retakeHint),s=Pt(e.reason);return(0,d.jsxs)(wt,{tone:"warning",children:[r!==null?(0,d.jsx)("span",{children:n.t(r)}):s!==null?(0,d.jsx)("span",{children:n.t(s)}):null,r===null?(0,d.jsx)("span",{children:n.t(t)}):null,(0,d.jsx)("span",{children:St(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(_n,"U");a(_n,"RetryNotice");function wn(e){let t=e.retry;if(t!==void 0)return{reason:t.reason,...t.retakeHint!==void 0?{retakeHint:t.retakeHint}:{},attemptsRemaining:t.attemptsRemaining??0,attemptsExhausted:t.attemptsRemaining===0}}l(wn,"G");a(wn,"faceIntroRetryOfContext");var bn=[{key:"capture.retryCoaching.light",icon:"light"},{key:"capture.retryCoaching.eyeLevel",icon:"smartphone"},{key:"capture.retryCoaching.head",icon:"face"}],oa={appearance:"hintTitles.appearance",motion:"hintTitles.motion",lighting:"hintTitles.lighting",framing:"hintTitles.framing"};function Sn({retry:e,start:t,context:n,disabled:r}){let s=at(),{t:i}=s,c=ze(e.reason,e.retakeHint),p=c==="face"?bn:Te[c].tips.map(x=>({key:x,icon:bn.find(U=>U.key===x)?.icon??Cn[x]??"face"})),w=e.retakeHint===void 0?null:$e(e.retakeHint),h=Pt(e.reason),m=w!==null?i(w):h!==null?i(h):void 0,R=i((e.retakeHint!==void 0?oa[e.retakeHint]:void 0)??"hintTitles.default");return(0,d.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-face-retry",children:[(0,d.jsx)(Ot,{}),(0,d.jsx)(De,{title:R}),m!==void 0?(0,d.jsx)(wt,{tone:"warning",children:(0,d.jsx)("span",{children:m})}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:p.slice(0,3).map(x=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:x.icon}),i(x.key)]},x.key))}),n.assets==="failed"?(0,d.jsx)(J,{kind:"secondary",full:!0,onClick:n.retryAssets,children:i("common.retry")}):null,(0,d.jsxs)(_t,{children:[(0,d.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:St(s,e.attemptsRemaining,e.attemptsExhausted)}),(0,d.jsxs)(J,{full:!0,disabled:n.assets!=="ready"||r||e.attemptsExhausted,"aria-busy":n.assets==="loading"||void 0,onClick:t,children:[(0,d.jsx)(me,{name:"camera"}),i("capture.recordAgain")]})]})]})}l(Sn,"q");a(Sn,"FaceRetry");function ua(e){return ca(e)}l(ua,"ye");a(ua,"isInAppBrowser");function da(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 s=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${s};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(da,"ge");a(da,"androidBrowserIntent");export{Pr as a,jt as b,Fn as c,an as d,ta as e,Aa as f,ra as g,na as h,sa as i,ia as j,ua as k,da as l};
1
+ import{b as Cr,d as _r}from"./chunk-FV5OWBNU.js";import{b as Sr,c as xt}from"./chunk-TC5736OF.js";import{a as xr}from"./chunk-XXCBLQ53.js";import{c as at}from"./chunk-NAURWQ6C.js";import{a as vr,b as kr,c as br,d as Le}from"./chunk-B7CZCSMF.js";import{F as wr,K as wt,L as St,a as Z,b as de,c as J,m as fr,n as $e,p as mr,q as nt,r as yr,s as gr,t as Ct,u as le,v as me,w as De,y as _t}from"./chunk-ENB7AFED.js";import{a as l,c as T,i as a}from"./chunk-SSU37LFQ.js";var Nr=T(Z(),1),g=T(de(),1),ne=T(de(),1),ve=T(Z(),1),G=T(de(),1),_=T(Z(),1),y=T(Z(),1),ot=T(Z(),1),ye=T(de(),1),Qr=T(Z(),1),ee=T(Z(),1),ct=T(Z(),1),Se=T(de(),1),xe=T(de(),1),P=T(de(),1),ut=T(Z(),1),pe=T(Z(),1),Y=T(Z(),1),E=T(Z(),1),ge=T(Z(),1),He=T(Z(),1),Et=T(de(),1),k=T(de(),1);import{subscribeCameraPermission as $n}from"@sekyro/web";import{getLivenessAssetsStatus as Dn,preloadLivenessAssets as Gn,subscribeLivenessAssets as Kn}from"@sekyro/web";import{createLivenessCapture as Zn}from"@sekyro/web";function ce({className:e,children:t}){return(0,g.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})}l(ce,"ne");a(ce,"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 Mr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,g.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"})]})}l(Mr,"pn");a(Mr,"SunIcon");function Ar(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,g.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Ar,"fn");a(Ar,"FaceUncoveredIcon");function Lr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,g.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,g.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Lr,"mn");a(Lr,"PhoneEyeLevelIcon");function Er(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.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,g.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Er,"yn");a(Er,"LookStraightIcon");function Ir(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Ir,"gn");a(Ir,"CameraCheckIcon");function Ur(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.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"})]})}l(Ur,"hn");a(Ur,"CameraAskIcon");function jr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:It}),(0,g.jsx)("path",{d:"M3 3l18 18"})]})}l(jr,"vn");a(jr,"CameraBlockedIcon");function it({off:e,className:t}){return(0,g.jsxs)(ce,{className:t,children:[(0,g.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,g.jsx)("path",{d:"M4 4l16 16"}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,g.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(it,"Ve");a(it,"SpeakerIcon");function Tr(e){return(0,g.jsx)(ce,{...e,children:(0,g.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Tr,"Cn");a(Tr,"CheckIcon");function Hr(e){return(0,g.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,g.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Hr,"kn");a(Hr,"SpinnerIcon");var Rt=["light","uncover","eyeLevel","straight"],jn={light:{key:"capture.tips.light",icon:a(()=>(0,ne.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:a(()=>(0,ne.jsx)(Ar,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:a(()=>(0,ne.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:a(()=>(0,ne.jsx)(Er,{}),"icon")}};function Or({tips:e}){let t=Le(),n=(0,Nr.useId)();return e.length===0?null:(0,ne.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ne.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ne.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?jn[r]:void 0,i=typeof r=="string"?r:r.id,c=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,p=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return(0,ne.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,ne.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,ne.jsx)("span",{children:p})]},i)})})]})}l(Or,"Sn");a(Or,"TipList");var Tn=220;function Pr({title:e,description:t,options:n,busy:r,error:s,focus:i,testId:c,look:p="cards",marked:w,onChoose:h}){let m=(0,ve.useId)(),R=Ct(),[x,U]=(0,ve.useState)(null),M=(0,ve.useRef)(null);(0,ve.useEffect)(()=>{s!==null&&U(null)},[s]),(0,ve.useEffect)(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);let B=a(A=>{r||x!==null||(U(A),M.current=setTimeout(()=>{M.current=null,U(null),h(A)},Tn))},"choose");return(0,G.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":m,"data-testid":c,children:[(0,G.jsxs)("div",{className:p==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,G.jsx)("h2",{id:m,ref:i?R:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,G.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?(0,G.jsx)(le,{tone:"danger",children:(0,G.jsx)("span",{children:s})}):null,p==="buttons"?(0,G.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,te)=>(0,G.jsx)(J,{kind:te===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>h(A.id),"onClick"),children:A.label},A.id))}):(0,G.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,G.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(x??w)===A.id,"aria-busy":r||void 0,disabled:r||x!==null&&x!==A.id,onClick:l(()=>B(A.id),"onClick"),children:[A.glyph!==void 0?(0,G.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,G.jsxs)("span",{className:"sekyro-card__body",children:[(0,G.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,G.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,G.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Pr,"Vn");a(Pr,"ChoiceScreen");var Br=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function lt(e){return e!==null&&Br.includes(e)}l(lt,"he");a(lt,"isVoiceKey");var Hn=a((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 s=e[n];r=s!=null&&Hn(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"we");a(je,"resolveClip");var On="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Pn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");a(oe,"synth");function qr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(qr,"Ir");a(qr,"speechAvailable");function Nt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(Nt,"wn");a(Nt,"baseLang");function Ut(e,t){let n=a(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=Nt(t);return e.find(s=>n(s.lang)===n(t))??e.find(s=>Nt(s.lang)===r)}l(Ut,"_n");a(Ut,"pickVoice");function Vr(e){if(!qr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Ut(t,e)!==void 0}l(Vr,"In");a(Vr,"speechUsable");function Fr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"xn");a(Fr,"subscribeVoices");function Ke(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}`}}l(Ke,"He");a(Ke,"clipIdentity");function Mt(e){e.pause(),e.removeAttribute("src"),e.load()}l(Mt,"Mn");a(Mt,"release");function $r(){let e=null,t=null,n=0,r=null,s=null,i=null,c=!1,p=null,w=[],h=new Map,m=a(()=>{w=oe()?.getVoices()??[]},"loadVoices"),R=!1,x=a(()=>{let f=oe();R||f===null||(R=!0,m(),f.addEventListener?.("voiceschanged",m))},"bindVoices"),U=a(()=>(e??(e=new Audio),e),"element"),M=a((f,N,S,b)=>{let u=oe();if(u!==null&&f!==""&&typeof SpeechSynthesisUtterance=="function"){x();let L=Ut(w,N);if(w.length===0||L!==void 0){u.cancel();let j=new SpeechSynthesisUtterance(f);j.lang=N,L!==void 0&&(j.voice=L),j.rate=.95,S!==void 0&&(j.onend=S),(S!==void 0||b!==void 0)&&(j.onerror=F=>{b!==void 0&&F.error==="not-allowed"?b():S?.()}),u.speak(j);return}}S?.()},"speak"),B=a(()=>{n+=1,r=null,s=i=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=a(f=>{for(let N of f){let S=Ke(N);if(h.has(S))continue;let b=new Audio;b.preload="auto",b.src=N,h.set(S,b)}},"warmClips"),te=a((f,N,S)=>{let b={utterance:f,generation:N,end:S};p=b;let u=a(()=>N===n&&p===b,"live"),L=a(()=>{u()&&(s=b)},"block");if(oe()?.cancel(),f.url!==null){let j=U();j.pause(),j.muted=!1,j.src=f.url,j.currentTime=0,j.onended=S??null;let F=a(()=>{i===b&&(i=null)},"settled"),o=j.play();if(o===void 0)return;i=b,o.then(F,H=>{if(F(),!u())return;let O=H?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return L();f.speech?M(f.text,f.lang,S,L):S?.()}});return}f.speech?M(f.text,f.lang,S,L):S?.()},"start");return{say(f){let N=f.url!==null?Ke(f.url):`tts:${f.lang}:${f.text}`;if(N===r)return;r=N,s=i=null,n+=1;let S=n,b=f.onEnd;te(f,S,b!==void 0?()=>{S===n&&b()}:void 0)},unlock({lang:f,speech:N,prefetch:S}){let b=s??(c?null:i);c=!0;let u=b!==null&&b.generation===n?b:null;s=i=null,u!==null&&te(u.utterance,u.generation,u.end);let L=U();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let H=Uint8Array.from(atob(On),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([H],{type:"audio/wav"}))}let j=L.paused===!1&&t!==null&&L.src!==t;t!==null&&!j&&(u===null||u.utterance.url===null)&&(L.muted=!0,L.onended=null,L.src=t,L.play()?.catch(()=>{}));let F=oe(),o=u!==null&&u.utterance.url===null;if(N&&!o&&F!==null&&typeof SpeechSynthesisUtterance=="function"){x();let H=new SpeechSynthesisUtterance(" ");H.volume=0,H.lang=f,F.speak(H)}A(S??[])},prefetch:A,stop:B,dispose(){B(),R&&oe()?.removeEventListener?.("voiceschanged",m),R=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Mt(e),e=null;for(let f of h.values())Mt(f);h.clear()}}}l($r,"En");a($r,"createVoicePlayer");var Bn="sekyro.voiceGuidance";function Dr(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}}l(Dr,"Nn");a(Dr,"readVoicePreference");function Gr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Gr,"Pn");a(Gr,"writeVoicePreference");var Ge="capture.tips.summary",qn=typeof window<"u"?_.useLayoutEffect:_.useEffect,Vn=Object.freeze({});function st(e,t){let n=new Set,r=[];for(let s of Br){let i=s===Ge?null:je(e,s,t);i===null||n.has(Ke(i))||(n.add(Ke(i)),r.push(i))}return r}l(st,"vt");a(st,"resolvedClipUrls");function Kr({locale:e,defaultClips:t,options:n}){let r=n===!1,s=r?{}:n??{},i=s.storageKey===void 0?Bn:s.storageKey,[c,p]=(0,_.useState)(s.defaultEnabled??!0),w=(0,_.useRef)(c),[h,m]=(0,_.useState)(!1),[R,x]=(0,_.useState)("none"),[U,M]=(0,_.useState)(!1),B=(0,_.useRef)(!1),[A,te]=(0,_.useState)(0),f=(0,_.useRef)(null),N=(0,_.useCallback)(()=>(f.current??(f.current=$r()),f.current),[]),S=Pn[e],b=s.speechFallback,u=b===void 0||b===!0?!0:b===!1?!1:b.includes(e),L=s.clips??t??Vn,j=(0,_.useRef)(!1),F=(0,_.useRef)(L);qn(()=>{F.current=L,w.current=c}),(0,_.useEffect)(()=>{if(r||i===null)return;let I=Dr(i);I!==null&&(w.current=I,p(I))},[r,i]),(0,_.useEffect)(()=>{if(!(r||!u))return Fr(()=>te(I=>I+1))},[r,u]);let o=s.clips;(0,_.useEffect)(()=>{if(r)return;let I=u&&Vr(S);m(st(L,e).length>0||I),x(o!==void 0&&je(o,Ge,e)!==null?"partner":je(L,Ge,e)!==null||I?"default":"none")},[r,L,o,e,u,S,A]),(0,_.useEffect)(()=>{if(r||!c||!j.current)return;let I=st(L,e);I.length>0&&N().prefetch(I)},[r,c,L,e,N]),(0,_.useEffect)(()=>()=>{f.current?.dispose(),f.current=null,j.current=!1},[]);let H=(0,_.useCallback)(I=>{r||(j.current=!0,N().unlock({lang:S,speech:u,...I?{prefetch:st(F.current,e)}:{}}))},[r,N,S,u,e]),O=(0,_.useCallback)(()=>H(w.current),[H]),W=(0,_.useCallback)(()=>{B.current=!1,M(!1)},[]),$=(0,_.useCallback)(()=>{W(),f.current?.stop()},[W]),ke=(0,_.useCallback)(()=>{B.current&&$()},[$]),he=(0,_.useCallback)((I,Re)=>{if(r)return;if(B.current){$();return}let be=N();be.stop(),B.current=!0,M(!0);let q=Re?.clip===!1?null:je(F.current,Ge,e);be.say({url:q,text:I,lang:S,speech:u,onEnd:W})},[r,$,N,e,S,u,W]),Q=(0,_.useCallback)(I=>{r||(I?H(!0):$(),i!==null&&Gr(i,I),w.current=I,p(I))},[r,H,$,i]),X=(0,_.useCallback)(()=>Q(!w.current),[Q]),ae=(0,_.useCallback)((I,Re)=>{if(r||!c)return;B.current&&W();let be=je(F.current,I,e);N().say({url:be,text:Re,lang:S,speech:u})},[r,c,e,N,S,u,W]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&c,setEnabled:Q,toggle:X,unlock:O,speakKey:ae,stop:$,summary:r?"none":R,summaryPlaying:U,toggleSummary:he,stopSummary:ke}),[r,h,c,Q,X,O,ae,$,R,U,he,ke])}l(Kr,"Ct");a(Kr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:s,stop:i,enabled:c}=e,p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){p.current&&i(),p.current=!1;return}p.current=!0,lt(t)&&t!==Ge&&n!==""&&s(t,n)},[r,c,t,n,s,i])}l(zr,"kt");a(zr,"useSpeakGuidance");function ze(e,t){let n=Zr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(ze,"On");a(ze,"retryCoachingOf");function Zr(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"}}l(Zr,"Kr");a(Zr,"coachingOfReason");var Te={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["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 Wr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:s}){let i=Le(),c=(0,ot.useRef)(null);return(0,ot.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,ye.jsx)("p",{className:"sekyro-text-body",children:i(Te[t].title)}),(0,ye.jsx)("ul",{className:"sekyro-coaching",children:Te[t].tips.map(p=>(0,ye.jsx)("li",{children:i(p)},p))}),n!==null?(0,ye.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,ye.jsx)(J,{ref:c,className:"sekyro-btn--start",onClick:s,children:i("capture.recordAgain")}):null]})}l(Wr,"Hn");a(Wr,"CapturedPanel");function jt(){try{return!1}catch{return!1}}l(jt,"rt");a(jt,"isDevBuild");var Fn=(0,Qr.createContext)(null);function Xr({state:e}){let t=Le(),[n,r]=(0,ct.useState)(!1);(0,ct.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?(0,Se.jsx)(Ir,{}):e==="denied"?(0,Se.jsx)(jr,{}):(0,Se.jsx)(Ur,{});return(0,Se.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,Se.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),(0,Se.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Xr,"Gn");a(Xr,"PermissionRow");function Jr({voice:e}){let t=Le();if(!e.supported)return null;let n=e.enabled;return(0,xe.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,xe.jsxs)("span",{className:"sekyro-switch__label",children:[(0,xe.jsx)(it,{off:!n}),t("capture.voiceGuidance")]}),(0,xe.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,xe.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,xe.jsx)(Tr,{className:"sekyro-switch__check"}):null})})]})}l(Jr,"Fn");a(Jr,"VoiceSwitch");function Yr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:s,tips:i,summary:c,startLabel:p,startDisabled:w,onStart:h}){let m=Le(),R=(0,ee.useRef)(c?.stop);R.current=c?.stop,(0,ee.useEffect)(()=>()=>R.current?.(),[]);let x=(0,ee.useRef)(null),U=(0,ee.useRef)(null),M=(0,ee.useRef)(null),B=(0,ee.useRef)(e),A=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{let u=B.current;if(B.current=e,u===e)return;let L=A.current;e!=="loading"&&(A.current=!1),en(x.current)&&(e==="failed"?M.current?.focus():L&&U.current?.focus())},[e]);let te=(0,ee.useCallback)(()=>{A.current=!0,t()},[t]),f=e==="loading",N=f||w,S=(0,ee.useCallback)(()=>{N||(R.current?.(),h())},[N,h]),b;return e==="failed"?b=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:m("fcv2.err.models")}),(0,P.jsx)(J,{kind:"ghost",ref:M,className:"sekyro-btn--start",onClick:te,"data-testid":"sekyro-assets-retry",children:m("common.retry")})]}):b=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(J,{ref:U,full:!0,"data-testid":"sekyro-start","aria-disabled":N?"true":void 0,"aria-busy":f?"true":void 0,onClick:S,children:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Hr,{}),m("capture.preparing.title")]}):p??m("capture.start")}),f?(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:x,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:m("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.assisted.lead")})]}):null,i!==!1?(0,P.jsx)(Or,{tips:i}):null,c!==void 0?(0,P.jsxs)(J,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(it,{off:!1}),m(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Xr,{state:n}),(0,P.jsx)(Jr,{voice:s}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.securityNote")}),b,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?m("capture.preparing.title"):e==="ready"?m("capture.ready"):""})]})}l(Yr,"jn");a(Yr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(en,"Br");a(en,"focusIsOurs");function tn(){let[e,t]=(0,ut.useState)({state:"unknown",settled:!1});return(0,ut.useEffect)(()=>$n(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(tn,"Yn");a(tn,"useCameraStatus");function rn(e){return Tt(e,"mobileRequired")}l(rn,"$n");a(rn,"useMobileRequired");function nn(e){return Tt(e,"returning").required}l(nn,"zn");a(nn,"useReturning");function Tt(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(c=>{i&&r({required:c===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}l(Tt,"Zn");a(Tt,"useFlag");function an(e){let t=a(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let i=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:c,settled:!0});return}let p=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(w=>{let h=e.captureChoice??null;p&&r({session:h!==null&&w===h?"choice":w==="assisted"||w==="choice"?w:"self",choice:h,settled:!0})},()=>{p&&r({session:"self",choice:null,settled:!0})}),()=>{p=!1}},[e]);let s=(0,pe.useCallback)(i=>{e?.chooseCaptureMode?.(i),r(c=>({...c,choice:i}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:s}}l(an,"Wn");a(an,"useCaptureMode");function sn(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)),s=e.on("result",()=>n(!1));return()=>{r(),s()}},[e]),t}l(sn,"Qn");a(sn,"useBusy");var zn=a(()=>"idle","serverSnapshot");function At(e){return Gn(e!==void 0?{assetBaseUrl:e}:{})}l(At,"er");a(At,"preload");function ln(e,t=!0){let n=(0,Y.useSyncExternalStore)((0,Y.useCallback)(h=>Kn(h,e),[e]),()=>Dn(e),zn),[r,s]=(0,Y.useState)(null),i=(0,Y.useRef)(!1),c=(0,Y.useCallback)(()=>{At(e).then(h=>{i.current&&h==="idle"&&s({base:e})})},[e]);(0,Y.useEffect)(()=>(i.current=!0,c(),()=>{i.current=!1}),[c]);let p=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(n!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,c())},[n,e,c,t]);let w=(0,Y.useCallback)(()=>{At(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:w}}l(ln,"tr");a(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,s=(0,E.useRef)(!1);e.verification!==r&&!s.current&&jt()&&(s.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let i=(0,E.useRef)(null),[c,p]=(0,E.useState)("idle"),[w,h]=(0,E.useState)(Rr),[m,R]=(0,E.useState)(!1),[x,U]=(0,E.useState)(!1),[M,B]=(0,E.useState)(null),[A,te]=(0,E.useState)(!1),[f,N]=(0,E.useState)(null),[S,b]=(0,E.useState)(null),[u,L]=(0,E.useState)(null),[j,F]=(0,E.useState)(null),[o,H]=(0,E.useState)(null),[O,W]=(0,E.useState)(!1),$=(0,E.useRef)(null),ke=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Q,X]=(0,E.useState)(0),ae=(0,E.useRef)(e);ae.current=e,(0,E.useEffect)(()=>{let re=t.current;if(re===null)return;let ue={video:re,...n!==void 0?{assetBaseUrl:n}:{}},K=r!==void 0?r.liveness(ue):Zn(ue);i.current=K;let Ne=a(()=>H(K.facingMode??null),"readFacing");Ne();let Ze=[K.on("state",C=>{C==="mode_switch"?W(!0):C!=="starting"&&C!=="gating"&&W(!1),C==="starting"?(ke.current!=="starting"&&(he.current+=1,X(Math.max(0,he.current))),b(null),L(null),h(Rr),U(!1),R(!1),B(null),N(null),$.current=null):C==="gating"&&ke.current==="recording"&&(U(!1),R(!1),B(null),$.current=null),ke.current=C,Ne(),p(C),ae.current.onStateChange?.(C)}),K.on("gate",C=>{let Ce=$.current;$.current=C.progress,R(Ce!==null&&C.progress<Ce-.001&&C.progress>0&&C.progress<1),C.progress>=1&&U(!0),h(C)}),K.on("frozen",({previewDataUrl:C})=>B(C)),K.on("profile",({animations:C})=>te(C==="reduced")),K.on("ramp",({colour:C})=>N(C)),K.on("captured",C=>{b(C),F(null),ae.current.onCaptured?.(C)}),K.on("error",C=>{L(C);let Ce=r?.reportCaptureIssue;Ce!==void 0&&xt(Ee=>Ce.call(r,Ee),Sr("liveness",C,Math.max(0,he.current))),ae.current.onError?.(C)}),r?.on("result",C=>{F(C),ae.current.onResult?.(C)})];return()=>{for(let C of Ze)C?.();i.current=null,K.destroy()}},[r,t,n]);let I=(0,E.useCallback)(()=>{i.current?.start()},[]),Re=(0,E.useCallback)(()=>{i.current?.retry()},[]),be=(0,E.useCallback)(async()=>{let re=i.current;return re===null||typeof re.canSwitchCaptureMode!="function"?!1:await re.canSwitchCaptureMode().catch(()=>!1)===!0},[]),q=(0,E.useCallback)(async re=>{let ue=i.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let K=await ue.setCaptureMode(re).catch(()=>!1)===!0;return K&&H(ue.facingMode??null),K},[]);return{state:c,gate:w,draining:m,gateLocked:x,frozenPreview:M,reduceMotion:A,rampColour:f,artifacts:S,error:u,result:j,facingMode:o,start:I,retry:Re,canSwitchCaptureMode:be,setCaptureMode:q,modeRestarted:O,attempt:Q}}l(on,"rr");a(on,"useLivenessHandle");var Wn=new Set(["national_number"]);function Lt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Wn.has(n));return t.length>0?{...e,options:t}:null}l(Lt,"or");a(Lt,"pending");function cn(e){let[t,n]=(0,ge.useState)(null),[r,s]=(0,ge.useState)(e===void 0),[i,c]=(0,ge.useState)(!1),[p,w]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{if(n(null),e===void 0){s(!0);return}let R=!0,x=e.methodChoice;typeof x=="function"?(s(!1),Promise.resolve().then(()=>x.call(e)).then(M=>{R&&n(Lt(M))},()=>{}).finally(()=>{R&&s(!0)})):s(!0);let U=e.on("method",M=>n(Lt(M)));return()=>{R=!1,U()}},[e]);let h=(0,ge.useCallback)(async R=>{if(e===void 0)return!1;c(!0),w(!1);try{return await e.selectMethod(R),n(null),!0}catch{return w(!0),!1}finally{c(!1)}},[e]),m=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:m==="national_number"&&!p?m:null,settled:r,busy:i,failed:p,select:h}}l(cn,"sr");a(cn,"useMethodChoice");var Qn=["ar","fr","en"];function un(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}}l(un,"co");a(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Qn){let s=t[r];if(!(typeof s!="object"||s===null))for(let[i,c]of Object.entries(s))!lt(i)||!un(c)||((n[r]??(n[r]={}))[i]=c)}return Object.keys(n).length>0?n:null}l(dn,"lo");a(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,He.useState)(null);(0,He.useEffect)(()=>{if(n(null),e===void 0)return;let s=!0,i=a(p=>{if(!s)return;let w=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;n(h=>h?.setId===w?.setId?h:w)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let c=e.on("view",p=>i(p.voice));return()=>{s=!1,c()}},[e]);let r=(0,He.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}l(pn,"ir");a(pn,"useServerVoiceClips");function hn({voice:e}){let t=Le();return(0,Et.jsx)(J,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Et.jsx)(it,{off:!e.enabled,className:"sekyro-icon"})})}l(hn,"cr");a(hn,"VoiceChip");var Xn=new Set(["abandoned","not_opened","cancelled","superseded"]),Jn=800,Yn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===Rt.length&&Rt.every(t=>e.includes(t))}l(fn,"go");a(fn,"isDefaultTips");function mn(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}l(mn,"ho");a(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}l(yn,"vo");a(yn,"isNoticeObject");var ea=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(gn,"ko");a(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}l(vn,"bo");a(vn,"isPostCapture");function ta({verification:e,locale:t,dir:n,strings:r,slots:s,autoStart:i=!1,notice:c,startDisabled:p=!1,startLabel:w,tips:h,tipsSummary:m,coach:R,voice:x,onGuidance:U,onCaptured:M,onResult:B,onError:A,onStateChange:te,assetBaseUrl:f,className:N}){let S=kr(t),b=(0,y.useMemo)(()=>vr(t,r),[t,r,S]),u=(0,y.useMemo)(()=>v=>b[v]??"",[b]),L=n??(t==="ar"?"rtl":"ltr"),j=(0,y.useRef)(null),F=(0,y.useContext)(Fn),o=on({verification:e,videoRef:j,assetBaseUrl:f,onCaptured:M,onResult:B,onError:A,onStateChange:te}),H=ln(f,o.state==="idle"&&o.error===null),O=cn(e),W=O.choice!==null,$=rn(e),ke=nn(e),he=sn(e),Q=tn(),X=an(e),ae=X.session==="choice",I=X.mode==="assisted",Re=x!==!1&&x?.clips===void 0,be=pn(Re?e:void 0),q=Kr({locale:t,defaultClips:be,options:x}),re=I?"environment":"user",ue=X.settled,K=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),Ze=(0,y.useRef)(q.unlock);Ze.current=q.unlock,(0,y.useEffect)(()=>{let v=K.current;if(v===null)return;let ie=["pointerup","touchend","click","keydown"],we=a(()=>{for(let Fe of ie)v.removeEventListener(Fe,Ae,!0)},"disarm");function Ae(Fe){if(Ne.current){we();return}mn(Fe)&&(Ne.current=!0,we(),Ze.current())}l(Ae,"Re"),a(Ae,"onGesture");for(let Fe of ie)v.addEventListener(Fe,Ae,{capture:!0,passive:!0});return we},[]);let C=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,q.unlock()),o.start()},[q.unlock,o.start]),Ce=(0,y.useCallback)(()=>o.start(),[o.start]),Ee=(0,y.useRef)(!1),Oe=o.state==="idle"&&o.error===null,Bt=!W&&!$.required&&(i===!0||i==="when-permitted"&&Q.permission==="granted"),qt=Bt&&O.settled&&$.settled&&ue,xn=i==="when-permitted"&&!Q.permissionSettled&&!Ee.current,Vt=Bt&&Oe&&!Ee.current,pt=(xn||Vt||!ue)&&H.gate==="ready"?"loading":H.gate;(0,y.useEffect)(()=>{!qt||!Oe||H.gate!=="ready"||Ee.current||(Ee.current=!0,Ce())},[qt,Oe,H.gate,Ce]);let Rn=Oe&&!W&&!$.required&&!(Vt&&H.gate==="ready"),[Ft,$t]=(0,y.useState)(!1),{canSwitchCaptureMode:Dt,setCaptureMode:Gt}=o;(0,y.useEffect)(()=>{if(!X.settled||!ae){$t(!1);return}let v=!0;return Dt().then(ie=>{v&&$t(ie)}),()=>{v=!1}},[X.settled,ae,Dt]);let{choose:Kt}=X,Ie=I?"self":"assisted",Nn=(0,y.useCallback)(async()=>{await Gt(Ie)&&Kt(Ie)},[Gt,Kt,Ie]),zt=o.state!=="idle"&&o.facingMode!==null?o.facingMode:re;(0,y.useEffect)(()=>{let v=j.current?.style;zt==="user"?v?.removeProperty("transform"):v&&(v.transform="none")},[zt]);let We=(0,y.useMemo)(()=>o.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(o.artifacts.keyframe):null,[o.artifacts]);(0,y.useEffect)(()=>{if(We!==null)return()=>URL.revokeObjectURL(We)},[We]);let Zt=o.frozenPreview??We,Ue=e!==void 0,D=gn(o.state),fe=vn(o.state),Pe=D||fe,se=o.result,Wt=o.state==="done"&&se!==null,Qe=D&&o.rampColour!==null,ht=o.state==="recording"&&o.frozenPreview!==null&&!Qe,Be=F!==null,Qt=Ft&&D&&!ht?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:a(()=>{Nn()},"onSwitch")}:null,Xe=o.modeRestarted&&D?u("capture.modeSwitch.restarted"):null,qe=fe||ht,Xt=fe?"checking":ht?"frozen":o.state==="recording"||Qe?"recording":o.gateLocked||o.gate.progress>=1?"locked":o.gate.faceDetected?"aligning":"seeking",Je=D?o.gate.hint:null,Ye=o.state==="starting"?"capture.preparing.title":Je===null?null:Je==="center"&&!o.gate.faceDetected?"fcv3.no_face":fr(Je),[Mn,Jt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Ye!=="fcv3.no_face"){Jt(Ye);return}if(!D)return;let v=setTimeout(()=>Jt(Ye),Jn);return()=>clearTimeout(v)},[Ye,D]);let ft=D&&!Qe&&typeof R=="string"&&R!=="",Yt=I&&D?u("capture.assisted.stage"):null,Me=D&&!ft?Qe?Yn:Mn:null,mt=ft?R:Me===null?"":u(Me);zr(q,Me,mt,D);let er=(0,y.useRef)(U);er.current=U,(0,y.useEffect)(()=>{if(lt(Me))try{er.current?.(Me)}catch(v){console.error("[@sekyro/react] onGuidance threw:",v)}},[Me]);let Ve=(0,y.useMemo)(()=>({supported:q.supported,enabled:q.enabled,setEnabled:q.setEnabled,toggle:q.toggle}),[q.supported,q.enabled,q.setEnabled,q.toggle]),yt=s?.voicePrompt,tr=yt!==void 0,rr=x===void 0,nr=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!tr||!rr||nr.current||!jt()||(nr.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."))},[tr,rr]);let An=yt!==void 0?(v,ie,we)=>yt(v,ie,we,Ve):q.supported?()=>(0,k.jsx)(hn,{voice:Ve}):void 0,{summary:gt,summaryPlaying:ar,toggleSummary:sr,stopSummary:ir}=q,et=m!==void 0&&m!=="",lr=et?m:u("capture.tips.summary"),or=et?gt!=="none":gt==="partner"||gt==="default"&&fn(h),Ln=(0,y.useMemo)(()=>or?{playing:ar,toggle:a(()=>sr(lr,{clip:!et}),"toggle"),stop:ir}:void 0,[or,ar,sr,lr,ir,et]),cr=(0,y.useMemo)(()=>({assets:pt,retryAssets:H.retry,permission:Q.permission,permissionSettled:Q.permissionSettled,captureMode:X.mode,facing:re,voice:Ve}),[pt,H.retry,Q.permission,Q.permissionSettled,X.mode,re,Ve]),En=yn(c)?(0,k.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:c.text})}):c??null,V=se!==null&&se.status==="retry"?se:null,tt=V!==null&&s?.intro!==void 0&&!D&&!fe&&o.error===null,ur=V===null?void 0:{reason:String(V.reasonCode??""),...V.retakeHint!==void 0?{retakeHint:V.retakeHint}:{},...V.attemptsRemaining!==void 0?{attemptsRemaining:V.attemptsRemaining}:{}},z=Wt&&se.status==="unavailable"&&!W&&se.reasonCode!=="portrait_required"?se:null,_e=Wt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,vt=a((v,ie)=>{if(v===void 0)return null;if(v==="device_cooldown"){let Ae=yr(t,ie);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let we=nt(v);return we===null?null:u(we)},"reasonText"),kt=a(v=>{let ie=v.retakeHint===void 0?null:$e(v.retakeHint);return ie===null?vt(v.reasonCode):u(ie)},"retryText"),dr=_e===null?null:vt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Xn.has(_e.reason)?u("errors.session_expired"):null),In=z!==null&&z.reasonCode!==void 0&&z.reasonCode!=="nni_unbound"&&z.reasonCode!=="id_number_unbound"&&z.reasonCode!=="method_required"&&z.reasonCode!=="mobile_required"&&!(z.reasonCode==="no_recorder"&&o.artifacts?.degraded==="NO_RECORDER"),rt=z?.reasonCode,pr=o.attempt;(0,y.useEffect)(()=>{z===null||rt===void 0||e?.reportCaptureIssue===void 0||ea.has(rt)||xt(v=>e.reportCaptureIssue?.(v),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:rt,attempt:Math.min(1e3,pr)})},[z,rt,pr,e]);let hr=Ct(),Un=W&&O.auto===null&&!D&&!fe&&o.error===null,bt=(0,y.useCallback)(async v=>{await O.select(v)&&o.state==="done"&&o.retry()},[O.select,o.state,o.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!D&&!fe&&bt(O.auto)},[O.auto,O.busy,D,fe,bt]),(0,k.jsx)(br,{value:u,children:(0,k.jsxs)("div",{ref:K,className:N===void 0?"sekyro-capture":`sekyro-capture ${N}`,dir:L,lang:t,"data-testid":"sekyro-liveness-capture","data-state":o.state,children:[s?.header,V!==null&&kt(V)!==null&&!(Be&&Pe)&&!tt?(0,k.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:kt(V)})}):null,Xe!==null&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Xe})}):null,he&&fe&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:u("reasons.mobile_required")})}):null,o.error!==null?s?.errorPanel!==void 0?s.errorPanel(o.error,o.retry):(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:u(mr(o.error))}),o.error.retryable?(0,k.jsx)(J,{ref:hr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u("common.retry")}):null]}):null,z!==null?(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:(z.reasonCode==="attestation"&&z.attestationError==="clock_wrong"?u("errors.device_clock"):vt(z.reasonCode))??u(z.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),In?(0,k.jsx)(J,{ref:hr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u(z.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,dr!==null&&_e!==null?(0,k.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:dr})}):null,(0,k.jsx)("div",{className:Pe?void 0:"sekyro-hidden","data-capture-live":Pe?"":void 0,children:Be?F({videoRef:j,guidance:qe&&Ue?u("capture.checking"):mt,coached:ft&&!(qe&&Ue),note:qe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:Xe??Yt,settled:qe&&Ue,progress:o.gate.progress,phase:Xt,still:qe?Zt:null,live:Pe,modeSwitch:Qt,...Ft||V!==null?{status:Xe??(V!==null&&D?kt(V):null)}:{},ramp:o.rampColour===null?null:{colour:o.rampColour}}):(0,k.jsx)(Cr,{videoRef:j,guidanceText:mt,guidanceHint:Je,guidanceKey:Me,progress:o.gate.progress,phase:Xt,draining:o.draining,stillUrl:Zt,showChecking:Ue,operatorText:Yt,voicePrompt:An,overlay:l(v=>(0,k.jsxs)(k.Fragment,{children:[s?.stageOverlay?.(v),(0,k.jsx)(_r,{colour:o.rampColour})]}),"overlay"),reduceMotion:o.reduceMotion,modeSwitch:Qt})}),Un&&O.choice!==null?(0,k.jsx)(Pr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(v=>({id:v,label:u(`method.${v}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:o.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(v=>{bt(v)},"onChoose")}):null,tt&&s?.intro!==void 0&&ur!==void 0?s.intro(o.retry,{...cr,retry:ur}):null,Rn?(0,k.jsxs)(k.Fragment,{children:[ke&&s?.header===void 0&&s?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,En,s?.intro!==void 0?s.intro(C,cr):(0,k.jsx)(Yr,{assets:pt,onRetryAssets:H.retry,permission:Q.permission,captureMode:X.mode,voice:Ve,tips:h??Rt,summary:Ln,startLabel:w,startDisabled:p,onStart:C})]}):null,(0,k.jsx)(Wr,{showCoaching:V!==null&&!(Be&&Pe)&&!tt,coaching:ze(V?.reasonCode,V?.retakeHint),attemptsText:V?.attemptsRemaining!==void 0?gr(b,t,V.attemptsRemaining):null,showRetake:V!==null&&!D&&!fe&&!tt||!Ue&&o.state==="captured",onRetake:o.retry}),s?.footer]})})}l(ta,"Ni");a(ta,"LivenessCapture");var Ht=T(Z(),1),dt=T(Z(),1),d=T(de(),1);import{methodNameOf as kn}from"@sekyro/web";import{isInAppBrowser as ca}from"@sekyro/web/client";var Aa={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function ra(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return kn(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return kn(e,t.locale)??t.t("method.nationalEid");default:return null}}l(ra,"J");a(ra,"identityLabel");function na(e,t){let[n,r]=(0,Ht.useState)(!1),[s,i]=(0,Ht.useState)(null);return{busy:n,error:s,run:a(c=>{r(!0),i(null),c().then(()=>r(!1),p=>{r(!1),i(e.t(xr(p,e.strings))),t?.(p)})},"run")}}l(na,"Q");a(na,"useChoiceAction");function Ot(){let e=`sekyro-face-light-${(0,dt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,d.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("mask",{id:e,children:(0,d.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,d.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,d.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Ot,"O");a(Ot,"FaceMark");var aa={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function sa(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}}l(sa,"le");a(sa,"faceIntroRetryOf");var Cn={"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 ia({start:e,context:t,tips:n,tipsTitle:r,human:s=!1,returning:i=!1,notice:c,retry:p}){let w=at(),{t:h}=w,m=p??wn(t),R=(0,dt.useContext)(wr)?.busy===!0;if(m!==void 0&&c===void 0&&t.captureMode!=="assisted")return(0,d.jsx)(Sn,{retry:m,start:e,context:t,disabled:R});let x=m===void 0?"face":ze(m.reason,m.retakeHint),U=x==="face"?null:Te[x].tips;return(0,d.jsxs)("section",{className:"sekyro-step",children:[(0,d.jsx)(Ot,{}),t.captureMode==="assisted"?(0,d.jsx)(De,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,d.jsx)(De,{title:h("returning.heading"),lead:h("returning.description")}):(0,d.jsx)(De,{title:h(s?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(s?"native.face.humanIntroLead":"native.face.introLead")}),m!==void 0?(0,d.jsx)(_n,{retry:m,title:Te[x].title}):null,r!==void 0&&U===null?(0,d.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:U!==null?U.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:Cn[M]??"face"}),h(M)]},M)):n!==void 0?n.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:aa[M.id]??"face"}),M.text]},M.id)):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"light"}),h("capture.tips.light")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,d.jsx)(J,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,c!==void 0?null:(0,d.jsx)(_t,{children:(0,d.jsxs)(J,{full:!0,disabled:t.assets!=="ready"||R,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,d.jsx)(me,{name:"camera"}),h("capture.start")]})})]})}l(ia,"ue");a(ia,"FaceIntro");var la=new Set(["match_inconclusive","no_face_source","below_threshold"]);function Pt(e){return e==="probe_not_from_liveness"?"capture.retrySamePerson.message":e==="faces_differ"?"reasons.faces_differ":la.has(e)?"capture.retryMatch.message":nt(e)}l(Pt,"F");a(Pt,"retryReasonKey");function _n({retry:e,title:t}){let n=at(),r=e.retakeHint===void 0?null:$e(e.retakeHint),s=Pt(e.reason);return(0,d.jsxs)(wt,{tone:"warning",children:[r!==null?(0,d.jsx)("span",{children:n.t(r)}):s!==null?(0,d.jsx)("span",{children:n.t(s)}):null,r===null?(0,d.jsx)("span",{children:n.t(t)}):null,(0,d.jsx)("span",{children:St(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(_n,"U");a(_n,"RetryNotice");function wn(e){let t=e.retry;if(t!==void 0)return{reason:t.reason,...t.retakeHint!==void 0?{retakeHint:t.retakeHint}:{},attemptsRemaining:t.attemptsRemaining??0,attemptsExhausted:t.attemptsRemaining===0}}l(wn,"G");a(wn,"faceIntroRetryOfContext");var bn=[{key:"capture.retryCoaching.light",icon:"light"},{key:"capture.retryCoaching.eyeLevel",icon:"smartphone"},{key:"capture.retryCoaching.head",icon:"face"}],oa={appearance:"hintTitles.appearance",motion:"hintTitles.motion",lighting:"hintTitles.lighting",framing:"hintTitles.framing"};function Sn({retry:e,start:t,context:n,disabled:r}){let s=at(),{t:i}=s,c=ze(e.reason,e.retakeHint),p=c==="face"?bn:Te[c].tips.map(x=>({key:x,icon:bn.find(U=>U.key===x)?.icon??Cn[x]??"face"})),w=e.retakeHint===void 0?null:$e(e.retakeHint),h=Pt(e.reason),m=w!==null?i(w):h!==null?i(h):void 0,R=i((e.retakeHint!==void 0?oa[e.retakeHint]:void 0)??"hintTitles.default");return(0,d.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-face-retry",children:[(0,d.jsx)(Ot,{}),(0,d.jsx)(De,{title:R}),m!==void 0?(0,d.jsx)(wt,{tone:"warning",children:(0,d.jsx)("span",{children:m})}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:p.slice(0,3).map(x=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:x.icon}),i(x.key)]},x.key))}),n.assets==="failed"?(0,d.jsx)(J,{kind:"secondary",full:!0,onClick:n.retryAssets,children:i("common.retry")}):null,(0,d.jsxs)(_t,{children:[(0,d.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:St(s,e.attemptsRemaining,e.attemptsExhausted)}),(0,d.jsxs)(J,{full:!0,disabled:n.assets!=="ready"||r||e.attemptsExhausted,"aria-busy":n.assets==="loading"||void 0,onClick:t,children:[(0,d.jsx)(me,{name:"camera"}),i("capture.recordAgain")]})]})]})}l(Sn,"q");a(Sn,"FaceRetry");function ua(e){return ca(e)}l(ua,"ye");a(ua,"isInAppBrowser");function da(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 s=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${s};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(da,"ge");a(da,"androidBrowserIntent");export{Pr as a,jt as b,Fn as c,an as d,ta as e,Aa as f,ra as g,na as h,sa as i,ia as j,ua as k,da as l};
@@ -1 +1 @@
1
- import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-BA2AJKJM.js";import{a as o,c as b,i}from"./chunk-SSU37LFQ.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
1
+ import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-ENB7AFED.js";import{a as o,c as b,i}from"./chunk-SSU37LFQ.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};