@sekyro/elements 0.1.0-rc.9 → 0.1.0

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 (142) hide show
  1. package/CHANGELOG.md +452 -0
  2. package/README.md +4 -4
  3. package/dist/cdn/chunks/{camera-trait-V4UAOPIQ-TFCPOCSU.js → camera-trait-DELAK3YN-4I2GHAFU.js} +1 -1
  4. package/dist/cdn/chunks/capture-session-doc-7SHEMIO2-UEB3BLJY.js +1 -0
  5. package/dist/cdn/chunks/challenge-frame-HTZ2ZBIE-5JRAFZOU.js +1 -0
  6. package/dist/cdn/chunks/chunk-37BKUH3E.js +1 -0
  7. package/dist/cdn/chunks/chunk-4VGBIKKF.js +3 -0
  8. package/dist/cdn/chunks/{chunk-ZXPJTB7H.js → chunk-4X4DNUJB.js} +1 -1
  9. package/dist/cdn/chunks/chunk-5QOH6NQH.js +1 -0
  10. package/dist/cdn/chunks/{chunk-SMZ7F4L7.js → chunk-5Y7NCFTK.js} +1 -1
  11. package/dist/cdn/chunks/chunk-65WXOD3F.js +33 -0
  12. package/dist/cdn/chunks/chunk-6MYG4HWP.js +1 -0
  13. package/dist/cdn/chunks/{chunk-DASQWRD2.js → chunk-6W6GR7P4.js} +1 -1
  14. package/dist/cdn/chunks/chunk-7UCVVWRT.js +1 -0
  15. package/dist/cdn/chunks/chunk-CIDO7UAK.js +1 -0
  16. package/dist/cdn/chunks/chunk-DDUCV6NE.js +1 -0
  17. package/dist/cdn/chunks/chunk-E7UFFFZO.js +1 -0
  18. package/dist/cdn/chunks/{chunk-A2ZKVVIE.js → chunk-ERJRG52Z.js} +1 -1
  19. package/dist/cdn/chunks/{chunk-O33NXBND.js → chunk-F3BSTTXB.js} +1 -1
  20. package/dist/cdn/chunks/{chunk-E2MOAJT7.js → chunk-G6ICN3K2.js} +1 -1
  21. package/dist/cdn/chunks/chunk-K3XSP444.js +25 -0
  22. package/dist/cdn/chunks/chunk-KQCTXWDO.js +1 -0
  23. package/dist/cdn/chunks/{chunk-RUN75CTZ.js → chunk-MVPBIASR.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-T5IERZBI.js → chunk-MZETEVSB.js} +1 -1
  25. package/dist/cdn/chunks/chunk-NGJMT7M3.js +1 -0
  26. package/dist/cdn/chunks/chunk-OD63YRJW.js +1 -0
  27. package/dist/cdn/chunks/chunk-PND4F7JQ.js +1 -0
  28. package/dist/cdn/chunks/chunk-PQGILDKC.js +1 -0
  29. package/dist/cdn/chunks/chunk-SLLJX5QK.js +1 -0
  30. package/dist/cdn/chunks/{chunk-UQKRYXN5.js → chunk-T5IBMUSY.js} +1 -1
  31. package/dist/cdn/chunks/chunk-W5WWCOOW.js +1 -0
  32. package/dist/cdn/chunks/chunk-XKZZC74I.js +1 -0
  33. package/dist/cdn/chunks/{chunk-DYCKQAZH.js → chunk-XUZB5KEZ.js} +1 -1
  34. package/dist/cdn/chunks/chunk-YHUTESVX.js +1 -0
  35. package/dist/cdn/chunks/create-document-capture-D6MSQXPC-REYSYPDK.js +1 -0
  36. package/dist/cdn/chunks/{create-portrait-capture-5VGYZUOK-N3333DJC.js → create-portrait-capture-3MHP4DGA-4XIQSUJ3.js} +1 -1
  37. package/dist/cdn/chunks/{detector-scanic-SE3CL55N-JIGLCDPS.js → detector-scanic-3VQFGZAA-NF7AFUUP.js} +1 -1
  38. package/dist/cdn/chunks/document-capture-view-HKEUWRPE-LOW3SNGM.js +1 -0
  39. package/dist/cdn/chunks/eid-view-Y5OFAHVC-H2H5O3H4.js +1 -0
  40. package/dist/cdn/chunks/email-otp-view-ZEVLA5UZ-JO2KA6XE.js +1 -0
  41. package/dist/cdn/chunks/flow-views-ARNNXDI4-7BYKNQLO.js +1 -0
  42. package/dist/cdn/chunks/form-view-PQQO4VIK-IE4YHFTL.js +1 -0
  43. package/dist/cdn/chunks/icons-form-R366YPMB-6C7SJPCB.js +1 -0
  44. package/dist/cdn/chunks/mrz-band-IH54XO42-AE4D3F2E.js +1 -0
  45. package/dist/cdn/chunks/overlay-de-QAMFKRTE-YSXFO53C.js +1 -0
  46. package/dist/cdn/chunks/overlay-es-5RUP36SI-HFW77Y5Z.js +1 -0
  47. package/dist/cdn/chunks/overlay-pt-7EUG7TIT-FUKZ7M5O.js +1 -0
  48. package/dist/cdn/chunks/plan-runner-DOJCVU2R-PLBX6YZK.js +1 -0
  49. package/dist/cdn/chunks/{portrait-capture-view-UYISOXXV-HR5FCO4J.js → portrait-capture-view-EKCFW3YQ-DSL42XKH.js} +1 -1
  50. package/dist/cdn/chunks/portrait-review-view-NKIVRFCL-BK65RBU6.js +1 -0
  51. package/dist/cdn/chunks/print-DCYX3CZD-DLQCPZZE.js +11 -0
  52. package/dist/cdn/chunks/proof-of-address-view-HYTT7NHY-73YT3QLR.js +1 -0
  53. package/dist/cdn/chunks/session-events-W5DRVA6F-BNHYAEHE.js +8 -0
  54. package/dist/cdn/chunks/session-watch-7HMFAHQI-WNCXXNDK.js +1 -0
  55. package/dist/cdn/define.js +1 -1
  56. package/dist/cdn/index.js +1 -1
  57. package/dist/{chunk-HOOZLWNR.js → chunk-25BK7D5W.js} +1 -1
  58. package/dist/chunk-2Z5FHSRB.js +33 -0
  59. package/dist/chunk-73ETQUUL.js +1 -0
  60. package/dist/{chunk-IB3NF7H5.js → chunk-B7CZCSMF.js} +1 -1
  61. package/dist/chunk-ENB7AFED.js +25 -0
  62. package/dist/{chunk-UIOHM6CB.js → chunk-FV5OWBNU.js} +1 -1
  63. package/dist/chunk-HBK2ROSI.js +1 -0
  64. package/dist/{chunk-DAAZBRNM.js → chunk-HFOCTDYM.js} +1 -1
  65. package/dist/{chunk-FAZTWW5J.js → chunk-N2BPYCKG.js} +1 -1
  66. package/dist/{chunk-6MLQBNF4.js → chunk-N3WQ4QSD.js} +1 -1
  67. package/dist/chunk-NAURWQ6C.js +1 -0
  68. package/dist/{chunk-THDSSKYQ.js → chunk-RV6PEFNT.js} +1 -1
  69. package/dist/{chunk-JIHK7L54.js → chunk-TC5736OF.js} +1 -1
  70. package/dist/chunk-XXCBLQ53.js +1 -0
  71. package/dist/chunk-Y7JBM2YL.js +1 -0
  72. package/dist/define.cjs +5 -5
  73. package/dist/define.js +1 -1
  74. package/dist/document-capture-view-HKEUWRPE-KB4IVUEE.js +1 -0
  75. package/dist/{eid-view-U2HL2IX7-ONZGT2S5.js → eid-view-Y5OFAHVC-NUZ7QUBA.js} +1 -1
  76. package/dist/{email-otp-view-CMJHROOH-4DBMTA3R.js → email-otp-view-ZEVLA5UZ-LAXHM22A.js} +1 -1
  77. package/dist/flow-views-ARNNXDI4-YXYLG7SQ.js +1 -0
  78. package/dist/form-view-PQQO4VIK-H7PE6SJF.js +1 -0
  79. package/dist/icons-form-R366YPMB-KUTXHC7X.js +1 -0
  80. package/dist/index.cjs +5 -5
  81. package/dist/index.d.cts +112 -17
  82. package/dist/index.d.ts +112 -17
  83. package/dist/index.js +1 -1
  84. package/dist/overlay-de-QAMFKRTE-Q37YV6YD.js +1 -0
  85. package/dist/overlay-es-5RUP36SI-N7N3ULGK.js +1 -0
  86. package/dist/overlay-pt-7EUG7TIT-5S423QBY.js +1 -0
  87. package/dist/portrait-capture-view-EKCFW3YQ-7UBYR6BX.js +1 -0
  88. package/dist/portrait-review-view-NKIVRFCL-IP7ZWZ6B.js +1 -0
  89. package/dist/proof-of-address-view-HYTT7NHY-QFJ33FM2.js +1 -0
  90. package/dist/styles.css +83 -4
  91. package/package.json +3 -3
  92. package/sbom.cdx.json +4 -4
  93. package/dist/cdn/chunks/capture-session-doc-ESEZJBQM-BXCU4HNS.js +0 -1
  94. package/dist/cdn/chunks/challenge-frame-YAQJ5YMB-MHZYRGKY.js +0 -1
  95. package/dist/cdn/chunks/chunk-2FETDQV5.js +0 -1
  96. package/dist/cdn/chunks/chunk-3S4VNKLC.js +0 -1
  97. package/dist/cdn/chunks/chunk-4PBYN632.js +0 -1
  98. package/dist/cdn/chunks/chunk-4ZCLJICC.js +0 -1
  99. package/dist/cdn/chunks/chunk-6NWHU56A.js +0 -33
  100. package/dist/cdn/chunks/chunk-CW56KMMH.js +0 -1
  101. package/dist/cdn/chunks/chunk-CYLXKJUY.js +0 -3
  102. package/dist/cdn/chunks/chunk-ELKN3A2Q.js +0 -1
  103. package/dist/cdn/chunks/chunk-F2MXING6.js +0 -1
  104. package/dist/cdn/chunks/chunk-GTYN5CAI.js +0 -25
  105. package/dist/cdn/chunks/chunk-J6ERQV2N.js +0 -1
  106. package/dist/cdn/chunks/chunk-KMKUWNV6.js +0 -1
  107. package/dist/cdn/chunks/chunk-KVTY4E6J.js +0 -1
  108. package/dist/cdn/chunks/chunk-L22GFJQV.js +0 -1
  109. package/dist/cdn/chunks/chunk-MSENKS6X.js +0 -1
  110. package/dist/cdn/chunks/chunk-OVZDKB3N.js +0 -1
  111. package/dist/cdn/chunks/chunk-PJ2UDPYO.js +0 -1
  112. package/dist/cdn/chunks/chunk-S5NGSYGI.js +0 -1
  113. package/dist/cdn/chunks/create-document-capture-V7XCRRDV-3MGZONM3.js +0 -1
  114. package/dist/cdn/chunks/document-capture-view-5FWUD45F-TTB7XRVE.js +0 -1
  115. package/dist/cdn/chunks/eid-view-U2HL2IX7-EKYQNIVA.js +0 -1
  116. package/dist/cdn/chunks/email-otp-view-CMJHROOH-S7HHGHMS.js +0 -1
  117. package/dist/cdn/chunks/flow-views-O3KBN7YF-37NQVUAE.js +0 -1
  118. package/dist/cdn/chunks/form-view-WVPN7ZUY-WVYV733R.js +0 -1
  119. package/dist/cdn/chunks/mrz-band-VYHOTDHY-VEZ2J5IL.js +0 -1
  120. package/dist/cdn/chunks/overlay-de-PVJMYZGV-JDDHHQJZ.js +0 -1
  121. package/dist/cdn/chunks/overlay-es-PZCE25XM-D7N7YW66.js +0 -1
  122. package/dist/cdn/chunks/overlay-pt-PZ3L6DR7-AD7SQLSO.js +0 -1
  123. package/dist/cdn/chunks/plan-runner-IXCKR4DB-OJHNDXG2.js +0 -1
  124. package/dist/cdn/chunks/portrait-review-view-67VI2Q6K-KD55P5MN.js +0 -1
  125. package/dist/cdn/chunks/print-SEWS3VHQ-HWJTHADG.js +0 -11
  126. package/dist/cdn/chunks/proof-of-address-view-EIQXYYM3-JYSRHJ7R.js +0 -1
  127. package/dist/chunk-DUYCGH4R.js +0 -33
  128. package/dist/chunk-MYYAFIK6.js +0 -1
  129. package/dist/chunk-TOU3UDCB.js +0 -25
  130. package/dist/chunk-V2KMG4IA.js +0 -1
  131. package/dist/chunk-WCPTICNC.js +0 -1
  132. package/dist/chunk-YZ6YGLNN.js +0 -1
  133. package/dist/chunk-ZLREPJUJ.js +0 -1
  134. package/dist/document-capture-view-5FWUD45F-PZAJNUII.js +0 -1
  135. package/dist/flow-views-O3KBN7YF-I2I3K4EY.js +0 -1
  136. package/dist/form-view-WVPN7ZUY-Z523S2WJ.js +0 -1
  137. package/dist/overlay-de-PVJMYZGV-75ZFRADU.js +0 -1
  138. package/dist/overlay-es-PZCE25XM-IEA7Y6EU.js +0 -1
  139. package/dist/overlay-pt-PZ3L6DR7-WMCH3XQV.js +0 -1
  140. package/dist/portrait-capture-view-UYISOXXV-SO3YYR22.js +0 -1
  141. package/dist/portrait-review-view-67VI2Q6K-ELE4HPWJ.js +0 -1
  142. package/dist/proof-of-address-view-EIQXYYM3-HDMZQJCO.js +0 -1
@@ -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{d as U}from"./chunk-RUN75CTZ.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-GTYN5CAI.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a as N,c as R}from"./chunk-4FHWXBOB.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
1
+ import{d as U}from"./chunk-MVPBIASR.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-K3XSP444.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a as N,c as R}from"./chunk-4FHWXBOB.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
@@ -0,0 +1 @@
1
+ import{b as Mr,d as Ar}from"./chunk-MVPBIASR.js";import{a as Ir}from"./chunk-E7UFFFZO.js";import{b as Lr,c as Nt}from"./chunk-ERJRG52Z.js";import{d as _t}from"./chunk-4VGBIKKF.js";import{c as at}from"./chunk-PQGILDKC.js";import{a as xr,b as Rr,c as Nr,d as Ee}from"./chunk-MZETEVSB.js";import{F as Er,K as xt,L as Rt,a as W,b as de,c as Y,m as Cr,n as Fe,p as _r,q as nt,r as wr,s as Sr,t as wt,u as le,v as me,w as $e,y as St}from"./chunk-K3XSP444.js";import{a}from"./chunk-5QL6W6FW.js";import{c as gr,d as kr,e as vr,h as br}from"./chunk-NGJMT7M3.js";import{b as Ct}from"./chunk-DDUCV6NE.js";import{g as yr}from"./chunk-6MYG4HWP.js";import{a as l,c as T}from"./chunk-4FHWXBOB.js";var jr=T(W(),1),g=T(de(),1),ne=T(de(),1),ke=T(W(),1),K=T(de(),1),_=T(W(),1),y=T(W(),1),ot=T(W(),1),ye=T(de(),1),nn=T(W(),1),ee=T(W(),1),ct=T(W(),1),Se=T(de(),1),xe=T(de(),1),P=T(de(),1);var ut=T(W(),1),pe=T(W(),1);var J=T(W(),1);var L=T(W(),1),ge=T(W(),1),He=T(W(),1),Ut=T(de(),1),v=T(de(),1);function ce({className:e,children:t}){return(0,g.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ce,"ne");a(ce,"Svg");var jt="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 Tr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,g.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(Tr,"pn");a(Tr,"SunIcon");function Hr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,g.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Hr,"fn");a(Hr,"FaceUncoveredIcon");function Or(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,g.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,g.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Or,"mn");a(Or,"PhoneEyeLevelIcon");function Pr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,g.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Pr,"yn");a(Pr,"LookStraightIcon");function Br(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Br,"gn");a(Br,"CameraCheckIcon");function qr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(qr,"hn");a(qr,"CameraAskIcon");function Vr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.jsx)("path",{d:"M3 3l18 18"})]})}l(Vr,"vn");a(Vr,"CameraBlockedIcon");function it({off:e,className:t}){return(0,g.jsxs)(ce,{className:t,children:[(0,g.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,g.jsx)("path",{d:"M4 4l16 16"}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,g.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(it,"Ve");a(it,"SpeakerIcon");function Dr(e){return(0,g.jsx)(ce,{...e,children:(0,g.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Dr,"Cn");a(Dr,"CheckIcon");function Fr(e){return(0,g.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,g.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Fr,"kn");a(Fr,"SpinnerIcon");var Mt=["light","uncover","eyeLevel","straight"],qn={light:{key:"capture.tips.light",icon:a(()=>(0,ne.jsx)(Tr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:a(()=>(0,ne.jsx)(Hr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:a(()=>(0,ne.jsx)(Or,{}),"icon")},straight:{key:"capture.tips.straight",icon:a(()=>(0,ne.jsx)(Pr,{}),"icon")}};function $r({tips:e}){let t=Ee(),n=(0,jr.useId)();return e.length===0?null:(0,ne.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ne.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ne.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?qn[r]:void 0,i=typeof r=="string"?r:r.id,c=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,p=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return(0,ne.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,ne.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,ne.jsx)("span",{children:p})]},i)})})]})}l($r,"Sn");a($r,"TipList");var Vn=220;function Kr({title:e,description:t,options:n,busy:r,error:s,focus:i,testId:c,look:p="cards",marked:w,onChoose:h}){let m=(0,ke.useId)(),R=wt(),[x,U]=(0,ke.useState)(null),M=(0,ke.useRef)(null);(0,ke.useEffect)(()=>{s!==null&&U(null)},[s]),(0,ke.useEffect)(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);let B=a(A=>{r||x!==null||(U(A),M.current=setTimeout(()=>{M.current=null,U(null),h(A)},Vn))},"choose");return(0,K.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":m,"data-testid":c,children:[(0,K.jsxs)("div",{className:p==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,K.jsx)("h2",{id:m,ref:i?R:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,K.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?(0,K.jsx)(le,{tone:"danger",children:(0,K.jsx)("span",{children:s})}):null,p==="buttons"?(0,K.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,te)=>(0,K.jsx)(Y,{kind:te===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>h(A.id),"onClick"),children:A.label},A.id))}):(0,K.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,K.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(x??w)===A.id,"aria-busy":r||void 0,disabled:r||x!==null&&x!==A.id,onClick:l(()=>B(A.id),"onClick"),children:[A.glyph!==void 0?(0,K.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,K.jsxs)("span",{className:"sekyro-card__body",children:[(0,K.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,K.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,K.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Kr,"Vn");a(Kr,"ChoiceScreen");var Gr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function lt(e){return e!==null&&Gr.includes(e)}l(lt,"he");a(lt,"isVoiceKey");var Dn=a((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let s=e[n];r=s!=null&&Dn(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"we");a(je,"resolveClip");var Fn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",$n={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");a(oe,"synth");function zr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(zr,"Ir");a(zr,"speechAvailable");function At(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(At,"wn");a(At,"baseLang");function Tt(e,t){let n=a(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=At(t);return e.find(s=>n(s.lang)===n(t))??e.find(s=>At(s.lang)===r)}l(Tt,"_n");a(Tt,"pickVoice");function Wr(e){if(!zr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Tt(t,e)!==void 0}l(Wr,"In");a(Wr,"speechUsable");function Zr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Zr,"xn");a(Zr,"subscribeVoices");function Ge(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(Ge,"He");a(Ge,"clipIdentity");function Et(e){e.pause(),e.removeAttribute("src"),e.load()}l(Et,"Mn");a(Et,"release");function Qr(){let e=null,t=null,n=0,r=null,s=null,i=null,c=!1,p=null,w=[],h=new Map,m=a(()=>{w=oe()?.getVoices()??[]},"loadVoices"),R=!1,x=a(()=>{let f=oe();R||f===null||(R=!0,m(),f.addEventListener?.("voiceschanged",m))},"bindVoices"),U=a(()=>(e??(e=new Audio),e),"element"),M=a((f,N,S,b)=>{let u=oe();if(u!==null&&f!==""&&typeof SpeechSynthesisUtterance=="function"){x();let E=Tt(w,N);if(w.length===0||E!==void 0){u.cancel();let j=new SpeechSynthesisUtterance(f);j.lang=N,E!==void 0&&(j.voice=E),j.rate=.95,S!==void 0&&(j.onend=S),(S!==void 0||b!==void 0)&&(j.onerror=D=>{b!==void 0&&D.error==="not-allowed"?b():S?.()}),u.speak(j);return}}S?.()},"speak"),B=a(()=>{n+=1,r=null,s=i=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=a(f=>{for(let N of f){let S=Ge(N);if(h.has(S))continue;let b=new Audio;b.preload="auto",b.src=N,h.set(S,b)}},"warmClips"),te=a((f,N,S)=>{let b={utterance:f,generation:N,end:S};p=b;let u=a(()=>N===n&&p===b,"live"),E=a(()=>{u()&&(s=b)},"block");if(oe()?.cancel(),f.url!==null){let j=U();j.pause(),j.muted=!1,j.src=f.url,j.currentTime=0,j.onended=S??null;let D=a(()=>{i===b&&(i=null)},"settled"),o=j.play();if(o===void 0)return;i=b,o.then(D,H=>{if(D(),!u())return;let O=H?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return E();f.speech?M(f.text,f.lang,S,E):S?.()}});return}f.speech?M(f.text,f.lang,S,E):S?.()},"start");return{say(f){let N=f.url!==null?Ge(f.url):`tts:${f.lang}:${f.text}`;if(N===r)return;r=N,s=i=null,n+=1;let S=n,b=f.onEnd;te(f,S,b!==void 0?()=>{S===n&&b()}:void 0)},unlock({lang:f,speech:N,prefetch:S}){let b=s??(c?null:i);c=!0;let u=b!==null&&b.generation===n?b:null;s=i=null,u!==null&&te(u.utterance,u.generation,u.end);let E=U();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let H=Uint8Array.from(atob(Fn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([H],{type:"audio/wav"}))}let j=E.paused===!1&&t!==null&&E.src!==t;t!==null&&!j&&(u===null||u.utterance.url===null)&&(E.muted=!0,E.onended=null,E.src=t,E.play()?.catch(()=>{}));let D=oe(),o=u!==null&&u.utterance.url===null;if(N&&!o&&D!==null&&typeof SpeechSynthesisUtterance=="function"){x();let H=new SpeechSynthesisUtterance(" ");H.volume=0,H.lang=f,D.speak(H)}A(S??[])},prefetch:A,stop:B,dispose(){B(),R&&oe()?.removeEventListener?.("voiceschanged",m),R=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Et(e),e=null;for(let f of h.values())Et(f);h.clear()}}}l(Qr,"En");a(Qr,"createVoicePlayer");var Kn="sekyro.voiceGuidance";function Xr(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(Xr,"Nn");a(Xr,"readVoicePreference");function Yr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Yr,"Pn");a(Yr,"writeVoicePreference");var Ke="capture.tips.summary",Gn=typeof window<"u"?_.useLayoutEffect:_.useEffect,zn=Object.freeze({});function st(e,t){let n=new Set,r=[];for(let s of Gr){let i=s===Ke?null:je(e,s,t);i===null||n.has(Ge(i))||(n.add(Ge(i)),r.push(i))}return r}l(st,"vt");a(st,"resolvedClipUrls");function Jr({locale:e,defaultClips:t,options:n}){let r=n===!1,s=r?{}:n??{},i=s.storageKey===void 0?Kn:s.storageKey,[c,p]=(0,_.useState)(s.defaultEnabled??!0),w=(0,_.useRef)(c),[h,m]=(0,_.useState)(!1),[R,x]=(0,_.useState)("none"),[U,M]=(0,_.useState)(!1),B=(0,_.useRef)(!1),[A,te]=(0,_.useState)(0),f=(0,_.useRef)(null),N=(0,_.useCallback)(()=>(f.current??(f.current=Qr()),f.current),[]),S=$n[e],b=s.speechFallback,u=b===void 0||b===!0?!0:b===!1?!1:b.includes(e),E=s.clips??t??zn,j=(0,_.useRef)(!1),D=(0,_.useRef)(E);Gn(()=>{D.current=E,w.current=c}),(0,_.useEffect)(()=>{if(r||i===null)return;let I=Xr(i);I!==null&&(w.current=I,p(I))},[r,i]),(0,_.useEffect)(()=>{if(!(r||!u))return Zr(()=>te(I=>I+1))},[r,u]);let o=s.clips;(0,_.useEffect)(()=>{if(r)return;let I=u&&Wr(S);m(st(E,e).length>0||I),x(o!==void 0&&je(o,Ke,e)!==null?"partner":je(E,Ke,e)!==null||I?"default":"none")},[r,E,o,e,u,S,A]),(0,_.useEffect)(()=>{if(r||!c||!j.current)return;let I=st(E,e);I.length>0&&N().prefetch(I)},[r,c,E,e,N]),(0,_.useEffect)(()=>()=>{f.current?.dispose(),f.current=null,j.current=!1},[]);let H=(0,_.useCallback)(I=>{r||(j.current=!0,N().unlock({lang:S,speech:u,...I?{prefetch:st(D.current,e)}:{}}))},[r,N,S,u,e]),O=(0,_.useCallback)(()=>H(w.current),[H]),Z=(0,_.useCallback)(()=>{B.current=!1,M(!1)},[]),F=(0,_.useCallback)(()=>{Z(),f.current?.stop()},[Z]),ve=(0,_.useCallback)(()=>{B.current&&F()},[F]),he=(0,_.useCallback)((I,Re)=>{if(r)return;if(B.current){F();return}let be=N();be.stop(),B.current=!0,M(!0);let q=Re?.clip===!1?null:je(D.current,Ke,e);be.say({url:q,text:I,lang:S,speech:u,onEnd:Z})},[r,F,N,e,S,u,Z]),Q=(0,_.useCallback)(I=>{r||(I?H(!0):F(),i!==null&&Yr(i,I),w.current=I,p(I))},[r,H,F,i]),X=(0,_.useCallback)(()=>Q(!w.current),[Q]),ae=(0,_.useCallback)((I,Re)=>{if(r||!c)return;B.current&&Z();let be=je(D.current,I,e);N().say({url:be,text:Re,lang:S,speech:u})},[r,c,e,N,S,u,Z]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&c,setEnabled:Q,toggle:X,unlock:O,speakKey:ae,stop:F,summary:r?"none":R,summaryPlaying:U,toggleSummary:he,stopSummary:ve}),[r,h,c,Q,X,O,ae,F,R,U,he,ve])}l(Jr,"Ct");a(Jr,"useVoiceGuidance");function en(e,t,n,r){let{speakKey:s,stop:i,enabled:c}=e,p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){p.current&&i(),p.current=!1;return}p.current=!0,lt(t)&&t!==Ke&&n!==""&&s(t,n)},[r,c,t,n,s,i])}l(en,"kt");a(en,"useSpeakGuidance");function ze(e,t){let n=tn(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(ze,"On");a(ze,"retryCoachingOf");function tn(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(tn,"Kr");a(tn,"coachingOfReason");var Te={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function rn({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:s}){let i=Ee(),c=(0,ot.useRef)(null);return(0,ot.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,ye.jsx)("p",{className:"sekyro-text-body",children:i(Te[t].title)}),(0,ye.jsx)("ul",{className:"sekyro-coaching",children:Te[t].tips.map(p=>(0,ye.jsx)("li",{children:i(p)},p))}),n!==null?(0,ye.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,ye.jsx)(Y,{ref:c,className:"sekyro-btn--start",onClick:s,children:i("capture.recordAgain")}):null]})}l(rn,"Hn");a(rn,"CapturedPanel");function Ht(){try{return!1}catch{return!1}}l(Ht,"rt");a(Ht,"isDevBuild");var Wn=(0,nn.createContext)(null);function an({state:e}){let t=Ee(),[n,r]=(0,ct.useState)(!1);(0,ct.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?(0,Se.jsx)(Br,{}):e==="denied"?(0,Se.jsx)(Vr,{}):(0,Se.jsx)(qr,{});return(0,Se.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,Se.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),(0,Se.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(an,"Gn");a(an,"PermissionRow");function sn({voice:e}){let t=Ee();if(!e.supported)return null;let n=e.enabled;return(0,xe.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,xe.jsxs)("span",{className:"sekyro-switch__label",children:[(0,xe.jsx)(it,{off:!n}),t("capture.voiceGuidance")]}),(0,xe.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,xe.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,xe.jsx)(Dr,{className:"sekyro-switch__check"}):null})})]})}l(sn,"Fn");a(sn,"VoiceSwitch");function ln({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:s,tips:i,summary:c,startLabel:p,startDisabled:w,onStart:h}){let m=Ee(),R=(0,ee.useRef)(c?.stop);R.current=c?.stop,(0,ee.useEffect)(()=>()=>R.current?.(),[]);let x=(0,ee.useRef)(null),U=(0,ee.useRef)(null),M=(0,ee.useRef)(null),B=(0,ee.useRef)(e),A=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{let u=B.current;if(B.current=e,u===e)return;let E=A.current;e!=="loading"&&(A.current=!1),on(x.current)&&(e==="failed"?M.current?.focus():E&&U.current?.focus())},[e]);let te=(0,ee.useCallback)(()=>{A.current=!0,t()},[t]),f=e==="loading",N=f||w,S=(0,ee.useCallback)(()=>{N||(R.current?.(),h())},[N,h]),b;return e==="failed"?b=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:m("fcv2.err.models")}),(0,P.jsx)(Y,{kind:"ghost",ref:M,className:"sekyro-btn--start",onClick:te,"data-testid":"sekyro-assets-retry",children:m("common.retry")})]}):b=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(Y,{ref:U,full:!0,"data-testid":"sekyro-start","aria-disabled":N?"true":void 0,"aria-busy":f?"true":void 0,onClick:S,children:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Fr,{}),m("capture.preparing.title")]}):p??m("capture.start")}),f?(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:x,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:m("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.assisted.lead")})]}):null,i!==!1?(0,P.jsx)($r,{tips:i}):null,c!==void 0?(0,P.jsxs)(Y,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(it,{off:!1}),m(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(an,{state:n}),(0,P.jsx)(sn,{voice:s}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.securityNote")}),b,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?m("capture.preparing.title"):e==="ready"?m("capture.ready"):""})]})}l(ln,"jn");a(ln,"PreCaptureScreen");function on(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(on,"Br");a(on,"focusIsOurs");function cn(){let[e,t]=(0,ut.useState)({state:"unknown",settled:!1});return(0,ut.useEffect)(()=>yr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(cn,"Yn");a(cn,"useCameraStatus");function un(e){return Ot(e,"mobileRequired")}l(un,"$n");a(un,"useMobileRequired");function dn(e){return Ot(e,"returning").required}l(dn,"zn");a(dn,"useReturning");function Ot(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(c=>{i&&r({required:c===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}l(Ot,"Zn");a(Ot,"useFlag");function pn(e){let t=a(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let i=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:c,settled:!0});return}let p=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(w=>{let h=e.captureChoice??null;p&&r({session:h!==null&&w===h?"choice":w==="assisted"||w==="choice"?w:"self",choice:h,settled:!0})},()=>{p&&r({session:"self",choice:null,settled:!0})}),()=>{p=!1}},[e]);let s=(0,pe.useCallback)(i=>{e?.chooseCaptureMode?.(i),r(c=>({...c,choice:i}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:s}}l(pn,"Wn");a(pn,"useCaptureMode");function hn(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),s=e.on("result",()=>n(!1));return()=>{r(),s()}},[e]),t}l(hn,"Qn");a(hn,"useBusy");var Zn=a(()=>"idle","serverSnapshot");function Lt(e){return gr(e!==void 0?{assetBaseUrl:e}:{})}l(Lt,"er");a(Lt,"preload");function fn(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(h=>vr(h,e),[e]),()=>kr(e),Zn),[r,s]=(0,J.useState)(null),i=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Lt(e).then(h=>{i.current&&h==="idle"&&s({base:e})})},[e]);(0,J.useEffect)(()=>(i.current=!0,c(),()=>{i.current=!1}),[c]);let p=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,c())},[n,e,c,t]);let w=(0,J.useCallback)(()=>{Lt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:w}}l(fn,"tr");a(fn,"useLivenessAssets");var Ur={progress:0,hint:null,faceDetected:!1};function mn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,L.useRef)(e.verification).current,s=(0,L.useRef)(!1);e.verification!==r&&!s.current&&Ht()&&(s.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let i=(0,L.useRef)(null),[c,p]=(0,L.useState)("idle"),[w,h]=(0,L.useState)(Ur),[m,R]=(0,L.useState)(!1),[x,U]=(0,L.useState)(!1),[M,B]=(0,L.useState)(null),[A,te]=(0,L.useState)(!1),[f,N]=(0,L.useState)(null),[S,b]=(0,L.useState)(null),[u,E]=(0,L.useState)(null),[j,D]=(0,L.useState)(null),[o,H]=(0,L.useState)(null),[O,Z]=(0,L.useState)(!1),F=(0,L.useRef)(null),ve=(0,L.useRef)("idle"),he=(0,L.useRef)(-1),[Q,X]=(0,L.useState)(0),ae=(0,L.useRef)(e);ae.current=e,(0,L.useEffect)(()=>{let re=t.current;if(re===null)return;let ue={video:re,...n!==void 0?{assetBaseUrl:n}:{}},G=r!==void 0?r.liveness(ue):br(ue);i.current=G;let Ne=a(()=>H(G.facingMode??null),"readFacing");Ne();let We=[G.on("state",C=>{C==="mode_switch"?Z(!0):C!=="starting"&&C!=="gating"&&Z(!1),C==="starting"?(ve.current!=="starting"&&(he.current+=1,X(Math.max(0,he.current))),b(null),E(null),h(Ur),U(!1),R(!1),B(null),N(null),F.current=null):C==="gating"&&ve.current==="recording"&&(U(!1),R(!1),B(null),F.current=null),ve.current=C,Ne(),p(C),ae.current.onStateChange?.(C)}),G.on("gate",C=>{let Ce=F.current;F.current=C.progress,R(Ce!==null&&C.progress<Ce-.001&&C.progress>0&&C.progress<1),C.progress>=1&&U(!0),h(C)}),G.on("frozen",({previewDataUrl:C})=>B(C)),G.on("profile",({animations:C})=>te(C==="reduced")),G.on("ramp",({colour:C})=>N(C)),G.on("captured",C=>{b(C),D(null),ae.current.onCaptured?.(C)}),G.on("error",C=>{E(C);let Ce=r?.reportCaptureIssue;Ce!==void 0&&Nt(Le=>Ce.call(r,Le),Lr("liveness",C,Math.max(0,he.current))),ae.current.onError?.(C)}),r?.on("result",C=>{D(C),ae.current.onResult?.(C)})];return()=>{for(let C of We)C?.();i.current=null,G.destroy()}},[r,t,n]);let I=(0,L.useCallback)(()=>{i.current?.start()},[]),Re=(0,L.useCallback)(()=>{i.current?.retry()},[]),be=(0,L.useCallback)(async()=>{let re=i.current;return re===null||typeof re.canSwitchCaptureMode!="function"?!1:await re.canSwitchCaptureMode().catch(()=>!1)===!0},[]),q=(0,L.useCallback)(async re=>{let ue=i.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let G=await ue.setCaptureMode(re).catch(()=>!1)===!0;return G&&H(ue.facingMode??null),G},[]);return{state:c,gate:w,draining:m,gateLocked:x,frozenPreview:M,reduceMotion:A,rampColour:f,artifacts:S,error:u,result:j,facingMode:o,start:I,retry:Re,canSwitchCaptureMode:be,setCaptureMode:q,modeRestarted:O,attempt:Q}}l(mn,"rr");a(mn,"useLivenessHandle");var Qn=new Set(["national_number"]);function It(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Qn.has(n));return t.length>0?{...e,options:t}:null}l(It,"or");a(It,"pending");function yn(e){let[t,n]=(0,ge.useState)(null),[r,s]=(0,ge.useState)(e===void 0),[i,c]=(0,ge.useState)(!1),[p,w]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{if(n(null),e===void 0){s(!0);return}let R=!0,x=e.methodChoice;typeof x=="function"?(s(!1),Promise.resolve().then(()=>x.call(e)).then(M=>{R&&n(It(M))},()=>{}).finally(()=>{R&&s(!0)})):s(!0);let U=e.on("method",M=>n(It(M)));return()=>{R=!1,U()}},[e]);let h=(0,ge.useCallback)(async R=>{if(e===void 0)return!1;c(!0),w(!1);try{return await e.selectMethod(R),n(null),!0}catch{return w(!0),!1}finally{c(!1)}},[e]),m=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:m==="national_number"&&!p?m:null,settled:r,busy:i,failed:p,select:h}}l(yn,"sr");a(yn,"useMethodChoice");var Xn=["ar","fr","en"];function gn(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(gn,"co");a(gn,"isClipUrl");function kn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Xn){let s=t[r];if(!(typeof s!="object"||s===null))for(let[i,c]of Object.entries(s))!lt(i)||!gn(c)||((n[r]??(n[r]={}))[i]=c)}return Object.keys(n).length>0?n:null}l(kn,"lo");a(kn,"toVoiceClipMap");function vn(e){let[t,n]=(0,He.useState)(null);(0,He.useEffect)(()=>{if(n(null),e===void 0)return;let s=!0,i=a(p=>{if(!s)return;let w=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;n(h=>h?.setId===w?.setId?h:w)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let c=e.on("view",p=>i(p.voice));return()=>{s=!1,c()}},[e]);let r=(0,He.useMemo)(()=>t!==null?kn(t):null,[t]);return e===void 0?null:r}l(vn,"ir");a(vn,"useServerVoiceClips");function bn({voice:e}){let t=Ee();return(0,Ut.jsx)(Y,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Ut.jsx)(it,{off:!e.enabled,className:"sekyro-icon"})})}l(bn,"cr");a(bn,"VoiceChip");var Yn=new Set(["abandoned","not_opened","cancelled","superseded"]),Jn=800,ea="capture.lookAtColours";function Cn(e){return e===void 0||e!==!1&&e.length===Mt.length&&Mt.every(t=>e.includes(t))}l(Cn,"go");a(Cn,"isDefaultTips");function _n(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(_n,"ho");a(_n,"carriesActivation");function wn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}l(wn,"vo");a(wn,"isNoticeObject");var ta=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function Sn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(Sn,"ko");a(Sn,"isCapturing");function xn(e){return e==="captured"||e==="uploading"||e==="checking"}l(xn,"bo");a(xn,"isPostCapture");function ra({verification:e,locale:t,dir:n,strings:r,slots:s,autoStart:i=!1,notice:c,startDisabled:p=!1,startLabel:w,tips:h,tipsSummary:m,coach:R,voice:x,onGuidance:U,onCaptured:M,onResult:B,onError:A,onStateChange:te,assetBaseUrl:f,className:N}){let S=Rr(t),b=(0,y.useMemo)(()=>xr(t,r),[t,r,S]),u=(0,y.useMemo)(()=>k=>b[k]??"",[b]),E=n??(t==="ar"?"rtl":"ltr"),j=(0,y.useRef)(null),D=(0,y.useContext)(Wn),o=mn({verification:e,videoRef:j,assetBaseUrl:f,onCaptured:M,onResult:B,onError:A,onStateChange:te}),H=fn(f,o.state==="idle"&&o.error===null),O=yn(e),Z=O.choice!==null,F=un(e),ve=dn(e),he=hn(e),Q=cn(),X=pn(e),ae=X.session==="choice",I=X.mode==="assisted",Re=x!==!1&&x?.clips===void 0,be=vn(Re?e:void 0),q=Jr({locale:t,defaultClips:be,options:x}),re=I?"environment":"user",ue=X.settled,G=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),We=(0,y.useRef)(q.unlock);We.current=q.unlock,(0,y.useEffect)(()=>{let k=G.current;if(k===null)return;let ie=["pointerup","touchend","click","keydown"],we=a(()=>{for(let De of ie)k.removeEventListener(De,Ae,!0)},"disarm");function Ae(De){if(Ne.current){we();return}_n(De)&&(Ne.current=!0,we(),We.current())}l(Ae,"Re"),a(Ae,"onGesture");for(let De of ie)k.addEventListener(De,Ae,{capture:!0,passive:!0});return we},[]);let C=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,q.unlock()),o.start()},[q.unlock,o.start]),Ce=(0,y.useCallback)(()=>o.start(),[o.start]),Le=(0,y.useRef)(!1),Oe=o.state==="idle"&&o.error===null,Vt=!Z&&!F.required&&(i===!0||i==="when-permitted"&&Q.permission==="granted"),Dt=Vt&&O.settled&&F.settled&&ue,Ln=i==="when-permitted"&&!Q.permissionSettled&&!Le.current,Ft=Vt&&Oe&&!Le.current,pt=(Ln||Ft||!ue)&&H.gate==="ready"?"loading":H.gate;(0,y.useEffect)(()=>{!Dt||!Oe||H.gate!=="ready"||Le.current||(Le.current=!0,Ce())},[Dt,Oe,H.gate,Ce]);let In=Oe&&!Z&&!F.required&&!(Ft&&H.gate==="ready"),[$t,Kt]=(0,y.useState)(!1),{canSwitchCaptureMode:Gt,setCaptureMode:zt}=o;(0,y.useEffect)(()=>{if(!X.settled||!ae){Kt(!1);return}let k=!0;return Gt().then(ie=>{k&&Kt(ie)}),()=>{k=!1}},[X.settled,ae,Gt]);let{choose:Wt}=X,Ie=I?"self":"assisted",Un=(0,y.useCallback)(async()=>{await zt(Ie)&&Wt(Ie)},[zt,Wt,Ie]),Zt=o.state!=="idle"&&o.facingMode!==null?o.facingMode:re;(0,y.useEffect)(()=>{let k=j.current?.style;Zt==="user"?k?.removeProperty("transform"):k&&(k.transform="none")},[Zt]);let Ze=(0,y.useMemo)(()=>o.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(o.artifacts.keyframe):null,[o.artifacts]);(0,y.useEffect)(()=>{if(Ze!==null)return()=>URL.revokeObjectURL(Ze)},[Ze]);let Qt=o.frozenPreview??Ze,Ue=e!==void 0,$=Sn(o.state),fe=xn(o.state),Pe=$||fe,se=o.result,Xt=o.state==="done"&&se!==null,Qe=$&&o.rampColour!==null,ht=o.state==="recording"&&o.frozenPreview!==null&&!Qe,Be=D!==null,Yt=$t&&$&&!ht?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:a(()=>{Un()},"onSwitch")}:null,Xe=o.modeRestarted&&$?u("capture.modeSwitch.restarted"):null,qe=fe||ht,Jt=fe?"checking":ht?"frozen":o.state==="recording"||Qe?"recording":o.gateLocked||o.gate.progress>=1?"locked":o.gate.faceDetected?"aligning":"seeking",Ye=$?o.gate.hint:null,Je=o.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!o.gate.faceDetected?"fcv3.no_face":Cr(Ye),[jn,er]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Je!=="fcv3.no_face"){er(Je);return}if(!$)return;let k=setTimeout(()=>er(Je),Jn);return()=>clearTimeout(k)},[Je,$]);let ft=$&&!Qe&&typeof R=="string"&&R!=="",tr=I&&$?u("capture.assisted.stage"):null,Me=$&&!ft?Qe?ea:jn:null,mt=ft?R:Me===null?"":u(Me);en(q,Me,mt,$);let rr=(0,y.useRef)(U);rr.current=U,(0,y.useEffect)(()=>{if(lt(Me))try{rr.current?.(Me)}catch(k){console.error("[@sekyro/react] onGuidance threw:",k)}},[Me]);let Ve=(0,y.useMemo)(()=>({supported:q.supported,enabled:q.enabled,setEnabled:q.setEnabled,toggle:q.toggle}),[q.supported,q.enabled,q.setEnabled,q.toggle]),yt=s?.voicePrompt,nr=yt!==void 0,ar=x===void 0,sr=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!nr||!ar||sr.current||!Ht()||(sr.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."))},[nr,ar]);let Tn=yt!==void 0?(k,ie,we)=>yt(k,ie,we,Ve):q.supported?()=>(0,v.jsx)(bn,{voice:Ve}):void 0,{summary:gt,summaryPlaying:ir,toggleSummary:lr,stopSummary:or}=q,et=m!==void 0&&m!=="",cr=et?m:u("capture.tips.summary"),ur=et?gt!=="none":gt==="partner"||gt==="default"&&Cn(h),Hn=(0,y.useMemo)(()=>ur?{playing:ir,toggle:a(()=>lr(cr,{clip:!et}),"toggle"),stop:or}:void 0,[ur,ir,lr,cr,or,et]),dr=(0,y.useMemo)(()=>({assets:pt,retryAssets:H.retry,permission:Q.permission,permissionSettled:Q.permissionSettled,captureMode:X.mode,facing:re,voice:Ve}),[pt,H.retry,Q.permission,Q.permissionSettled,X.mode,re,Ve]),On=wn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,V=se!==null&&se.status==="retry"?se:null,tt=V!==null&&s?.intro!==void 0&&!$&&!fe&&o.error===null,pr=V===null?void 0:{reason:String(V.reasonCode??""),...V.retakeHint!==void 0?{retakeHint:V.retakeHint}:{},...V.attemptsRemaining!==void 0?{attemptsRemaining:V.attemptsRemaining}:{}},z=Xt&&se.status==="unavailable"&&!Z&&se.reasonCode!=="portrait_required"?se:null,_e=Xt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,kt=a((k,ie)=>{if(k===void 0)return null;if(k==="device_cooldown"){let Ae=wr(t,ie);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let we=nt(k);return we===null?null:u(we)},"reasonText"),vt=a(k=>{let ie=k.retakeHint===void 0?null:Fe(k.retakeHint);return ie===null?kt(k.reasonCode):u(ie)},"retryText"),hr=_e===null?null:kt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Yn.has(_e.reason)?u("errors.session_expired"):null),Pn=z!==null&&z.reasonCode!==void 0&&z.reasonCode!=="nni_unbound"&&z.reasonCode!=="id_number_unbound"&&z.reasonCode!=="method_required"&&z.reasonCode!=="mobile_required"&&!(z.reasonCode==="no_recorder"&&o.artifacts?.degraded==="NO_RECORDER"),rt=z?.reasonCode,fr=o.attempt;(0,y.useEffect)(()=>{z===null||rt===void 0||e?.reportCaptureIssue===void 0||ta.has(rt)||Nt(k=>e.reportCaptureIssue?.(k),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:rt,attempt:Math.min(1e3,fr)})},[z,rt,fr,e]);let mr=wt(),Bn=Z&&O.auto===null&&!$&&!fe&&o.error===null,bt=(0,y.useCallback)(async k=>{await O.select(k)&&o.state==="done"&&o.retry()},[O.select,o.state,o.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!$&&!fe&&bt(O.auto)},[O.auto,O.busy,$,fe,bt]),(0,v.jsx)(Nr,{value:u,children:(0,v.jsxs)("div",{ref:G,className:N===void 0?"sekyro-capture":`sekyro-capture ${N}`,dir:E,lang:t,"data-testid":"sekyro-liveness-capture","data-state":o.state,children:[s?.header,V!==null&&vt(V)!==null&&!(Be&&Pe)&&!tt?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:vt(V)})}):null,Xe!==null&&!Be?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:Xe})}):null,he&&fe&&!Be?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,F.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,o.error!==null?s?.errorPanel!==void 0?s.errorPanel(o.error,o.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(_r(o.error))}),o.error.retryable?(0,v.jsx)(Y,{ref:mr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u("common.retry")}):null]}):null,z!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(z.reasonCode==="attestation"&&z.attestationError==="clock_wrong"?u("errors.device_clock"):kt(z.reasonCode))??u(z.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Pn?(0,v.jsx)(Y,{ref:mr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u(z.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,hr!==null&&_e!==null?(0,v.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:hr})}):null,(0,v.jsx)("div",{className:Pe?void 0:"sekyro-hidden","data-capture-live":Pe?"":void 0,children:Be?D({videoRef:j,guidance:qe&&Ue?u("capture.checking"):mt,coached:ft&&!(qe&&Ue),note:qe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:Xe??tr,settled:qe&&Ue,progress:o.gate.progress,phase:Jt,still:qe?Qt:null,live:Pe,modeSwitch:Yt,...$t||V!==null?{status:Xe??(V!==null&&$?vt(V):null)}:{},ramp:o.rampColour===null?null:{colour:o.rampColour}}):(0,v.jsx)(Mr,{videoRef:j,guidanceText:mt,guidanceHint:Ye,guidanceKey:Me,progress:o.gate.progress,phase:Jt,draining:o.draining,stillUrl:Qt,showChecking:Ue,operatorText:tr,voicePrompt:Tn,overlay:l(k=>(0,v.jsxs)(v.Fragment,{children:[s?.stageOverlay?.(k),(0,v.jsx)(Ar,{colour:o.rampColour})]}),"overlay"),reduceMotion:o.reduceMotion,modeSwitch:Yt})}),Bn&&O.choice!==null?(0,v.jsx)(Kr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(k=>({id:k,label:u(`method.${k}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:o.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(k=>{bt(k)},"onChoose")}):null,tt&&s?.intro!==void 0&&pr!==void 0?s.intro(o.retry,{...dr,retry:pr}):null,In?(0,v.jsxs)(v.Fragment,{children:[ve&&s?.header===void 0&&s?.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,On,s?.intro!==void 0?s.intro(C,dr):(0,v.jsx)(ln,{assets:pt,onRetryAssets:H.retry,permission:Q.permission,captureMode:X.mode,voice:Ve,tips:h??Mt,summary:Hn,startLabel:w,startDisabled:p,onStart:C})]}):null,(0,v.jsx)(rn,{showCoaching:V!==null&&!(Be&&Pe)&&!tt,coaching:ze(V?.reasonCode,V?.retakeHint),attemptsText:V?.attemptsRemaining!==void 0?Sr(b,t,V.attemptsRemaining):null,showRetake:V!==null&&!$&&!fe&&!tt||!Ue&&o.state==="captured",onRetake:o.retry}),s?.footer]})})}l(ra,"Ni");a(ra,"LivenessCapture");var Pt=T(W(),1),dt=T(W(),1),d=T(de(),1);var La={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function na(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return _t(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return _t(e,t.locale)??t.t("method.nationalEid");default:return null}}l(na,"J");a(na,"identityLabel");function aa(e,t){let[n,r]=(0,Pt.useState)(!1),[s,i]=(0,Pt.useState)(null);return{busy:n,error:s,run:a(c=>{r(!0),i(null),c().then(()=>r(!1),p=>{r(!1),i(e.t(Ir(p,e.strings))),t?.(p)})},"run")}}l(aa,"Q");a(aa,"useChoiceAction");function Bt(){let e=`sekyro-face-light-${(0,dt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,d.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("mask",{id:e,children:(0,d.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,d.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,d.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Bt,"O");a(Bt,"FaceMark");var sa={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function ia(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(ia,"le");a(ia,"faceIntroRetryOf");var Nn={"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 la({start:e,context:t,tips:n,tipsTitle:r,human:s=!1,returning:i=!1,notice:c,retry:p}){let w=at(),{t:h}=w,m=p??An(t),R=(0,dt.useContext)(Er)?.busy===!0;if(m!==void 0&&c===void 0&&t.captureMode!=="assisted")return(0,d.jsx)(En,{retry:m,start:e,context:t,disabled:R});let x=m===void 0?"face":ze(m.reason,m.retakeHint),U=x==="face"?null:Te[x].tips;return(0,d.jsxs)("section",{className:"sekyro-step",children:[(0,d.jsx)(Bt,{}),t.captureMode==="assisted"?(0,d.jsx)($e,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,d.jsx)($e,{title:h("returning.heading"),lead:h("returning.description")}):(0,d.jsx)($e,{title:h(s?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(s?"native.face.humanIntroLead":"native.face.introLead")}),m!==void 0?(0,d.jsx)(Mn,{retry:m,title:Te[x].title}):null,r!==void 0&&U===null?(0,d.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:U!==null?U.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:Nn[M]??"face"}),h(M)]},M)):n!==void 0?n.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:sa[M.id]??"face"}),M.text]},M.id)):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"light"}),h("capture.tips.light")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,d.jsx)(Y,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,c!==void 0?null:(0,d.jsx)(St,{children:(0,d.jsxs)(Y,{full:!0,disabled:t.assets!=="ready"||R,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,d.jsx)(me,{name:"camera"}),h("capture.start")]})})]})}l(la,"ue");a(la,"FaceIntro");var oa=new Set(["match_inconclusive","no_face_source","below_threshold"]);function qt(e){return e==="probe_not_from_liveness"?"capture.retrySamePerson.message":e==="faces_differ"?"reasons.faces_differ":oa.has(e)?"capture.retryMatch.message":nt(e)}l(qt,"F");a(qt,"retryReasonKey");function Mn({retry:e,title:t}){let n=at(),r=e.retakeHint===void 0?null:Fe(e.retakeHint),s=qt(e.reason);return(0,d.jsxs)(xt,{tone:"warning",children:[r!==null?(0,d.jsx)("span",{children:n.t(r)}):s!==null?(0,d.jsx)("span",{children:n.t(s)}):null,r===null?(0,d.jsx)("span",{children:n.t(t)}):null,(0,d.jsx)("span",{children:Rt(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(Mn,"U");a(Mn,"RetryNotice");function An(e){let t=e.retry;if(t!==void 0)return{reason:t.reason,...t.retakeHint!==void 0?{retakeHint:t.retakeHint}:{},attemptsRemaining:t.attemptsRemaining??0,attemptsExhausted:t.attemptsRemaining===0}}l(An,"G");a(An,"faceIntroRetryOfContext");var Rn=[{key:"capture.retryCoaching.light",icon:"light"},{key:"capture.retryCoaching.eyeLevel",icon:"smartphone"},{key:"capture.retryCoaching.head",icon:"face"}],ca={appearance:"hintTitles.appearance",motion:"hintTitles.motion",lighting:"hintTitles.lighting",framing:"hintTitles.framing"};function En({retry:e,start:t,context:n,disabled:r}){let s=at(),{t:i}=s,c=ze(e.reason,e.retakeHint),p=c==="face"?Rn:Te[c].tips.map(x=>({key:x,icon:Rn.find(U=>U.key===x)?.icon??Nn[x]??"face"})),w=e.retakeHint===void 0?null:Fe(e.retakeHint),h=qt(e.reason),m=w!==null?i(w):h!==null?i(h):void 0,R=i((e.retakeHint!==void 0?ca[e.retakeHint]:void 0)??"hintTitles.default");return(0,d.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-face-retry",children:[(0,d.jsx)(Bt,{}),(0,d.jsx)($e,{title:R}),m!==void 0?(0,d.jsx)(xt,{tone:"warning",children:(0,d.jsx)("span",{children:m})}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:p.slice(0,3).map(x=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:x.icon}),i(x.key)]},x.key))}),n.assets==="failed"?(0,d.jsx)(Y,{kind:"secondary",full:!0,onClick:n.retryAssets,children:i("common.retry")}):null,(0,d.jsxs)(St,{children:[(0,d.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:Rt(s,e.attemptsRemaining,e.attemptsExhausted)}),(0,d.jsxs)(Y,{full:!0,disabled:n.assets!=="ready"||r||e.attemptsExhausted,"aria-busy":n.assets==="loading"||void 0,onClick:t,children:[(0,d.jsx)(me,{name:"camera"}),i("capture.recordAgain")]})]})]})}l(En,"q");a(En,"FaceRetry");function ua(e){return Ct(e)}l(ua,"ye");a(ua,"isInAppBrowser");function da(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let s=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${s};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(da,"ge");a(da,"androidBrowserIntent");export{Kr as a,Ht as b,Wn as c,pn as d,ra as e,La as f,na as g,aa as h,ia as i,la as j,ua as k,da as l};
@@ -0,0 +1 @@
1
+ import{a as t,b as r,c as a,d as m,e as o,f as p,g as i,h as s}from"./chunk-OD63YRJW.js";import"./chunk-XKZZC74I.js";import"./chunk-37BKUH3E.js";import"./chunk-NGJMT7M3.js";import"./chunk-DDUCV6NE.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,m as PROBE_FRESH_MS,t as SAME_FACE_MAX_DROPS,i as createDocumentCapture,s as createDocumentCaptureInternal,o as faceVerdict,p as warmDocumentCapture};
@@ -1 +1 @@
1
- import{a as r,b as a,c as t,d as o,e as m,f as p}from"./chunk-UQKRYXN5.js";import"./chunk-IO7MUUC6.js";import"./chunk-Q5ZVLMKQ.js";import"./chunk-L244IUB3.js";import"./chunk-Y6PC7FZV.js";import"./chunk-KHSYTJ46.js";import"./chunk-CW56KMMH.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{r as ANALYSIS_LONG_EDGE,a as PORTRAIT_JPEG_QUALITY,m as createPortraitCaptureInternal,t as defaultGrabber,o as observe,p as warmPortraitCapture};
1
+ import{a as r,b as a,c as t,d as o,e as m,f as p}from"./chunk-T5IBMUSY.js";import"./chunk-IO7MUUC6.js";import"./chunk-Q5ZVLMKQ.js";import"./chunk-L244IUB3.js";import"./chunk-Y6PC7FZV.js";import"./chunk-KHSYTJ46.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{r as ANALYSIS_LONG_EDGE,a as PORTRAIT_JPEG_QUALITY,m as createPortraitCaptureInternal,t as defaultGrabber,o as observe,p as warmPortraitCapture};