@sekyro/elements 0.1.0-rc.27 → 0.1.0-rc.29

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 (96) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +3 -3
  3. package/dist/cdn/chunks/{capture-session-doc-BT2W22H5-TWRWJRRR.js → capture-session-doc-HGA7NCJI-PAHR5UED.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-TV7CW7VL.js → chunk-2CQQAB3Y.js} +1 -1
  5. package/dist/cdn/chunks/{chunk-F4Q2Q4OC.js → chunk-37BKUH3E.js} +1 -1
  6. package/dist/cdn/chunks/chunk-45BISCD7.js +1 -0
  7. package/dist/cdn/chunks/{chunk-IWZRAEUN.js → chunk-5Y7NCFTK.js} +1 -1
  8. package/dist/cdn/chunks/{chunk-UYEEBLOW.js → chunk-62ISTF5A.js} +1 -1
  9. package/dist/cdn/chunks/chunk-6OAH57ZL.js +1 -0
  10. package/dist/cdn/chunks/{chunk-ATYTAIFS.js → chunk-ACJWBI6P.js} +1 -1
  11. package/dist/cdn/chunks/{chunk-LKG2GOWP.js → chunk-F4XXN364.js} +1 -1
  12. package/dist/cdn/chunks/{chunk-EHVBCFRB.js → chunk-FYHEA2LI.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-JPREVWIF.js → chunk-I7ZZMP7U.js} +1 -1
  14. package/dist/cdn/chunks/{chunk-66K4ELX6.js → chunk-IVTMNMUT.js} +1 -1
  15. package/dist/cdn/chunks/chunk-LAEGXG2I.js +3 -0
  16. package/dist/cdn/chunks/{chunk-5H2LBGA7.js → chunk-LPLPMWHJ.js} +1 -1
  17. package/dist/cdn/chunks/chunk-LVIQDNPD.js +1 -0
  18. package/dist/cdn/chunks/chunk-M36CK35T.js +1 -0
  19. package/dist/cdn/chunks/{chunk-2SXFB7OS.js → chunk-OC5UPJL5.js} +1 -1
  20. package/dist/cdn/chunks/{chunk-ZYXKVMFC.js → chunk-OP6NSXRA.js} +1 -1
  21. package/dist/cdn/chunks/{chunk-N6TFSAF3.js → chunk-RPS5MI2Z.js} +1 -1
  22. package/dist/cdn/chunks/chunk-RY47T7P4.js +33 -0
  23. package/dist/cdn/chunks/{chunk-2PCS4H3E.js → chunk-S3DETOVP.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-DM2IEIG4.js → chunk-TX7C4L3S.js} +1 -1
  25. package/dist/cdn/chunks/{chunk-2IYNWMYV.js → chunk-V2MJE7IH.js} +1 -1
  26. package/dist/cdn/chunks/chunk-XKZZC74I.js +1 -0
  27. package/dist/cdn/chunks/{chunk-2RVF3WJ3.js → chunk-ZQRIQWIK.js} +1 -1
  28. package/dist/cdn/chunks/{create-document-capture-R3H5TJD5-FZDYMF5Q.js → create-document-capture-HHRMCAWL-7OHYRTAN.js} +1 -1
  29. package/dist/cdn/chunks/{detector-scanic-P2RTEQUV-A5WTP2Q7.js → detector-scanic-3VQFGZAA-NF7AFUUP.js} +1 -1
  30. package/dist/cdn/chunks/document-capture-view-CFKS7K5J-YDK5DUQJ.js +1 -0
  31. package/dist/cdn/chunks/{eid-view-5M34JRB3-JW2ZYCJG.js → eid-view-3G2EEGBI-C54IOJRT.js} +1 -1
  32. package/dist/cdn/chunks/{email-otp-view-ULR3QWIN-SSLNYDY6.js → email-otp-view-PNB5UXJZ-FK3XWFBY.js} +1 -1
  33. package/dist/cdn/chunks/flow-views-6TVHTMMX-6QNRGOHC.js +1 -0
  34. package/dist/cdn/chunks/{form-view-426ISA4K-AKPX7G27.js → form-view-4HIBPKH7-QFAEVYU7.js} +1 -1
  35. package/dist/cdn/chunks/overlay-de-SHNL7LAI-G24N6OC4.js +1 -0
  36. package/dist/cdn/chunks/overlay-es-A6FGTLAH-EVEFVZOC.js +1 -0
  37. package/dist/cdn/chunks/overlay-pt-LTTU3QMC-AKB6BK52.js +1 -0
  38. package/dist/cdn/chunks/plan-runner-AUM4X5WF-XQRCBU72.js +1 -0
  39. package/dist/cdn/chunks/{portrait-capture-view-6K6W3USJ-MT7SJLT2.js → portrait-capture-view-VGMA3DDR-TSACU3HP.js} +1 -1
  40. package/dist/cdn/chunks/{portrait-review-view-PZQZZCYH-NEHNS5VW.js → portrait-review-view-UGBWX5MS-SJLTTTW5.js} +1 -1
  41. package/dist/cdn/chunks/{proof-of-address-view-MX5Q2XV2-S4FLPL4A.js → proof-of-address-view-JOIFXMMC-3KTUEBGM.js} +1 -1
  42. package/dist/cdn/define.js +1 -1
  43. package/dist/cdn/index.js +1 -1
  44. package/dist/{chunk-GQIZ42ZI.js → chunk-2X65ALSL.js} +1 -1
  45. package/dist/{chunk-CCJXGVIL.js → chunk-36B6FF7N.js} +1 -1
  46. package/dist/{chunk-R57PCZSZ.js → chunk-3MS3OEXH.js} +1 -1
  47. package/dist/chunk-4VZPYERM.js +33 -0
  48. package/dist/{chunk-FXWTWHNX.js → chunk-DBP7O23Y.js} +1 -1
  49. package/dist/{chunk-JRZE2IZT.js → chunk-FCWRFBJ5.js} +1 -1
  50. package/dist/{chunk-Z5TRMVOP.js → chunk-I2W7JAV3.js} +1 -1
  51. package/dist/{chunk-PNC5GJ4N.js → chunk-K2RX6MKD.js} +1 -1
  52. package/dist/{chunk-JPVADGVQ.js → chunk-ONLUBR6R.js} +1 -1
  53. package/dist/chunk-RKDMXMMR.js +1 -0
  54. package/dist/{chunk-XDH4CTRQ.js → chunk-VMIPS4GV.js} +1 -1
  55. package/dist/{chunk-YQXEEIWM.js → chunk-XL5ZL55K.js} +1 -1
  56. package/dist/{chunk-C6FGUALJ.js → chunk-YOH3GSLC.js} +1 -1
  57. package/dist/{chunk-G3M7C3QG.js → chunk-ZX3DKTKJ.js} +1 -1
  58. package/dist/define.cjs +5 -5
  59. package/dist/define.js +1 -1
  60. package/dist/document-capture-view-CFKS7K5J-SAJ6PQWE.js +1 -0
  61. package/dist/{eid-view-5M34JRB3-QXLAE3HM.js → eid-view-3G2EEGBI-LZVUJU6I.js} +1 -1
  62. package/dist/{email-otp-view-ULR3QWIN-UCGDMZIL.js → email-otp-view-PNB5UXJZ-QTVVXYTH.js} +1 -1
  63. package/dist/flow-views-6TVHTMMX-KNUYB6W7.js +1 -0
  64. package/dist/{form-view-426ISA4K-CTBMZ6MO.js → form-view-4HIBPKH7-2HUEAOFF.js} +1 -1
  65. package/dist/index.cjs +5 -5
  66. package/dist/index.d.cts +21 -10
  67. package/dist/index.d.ts +21 -10
  68. package/dist/index.js +1 -1
  69. package/dist/overlay-de-SHNL7LAI-UGRIY37I.js +1 -0
  70. package/dist/overlay-es-A6FGTLAH-4TTQSKC5.js +1 -0
  71. package/dist/overlay-pt-LTTU3QMC-3TI32HHQ.js +1 -0
  72. package/dist/{portrait-capture-view-6K6W3USJ-IHLY62OK.js → portrait-capture-view-VGMA3DDR-LFQ6FAYZ.js} +1 -1
  73. package/dist/{portrait-review-view-PZQZZCYH-WJPV3V7H.js → portrait-review-view-UGBWX5MS-UPYQ75SA.js} +1 -1
  74. package/dist/{proof-of-address-view-MX5Q2XV2-NADFPD37.js → proof-of-address-view-JOIFXMMC-PQ4IIQV2.js} +1 -1
  75. package/package.json +2 -2
  76. package/sbom.cdx.json +4 -4
  77. package/dist/cdn/chunks/chunk-2RXQBUDC.js +0 -3
  78. package/dist/cdn/chunks/chunk-35AXFJCG.js +0 -1
  79. package/dist/cdn/chunks/chunk-B737CEIX.js +0 -1
  80. package/dist/cdn/chunks/chunk-FCQZZSGE.js +0 -1
  81. package/dist/cdn/chunks/chunk-IJKJJDVP.js +0 -1
  82. package/dist/cdn/chunks/chunk-URRHIQLF.js +0 -33
  83. package/dist/cdn/chunks/chunk-ZEUQQLSO.js +0 -1
  84. package/dist/cdn/chunks/document-capture-view-RR4DTGYF-DE3CFMWM.js +0 -1
  85. package/dist/cdn/chunks/flow-views-V3OXW6PI-COAN2VQJ.js +0 -1
  86. package/dist/cdn/chunks/overlay-de-OWNOVFUK-G2EPYZKC.js +0 -1
  87. package/dist/cdn/chunks/overlay-es-POP2QZLC-6H5GQA7F.js +0 -1
  88. package/dist/cdn/chunks/overlay-pt-IKCWBDLR-4R2H3Y7Q.js +0 -1
  89. package/dist/cdn/chunks/plan-runner-EY7VTTUP-RLLA2EQK.js +0 -1
  90. package/dist/chunk-KN3AOAYL.js +0 -33
  91. package/dist/chunk-RDCMAYQA.js +0 -1
  92. package/dist/document-capture-view-RR4DTGYF-5PXLLNJY.js +0 -1
  93. package/dist/flow-views-V3OXW6PI-BFMDN2IB.js +0 -1
  94. package/dist/overlay-de-OWNOVFUK-QY6M35JN.js +0 -1
  95. package/dist/overlay-es-POP2QZLC-325Q4JIU.js +0 -1
  96. package/dist/overlay-pt-IKCWBDLR-2YDKPIHK.js +0 -1
@@ -1 +1 @@
1
- import{g as X}from"./chunk-2RXQBUDC.js";import{a as z,b as ee}from"./chunk-5H2LBGA7.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
1
+ import{g as X}from"./chunk-LAEGXG2I.js";import{a as z,b as ee}from"./chunk-LPLPMWHJ.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
@@ -1 +1 @@
1
- import{a as Rr}from"./chunk-2RVF3WJ3.js";import{c as wt}from"./chunk-FCQZZSGE.js";import{b as br,d as Cr}from"./chunk-2IYNWMYV.js";import{b as Nr,c as _t}from"./chunk-EHVBCFRB.js";import{d as bt}from"./chunk-2RXQBUDC.js";import{a as gr,b as vr,c as kr,d as Me}from"./chunk-UYEEBLOW.js";import{F as wr,K as Sr,L as xr,a as K,b as de,c as te,m as hr,n as Je,p as fr,q as et,r as mr,s as yr,t as Ct,u as oe,v as Ee,w as tt,y as _r}from"./chunk-5H2LBGA7.js";import{c as cr,d as ur,e as dr,h as pr}from"./chunk-JPREVWIF.js";import{b as kt}from"./chunk-TV7CW7VL.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as ir}from"./chunk-6MYG4HWP.js";import{a as l,c as U}from"./chunk-4FHWXBOB.js";var Mr=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),$=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Xr=U(K(),1),X=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var Q=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),Mt=U(de(),1),v=U(de(),1);function ce({className:e,children:t}){return(0,y.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");s(ce,"Svg");var Et="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 Er(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.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(Er,"ln");s(Er,"SunIcon");function Lr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Lr,"un");s(Lr,"FaceUncoveredIcon");function Ir(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Ir,"dn");s(Ir,"PhoneEyeLevelIcon");function Ur(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.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,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Ur,"pn");s(Ur,"LookStraightIcon");function jr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(jr,"fn");s(jr,"CameraCheckIcon");function Tr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.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(Tr,"mn");s(Tr,"CameraAskIcon");function Or(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Or,"yn");s(Or,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Pr(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Pr,"gn");s(Pr,"CheckIcon");function Br(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Br,"hn");s(Br,"SpinnerIcon");var St=["light","uncover","eyeLevel","straight"],Un={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ur,{}),"icon")}};function qr({tips:e}){let t=Me(),n=(0,Mr.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Un[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(qr,"Cn");s(qr,"TipList");var jn=220;function Vr({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=Ct(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},jn))},"choose");return(0,$.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,$.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,$.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,$.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,$.jsx)(oe,{tone:"danger",children:(0,$.jsx)("span",{children:a})}):null,d==="buttons"?(0,$.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,J)=>(0,$.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,$.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,$.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:l(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,$.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,$.jsxs)("span",{className:"sekyro-card__body",children:[(0,$.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,$.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,$.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Vr,"bn");s(Vr,"ChoiceScreen");var Dr=["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 st(e){return e!==null&&Dr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Tn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Tn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(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 ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(ie,"re");s(ie,"synth");function Hr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Hr,"Lr");s(Hr,"speechAvailable");function xt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(xt,"Sn");s(xt,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=xt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>xt(a.lang)===r)}l(Lt,"Mn");s(Lt,"pickVoice");function $r(e){if(!Hr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}l($r,"wn");s($r,"speechUsable");function Fr(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"Ln");s(Fr,"subscribeVoices");function De(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(De,"Ke");s(De,"clipIdentity");function Nt(e){e.pause(),e.removeAttribute("src"),e.load()}l(Nt,"Rn");s(Nt,"release");function Gr(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Lt(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&J(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(On),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Nt(e),e=null;for(let h of p.values())Nt(h);p.clear()}}}l(Gr,"_n");s(Gr,"createVoicePlayer");var Bn="sekyro.voiceGuidance";function Kr(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(Kr,"xn");s(Kr,"readVoicePreference");function Zr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Zr,"En");s(Zr,"writeVoicePreference");var Ve="capture.tips.summary",qn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Vn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Dr){let o=a===Ve?null:je(e,a,t);o===null||n.has(De(o))||(n.add(De(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Bn:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Gr()),h.current),[]),_=Pn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Vn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);qn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||o===null)return;let L=Kr(o);L!==null&&(S.current=L,d(L))},[r,o]),(0,C.useEffect)(()=>{if(!(r||!u))return Fr(()=>J(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&$r(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),H=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&H()},[H]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){H();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,H,x,e,_,u,z]),W=(0,C.useCallback)(L=>{r||(L?T(!0):H(),o!==null&&Zr(o,L),S.current=L,d(L))},[r,T,H,o]),Y=(0,C.useCallback)(()=>W(!S.current),[W]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:W,toggle:Y,unlock:O,speakKey:ne,stop:H,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,W,Y,O,ne,H,N,R,he,ge])}l(zr,"vt");s(zr,"useVoiceGuidance");function Wr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(Wr,"Ct");s(Wr,"useSpeakGuidance");function lt(e,t){let n=Yr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(lt,"Pn");s(lt,"retryCoachingOf");function Yr(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(Yr,"Pr");s(Yr,"coachingOfReason");var He={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 Qr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(He[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:He[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Qr,"Tn");s(Qr,"CapturedPanel");function It(){try{return!1}catch{return!1}}l(It,"nt");s(It,"isDevBuild");var Dn=(0,Xr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(jr,{}):e==="denied"?(0,we.jsx)(Or,{}):(0,we.jsx)(Tr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Jr,"On");s(Jr,"PermissionRow");function en({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Pr,{className:"sekyro-switch__check"}):null})})]})}l(en,"Hn");s(en,"VoiceSwitch");function tn({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),A=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),rn(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Br,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,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:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,P.jsx)(qr,{tips:o}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(en,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(tn,"Fn");s(tn,"PreCaptureScreen");function rn(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(rn,"Hr");s(rn,"focusIsOurs");function nn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(nn,"Dn");s(nn,"useCameraStatus");function sn(e){return Ut(e,"mobileRequired")}l(sn,"qn");s(sn,"useMobileRequired");function an(e){return Ut(e,"returning").required}l(an,"jn");s(an,"useReturning");function Ut(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(Ut,"Yn");s(Ut,"useFlag");function ln(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(ln,"$n");s(ln,"useCaptureMode");function on(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(on,"zn");s(on,"useBusy");var Hn=s(()=>"idle","serverSnapshot");function Rt(e){return cr(e!==void 0?{assetBaseUrl:e}:{})}l(Rt,"Qn");s(Rt,"preload");function cn(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>dr(p,e),[e]),()=>ur(e),Hn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{Rt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{Rt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(cn,"Jn");s(cn,"useLivenessAssets");var Ar={progress:0,hint:null,faceDetected:!1};function un(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&It()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Ar),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,J]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),H=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[W,Y]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},F=r!==void 0?r.liveness(ue):pr(ue);o.current=F;let Ne=s(()=>T(F.facingMode??null),"readFacing");Ne();let $e=[F.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,Y(Math.max(0,he.current))),k(null),M(null),p(Ar),R(!1),N(!1),q(null),x(null),H.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),H.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),F.on("gate",b=>{let ke=H.current;H.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),F.on("frozen",({previewDataUrl:b})=>q(b)),F.on("profile",({animations:b})=>J(b==="reduced")),F.on("ramp",({colour:b})=>x(b)),F.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),F.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&_t(Le=>ke.call(r,Le),Nr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();o.current=null,F.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{o.current?.start()},[]),xe=(0,E.useCallback)(()=>{o.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ue=o.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let F=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return F&&T(ue.facingMode??null),F},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:W}}l(un,"er");s(un,"useLivenessHandle");var $n=new Set(["national_number"]);function At(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>$n.has(n));return t.length>0?{...e,options:t}:null}l(At,"tr");s(At,"pending");function dn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(At(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(At(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(dn,"nr");s(dn,"useMethodChoice");var Fn=["ar","fr","en"];function pn(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(pn,"io");s(pn,"isClipUrl");function hn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Fn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!pn(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(hn,"ao");s(hn,"toVoiceClipMap");function fn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?hn(t):null,[t]);return e===void 0?null:r}l(fn,"rr");s(fn,"useServerVoiceClips");function mn({voice:e}){let t=Me();return(0,Mt.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Mt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(mn,"sr");s(mn,"VoiceChip");var Gn=new Set(["abandoned","not_opened","cancelled","superseded"]),Kn=800,Zn="capture.lookAtColours";function yn(e){return e===void 0||e!==!1&&e.length===St.length&&St.every(t=>e.includes(t))}l(yn,"mo");s(yn,"isDefaultTips");function gn(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(gn,"yo");s(gn,"carriesActivation");function vn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(vn,"go");s(vn,"isNoticeObject");var zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function kn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(kn,"vo");s(kn,"isCapturing");function bn(e){return e==="captured"||e==="uploading"||e==="checking"}l(bn,"Co");s(bn,"isPostCapture");function Wn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:J,assetBaseUrl:h,className:x}){let _=vr(t),k=(0,m.useMemo)(()=>gr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(Dn),i=un({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:J}),T=cn(h,i.state==="idle"&&i.error===null),O=dn(e),z=O.choice!==null,H=sn(e),ge=an(e),he=on(e),W=nn(),Y=ln(e),ne=Y.session==="choice",L=Y.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=fn(xe?e:void 0),V=zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ue=Y.settled,F=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),$e=(0,m.useRef)(V.unlock);$e.current=V.unlock,(0,m.useEffect)(()=>{let g=F.current;if(g===null)return;let le=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of le)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}gn(qe)&&(Ne.current=!0,_e(),$e.current())}l(Ae,"Re"),s(Ae,"onGesture");for(let qe of le)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,Tt=!z&&!H.required&&(o===!0||o==="when-permitted"&&W.permission==="granted"),Ot=Tt&&O.settled&&H.settled&&ue,wn=o==="when-permitted"&&!W.permissionSettled&&!Le.current,Pt=Tt&&Oe&&!Le.current,ut=(wn||Pt||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Ot||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Ot,Oe,T.gate,ke]);let Sn=Oe&&!z&&!H.required&&!(Pt&&T.gate==="ready"),[Bt,qt]=(0,m.useState)(!1),{canSwitchCaptureMode:Vt,setCaptureMode:Dt}=i;(0,m.useEffect)(()=>{if(!Y.settled||!ne){qt(!1);return}let g=!0;return Vt().then(le=>{g&&qt(le)}),()=>{g=!1}},[Y.settled,ne,Vt]);let{choose:Ht}=Y,Ie=L?"self":"assisted",xn=(0,m.useCallback)(async()=>{await Dt(Ie)&&Ht(Ie)},[Dt,Ht,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let Fe=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Ft=i.frozenPreview??Fe,Ue=e!==void 0,Z=kn(i.state),be=bn(i.state),Ge=Z||be,se=i.result,Gt=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Kt=Bt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{xn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Zt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",We=Z?i.gate.hint:null,Ye=i.state==="starting"?"capture.preparing.title":We===null?null:We==="center"&&!i.gate.faceDetected?"fcv3.no_face":hr(We),[Nn,zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(Ye!=="fcv3.no_face"){zt(Ye);return}if(!Z)return;let g=setTimeout(()=>zt(Ye),Kn);return()=>clearTimeout(g)},[Ye,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",Wt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Zn:Nn:null,ht=pt?N:Re===null?"":u(Re);Wr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Qt=ft!==void 0,Xt=j===void 0,Jt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Qt||!Xt||Jt.current||!It()||(Jt.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."))},[Qt,Xt]);let Rn=ft!==void 0?(g,le,_e)=>ft(g,le,_e,Be):V.supported?()=>(0,v.jsx)(mn,{voice:Be}):void 0,{summary:mt,summaryPlaying:er,toggleSummary:tr,stopSummary:rr}=V,Qe=w!==void 0&&w!=="",nr=Qe?w:u("capture.tips.summary"),sr=Qe?mt!=="none":mt==="partner"||mt==="default"&&yn(p),An=(0,m.useMemo)(()=>sr?{playing:er,toggle:s(()=>tr(nr,{clip:!Qe}),"toggle"),stop:rr}:void 0,[sr,er,tr,nr,rr,Qe]),Mn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:W.permission,permissionSettled:W.permissionSettled,captureMode:Y.mode,facing:ee,voice:Be}),[ut,T.retry,W.permission,W.permissionSettled,Y.mode,ee,Be]),En=vn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Gt&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Gt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,le)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=mr(t,le);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let le=g.retakeHint===void 0?null:Je(g.retakeHint);return le===null?yt(g.reasonCode):u(le)},"retryText"),ar=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Gn.has(Ce.reason)?u("errors.session_expired"):null),Ln=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,lr=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||zn.has(Xe)||_t(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,lr)})},[G,Xe,lr,e]);let or=Ct(),In=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(kr,{value:u,children:(0,v.jsxs)("div",{ref:F,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&&gt(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,H.required&&Oe?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(fr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Ln?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,ar!==null&&Ce!==null?(0,v.jsx)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:ar})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):Wt),settled:Pe&&Ue,progress:i.gate.progress,phase:Zt,still:Pe?Ft:null,live:Ge,modeSwitch:Kt,...Bt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(br,{videoRef:I,guidanceText:ht,guidanceHint:We,guidanceKey:Re,progress:i.gate.progress,phase:Zt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:Wt,voicePrompt:Rn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(Cr,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Kt})}),In&&O.choice!==null?(0,v.jsx)(Vr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,Sn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,En,a?.intro!==void 0?a.intro(b,Mn):(0,v.jsx)(tn,{assets:ut,onRetryAssets:T.retry,permission:W.permission,captureMode:Y.mode,voice:Be,tips:p??St,summary:An,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Qr,{showCoaching:ae!==null,coaching:lt(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?yr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Wn,"Ei");s(Wn,"LivenessCapture");var jt=U(K(),1),ct=U(K(),1),f=U(de(),1);var Ss={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Yn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return bt(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return bt(e,t.locale)??t.t("method.nationalEid");default:return null}}l(Yn,"D");s(Yn,"identityLabel");function Qn(e,t){let[n,r]=(0,jt.useState)(!1),[a,o]=(0,jt.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(Rr(d,e.strings))),t?.(d)})},"run")}}l(Qn,"W");s(Qn,"useChoiceAction");function Cn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Cn,"B");s(Cn,"FaceMark");var Xn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(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(Jn,"re");s(Jn,"faceIntroRetryOf");var es={"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 ts({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=wt(),{t:p}=S,w=d===void 0?"face":lt(d.reason,d.retakeHint),N=w==="face"?null:He[w].tips,j=(0,ct.useContext)(wr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(Cn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(_n,{retry:d,title:He[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:es[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Xn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(_r,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}l(ts,"ae");s(ts,"FaceIntro");var rs=new Set(["match_inconclusive","no_face_source","below_threshold"]);function _n({retry:e,title:t}){let n=wt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":rs.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(Sr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:xr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(_n,"M");s(_n,"RetryNotice");function ns(e){return kt(e)}l(ns,"ce");s(ns,"isInAppBrowser");function ss(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(ss,"pe");s(ss,"androidBrowserIntent");export{Vr as a,It as b,Dn as c,ln as d,Wn as e,Ss as f,Yn as g,Qn as h,Jn as i,ts as j,ns as k,ss as l};
1
+ import{a as Rr}from"./chunk-ZQRIQWIK.js";import{c as wt}from"./chunk-M36CK35T.js";import{b as br,d as Cr}from"./chunk-V2MJE7IH.js";import{b as Nr,c as _t}from"./chunk-FYHEA2LI.js";import{d as bt}from"./chunk-LAEGXG2I.js";import{a as gr,b as vr,c as kr,d as Me}from"./chunk-62ISTF5A.js";import{F as wr,K as Sr,L as xr,a as K,b as de,c as te,m as hr,n as Je,p as fr,q as et,r as mr,s as yr,t as Ct,u as oe,v as Ee,w as tt,y as _r}from"./chunk-LPLPMWHJ.js";import{c as cr,d as ur,e as dr,h as pr}from"./chunk-I7ZZMP7U.js";import{b as kt}from"./chunk-2CQQAB3Y.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as ir}from"./chunk-6MYG4HWP.js";import{a as l,c as U}from"./chunk-4FHWXBOB.js";var Mr=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),$=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Xr=U(K(),1),X=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var Q=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),Mt=U(de(),1),v=U(de(),1);function ce({className:e,children:t}){return(0,y.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");s(ce,"Svg");var Et="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 Er(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.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(Er,"ln");s(Er,"SunIcon");function Lr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Lr,"un");s(Lr,"FaceUncoveredIcon");function Ir(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Ir,"dn");s(Ir,"PhoneEyeLevelIcon");function Ur(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.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,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Ur,"pn");s(Ur,"LookStraightIcon");function jr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(jr,"fn");s(jr,"CameraCheckIcon");function Tr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.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(Tr,"mn");s(Tr,"CameraAskIcon");function Or(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Et}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Or,"yn");s(Or,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Pr(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Pr,"gn");s(Pr,"CheckIcon");function Br(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Br,"hn");s(Br,"SpinnerIcon");var St=["light","uncover","eyeLevel","straight"],Un={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ur,{}),"icon")}};function qr({tips:e}){let t=Me(),n=(0,Mr.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Un[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(qr,"Cn");s(qr,"TipList");var jn=220;function Vr({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=Ct(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},jn))},"choose");return(0,$.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,$.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,$.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,$.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,$.jsx)(oe,{tone:"danger",children:(0,$.jsx)("span",{children:a})}):null,d==="buttons"?(0,$.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,J)=>(0,$.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,$.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,$.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:l(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,$.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,$.jsxs)("span",{className:"sekyro-card__body",children:[(0,$.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,$.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,$.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Vr,"bn");s(Vr,"ChoiceScreen");var Dr=["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 st(e){return e!==null&&Dr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Tn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Tn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(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 ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(ie,"re");s(ie,"synth");function Hr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Hr,"Lr");s(Hr,"speechAvailable");function xt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(xt,"Sn");s(xt,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=xt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>xt(a.lang)===r)}l(Lt,"Mn");s(Lt,"pickVoice");function $r(e){if(!Hr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}l($r,"wn");s($r,"speechUsable");function Fr(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"Ln");s(Fr,"subscribeVoices");function De(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(De,"Ke");s(De,"clipIdentity");function Nt(e){e.pause(),e.removeAttribute("src"),e.load()}l(Nt,"Rn");s(Nt,"release");function Gr(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Lt(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&J(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(On),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Nt(e),e=null;for(let h of p.values())Nt(h);p.clear()}}}l(Gr,"_n");s(Gr,"createVoicePlayer");var Bn="sekyro.voiceGuidance";function Kr(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(Kr,"xn");s(Kr,"readVoicePreference");function Zr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Zr,"En");s(Zr,"writeVoicePreference");var Ve="capture.tips.summary",qn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Vn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Dr){let o=a===Ve?null:je(e,a,t);o===null||n.has(De(o))||(n.add(De(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Bn:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Gr()),h.current),[]),_=Pn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Vn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);qn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||o===null)return;let L=Kr(o);L!==null&&(S.current=L,d(L))},[r,o]),(0,C.useEffect)(()=>{if(!(r||!u))return Fr(()=>J(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&$r(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),H=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&H()},[H]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){H();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,H,x,e,_,u,z]),W=(0,C.useCallback)(L=>{r||(L?T(!0):H(),o!==null&&Zr(o,L),S.current=L,d(L))},[r,T,H,o]),Y=(0,C.useCallback)(()=>W(!S.current),[W]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:W,toggle:Y,unlock:O,speakKey:ne,stop:H,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,W,Y,O,ne,H,N,R,he,ge])}l(zr,"vt");s(zr,"useVoiceGuidance");function Wr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(Wr,"Ct");s(Wr,"useSpeakGuidance");function lt(e,t){let n=Yr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(lt,"Pn");s(lt,"retryCoachingOf");function Yr(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(Yr,"Pr");s(Yr,"coachingOfReason");var He={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 Qr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(He[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:He[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Qr,"Tn");s(Qr,"CapturedPanel");function It(){try{return!1}catch{return!1}}l(It,"nt");s(It,"isDevBuild");var Dn=(0,Xr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(jr,{}):e==="denied"?(0,we.jsx)(Or,{}):(0,we.jsx)(Tr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Jr,"On");s(Jr,"PermissionRow");function en({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Pr,{className:"sekyro-switch__check"}):null})})]})}l(en,"Hn");s(en,"VoiceSwitch");function tn({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),A=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),rn(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Br,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,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:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,P.jsx)(qr,{tips:o}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(en,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(tn,"Fn");s(tn,"PreCaptureScreen");function rn(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(rn,"Hr");s(rn,"focusIsOurs");function nn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>ir(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(nn,"Dn");s(nn,"useCameraStatus");function sn(e){return Ut(e,"mobileRequired")}l(sn,"qn");s(sn,"useMobileRequired");function an(e){return Ut(e,"returning").required}l(an,"jn");s(an,"useReturning");function Ut(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(Ut,"Yn");s(Ut,"useFlag");function ln(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(ln,"$n");s(ln,"useCaptureMode");function on(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(on,"zn");s(on,"useBusy");var Hn=s(()=>"idle","serverSnapshot");function Rt(e){return cr(e!==void 0?{assetBaseUrl:e}:{})}l(Rt,"Qn");s(Rt,"preload");function cn(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>dr(p,e),[e]),()=>ur(e),Hn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{Rt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{Rt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(cn,"Jn");s(cn,"useLivenessAssets");var Ar={progress:0,hint:null,faceDetected:!1};function un(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&It()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Ar),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,J]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),H=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[W,Y]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},F=r!==void 0?r.liveness(ue):pr(ue);o.current=F;let Ne=s(()=>T(F.facingMode??null),"readFacing");Ne();let $e=[F.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,Y(Math.max(0,he.current))),k(null),M(null),p(Ar),R(!1),N(!1),q(null),x(null),H.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),H.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),F.on("gate",b=>{let ke=H.current;H.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),F.on("frozen",({previewDataUrl:b})=>q(b)),F.on("profile",({animations:b})=>J(b==="reduced")),F.on("ramp",({colour:b})=>x(b)),F.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),F.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&_t(Le=>ke.call(r,Le),Nr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();o.current=null,F.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{o.current?.start()},[]),xe=(0,E.useCallback)(()=>{o.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ue=o.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let F=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return F&&T(ue.facingMode??null),F},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:W}}l(un,"er");s(un,"useLivenessHandle");var $n=new Set(["national_number"]);function At(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>$n.has(n));return t.length>0?{...e,options:t}:null}l(At,"tr");s(At,"pending");function dn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(At(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(At(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(dn,"nr");s(dn,"useMethodChoice");var Fn=["ar","fr","en"];function pn(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(pn,"io");s(pn,"isClipUrl");function hn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Fn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!pn(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(hn,"ao");s(hn,"toVoiceClipMap");function fn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?hn(t):null,[t]);return e===void 0?null:r}l(fn,"rr");s(fn,"useServerVoiceClips");function mn({voice:e}){let t=Me();return(0,Mt.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Mt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(mn,"sr");s(mn,"VoiceChip");var Gn=new Set(["abandoned","not_opened","cancelled","superseded"]),Kn=800,Zn="capture.lookAtColours";function yn(e){return e===void 0||e!==!1&&e.length===St.length&&St.every(t=>e.includes(t))}l(yn,"mo");s(yn,"isDefaultTips");function gn(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(gn,"yo");s(gn,"carriesActivation");function vn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(vn,"go");s(vn,"isNoticeObject");var zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function kn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(kn,"vo");s(kn,"isCapturing");function bn(e){return e==="captured"||e==="uploading"||e==="checking"}l(bn,"Co");s(bn,"isPostCapture");function Wn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:J,assetBaseUrl:h,className:x}){let _=vr(t),k=(0,m.useMemo)(()=>gr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(Dn),i=un({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:J}),T=cn(h,i.state==="idle"&&i.error===null),O=dn(e),z=O.choice!==null,H=sn(e),ge=an(e),he=on(e),W=nn(),Y=ln(e),ne=Y.session==="choice",L=Y.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=fn(xe?e:void 0),V=zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ue=Y.settled,F=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),$e=(0,m.useRef)(V.unlock);$e.current=V.unlock,(0,m.useEffect)(()=>{let g=F.current;if(g===null)return;let le=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of le)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}gn(qe)&&(Ne.current=!0,_e(),$e.current())}l(Ae,"Re"),s(Ae,"onGesture");for(let qe of le)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,Tt=!z&&!H.required&&(o===!0||o==="when-permitted"&&W.permission==="granted"),Ot=Tt&&O.settled&&H.settled&&ue,wn=o==="when-permitted"&&!W.permissionSettled&&!Le.current,Pt=Tt&&Oe&&!Le.current,ut=(wn||Pt||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Ot||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Ot,Oe,T.gate,ke]);let Sn=Oe&&!z&&!H.required&&!(Pt&&T.gate==="ready"),[Bt,qt]=(0,m.useState)(!1),{canSwitchCaptureMode:Vt,setCaptureMode:Dt}=i;(0,m.useEffect)(()=>{if(!Y.settled||!ne){qt(!1);return}let g=!0;return Vt().then(le=>{g&&qt(le)}),()=>{g=!1}},[Y.settled,ne,Vt]);let{choose:Ht}=Y,Ie=L?"self":"assisted",xn=(0,m.useCallback)(async()=>{await Dt(Ie)&&Ht(Ie)},[Dt,Ht,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let Fe=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Ft=i.frozenPreview??Fe,Ue=e!==void 0,Z=kn(i.state),be=bn(i.state),Ge=Z||be,se=i.result,Gt=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Kt=Bt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{xn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Zt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",We=Z?i.gate.hint:null,Ye=i.state==="starting"?"capture.preparing.title":We===null?null:We==="center"&&!i.gate.faceDetected?"fcv3.no_face":hr(We),[Nn,zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(Ye!=="fcv3.no_face"){zt(Ye);return}if(!Z)return;let g=setTimeout(()=>zt(Ye),Kn);return()=>clearTimeout(g)},[Ye,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",Wt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Zn:Nn:null,ht=pt?N:Re===null?"":u(Re);Wr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Qt=ft!==void 0,Xt=j===void 0,Jt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Qt||!Xt||Jt.current||!It()||(Jt.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."))},[Qt,Xt]);let Rn=ft!==void 0?(g,le,_e)=>ft(g,le,_e,Be):V.supported?()=>(0,v.jsx)(mn,{voice:Be}):void 0,{summary:mt,summaryPlaying:er,toggleSummary:tr,stopSummary:rr}=V,Qe=w!==void 0&&w!=="",nr=Qe?w:u("capture.tips.summary"),sr=Qe?mt!=="none":mt==="partner"||mt==="default"&&yn(p),An=(0,m.useMemo)(()=>sr?{playing:er,toggle:s(()=>tr(nr,{clip:!Qe}),"toggle"),stop:rr}:void 0,[sr,er,tr,nr,rr,Qe]),Mn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:W.permission,permissionSettled:W.permissionSettled,captureMode:Y.mode,facing:ee,voice:Be}),[ut,T.retry,W.permission,W.permissionSettled,Y.mode,ee,Be]),En=vn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Gt&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Gt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,le)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=mr(t,le);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let le=g.retakeHint===void 0?null:Je(g.retakeHint);return le===null?yt(g.reasonCode):u(le)},"retryText"),ar=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Gn.has(Ce.reason)?u("errors.session_expired"):null),Ln=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,lr=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||zn.has(Xe)||_t(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,lr)})},[G,Xe,lr,e]);let or=Ct(),In=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(kr,{value:u,children:(0,v.jsxs)("div",{ref:F,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&&gt(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,H.required&&Oe?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(fr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Ln?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,ar!==null&&Ce!==null?(0,v.jsx)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:ar})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):Wt),settled:Pe&&Ue,progress:i.gate.progress,phase:Zt,still:Pe?Ft:null,live:Ge,modeSwitch:Kt,...Bt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(br,{videoRef:I,guidanceText:ht,guidanceHint:We,guidanceKey:Re,progress:i.gate.progress,phase:Zt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:Wt,voicePrompt:Rn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(Cr,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Kt})}),In&&O.choice!==null?(0,v.jsx)(Vr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,Sn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,En,a?.intro!==void 0?a.intro(b,Mn):(0,v.jsx)(tn,{assets:ut,onRetryAssets:T.retry,permission:W.permission,captureMode:Y.mode,voice:Be,tips:p??St,summary:An,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Qr,{showCoaching:ae!==null,coaching:lt(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?yr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Wn,"Ei");s(Wn,"LivenessCapture");var jt=U(K(),1),ct=U(K(),1),f=U(de(),1);var Ss={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Yn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return bt(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return bt(e,t.locale)??t.t("method.nationalEid");default:return null}}l(Yn,"D");s(Yn,"identityLabel");function Qn(e,t){let[n,r]=(0,jt.useState)(!1),[a,o]=(0,jt.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(Rr(d,e.strings))),t?.(d)})},"run")}}l(Qn,"W");s(Qn,"useChoiceAction");function Cn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Cn,"B");s(Cn,"FaceMark");var Xn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(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(Jn,"re");s(Jn,"faceIntroRetryOf");var es={"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 ts({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=wt(),{t:p}=S,w=d===void 0?"face":lt(d.reason,d.retakeHint),N=w==="face"?null:He[w].tips,j=(0,ct.useContext)(wr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(Cn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(_n,{retry:d,title:He[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:es[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Xn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(_r,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}l(ts,"ae");s(ts,"FaceIntro");var rs=new Set(["match_inconclusive","no_face_source","below_threshold"]);function _n({retry:e,title:t}){let n=wt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":rs.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(Sr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:xr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(_n,"M");s(_n,"RetryNotice");function ns(e){return kt(e)}l(ns,"ce");s(ns,"isInAppBrowser");function ss(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(ss,"pe");s(ss,"androidBrowserIntent");export{Vr as a,It as b,Dn as c,ln as d,Wn as e,Ss as f,Yn as g,Qn as h,Jn as i,ts as j,ns as k,ss as l};
@@ -1,4 +1,4 @@
1
- import{d as I}from"./chunk-UYEEBLOW.js";import{a as C,b as P,c as H}from"./chunk-5H2LBGA7.js";import{a as T}from"./chunk-JPREVWIF.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
1
+ import{d as I}from"./chunk-62ISTF5A.js";import{a as C,b as P,c as H}from"./chunk-LPLPMWHJ.js";import{a as T}from"./chunk-I7ZZMP7U.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
2
2
  /*! Bundled license information:
3
3
 
4
4
  react-dom/cjs/react-dom.production.js:
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-4FHWXBOB.js";var ct=Object.freeze({minLines:4,fillMin:.55,fillMax:.98,offsetMax:.12,steadyFillDelta:.04,steadyOffsetDelta:.03,layoutShiftMax:.025,lineCountDelta:1,lockMs:600,steadyMs:900,minFrames:3});function Kt(e,t){let i=e.lineBoxes;if(i.length===0)return{lineCount:0,detected:!1,fill:0,offsetX:0,offsetY:0,centers:[]};let r=Math.min(...i.map(s=>s[0])),a=Math.max(...i.map(s=>s[0]+s[2])),n=Math.min(...i.map(s=>s[1])),l=Math.max(...i.map(s=>s[1]+s[3]));return{lineCount:i.length,detected:i.length>=t.minLines,fill:a-r,offsetX:(r+a)/2-.5,offsetY:(n+l)/2-.5,centers:i.map(s=>[s[0]+s[2]/2,s[1]+s[3]/2])}}d(Kt,"M");function $t(e,t){if(e.centers.length===0||t.centers.length===0)return Number.POSITIVE_INFINITY;let i=0;for(let[r,a]of t.centers){let n=Number.POSITIVE_INFINITY;for(let[l,s]of e.centers)n=Math.min(n,Math.hypot(r-l,a-s));i+=n}return i/t.centers.length}d($t,"p");var D,Rt=(D=class{constructor(t=ct){this.t=t,this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}offer(t,i,r={glareOk:!0,sharpOk:!0}){let a=this.t,n=Kt(t,a),l=this.last;this.last=n;let s=n.fill>=a.fillMin&&n.fill<=a.fillMax,h=Math.abs(n.offsetX)<=a.offsetMax&&Math.abs(n.offsetY)<=a.offsetMax,o=l!==null&&l.detected&&Math.abs(n.lineCount-l.lineCount)<=a.lineCountDelta&&$t(l,n)<=a.layoutShiftMax,m=n.detected&&r.glareOk&&r.sharpOk&&s&&o&&l!==null&&Math.abs(n.fill-l.fill)<=a.steadyFillDelta&&Math.abs(n.offsetX-l.offsetX)<=a.steadyOffsetDelta&&Math.abs(n.offsetY-l.offsetY)<=a.steadyOffsetDelta,u=m&&h,f=n.detected?r.glareOk?n.fill<a.fillMin?"closer":n.fill>a.fillMax?"farther":h?r.sharpOk?void 0:"blurry":"center":"glare":void 0;return m?(this.frames++,this.steadySince??(this.steadySince=i),this.goodSince=u?this.goodSince??i:null,(this.goodSince!==null&&i-this.goodSince>=a.lockMs||i-this.steadySince>=a.steadyMs)&&this.frames>=a.minFrames?{state:"locked"}:{state:"locking",...f?{hint:f}:{}}):(this.goodSince=null,this.steadySince=null,this.frames=n.detected?1:0,{state:n.detected?"locking":"searching",...f?{hint:f}:{}})}reset(){this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}},d(D,"y"),D);function Se(e,t){if(!Number.isFinite(e)||e<0)return"low";if(e<=150)return"high";let i=typeof t!="number"||!Number.isFinite(t)||t>3;return e<=400&&i?"mid":"low"}d(Se,"L");var Nt=Object.freeze({low:Object.freeze({stride:1,bandWidthPx:960}),mid:Object.freeze({stride:2,bandWidthPx:1280}),high:Object.freeze({stride:1,bandWidthPx:1280})}),At=3e3;function we(e=globalThis){let t=e.navigator?.deviceMemory;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}d(we,"O");var te=[[1,0],[0,1],[1,1],[1,-1]];function ee(e){let{width:t,height:i,data:r}=e;if(t<16||i<16)return-1;let a=new Uint8Array(t*i);for(let l=0,s=0;l<a.length;l+=1,s+=4)a[l]=Math.round(.299*(r[s]??0)+.587*(r[s+1]??0)+.114*(r[s+2]??0));let n=-1;for(let[l,s]of te){let h=new Uint32Array(256),o=new Float64Array(256),m=0;for(let g=1;g<i-1;g+=1){let k=g*t,I=(g+s)*t,w=(g-s)*t;for(let z=1;z<t-1;z+=1){let v=a[I+z+l]??0,x=a[w+z-l]??0,c=Math.abs(v-x);h[c]=(h[c]??0)+1,o[c]=(o[c]??0)+Math.abs(v+x-2*(a[k+z]??0)),m+=1}}let u=Math.max(1,Math.floor(m/20)),f=0,M=0,S=0;for(let g=255;g>=0&&f<u;g-=1){let k=h[g]??0;f+=k,M+=k*g,S+=o[g]??0}if(M===0)return 0;let T=S/M;n=n<0?T:Math.min(n,T)}return n}d(ee,"Fe");var ie=.06;function Fe(e,t,i,r=ie){if(e===null||t.width<=0||t.height<=0)return null;let a=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],n=i.width/t.width,l=i.height/t.height,s=Math.min(...a.map(k=>k.x))*n,h=Math.max(...a.map(k=>k.x))*n,o=Math.min(...a.map(k=>k.y))*l,m=Math.max(...a.map(k=>k.y))*l,u=(h-s)*r,f=(m-o)*r,M=Math.max(0,Math.floor(s-u)),S=Math.max(0,Math.floor(o-f)),T=Math.min(i.width,Math.ceil(h+u)),g=Math.min(i.height,Math.ceil(m+f));return T-M<16||g-S<16?null:{x:M,y:S,width:T-M,height:g-S}}d(Fe,"yt");function Le(e,t){let i=t??{x:0,y:0,width:e.width,height:e.height},r=Math.min(1,1e3/Math.max(i.width,i.height)),a=Math.max(1,Math.round(i.width*r)),n=Math.max(1,Math.round(i.height*r)),l=document.createElement("canvas");l.width=a,l.height=n;try{let s=l.getContext("2d",{willReadFrequently:!0});return s===null?-1:(s.imageSmoothingQuality="high",s.drawImage(e,i.x,i.y,i.width,i.height,0,0,a,n),ee(s.getImageData(0,0,a,n)))}catch{return-1}finally{l.width=0,l.height=0}}d(Le,"Tt");function ae(e,t,i=!1,r=1,a=!1,n){let l=!1,s=d((f,M)=>f===null?!1:(l=!0,n!==void 0&&n(t,f,M)),"o");if(!i)return s(e(t),Mt)?"verso":l?"unsure":"recto";let h=r>0?Math.min(1,r):0,o=d(f=>f!==null&&f.y+f.height/2>=t.height/2&&f.width>=.8*h*t.width?f:null,"s"),m=.32*(h||1),u={LONE_EDGE_PX:Math.max(4,Math.round(t.width*le))};return s(o(e(t,u)),Mt)||s(o(e(t,{...u,MAX_HEIGHT_FRAC:m})),Mt)||a&&s(o(e(t,{...u,MAX_HEIGHT_FRAC:m,EDGE_LUMA_DELTA:Yt})),Yt)?"verso":l?"unsure":"recto"}d(ae,"tt");var Mt=40,le=.02,Yt=24,Wt=320;async function re(e,t=!1,i=1,r=!1,a){let{detectMrzBand:n,isMrzLayout:l}=await import("./mrz-band-IH54XO42-AE4D3F2E.js");return ae(a?.(n)??n,e,t,i,r,l)}d(re,"rt");var et=.06;async function Oe(e,t,i=480,r){return ne(e,i,...se(t,e),r)}d(Oe,"Lt");function se(e,t){let i=Math.max(0,e.x-e.width*et),r=Math.max(0,e.y-e.height*et),a=Math.min(t.width,e.x+e.width*(1+et)),n=Math.min(t.height,e.y+e.height*(1+et)),l={x:i,y:r,width:Math.max(1,a-i),height:Math.max(1,n-r)};return[l,!0,Math.min(1,e.width/l.width)]}d(se,"it");async function ne(e,t=480,i,r=i!=null,a=1,n){let l=i??{x:0,y:0,width:e.width,height:e.height},s=d(async m=>{let u=Math.max(1,Math.round(l.height/l.width*m)),f=document.createElement("canvas");f.width=m,f.height=u;try{let M=f.getContext("2d");return M===null?"recto":(M.drawImage(e,l.x,l.y,l.width,l.height,0,0,m,u),await re(M.getImageData(0,0,m,u),r,a,r,n))}finally{f.width=0,f.height=0}},"o"),h=await s(t);if(h==="verso"||!r||t<=Wt)return h;let o=await s(Wt);return o==="recto"?h:o}d(ne,"at");var mt=Object.freeze({brightness:0,glare:0,cardGlare:0,sharpness:0,fill:0,shape:0,content:0,offsetX:0,offsetY:0,edgeConfidence:0,box:null}),N=d(e=>Math.min(1,Math.max(0,e)),"D");function Ce(e,t,i,r=.06){let a=Math.max(e.width/i,e.height),n=a*i,l=(e.width-n)/2,s=(e.height-a)/2,h=N((t.x-t.width*r-l)/n),o=N((t.y-t.height*r-s)/a),m=N((t.x+t.width*(1+r)-l)/n),u=N((t.y+t.height*(1+r)-s)/a);return{x:h,y:o,width:m-h,height:u-o}}d(Ce,"Rt");function _e(e,t,i={}){let r=i.edgePeakFrac??0,{width:a,height:n,data:l}=e;if(a<=0||n<=0)return mt;let s=N(t.x),h=N(t.y),o={x:s,y:h,width:Math.max(0,N(t.x+t.width)-s),height:Math.max(0,N(t.y+t.height)-h)};if(o.width<=0||o.height<=0)return mt;let m=o.x*a,u=o.y*n,f=(o.x+o.width)*a,M=(o.y+o.height)*n,S=(f-m)*.15,T=(M-u)*.15,g=d((b,y,L)=>Math.min(L,Math.max(y,b)),"M"),k=g(Math.floor(m-S),0,a-1),I=g(Math.floor(u-T),0,n-1),w=g(Math.ceil(f+S),k+1,a),z=g(Math.ceil(M+T),I+1,n),v=Math.max(1,Math.ceil(Math.max(w-k,z-I)/320)),x=Math.floor((w-k+v-1)/v),c=Math.floor((z-I+v-1)/v);if(x<3||c<3)return mt;let p=new Int32Array(x*c);for(let b=0;b<c;b++){let y=I+b*v;for(let L=0;L<x;L++){let E=(y*a+k+L*v)*4;p[b*x+L]=(l[E]??0)*77+(l[E+1]??0)*150+(l[E+2]??0)*29>>8}}let F=d((b,y)=>(b-y-.5)/v,"w"),_=F(m,k),O=F(f,k),R=F(u,I),A=F(M,I),G=(f-m)/v,Y=(M-u)/v,W=g(Math.ceil(_),0,x-1),yt=g(Math.floor(O),W,x-1),lt=g(Math.ceil(R),0,c-1),kt=g(Math.floor(A),lt,c-1),vt=0,St=0,j=0,wt=0,zt=0,B=0;for(let b=lt;b<=kt;b++)for(let y=W;y<=yt;y++){let L=p[b*x+y];if(vt+=L,L>=248&&St++,j++,y>=1&&y<x-1&&b>=1&&b<c-1){let E=p[b*x+y-1]+p[b*x+y+1]+p[(b-1)*x+y]+p[(b+1)*x+y]-4*L;wt+=E,zt+=E*E,B++}}let Tt=j>0?vt/j:0,It=j>0?St/j:0,Ft=B>0?wt/B:0,Xt=B>0?Math.max(0,zt/B-Ft*Ft):0,rt=new Float64Array(x),st=new Float64Array(c);for(let b=0;b<c;b++)for(let y=1;y<x-1;y++)rt[y]=rt[y]+Math.abs(p[b*x+y+1]-p[b*x+y-1]);for(let b=1;b<c-1;b++)for(let y=0;y<x;y++)st[b]=st[b]+Math.abs(p[(b+1)*x+y]-p[(b-1)*x+y]);let P=Ht(rt,st,_,O,R,A,r),nt="luma",C=i.weakEdges,jt=gt(P,G,Y),Bt=(P.right.position-P.left.position)/G,Qt=P.confidence>=(i.edgeConfidenceMin??Number.POSITIVE_INFINITY)&&(C===void 0||C.shapeTolerance<=0||Math.abs(jt-1)<=C.shapeTolerance)&&(C?.fillMin===void 0||Bt>=C.fillMin);if(C!==void 0&&!Qt){let b=he(l,a,p,x,c,k,I,v,_,O,R,A,C.peakFrac??r,C.chromaWeight),y=b.confidence>=C.edgeMin?ue(p,x,c,b):null,L=gt(b,G,Y);y!==null&&y.inside>=C.contentMin&&y.outsideOverInside<=C.surroundPrintMax&&(C.shapeTolerance<=0||Math.abs(L-1)<=C.shapeTolerance)&&(P=b,nt="colour")}let{left:Q,right:U,top:Z,bottom:J,confidence:Lt}=P,Ut=(U.position-Q.position)/G,qt=gt(P,G,Y),Zt=((Q.position+U.position)/2-(_+O)/2)/G,Jt=((Z.position+J.position)/2-(R+A)/2)/Y,K=d((b,y)=>y+(b+.5)*v,"U"),Ot=It,Ct=0;{let b=(U.position-Q.position)*.06,y=(J.position-Z.position)*.06,L=g(Math.ceil(Q.position+b),0,x-1),E=g(Math.floor(U.position-b),0,x-1),tt=g(Math.ceil(Z.position+y),0,c-1),Gt=g(Math.floor(J.position-y),0,c-1),Pt=0,dt=0;for(let ft=tt;ft<=Gt;ft++)for(let ut=L;ut<=E;ut++)dt++,p[ft*x+ut]>=248&&Pt++;dt>=16&&(Ot=Pt/dt,Ct=pt(p,x,L,E,tt,Gt))}let ht=nt==="colour"||Lt>=(i.edgeConfidenceMin??Number.POSITIVE_INFINITY),ot=ht?de(p,x,c,P):bt(p,x,0,x-1,0,c-1),$=ht&&i.zones!==void 0&&i.zones.length>0?fe(p,x,c,P,i.zones,i.zonePatch??at.zoneGlarePatch):null,_t=0,Et=0,q=0;for(let b=0;b<c;b++)for(let y=0;y<x;y++){if(y>=W&&y<=yt&&b>=lt&&b<=kt)continue;let L=p[b*x+y];_t+=L,q++;let E=y+2<x?p[b*x+y+2]:L,tt=b+2<c?p[(b+2)*x+y]:L;(Math.abs(E-L)>=24||Math.abs(tt-L)>=24)&&Et++}return{brightness:Tt,glare:It,cardGlare:Ot,sharpness:Xt,fill:Ut,shape:qt,content:Ct,offsetX:Zt,offsetY:Jt,edgeConfidence:Lt,edges:nt,surround:q>0?_t/q:Tt,surroundPrint:q>0?Et/q:0,...ot!==null?{cardLuma:ot.mean,cardLumaHigh:ot.high,cardLight:ht?"card":"scene"}:{},...$!==null?{zoneGlare:$.share,...$.field!==void 0?{zoneGlareField:$.field}:{}}:{},box:{left:K(Q.position,k),right:K(U.position,k),top:K(Z.position,I),bottom:K(J.position,I)}}}d(_e,"It");function gt(e,t,i){let r=(e.right.position-e.left.position)/t,a=(e.bottom.position-e.top.position)/i;return a>0?r/a:0}d(gt,"he");function Ht(e,t,i,r,a,n,l){let s=it(e,!0,i,l),h=it(e,!1,r,l),o=it(t,!0,a,l),m=it(t,!1,n,l),u=Dt(e),f=Dt(t),M=u<=0||f<=0?0:Math.min(Math.min(s.value,h.value)/u,Math.min(o.value,m.value)/f);return{left:s,right:h,top:o,bottom:m,confidence:M}}d(Ht,"Be");function he(e,t,i,r,a,n,l,s,h,o,m,u,f,M){let S=new Int32Array(r*a),T=new Int32Array(r*a);for(let w=0;w<a;w++){let z=l+w*s;for(let v=0;v<r;v++){let x=(z*t+n+v*s)*4,c=i[w*r+v];S[w*r+v]=(e[x+2]??0)-c,T[w*r+v]=(e[x]??0)-c}}let g=M*M,k=new Float64Array(r);for(let w=1;w<r-1;w++){let z=0,v=0,x=0;for(let c=0;c<a;c++){let p=c*r+w+1,F=c*r+w-1;z+=i[p]-i[F],v+=S[p]-S[F],x+=T[p]-T[F]}k[w]=Math.sqrt(z*z+g*(v*v+x*x))}let I=new Float64Array(a);for(let w=1;w<a-1;w++){let z=0,v=0,x=0;for(let c=0;c<r;c++){let p=(w+1)*r+c,F=(w-1)*r+c;z+=i[p]-i[F],v+=S[p]-S[F],x+=T[p]-T[F]}I[w]=Math.sqrt(z*z+g*(v*v+x*x))}return Ht(k,I,h,o,m,u,f)}d(he,"ot");function bt(e,t,i,r,a,n){let l=new Uint32Array(256),s=0,h=0;for(let o=a;o<=n;o++)for(let m=i;m<=r;m++){let u=Math.min(255,Math.max(0,e[o*t+m]));l[u]=l[u]+1,h+=u,s++}return s>0?{mean:h/s,high:oe(l,s,.9)}:null}d(bt,"me");function oe(e,t,i){let r=i*(t-1),a=0;for(let n=0;n<256;n++)if(a+=e[n],a>r)return n;return 255}d(oe,"st");function de(e,t,i,r){let a=d((u,f,M)=>Math.min(M,Math.max(f,u)),"r"),n=(r.right.position-r.left.position)*.06,l=(r.bottom.position-r.top.position)*.06,s=a(Math.ceil(r.left.position+n),0,t-1),h=a(Math.floor(r.right.position-n),0,t-1),o=a(Math.ceil(r.top.position+l),0,i-1),m=a(Math.floor(r.bottom.position-l),0,i-1);return h>=s&&m>=o?bt(e,t,s,h,o,m):null}d(de,"lt");function fe(e,t,i,r,a,n){let l=d((c,p,F)=>Math.min(F,Math.max(p,c)),"a"),s=l(Math.ceil(r.left.position),0,t-1),h=l(Math.floor(r.right.position),0,t-1),o=l(Math.ceil(r.top.position),0,i-1),m=l(Math.floor(r.bottom.position),0,i-1),u=h-s+1,f=m-o+1;if(u<8||f<5)return null;let M=Math.max(1,Math.round(n*u)),S=u+1,T=d(c=>{let p=new Int32Array(S*(f+1));for(let F=0;F<f;F++){let _=0;for(let O=0;O<u;O++)_+=c(O,F),p[(F+1)*S+O+1]=p[F*S+O+1]+_}return p},"T"),g=d((c,p,F,_,O)=>c[(O+1)*S+_+1]-c[F*S+_+1]-c[(O+1)*S+p]+c[F*S+p],"M"),k=T((c,p)=>e[(o+p)*t+s+c]>=248?1:0),I=(2*M+1)*(2*M+1),w=T((c,p)=>c>=M&&p>=M&&c+M<u&&p+M<f&&g(k,c-M,p-M,c+M,p+M)===I?1:0),z=T((c,p)=>g(w,Math.max(0,c-M),Math.max(0,p-M),Math.min(u-1,c+M),Math.min(f-1,p+M))>0?1:0),v=0,x;for(let c of a){let[p,F,_,O]=c.box,R=l(Math.floor(p*u),0,u-1),A=l(Math.ceil(_*u)-1,R,u-1),G=l(Math.floor(F*f),0,f-1),Y=l(Math.ceil(O*f)-1,G,f-1),W=g(z,R,G,A,Y)/((A-R+1)*(Y-G+1));W>v&&(v=W,x=c.field)}return x!==void 0?{share:v,field:x}:{share:0}}d(fe,"ut");function Ee(e){let{width:t,height:i,data:r}=e;if(t<=0||i<=0)return null;let a=Math.max(1,Math.ceil(Math.max(t,i)/160)),n=Math.ceil(t/a),l=Math.ceil(i/a),s=new Int32Array(n*l);for(let h=0;h<l;h++)for(let o=0;o<n;o++){let m=(h*a*t+o*a)*4;s[h*n+o]=(r[m]??0)*77+(r[m+1]??0)*150+(r[m+2]??0)*29>>8}return bt(s,n,0,n-1,0,l-1)}d(Ee,"_t");function pt(e,t,i,r,a,n){let l=0,s=0;for(let h=a;h<=n;h++)for(let o=i;o<=r;o++){l++;let m=e[h*t+o],u=o+2<=r?e[h*t+o+2]:m,f=h+2<=n?e[(h+2)*t+o]:m;(Math.abs(u-m)>=24||Math.abs(f-m)>=24)&&s++}return l>0?s/l:0}d(pt,"de");function ue(e,t,i,r){let a=d((g,k,I)=>Math.min(I,Math.max(k,g)),"r"),n=r.left.position,l=r.right.position,s=r.top.position,h=r.bottom.position,o=(l-n)*.06,m=(h-s)*.06,u=pt(e,t,a(Math.ceil(n+o),0,t-1),a(Math.floor(l-o),0,t-1),a(Math.ceil(s+m),0,i-1),a(Math.floor(h-m),0,i-1));if(u<=0)return{inside:u,outsideOverInside:1};let f=[a(Math.ceil(s),0,i-1),a(Math.floor(h),0,i-1)],M=[a(Math.ceil(n),0,t-1),a(Math.floor(l),0,t-1)],S=[[0,Math.floor(n)-2,f[0],f[1]],[Math.ceil(l)+2,t-1,f[0],f[1]],[M[0],M[1],0,Math.floor(s)-2],[M[0],M[1],Math.ceil(h)+2,i-1]],T=0;for(let[g,k,I,w]of S){if(k-g<1||w-I<1)return{inside:u,outsideOverInside:1};T=Math.max(T,pt(e,t,g,k,I,w)/u)}return{inside:u,outsideOverInside:T}}d(ue,"ct");function it(e,t,i,r){let a=e.length,n=Math.max(1,Math.floor(a*.45)),l=t?1:Math.max(1,a-1-n),s=t?Math.min(a-2,n):a-2,h=l;for(let M=l;M<=s;M++)e[M]>e[h]&&(h=M);if(r>0&&r<1){let M=e[h]*r,S=h,T=Math.abs(h-i);for(let g=l;g<=s;g++){let k=e[g];if(k<M||k<(e[g-1]??0)||k<(e[g+1]??0))continue;let I=Math.abs(g-i);I<T&&(S=g,T=I)}h=S}let o=h>0?e[h-1]:0,m=e[h],u=h<a-1?e[h+1]:0,f=o+m+u;return{position:f>0?h+(u-o)/f:h,value:m}}d(it,"q");function Dt(e){if(e.length<3)return 0;let t=0;for(let i=1;i<e.length-1;i++)t+=e[i];return t/(e.length-2)}d(Dt,"Oe");function Ge(e){let t=e.box;return t===null||t.right-t.left<4||t.bottom-t.top<4?null:{topLeft:{x:t.left,y:t.top},topRight:{x:t.right,y:t.top},bottomRight:{x:t.right,y:t.bottom},bottomLeft:{x:t.left,y:t.bottom}}}d(Ge,"Et");function ce(e,t){return e==null?!1:t.darkCardLuma>0&&e.mean<t.darkCardLuma||t.darkCardHighLuma>0&&e.high<t.darkCardHighLuma}d(ce,"ht");function Me(e,t){return e!=null&&t.darkCardHighLuma>0&&e.high<t.darkCardHighLuma}d(Me,"dt");function Vt(e,t){return e.cardLuma===void 0||e.cardLumaHigh===void 0?!1:e.cardLight==="scene"?Me({mean:e.cardLuma,high:e.cardLumaHigh},t):ce({mean:e.cardLuma,high:e.cardLumaHigh},t)}d(Vt,"He");function Pe(e,t,i){return t||e.box===null||e.surround===void 0||Vt(e,i)?!1:e.content>=i.contentMin&&e.surround>=i.lightSurfaceLuma&&(e.surroundPrint??1)<=e.content*i.weakSurroundPrintMax}d(Pe,"At");var me=["weakEdgeMin","weakSurroundPrintMax","weakChromaWeight","lightSurfaceLuma","weakEdgesHintMs","darkCardLuma","darkCardHighLuma","zoneGlareMax","zoneGlareTorchMax","zoneGlarePatch"],at=Object.freeze({fillMin:.82,fillMax:1.06,offsetMax:.06,glareMax:.025,secondSideGlareMax:.05,secondSideSharpnessMin:120,sharpnessMin:180,edgeConfidenceMin:1.6,darkBrightness:70,lockMs:450,steadyMs:900,steadyFillMin:.45,steadyFillMax:1.3,steadyFillDelta:.06,steadyOffsetDelta:.04,steadyRefMs:100,edgePeakFrac:.4,shapeTolerance:.2,contentMin:.1,weakEdgeMin:2,weakSurroundPrintMax:.3,weakChromaWeight:3,lightSurfaceLuma:150,weakEdgesHintMs:2500,darkCardLuma:45,darkCardHighLuma:70,zoneGlareMax:.08,zoneGlareTorchMax:.04,zoneGlarePatch:.009});function Re(e,t){return{edgePeakFrac:e.edgePeakFrac,edgeConfidenceMin:e.edgeConfidenceMin,...t!==void 0&&t.length>0&&e.zoneGlareMax>0?{zones:t,zonePatch:e.zoneGlarePatch}:{},...e.weakEdgeMin>0?{weakEdges:{edgeMin:e.weakEdgeMin,surroundPrintMax:e.weakSurroundPrintMax,shapeTolerance:e.shapeTolerance,contentMin:e.contentMin,chromaWeight:e.weakChromaWeight,fillMin:e.fillMin}}:{}}}d(Re,"Ct");function Ne(e,t){let i=d(s=>s!==null&&typeof s=="object"?s:{},"n"),r=d(s=>typeof s=="number"&&Number.isFinite(s)&&s>=0&&s<=1e6,"i"),a=i(e),n=i(t),l={...at};for(let s of Object.keys(at)){let h=a[s];r(h)&&(l[s]=h)}for(let s of me){let h=n[s];r(h)&&(l[s]=h)}return l}d(Ne,"Gt");function Ae(e){return{...e,glareMax:Math.max(e.glareMax,e.secondSideGlareMax),sharpnessMin:Math.min(e.sharpnessMin,e.secondSideSharpnessMin)}}d(Ae,"Ft");var H,Ye=(H=class{constructor(t=at){this.t=t,this.goodSince=null,this.steadySince=null,this.last=null}setTuning(t){this.t=t,this.reset()}reset(){this.goodSince=null,this.steadySince=null,this.last=null}tick(t,i,r={}){let a=this.t,n=a.shapeTolerance<=0||Math.abs(t.shape-1)<=a.shapeTolerance,l=(t.edges==="colour"?a.weakEdgeMin>0&&t.edgeConfidence>=a.weakEdgeMin:t.edgeConfidence>=a.edgeConfidenceMin)&&n&&t.content>=a.contentMin,s=t.fill>=a.fillMin&&t.fill<=a.fillMax,h=Math.abs(t.offsetX)<=a.offsetMax&&Math.abs(t.offsetY)<=a.offsetMax,o=r.torch===!0?a.zoneGlareTorchMax:a.zoneGlareMax,m=a.zoneGlareMax>0&&l&&t.zoneGlare!==void 0&&t.zoneGlare>=o,u=m?t.zoneGlareField??"text":"none",f=t.cardGlare<=a.glareMax&&!m,M=t.sharpness>=a.sharpnessMin,S=this.last;this.last={fill:t.fill,offsetX:t.offsetX,offsetY:t.offsetY,at:i};let T=S!==null&&a.steadyRefMs>0?Math.min(3,Math.max(1,(i-S.at)/a.steadyRefMs)):1,g=l&&S!==null&&Math.abs(t.fill-S.fill)<=a.steadyFillDelta*T&&Math.abs(t.offsetX-S.offsetX)<=a.steadyOffsetDelta*T&&Math.abs(t.offsetY-S.offsetY)<=a.steadyOffsetDelta*T,k=Vt(t,a),I=g&&!k&&f&&M&&t.fill>=a.steadyFillMin&&t.fill<=a.steadyFillMax,w=l&&!k&&s&&h&&f&&M,z;if(l?f?k?z="dark":t.fill<a.fillMin?z="too_small":t.fill>a.fillMax?z="too_big":M?h?z="locking":z="off_center":z="blurry":z="glare":z=k?"dark":"no_card",w){if(I&&(this.steadySince??(this.steadySince=i)),this.goodSince??(this.goodSince=i),i-this.goodSince>=a.lockMs)return{detected:l,ready:!0,via:"good",blocker:"locking",still:g,glareZone:u};let v=this.steadySince!==null&&i-this.steadySince>=a.steadyMs;return{detected:l,ready:v,via:v?"steady":null,blocker:"locking",still:g,glareZone:u}}if(this.goodSince=null,I){this.steadySince??(this.steadySince=i);let v=i-this.steadySince>=a.steadyMs;return{detected:l,ready:v,via:v?"steady":null,blocker:v?"locking":"steadying",still:g,glareZone:u}}return this.steadySince=null,{detected:l,ready:!1,via:null,blocker:z,still:g,glareZone:u}}},d(H,"Ne"),H),V,ge=(V=class{constructor(t=2){this.stableReads=t,this.last=null,this.run=0}offer(t){return t===null?(this.reset(),!1):(this.run=t===this.last?this.run+1:1,this.last=t,this.run>=this.stableReads)}reset(){this.last=null,this.run=0}},d(V,"$"),V),xe=Object.freeze({...ct,minIntervalMs:150,maxWidthPx:480,detectorLimit:960,searchTimeoutMs:12e3}),pe=250,be=Object.freeze({detectorLimit:960,bandMaxWidthPx:1280,minBandWidthPx:900,bandTop:.55,minIntervalMs:150,stableReads:2,profileReads:5,maxReadMs:1200,searchTimeoutMs:12e3}),ye=d(()=>typeof document>"u"||document.visibilityState!=="hidden","gt"),ke=d((e,t,i)=>createImageBitmap(e,Math.round(t.x),Math.round(t.y),Math.max(1,Math.round(t.w)),Math.max(1,Math.round(t.h)),{resizeWidth:Math.max(1,Math.round(Math.min(t.w,i))),resizeQuality:"high"}),"pt"),xt=d((e,t)=>{if(e.length===0)return 0;let i=[...e].sort((r,a)=>r-a);return i[Math.min(i.length-1,Math.floor(i.length*t))]},"fe");function ve(e){return e<=250?"fast":e<=600?"mid":"slow"}d(ve,"xt");function We(e,t,i){let r=e.y+e.h*t,a=Math.min(i,e.y+e.h*1.05);return{x:e.x,y:r,w:e.w,h:Math.max(1,a-r)}}d(We,"Ht");var X,De=(X=class{constructor(t){this.o=t,this.engine=null,this.deviceTier=null,this.gen=0,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.hiddenSince=null,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.firstSeen=null,this.reads=0,this.times=[],this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.valid=null,this.faceMode="off",this.disabled=!1,this.expired=!1,this.absentSince=null,this.crop=t.crop??ke,this.visible=t.visible??ye,this.mrzGate=new ge(t.liveMrz?.stableReads??2),this.lockGate=new Rt(t.textLock??xe)}setEngine(t,i){this.engine=t,i!==void 0&&(this.deviceTier=i)}liveCadence(t){let i=this.deviceTier===null?null:Nt[this.deviceTier];return{stride:i?.stride??1,bandWidthPx:Math.min(t.bandMaxWidthPx,i?.bandWidthPx??t.bandMaxWidthPx)}}get bandTop(){return this.o.liveMrz?.bandTop??be.bandTop}get liveMrzOn(){return this.o.liveMrz!==null}get hasEngine(){return this.engine!==null&&!this.disabled}get tier(){return this.deviceTier}reset(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.hiddenSince=null,this.firstSeen=null,this.reads=0,this.times=[],this.mrzGate.reset(),this.lockGate.reset(),this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.absentSince=null,this.valid=null,this.faceMode="off",this.expired=!1}rearmFace(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.mrzGate.reset(),this.lockGate.reset(),this.fired=null,this.absentSince=null,this.valid=null,this.fallback===null&&(this.mrzState={state:"searching"}),this.lockOff||(this.lockState={state:"searching"})}liveCapture(){return this.fired?.via==="live_mrz"?this.valid:null}modeFor(t){return this.engine===null||this.disabled?"off":t.mrzFace&&this.o.liveMrz!==null&&this.fallback===null?"live_mrz":this.o.textLock!==null&&!this.lockOff?"text_lock":"off"}tick(t){let i=this.modeFor(t);return i!=="off"&&(this.faceMode=i),this.fired?.via==="live_mrz"&&(t.present?this.absentSince=null:(this.absentSince??(this.absentSince=t.atMs),t.atMs-this.absentSince>=pe&&(this.absentSince=null,this.rearmFace()))),this.fired!==null?{ready:!0,via:this.fired.via,suspendQuality:this.fired.via==="live_mrz",mode:i,...this.states()}:i!=="off"&&!this.visible()?(this.hiddenSince??(this.hiddenSince=t.atMs),this.mrzGate.reset(),{ready:!1,suspendQuality:i==="live_mrz"&&this.fallback===null,mode:i,...this.states()}):(this.hiddenSince!==null&&(this.firstSeen!==null&&(this.firstSeen+=t.atMs-this.hiddenSince),this.hiddenSince=null),i==="live_mrz"?this.liveTick(t,this.o.liveMrz):i==="text_lock"?this.lockTick(t,this.o.textLock):{ready:!1,suspendQuality:!1,mode:i,...this.states()})}states(){return{...this.faceMode==="live_mrz"||this.fallback!==null?{mrz:this.fallback!==null?{state:"fallback",reason:this.fallback}:this.mrzState}:{},...this.faceMode==="text_lock"?{lock:this.lockState}:{}}}canRead(t,i){let r=this.engine;return r!==null&&!this.inFlight&&!r.busy&&t-this.lastReadAt>=i}fall(t){this.fallback=t,this.mrzGate.reset()}liveTick(t,i){let r=d(()=>this.expired||this.firstSeen===null||t.atMs-this.firstSeen<At,"i"),a=d(()=>this.fallback!==null?{ready:!1,suspendQuality:!1,mode:"live_mrz",mrz:{state:"fallback",reason:this.fallback}}:{ready:!1,suspendQuality:r(),mode:"live_mrz",mrz:this.mrzState},"r");if(!t.present||t.band===null)return this.mrzGate.reset(),this.mrzState={state:"searching"},this.expired&&(this.expired=!1,this.firstSeen=null),a();if(this.firstSeen??(this.firstSeen=t.atMs),!this.expired&&t.atMs-this.firstSeen>i.searchTimeoutMs)return this.fall("timeout"),a();if(t.band.w<i.minBandWidthPx)return t.card!==null&&t.card.w<i.minBandWidthPx?(this.fall("unsupported"),a()):(this.expired||(this.mrzState={state:"reading",coach:t.portrait?"turnSideways":"moveCloser"}),{ready:!1,suspendQuality:this.expired,mode:"live_mrz",mrz:this.mrzState});let n=this.liveCadence(i);if(this.ticksSinceRead++,this.ticksSinceRead<n.stride||!this.canRead(t.atMs,i.minIntervalMs))return a();this.inFlight=!0,this.lastReadAt=t.atMs,this.ticksSinceRead=0;let l=this.gen,s=this.engine,h=t.glareOk?t.sharpOk?void 0:"holdStill":"glare";return this.crop(t.video,t.band,n.bandWidthPx).then(o=>this.o.expiredBefore!==void 0?s.bandRead(o,i.detectorLimit,this.o.expiredBefore):s.bandRead(o,i.detectorLimit)).then(o=>{if(l===this.gen){if(this.reads++,this.times.push(o.ms),this.times.length>8&&this.times.shift(),!this.expired&&this.reads>=i.profileReads&&xt(this.times,.5)>i.maxReadMs)return this.fall("slow");if(this.mrzGate.offer(o.valid?o.digest??null:null)&&o.format&&o.digest){if(o.expired===!0&&this.o.expiredBefore!==void 0){this.expired=!0,this.mrzState={state:"expired",format:o.format};return}this.expired=!1,this.valid={format:o.format,...o.documentCode!==void 0?{documentCode:o.documentCode}:{},digest:o.digest,lineCount:o.lineCount,framesToValid:this.reads,msToValid:Math.round(t.atMs-(this.firstSeen??t.atMs))},this.mrzState={state:"valid",format:o.format},this.fired={via:"live_mrz",at:t.atMs};return}this.expired||(this.mrzState={state:"reading",...h?{coach:h}:{},...o.format?{format:o.format}:{}})}}).catch(()=>{l===this.gen&&this.fall("error")}).finally(()=>{l===this.gen&&(this.inFlight=!1)}),a()}lockTick(t,i){let r=d(()=>({ready:!1,suspendQuality:!1,mode:"text_lock",lock:this.lockState,...this.fallback!==null?{mrz:{state:"fallback",reason:this.fallback}}:{}}),"i");if(!t.present||t.card===null)return this.lockGate.reset(),this.lockState={state:"searching"},r();if(this.firstSeen??(this.firstSeen=t.atMs),t.atMs-this.firstSeen>i.searchTimeoutMs)return this.lockOff=!0,r();if(!this.canRead(t.atMs,i.minIntervalMs))return r();this.inFlight=!0,this.lastReadAt=t.atMs;let a=this.gen,n=this.engine,l={glareOk:t.glareOk,sharpOk:t.sharpOk};return this.crop(t.video,t.card,i.maxWidthPx).then(s=>n.layoutRead(s,i.detectorLimit)).then(s=>{if(a!==this.gen)return;this.reads++,this.times.push(s.ms),this.times.length>8&&this.times.shift();let h=this.lockGate.offer(s,t.atMs,l);this.lockState=h.state==="locked"?{state:"locked"}:{state:h.state,...h.hint?{hint:h.hint}:{}},h.state==="locked"&&(this.fired={via:"text_lock",at:t.atMs})}).catch(()=>{a===this.gen&&(this.lockOff=!0,this.lockError=!0)}).finally(()=>{a===this.gen&&(this.inFlight=!1)}),r()}disable(){this.disabled=!0,this.reset()}report(t,i,r){let a=this.faceMode;if(a==="off")return null;let n=xt(this.times,.5),l={capture:t,mode:a,reads:this.reads,...this.times.length>0?{readP50Ms:Math.round(n),readP90Ms:Math.round(xt(this.times,.9)),deviceClass:ve(n)}:{}};return a==="live_mrz"?this.fired?.via==="live_mrz"&&this.valid!==null&&i==="live_mrz"?{...l,outcome:"valid",format:this.valid.format,framesToValid:this.valid.framesToValid,msToValid:this.valid.msToValid}:this.fallback!==null?{...l,outcome:this.fallback}:{...l,outcome:r-(this.firstSeen??r)>=(this.o.liveMrz?.searchTimeoutMs??1/0)?"timeout":"off"}:this.fired?.via==="text_lock"?{...l,outcome:"locked",framesToLock:Math.max(1,this.reads),msToLock:Math.round(this.fired.at-(this.firstSeen??this.fired.at))}:{...l,outcome:this.lockError?"error":this.lockOff?"timeout":"off"}}},d(X,"Ve"),X);export{Se as a,we as b,Fe as c,Le as d,ae as e,Oe as f,se as g,ne as h,mt as i,Ce as j,_e as k,Ee as l,Ge as m,ce as n,Me as o,Vt as p,Pe as q,at as r,Re as s,Ne as t,Ae as u,Ye as v,xe as w,be as x,We as y,De as z};
@@ -1 +1 @@
1
- import{F as t,G as a,a as i}from"./chunk-B737CEIX.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,c){if(r instanceof t)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){if(r.code==="attestation_invalid"&&r.details?.browserCheck==="clock_wrong")return"errors.device_clock";let e=`errors.${r.code}`;if(Object.hasOwn(c,e))return e}return"errors.network_error"}o(d,"d");n(d,"errorKey");export{d as a};
1
+ import{F as t,G as a,a as i}from"./chunk-45BISCD7.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,c){if(r instanceof t)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){if(r.code==="attestation_invalid"&&r.details?.browserCheck==="clock_wrong")return"errors.device_clock";let e=`errors.${r.code}`;if(Object.hasOwn(c,e))return e}return"errors.network_error"}o(d,"d");n(d,"errorKey");export{d as a};
@@ -1 +1 @@
1
- import{a as t,b as r,c as a,d as m,e as o,f as p,g as i}from"./chunk-35AXFJCG.js";import"./chunk-ZEUQQLSO.js";import"./chunk-F4Q2Q4OC.js";import"./chunk-JPREVWIF.js";import"./chunk-TV7CW7VL.js";import"./chunk-P7K7ELYZ.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import"./chunk-4FHWXBOB.js";export{r as BARCODE_BUDGET_MS,a as FACE_CONFIRM_BUDGET_MS,t as SAME_FACE_MAX_DROPS,p as createDocumentCapture,i as createDocumentCaptureInternal,m as faceVerdict,o as warmDocumentCapture};
1
+ import{a as t,b as r,c as a,d as m,e as o,f as p,g as i}from"./chunk-6OAH57ZL.js";import"./chunk-XKZZC74I.js";import"./chunk-37BKUH3E.js";import"./chunk-I7ZZMP7U.js";import"./chunk-2CQQAB3Y.js";import"./chunk-P7K7ELYZ.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import"./chunk-4FHWXBOB.js";export{r as BARCODE_BUDGET_MS,a as FACE_CONFIRM_BUDGET_MS,t as SAME_FACE_MAX_DROPS,p as createDocumentCapture,i as createDocumentCaptureInternal,m as faceVerdict,o as warmDocumentCapture};