@tsocial/tvweb-sdk 5.38.2 → 5.38.3

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 (40) hide show
  1. package/build/esm/chunk-05fa8f5c.js +1 -0
  2. package/build/esm/chunk-0da5ca80.js +1 -0
  3. package/build/esm/chunk-2c071949.js +3 -0
  4. package/build/esm/{chunk-df438efe.js → chunk-39590709.js} +2 -2
  5. package/build/esm/chunk-39bd8f09.js +1 -0
  6. package/build/esm/chunk-412186c9.js +1 -0
  7. package/build/esm/chunk-5a4684bb.js +256 -0
  8. package/build/esm/chunk-5b66da4d.js +1 -0
  9. package/build/esm/chunk-6633ffde.js +1 -0
  10. package/build/esm/{chunk-4588a2bc.js → chunk-68a33382.js} +32 -32
  11. package/build/esm/{chunk-a9d5f5ae.js → chunk-776149f4.js} +1 -1
  12. package/build/esm/chunk-804b51ae.js +1 -0
  13. package/build/esm/chunk-85504064.js +1 -0
  14. package/build/esm/{chunk-d6a3ff5a.js → chunk-8eff00f2.js} +1 -1
  15. package/build/esm/{chunk-26f22aaa.js → chunk-93ad2e94.js} +1 -1
  16. package/build/esm/chunk-abc9d931.js +1195 -0
  17. package/build/esm/{chunk-69854c99.js → chunk-b0d9736a.js} +2 -2
  18. package/build/esm/{chunk-f253519c.js → chunk-bf273baf.js} +1 -1
  19. package/build/esm/{chunk-d436b362.js → chunk-dbd45d78.js} +5 -5
  20. package/build/esm/chunk-e1e2700f.js +1 -0
  21. package/build/esm/tvweb-sdk.esm.min.js +1 -1
  22. package/build/tvweb-sdk.cjs.min.js +651 -695
  23. package/build/tvweb-sdk.standalone.js +5996 -7690
  24. package/build/tvweb-sdk.standalone.min.js +651 -695
  25. package/build/types/index.d.ts +1 -9
  26. package/package.json +5 -5
  27. package/build/esm/chunk-05ac2e29.js +0 -1
  28. package/build/esm/chunk-148a64eb.js +0 -1
  29. package/build/esm/chunk-18c2104b.js +0 -1
  30. package/build/esm/chunk-2f00d703.js +0 -1
  31. package/build/esm/chunk-30941db8.js +0 -1
  32. package/build/esm/chunk-4dbeaf6f.js +0 -256
  33. package/build/esm/chunk-5952fbfb.js +0 -1
  34. package/build/esm/chunk-67dba361.js +0 -1
  35. package/build/esm/chunk-7a1034f3.js +0 -1
  36. package/build/esm/chunk-94b9613e.js +0 -45
  37. package/build/esm/chunk-95585c1a.js +0 -3
  38. package/build/esm/chunk-bb5383fa.js +0 -1195
  39. package/build/esm/chunk-d7808881.js +0 -1
  40. package/build/esm/chunk-e2249d38.js +0 -1
@@ -0,0 +1 @@
1
+ import{Y as r}from"./chunk-abc9d931.js";import{r as o}from"./chunk-8eff00f2.js";var s=r(o());export{s as d};
@@ -0,0 +1 @@
1
+ import{j as r,r as o,s as e,$ as n,ab as t,ac as i,ad as a,ae as s,af as u,ag as d,ah as c,ai as l,aj as g,ak as f,al as p,am as h,Y as b,u as x,an as y}from"./chunk-abc9d931.js";let k=o.createContext(!1),C=({children:o,debug:e=!1})=>r.jsx(k.Provider,{value:e,children:o}),T=()=>o.useContext(k),v={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"},m={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},titleBack:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},instruction:{padding:"unset",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"},captured:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"}},error:{padding:"5px 10px",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},toggle:{color:"#d1d1d1",fontSize:"16px",fontWeight:"500",gap:"16px",backgroundColor:"#fff",active:{backgroundColor:"#2196f3"},inactive:{backgroundColor:"#ccc"}},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:"60px",height:"60px",disabled:{src:""}},loadingIcon:{src:"",width:"100px",height:"100px"},rectangleMask:{width:600,height:400,strokeWidth:2,strokeStyles:{},radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:"#fff",strokeWidth:2,strokeDasharray:"7, 4",opacity:.6},error:{fill:"rgba(234,50,35, 0.1)",strokeWidth:2,stroke:"#ea3223"}}},IDConfirmPopup:{image:{borderRadius:"5px"}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:"8px",color:"#ffffff",padding:"12px",leftOffset:"24px",focusOutlineColor:"#ffffff"},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:"#ffffff",borderRadius:"8px",fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{color:"#fff",fontSize:"20px",fontWeight:"700",backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:"5px",backgroundColor:"#e7e6e6"},guideText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"},countdownText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"}},scanTooltip:{backgroundColor:"#00ce78",borderRadius:"8px",color:"#fff",padding:"10px",textAlign:"center"},scanCountdown:{textAlign:"center",color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"none",borderRadius:"3px",padding:"5px 10px"},invalidPopup:{padding:"10px",title:{display:"block",color:v.tsSecondary,fontSize:"16px",fontWeight:"bold",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{color:"#fff",fontSize:"1rem",fontWeight:"normal",backgroundColor:v.tsBlue,border:"none",borderRadius:"3px",outline:"none",height:"66px",margin:"30px 0 0 0"},skipButton:{color:v.tsBlue,fontSize:"1rem",fontWeight:"normal",backgroundColor:"unset",border:"none",borderRadius:"unset",outline:"none",height:"unset",margin:"20px 0"}},resultText:{success:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#34ce60"},error:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#ff9532"}}}},D={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},titleBack:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},instruction:{...e.DesignToken.Typography.body,padding:"5px 10px",color:"rgba(255, 255, 255, 0.8)",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},captured:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"}},error:{...e.DesignToken.Typography.body,padding:"5px 10px",color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},toggle:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,gap:e.DesignToken.Spacing.base,backgroundColor:e.DesignToken.Color.base.white,active:{backgroundColor:e.DesignToken.Color.base.blue},inactive:{backgroundColor:e.DesignToken.Color.neutral[300]}},countdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:e.DesignToken.Height["7xl"],height:e.DesignToken.Height["7xl"],disabled:{src:""}},loadingIcon:{src:"",width:"47px",height:"47px"},rectangleMask:{width:600,height:400,strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),strokeStyles:{},radius:n.getCSSNumericValue(e.DesignToken.CornerRadius.base),paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:e.DesignToken.Color.neutral[400],strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"])},error:{fill:"none",strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),stroke:e.DesignToken.Color.semantic.error[400]}}},IDConfirmPopup:{image:{borderRadius:e.DesignToken.CornerRadius["2xs"]}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:e.DesignToken.Spacing.sm,leftOffset:"24px",focusOutlineColor:e.DesignToken.Color.base.white},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:e.DesignToken.Color.base.white,borderRadius:e.DesignToken.CornerRadius.xs,fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{...e.DesignToken.Typography.h4,backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:e.DesignToken.CornerRadius["2xs"],backgroundColor:"transparent"},guideText:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.neutral[600],textAlign:"center"},countdownText:{...e.DesignToken.UIText.medium,color:e.DesignToken.Color.neutral[500],textAlign:"center"}},scanTooltip:{backgroundColor:"transparent",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:"10px",textAlign:"center"},scanCountdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],textAlign:"center",backgroundColor:"transparent",border:"none",borderRadius:e.DesignToken.CornerRadius["2xs"],padding:"0px"},invalidPopup:{padding:"10px",title:{...e.DesignToken.Typography.h6,color:e.DesignToken.Color.content.primary,display:"none",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"24px 0 0 0"},skipButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"12px 0"}},resultText:{success:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.success[400]},error:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.warning[500]}}}},R=m,S=D,{DesignToken:W}=e,w={FlashLiveness:{maskFill:"#fff",mask:{strokeColor:W.Color.separators.secondary,strokeColorError:W.Color.semantic.error[400],strokeWidth:4,path:"M118.5 2.5C54.2233 2.5 2.5 59.5579 2.5 129.447C2.5 146.072 3.68394 172.618 8.16415 200.483C12.6369 228.301 20.4309 257.673 33.7816 279.787C46.9667 301.626 59.6817 317.047 73.3658 327.003C87.1207 337.011 101.735 341.41 118.5 341.41C135.265 341.41 149.879 337.011 163.634 327.003C177.318 317.047 190.033 301.626 203.218 279.787C216.569 257.673 224.363 228.301 228.836 200.483C233.316 172.618 234.5 146.072 234.5 129.447C234.5 59.5579 182.777 2.5 118.5 2.5Z",width:237,height:344},title:{hidden:!1,height:"auto",color:W.Color.content.primary,fontSize:W.Typography.h5.fontSize,fontWeight:W.Typography.h5.fontWeight,lineHeight:W.Typography.h5.lineHeight},guideline:{text:{close:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},far:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},flashing:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",padding:"12px 16px"}},icon:{color:W.Color.blue[900],src:""}},instruction:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",maxWidth:"200px"},timeoutText:{color:W.Color.semantic.error[400],fontSize:W.Typography.body.fontSize,fontWeight:W.Typography.body.fontWeight,padding:"0"},errorOverlay:{backgroundColor:"transparent",opacity:0},progressBar:{mainColor:W.Color.blue[900],secondaryColor:W.Color.blue[100],textColor:W.Color.blue[900],fontSize:W.Typography.body.fontSize,fontWeight:W.FontWeight["semi-bold"]},flashing:{logo:{src:"",width:"140px",height:"auto"},backgroundPattern:{srcMobile:"",srcDesktop:"",width:"100%",height:"auto"}}}},z=w,j=w,{DesignToken:_}=e,I={Selfie:{backgroundColor:"#FFF",title:{...e.DesignToken.Typography.h5,color:e.DesignToken.Color.content.primary},countdown:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"0px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{activeColor:"rgba(52, 152, 211, 1)",innerPadding:3,showDashedRing:!0,showOutsideRing:!1,dashedRingLineThick:"2",dashedRingLineSpacing:"3.5",dashedRingColor:"rgba(193, 197, 204, 1)",dashedRingOpacity:1,insideRingColor:"#fff",insideRingWidth:10,insideRingStrokeDash:"0",outsideRingOpacity:1,outsideRingColor:"#fff",errorRingWidth:0,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,errorRingColor:"#df0000",dashedRingWidth:10,dashedInsideRingColor:"#fff",dashedInsideRingWidth:3,showInsideRing:!0},progressCircleV2:{activeColor:_.Color.blue[900],neutralColor:_.Color.neutral[300],errorColor:_.Color.semantic.error[400],radius:160,strokeWidth:2,progress:0,tickWidth:15,numberOfTicks:200},Active:{instruction:{color:_.Color.content.primary,fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,textShadow:"none",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"168px",left:"",leftWidth:"150px",right:"",rightWidth:"150px",up:"",upWidth:"150px"},imageHolder:{width:"72px",height:"72px",borderRadius:"50%",border:`3px solid ${_.Color.blue[900]}`,fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:"",activeStepBorder:`1px solid ${_.Color.separators.tertiary}`,activeStepBorderRadius:"50%"}}}},O={Selfie:{backgroundColor:"rgba(0, 0, 0, 0.6)",captureIcon:{src:"",width:"50px"},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{radius:160,strokeWidth:3,progress:0,showErrorRing:!0,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:1,insideRingStrokeDash:"2",errorRingColor:"#df0000",errorRingWidth:1,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!1,showDashedRing:!1,showInsideRing:!0},Active:{instruction:{color:"#fff",fontSize:"20px",fontWeight:"normal",textShadow:"2px 2px 4px #000000",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"140px",left:"",leftWidth:"80px",right:"",rightWidth:"80px",up:"",upWidth:"80px"},imageHolder:{width:"40px",height:"40px",borderRadius:"50%",border:"2px solid #fff",fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:""}}}},A=I,{DesignToken:B}=e,P={PassiveLiveness:{instruction:{color:B.Color.content["on-bg-color"],fontSize:B.Typography.label.fontSize,fontWeight:B.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",padding:"12px 12px"}}},F=P,q=P,U={closeButton:{top:e.DesignToken.Spacing.base,right:e.DesignToken.Spacing.base,left:"auto",bottom:"auto",display:"block",src:"",width:"24px",height:"auto"},popup:{backgroundColor:e.DesignToken.Color.base.white,padding:"10px",border:"none",borderRadius:e.DesignToken.CornerRadius.sm,overlay:{backgroundColor:e.DesignToken.Color.mask[70]},title:{...e.DesignToken.Typography.h6,fontWeight:e.DesignToken.FontWeight["semi-bold"],color:e.DesignToken.Color.content.primary,textAlign:"center",display:"initial",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",border:"unset",borderRadius:"unset",margin:"30px 0 0 0",padding:"0 0 0 0"},primaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"},secondaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"}}},H={v1:{...R,...z,...O,...F,...U},v2:{...S,...j,...A,...q,...U}};function $(){if(rn)return re;rn=1;var r=s();return re=function(){try{var o=r(Object,"defineProperty");return o({},"",{}),o}catch(r){}}()}function E(){if(ri)return rt;ri=1;var r=$();return rt=function(o,e,n){"__proto__"==e&&r?r(o,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):o[e]=n}}function L(){if(rs)return ra;rs=1;var r=E(),o=u();return ra=function(e,n,t){(void 0===t||o(e[n],t))&&(void 0!==t||n in e)||r(e,n,t)}}var M,V,K,N,Q,Y,Z,G,J,X,rr,ro,re,rn,rt,ri,ra,rs,ru,rd,rc,rl,rg,rf,rp,rh,rb,rx,ry,rk,rC,rT,rv,rm,rD,rR,rS,rW,rw,rz,rj,r_,rI,rO,rA,rB,rP,rF,rq,rU,rH,r$,rE,rL,rM,rV,rK,rN,rQ,rY,rZ,rG,rJ,rX,r0,r1,r2,r3,r5,r4,r6,r7,r8,r9,or,oo,oe,on,ot,oi,oa,os,ou,od,oc,ol,og,of,op,oh,ob,ox,oy,ok,oC,oT,ov,om,oD,oR,oS,oW,ow,oz,oj,o_,oI,oO,oA,oB={exports:{}};oB.exports;function oP(){return rD?rm:(rD=1,rm=function(r,o){return function(e){return r(o(e))}})}function oF(){return rS?rR:(rS=1,rR=oP()(Object.getPrototypeOf,Object))}function oq(){if(rw)return rW;rw=1;var r=Object.prototype;return rW=function(o){var e=o&&o.constructor;return o===("function"==typeof e&&e.prototype||r)}}function oU(){if(rA)return rO;rA=1;var r=function(){if(rI)return r_;rI=1;var r=l(),o=g();return r_=function(e){return o(e)&&"[object Arguments]"==r(e)}}(),o=g(),e=Object.prototype,n=e.hasOwnProperty,t=e.propertyIsEnumerable;return rO=r(function(){return arguments}())?r:function(r){return o(r)&&n.call(r,"callee")&&!t.call(r,"callee")}}function oH(){return rP?rB:(rP=1,rB=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=0x1fffffffffffff})}function o$(){if(rq)return rF;rq=1;var r=f(),o=oH();return rF=function(e){return null!=e&&o(e.length)&&!r(e)}}var oE={exports:{}};function oL(){var r,o,e,n,t,i,a,s;if(rL)return oE.exports;return rL=1,r=oE,o=oE.exports,e=d(),n=rE?r$:(rE=1,r$=function(){return!1}),s=(a=(i=(t=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&i.exports===t?e.Buffer:void 0)?a.isBuffer:void 0,r.exports=s||n,oE.exports}function oM(){if(rV)return rM;rV=1;var r=l(),o=oF(),e=g(),n=Object.prototype,t=Function.prototype.toString,i=n.hasOwnProperty,a=t.call(Object);return rM=function(n){if(!e(n)||"[object Object]"!=r(n))return!1;var s=o(n);if(null===s)return!0;var u=i.call(s,"constructor")&&s.constructor;return"function"==typeof u&&u instanceof u&&t.call(u)==a}}oE.exports;var oV={exports:{}};oV.exports;function oK(){if(rJ)return rG;rJ=1;var r=function(){if(rN)return rK;rN=1;var r=l(),o=oH(),e=g(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,rK=function(t){return e(t)&&o(t.length)&&!!n[r(t)]}}(),o=rY?rQ:(rY=1,rQ=function(r){return function(o){return r(o)}}),e=function(){var r,o,e,n,t,i;if(rZ)return oV.exports;return rZ=1,r=oV,o=oV.exports,e=p(),i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n&&e.process,r.exports=function(){try{var r=t&&t.require&&t.require("util").types;if(r)return r;return i&&i.binding&&i.binding("util")}catch(r){}}(),oV.exports}(),n=e&&e.isTypedArray;return rG=n?o(n):r}function oN(){return r0?rX:(r0=1,rX=function(r,o){if("constructor"!==o||"function"!=typeof r[o]){if("__proto__"!=o)return r[o]}})}function oQ(){if(r5)return r3;r5=1;var r=function(){if(r2)return r1;r2=1;var r=E(),o=u(),e=Object.prototype.hasOwnProperty;return r1=function(n,t,i){var a=n[t];e.call(n,t)&&o(a,i)&&(void 0!==i||t in n)||r(n,t,i)}}(),o=E();return r3=function(e,n,t,i){var a=!t;t||(t={});for(var s=-1,u=n.length;++s<u;){var d=n[s],c=i?i(t[d],e[d],d,t,e):void 0;void 0===c&&(c=e[d]),a?o(t,d,c):r(t,d,c)}return t}}function oY(){if(r8)return r7;r8=1;var r=/^(?:0|[1-9]\d*)$/;return r7=function(o,e){var n=typeof o;return!!(e=null==e?0x1fffffffffffff:e)&&("number"==n||"symbol"!=n&&r.test(o))&&o>-1&&o%1==0&&o<e}}function oZ(){if(or)return r9;or=1;var r=r6?r4:(r6=1,r4=function(r,o){for(var e=-1,n=Array(r);++e<r;)n[e]=o(e);return n}),o=oU(),e=h(),n=oL(),t=oY(),i=oK(),a=Object.prototype.hasOwnProperty;return r9=function(s,u){var d=e(s),c=!d&&o(s),l=!d&&!c&&n(s),g=!d&&!c&&!l&&i(s),f=d||c||l||g,p=f?r(s.length,String):[],h=p.length;for(var b in s)(u||a.call(s,b))&&!(f&&("length"==b||l&&("offset"==b||"parent"==b)||g&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||t(b,h)))&&p.push(b);return p}}function oG(){if(oa)return oi;oa=1;var r=oZ(),o=function(){if(ot)return on;ot=1;var r=c(),o=oq(),e=oe?oo:(oe=1,oo=function(r){var o=[];if(null!=r)for(var e in Object(r))o.push(e);return o}),n=Object.prototype.hasOwnProperty;return on=function(t){if(!r(t))return e(t);var i=o(t),a=[];for(var s in t)"constructor"==s&&(i||!n.call(t,s))||a.push(s);return a}}(),e=o$();return oi=function(n){return e(n)?r(n,!0):o(n)}}function oJ(){return op?of:(op=1,of=function(r){return r})}function oX(){return ob?oh:(ob=1,oh=function(r,o,e){switch(e.length){case 0:return r.call(o);case 1:return r.call(o,e[0]);case 2:return r.call(o,e[0],e[1]);case 3:return r.call(o,e[0],e[1],e[2])}return r.apply(o,e)})}function o0(){if(ow)return oW;ow=1;var r=oJ(),o=function(){if(oy)return ox;oy=1;var r=oX(),o=Math.max;return ox=function(e,n,t){return n=o(void 0===n?e.length-1:n,0),function(){for(var i=arguments,a=-1,s=o(i.length-n,0),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=i[a];return d[n]=t(u),r(e,this,d)}}}(),e=function(){if(oS)return oR;oS=1;var r=function(){if(ov)return oT;ov=1;var r=oC?ok:(oC=1,ok=function(r){return function(){return r}}),o=$(),e=oJ();return oT=o?function(e,n){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:e}();return oR=(function(){if(oD)return om;oD=1;var r=Date.now;return om=function(o){var e=0,n=0;return function(){var t=r(),i=16-(t-n);if(n=t,i>0){if(++e>=800)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}})()(r)}();return oW=function(n,t){return e(o(n,t,r),n+"")}}function o1(){if(oj)return oz;oj=1;var r=u(),o=o$(),e=oY(),n=c();return oz=function(t,i,a){if(!n(a))return!1;var s=typeof i;return("number"==s?!!(o(a)&&e(i,a.length)):"string"==s&&i in a)&&r(a[i],t)}}function o2(){if(oI)return o_;oI=1;var r=o0(),o=o1();return o_=function(e){return r(function(r,n){var t=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),r=Object(r);++t<i;){var u=n[t];u&&e(r,u,t,a)}return r})}}var o3=b(function(){if(oA)return oO;oA=1;var r=function(){if(og)return ol;og=1;var r=function(){if(ro)return rr;ro=1;var r=t(),o=function(){if(V)return M;V=1;var r=t();return M=function(){this.__data__=new r,this.size=0}}(),e=N?K:(N=1,K=function(r){var o=this.__data__,e=o.delete(r);return this.size=o.size,e}),n=Y?Q:(Y=1,Q=function(r){return this.__data__.get(r)}),s=G?Z:(G=1,Z=function(r){return this.__data__.has(r)}),u=function(){if(X)return J;X=1;var r=t(),o=i(),e=a();return J=function(n,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!o||a.length<199)return a.push([n,t]),this.size=++i.size,this;i=this.__data__=new e(a)}return i.set(n,t),this.size=i.size,this}}();function d(o){var e=this.__data__=new r(o);this.size=e.size}return d.prototype.clear=o,d.prototype.delete=e,d.prototype.get=n,d.prototype.has=s,d.prototype.set=u,rr=d}(),o=L(),e=rl?rc:(rl=1,rc=(rd?ru:(rd=1,ru=function(r){return function(o,e,n){for(var t=-1,i=Object(o),a=n(o),s=a.length;s--;){var u=a[r?s:++t];if(!1===e(i[u],u,i))break}return o}}))()),n=function(){if(oc)return od;oc=1;var r=L(),o=function(){var r,o,e,n,t,i,a;if(rg)return oB.exports;return rg=1,r=oB,o=oB.exports,e=d(),a=(i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n?e.Buffer:void 0)?i.allocUnsafe:void 0,r.exports=function(r,o){if(o)return r.slice();var e=r.length,n=a?a(e):new r.constructor(e);return r.copy(n),n},oB.exports}(),e=function(){if(ry)return rx;ry=1;var r=function(){if(rb)return rh;rb=1;var r=rp?rf:(rp=1,rf=d().Uint8Array);return rh=function(o){var e=new o.constructor(o.byteLength);return new r(e).set(new r(o)),e}}();return rx=function(o,e){var n=e?r(o.buffer):o.buffer;return new o.constructor(n,o.byteOffset,o.length)}}(),n=rC?rk:(rC=1,rk=function(r,o){var e=-1,n=r.length;for(o||(o=Array(n));++e<n;)o[e]=r[e];return o}),t=function(){if(rj)return rz;rj=1;var r=function(){if(rv)return rT;rv=1;var r=c(),o=Object.create;return rT=function(){function e(){}return function(n){if(!r(n))return{};if(o)return o(n);e.prototype=n;var t=new e;return e.prototype=void 0,t}}()}(),o=oF(),e=oq();return rz=function(n){return"function"!=typeof n.constructor||e(n)?{}:r(o(n))}}(),i=oU(),a=h(),s=function(){if(rH)return rU;rH=1;var r=o$(),o=g();return rU=function(e){return o(e)&&r(e)}}(),u=oL(),l=f(),p=c(),b=oM(),x=oK(),y=oN(),k=function(){if(ou)return os;ou=1;var r=oQ(),o=oG();return os=function(e){return r(e,o(e))}}();return od=function(d,c,g,f,h,C,T){var v=y(d,g),m=y(c,g),D=T.get(m);if(D)return void r(d,g,D);var R=C?C(v,m,g+"",d,c,T):void 0,S=void 0===R;if(S){var W=a(m),w=!W&&u(m),z=!W&&!w&&x(m);R=m,W||w||z?a(v)?R=v:s(v)?R=n(v):w?(S=!1,R=o(m,!0)):z?(S=!1,R=e(m,!0)):R=[]:b(m)||i(m)?(R=v,i(v)?R=k(v):(!p(v)||l(v))&&(R=t(m))):S=!1}S&&(T.set(m,R),h(R,m,f,C,T),T.delete(m)),r(d,g,R)}}(),s=c(),u=oG(),l=oN();return ol=function t(i,a,d,c,g){i!==a&&e(a,function(e,u){if(g||(g=new r),s(e))n(i,a,u,d,t,c,g);else{var f=c?c(l(i,u),e,u+"",i,a,g):void 0;void 0===f&&(f=e),o(i,u,f)}},u)}}();return oO=o2()(function(o,e,n){r(o,e,n)})}());let o5=r=>{let{customTheme:e,clientSettings:n,themeVersion:t,uiSettings:i,defaultThemes:a=H}=r,s=x.getWebSetting(n,"data.settings.sdk_settings.ui_custom_settings");return o.useMemo(()=>{let r=y.selectUiSettings(i,s);return{...o3({},y.mapUISettingsToCustomTheme(r),e),themeVersion:t,defaultThemes:a}},[e,a,t,i,s])},o4=()=>{},o6=o.createContext({onDoneCallback:o4,onErrorCallback:o4,onCloseCallback:o4}),o7=({children:e,onDone:n=o4,onError:t=o4,onClose:i=o4})=>{let a=o.useCallback(r=>{n&&n(r)},[n]),s=o.useCallback(r=>{t&&t(r)},[t]),u=o.useCallback(()=>{i&&i()},[i]),d=o.useMemo(()=>({onDoneCallback:a,onErrorCallback:s,onCloseCallback:u}),[a,s,u]);return r.jsx(o6.Provider,{value:d,children:e})},o8=()=>{let r=o.useContext(o6);if(void 0===r)throw Error("useSDKCallback must be used within a SDKCallbackProvider");return r},o9=o.createContext(""),er=({children:o,isWrappedBy:e=""})=>r.jsx(o9.Provider,{value:e,children:o}),eo=()=>o.useContext(o9);export{C as D,o7 as S,er as W,T as a,eo as b,o5 as c,D as d,H as e,o2 as f,oG as g,oM as h,o0 as i,oX as j,oP as k,oq as l,o3 as m,oZ as n,o$ as o,o1 as p,oQ as r,v as t,o8 as u};
@@ -0,0 +1,3 @@
1
+ import{o as e,P as i,s as t,x as c,Q as o,e as n,n as r,j as a}from"./chunk-abc9d931.js";let s=e.img`
2
+ width: ${({width:e})=>e};
3
+ `;function l({type:e}){let i=c(),l=o(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),F=o(`Selfie.Active.directionIcon.${t.FaceDirection.FRONTAL}`,"frontal_arrow.svg"),d=n(`Selfie.Active.directionIcon.${e}Width`)({theme:i}),f=r(i,`Selfie.Active.directionIcon.${e}`);return null===f?a.jsx(a.Fragment,{}):e===t.FaceDirection.FRONTAL&&F?a.jsx(s,{src:F,width:d,alt:""}):f&&null!==f?a.jsx(s,{src:r(i,`Selfie.Active.directionIcon.${e}`),width:d,alt:""}):a.jsx(s,{src:l,alt:"",width:d})}l.propTypes={type:i.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},l.defaultProps={type:t.FaceDirection.LEFT};export{l as D};
@@ -1,3 +1,3 @@
1
- import{i as e,P as r,s as t,A as n,U as s,m as i,b as a,j as o,C as c,r as l,aI as u,c as m,a4 as p,k as d,aJ as f}from"./chunk-bb5383fa.js";import{M as g,O as h,W as j,C as x}from"./chunk-d436b362.js";import{u as F}from"./chunk-148a64eb.js";import{p as y,g as C,a as D,O as S,I as b,h as I,F as T,i as v,j as E,L as k,b as L,S as R}from"./chunk-4dbeaf6f.js";import{u as V}from"./chunk-30941db8.js";import"./chunk-05ac2e29.js";import"./chunk-d6a3ff5a.js";import"./chunk-7a1034f3.js";import"./chunk-67dba361.js";let _=e.img`
1
+ import{o as e,P as r,s as t,x as n,Q as s,e as i,n as a,j as o,y as c,r as l,aH as u,c as m,a2 as p,b as d,aI as f}from"./chunk-abc9d931.js";import{M as g,O as h,W as x,C as F}from"./chunk-dbd45d78.js";import{u as j}from"./chunk-39bd8f09.js";import{p as y,g as C,a as D,O as S,I as b,h as I,F as T,i as v,j as E,L as L,b as R,S as k}from"./chunk-5a4684bb.js";import{u as V}from"./chunk-0da5ca80.js";import"./chunk-05fa8f5c.js";import"./chunk-8eff00f2.js";import"./chunk-e1e2700f.js";let _=e.img`
2
2
  width: ${({width:e})=>e};
3
- `;function w({type:e}){let r=n(),t=s(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),c=i(`Selfie.Active.directionIcon.${e}Width`)({theme:r}),l=a(r,`Selfie.Active.directionIcon.${e}`);return null===l?o.jsx(o.Fragment,{}):l&&null!==l?o.jsx(_,{src:a(r,`Selfie.Active.directionIcon.${e}`),width:c,alt:""}):o.jsx(_,{src:t,alt:"",width:c})}w.propTypes={type:r.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},w.defaultProps={type:t.FaceDirection.LEFT};let A=d.isMobile?{width:{ideal:640}}:null,$=({stepNumber:e,type:r,theme:t})=>{let n=f(`instruction_${r}.svg`),s=a(t,`Selfie.Active.imageHolder.${r}`);return null===s?o.jsx(o.Fragment,{}):"string"==typeof s&&""!==s?o.jsx("img",{src:s,alt:""}):"v1"===a(t,"themeVersion")?o.jsx("span",{children:e}):o.jsx("img",{src:n,alt:""})};function P(e){var r,f;let{apiCheck:_,onLivenessDetectionDone:w,captureFrameSettings:P,onFramesCaptured:N,frontCamera:H,flipVideoHorizontal:O,customDirectionIcon:M,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,defaultCameraId:Y,offsetFaceY:J,styledComponent:q,isLoading:Q,serviceSettings:X,onReset:Z}=e,ee=n(),{onErrorCallback:er,onCloseCallback:et}=V(),en=c.useAsset("bg_camera_mask.png"),es=c.useAsset("bg_camera_mask_red.png"),ei=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[ea,eo]=l.useState({}),{yFaceVerificationStepsWrapper:ec,yFaceDetectionError:el}=ea,[eu,em]=l.useState(""),[ep,ed]=l.useState(),ef=l.useMemo(()=>({backgroundColor:i("Selfie.backgroundColor")({theme:ee})}),[ee]);u(a(ee,"themeVersion"),"up_arrow.gif"),u(a(ee,"themeVersion"),"left_arrow.gif"),u(a(ee,"themeVersion"),"right_arrow.gif"),u(a(ee,"themeVersion"),"frontal_arrow.gif"),u(a(ee,"themeVersion"),"instruction_up.svg"),u(a(ee,"themeVersion"),"instruction_left.svg"),u(a(ee,"themeVersion"),"instruction_right.svg"),u(a(ee,"themeVersion"),"instruction_frontal.svg");let eg=l.useCallback(({clientHeight:e,videoAreaWidth:r,videoAreaHeight:t,lostX:n,lostY:s})=>{let i,a;d.isMobile?a=i=r:i=a=t-200;let o=Math.floor((r-i)/2)+n,c=5+s,l=s+25,u=l+30;eo({yFaceDetectionError:l,yFaceVerificationStepsWrapper:u+a+20});let m=Math.floor(s),p=Math.floor(e-s);return c=Math.floor(u),0!==J&&(c+J<m||c+J+a>p)?er({code:`offsetFaceY must be in [-${c-m}, ${p-a-c}]`}):c+=J,{x:o,y:c,width:i,height:a}},[J,er]),{shouldResetFlowOnOrientationChange:eh,cropArea:ej,curStepIndex:ex,directionIcon:eF,directionIconAnimation:ey,faceDetectionError:eC,resetFlow:eD,handleVideoPlayed:eS,instructions:eb,refVideo:eI,refIsReseting:eT,steps:ev,videoPlayed:eE,activeCapturing:ek,warmupDone:eL,showLoading:eR}=F({currentOrientation:ep,apiCheck:_,bgCameraMask:en,bgCameraMaskRed:es,surroundStyle:ef,onLivenessDetectionDone:w,onError:er,cropAreaDimension:eg,customDirectionIcon:M,captureFrameSettings:P,onFramesCaptured:N,setRemainingTime:em,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,serviceSettings:X,onReset:Z});l.useEffect(()=>{"string"==typeof ev[0]?.directionIcon&&Promise.all(ev.map(e=>y(e.directionIcon)))},[ev]);let{CloseCameraButton:eV}=q,e_=C(e,ee),ew=eT.current?0:ex/ev.length*100,{lang:eA}=m.useSDKSettings(),e$=l.useRef(0),eP=l.useRef({}),eN=l.useRef(t.ErrorDuration.SHORT),eH=l.useMemo(()=>{let{msg:e,duration:r=t.ErrorDuration.SHORT}=eC||{},n=e?.[eA];return Date.now()-e$.current>=eN.current&&(e$.current=Date.now(),eN.current=r,eP.current=n),eP.current},[eC,ex]),eO=l.useCallback(e=>{ed(e),eh?eD():e===g.LANDSCAPE?eI.current?.pause():eI.current?.play()},[eI,eD,eh]);return o.jsx(h,{onOrientationChange:eO,children:o.jsxs(p,{frontCamera:H,onVideoPlayed:eS,onClose:et,flipHorizontal:O??H,ref:eI,videoSettings:A,onError:er,scale:z,defaultCameraId:Y,closeButton:eV||null,children:[!eL&&o.jsx(j,{}),eE?o.jsxs(o.Fragment,{children:[ej.current?o.jsxs(x,{x:`${ej.current.x}px`,y:`${ej.current.y}px`,width:`${ej.current.width}px`,height:`${ej.current.height}px`,surroundStyle:ej.current.surroundStyle,children:[o.jsx(D,{}),o.jsx(S,{...e_,progress:ew,showErrorRing:!!eC&&i("Selfie.progressCircle.showErrorRing")({theme:ee})}),o.jsx(b,{children:(r=eF,f=ey,r?"string"==typeof r?o.jsx("img",{className:f,src:r,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):r:null)}),ek&&o.jsx(I,{})]}):null,eb?o.jsxs(o.Fragment,{children:[o.jsx(T,{top:ec+5,className:"instructions",children:eb}),o.jsx(v,{top:ec+35,children:ev.map((e,r)=>{let{name:t,image:{objUrl:n}}=e;return o.jsx(E,{active:ex>=r,className:"step-item",children:n?o.jsx("img",{className:"image_preview",src:n,alt:""}):o.jsx($,{stepNumber:r+1,type:t,theme:ee})},t)})})]}):null]}):null,(eR||Q)&&o.jsx(k,{children:o.jsx("img",{src:ei,alt:"",className:"spin"})}),eu&&o.jsx(L,{top:ec-30,children:eu}),"string"==typeof eH?o.jsx(R,{top:el-15,className:"face-detection-error",children:eH}):null]})})}P.propTypes={apiCheck:r.bool,onLivenessDetectionDone:r.func,onClose:r.func,onError:r.func,onReset:r.func,captureFrameSettings:r.shape({}),onFramesCaptured:r.func,flipVideoHorizontal:r.bool,frontCamera:r.bool,isLoading:r.bool,customDirectionIcon:r.shape({}),customStepTimeConstraints:r.shape({}),onProcessing:r.func,customErrors:r.shape({}),apiCredentials:r.shape({accessKey:r.string,secretKey:r.string,apiUrl:r.string}),outputEncryptionSettings:r.shape({}),cameraScale:r.number,defaultCameraId:r.string,offsetFaceY:r.number,styledComponent:r.shape({CloseCameraButton:r.node}),serviceSettings:r.shape({})},P.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[t.FaceDirection.LEFT]:o.jsx(w,{type:t.FaceDirection.LEFT}),[t.FaceDirection.RIGHT]:o.jsx(w,{type:t.FaceDirection.RIGHT}),[t.FaceDirection.UP]:o.jsx(w,{type:t.FaceDirection.UP}),[t.FaceDirection.FRONTAL]:o.jsx(w,{type:t.FaceDirection.FRONTAL})},customStepTimeConstraints:{[t.FaceDirection.UP]:{delayTime:0},[t.FaceDirection.LEFT]:{delayTime:0},[t.FaceDirection.RIGHT]:{delayTime:0},[t.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
3
+ `;function w({type:e}){let r=n(),t=s(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),c=i(`Selfie.Active.directionIcon.${e}Width`)({theme:r}),l=a(r,`Selfie.Active.directionIcon.${e}`);return null===l?o.jsx(o.Fragment,{}):l&&null!==l?o.jsx(_,{src:a(r,`Selfie.Active.directionIcon.${e}`),width:c,alt:""}):o.jsx(_,{src:t,alt:"",width:c})}w.propTypes={type:r.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},w.defaultProps={type:t.FaceDirection.LEFT};let A=d.isMobile?{width:{ideal:640}}:null,$=({stepNumber:e,type:r,theme:t})=>{let n=f(`instruction_${r}.svg`),s=a(t,`Selfie.Active.imageHolder.${r}`);return null===s?o.jsx(o.Fragment,{}):"string"==typeof s&&""!==s?o.jsx("img",{src:s,alt:""}):"v1"===a(t,"themeVersion")?o.jsx("span",{children:e}):o.jsx("img",{src:n,alt:""})};function P(e){var r,f;let{apiCheck:_,onLivenessDetectionDone:w,captureFrameSettings:P,onFramesCaptured:H,frontCamera:N,flipVideoHorizontal:O,customDirectionIcon:M,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,defaultCameraId:Y,offsetFaceY:Q,styledComponent:q,isLoading:J,serviceSettings:X,onReset:Z}=e,ee=n(),{onErrorCallback:er,onCloseCallback:et}=V(),en=c.useAsset("bg_camera_mask.png"),es=c.useAsset("bg_camera_mask_red.png"),ei=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[ea,eo]=l.useState({}),{yFaceVerificationStepsWrapper:ec,yFaceDetectionError:el}=ea,[eu,em]=l.useState(""),[ep,ed]=l.useState(),ef=l.useMemo(()=>({backgroundColor:i("Selfie.backgroundColor")({theme:ee})}),[ee]);u(a(ee,"themeVersion"),"up_arrow.gif"),u(a(ee,"themeVersion"),"left_arrow.gif"),u(a(ee,"themeVersion"),"right_arrow.gif"),u(a(ee,"themeVersion"),"frontal_arrow.gif"),u(a(ee,"themeVersion"),"instruction_up.svg"),u(a(ee,"themeVersion"),"instruction_left.svg"),u(a(ee,"themeVersion"),"instruction_right.svg"),u(a(ee,"themeVersion"),"instruction_frontal.svg");let eg=l.useCallback(({clientHeight:e,videoAreaWidth:r,videoAreaHeight:t,lostX:n,lostY:s})=>{let i,a;d.isMobile?a=i=r:i=a=t-200;let o=Math.floor((r-i)/2)+n,c=5+s,l=s+25,u=l+30;eo({yFaceDetectionError:l,yFaceVerificationStepsWrapper:u+a+20});let m=Math.floor(s),p=Math.floor(e-s);return c=Math.floor(u),0!==Q&&(c+Q<m||c+Q+a>p)?er({code:`offsetFaceY must be in [-${c-m}, ${p-a-c}]`}):c+=Q,{x:o,y:c,width:i,height:a}},[Q,er]),{shouldResetFlowOnOrientationChange:eh,cropArea:ex,curStepIndex:eF,directionIcon:ej,directionIconAnimation:ey,faceDetectionError:eC,resetFlow:eD,handleVideoPlayed:eS,instructions:eb,refVideo:eI,refIsReseting:eT,steps:ev,videoPlayed:eE,activeCapturing:eL,warmupDone:eR,showLoading:ek}=j({currentOrientation:ep,apiCheck:_,bgCameraMask:en,bgCameraMaskRed:es,surroundStyle:ef,onLivenessDetectionDone:w,onError:er,cropAreaDimension:eg,customDirectionIcon:M,captureFrameSettings:P,onFramesCaptured:H,setRemainingTime:em,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,serviceSettings:X,onReset:Z});l.useEffect(()=>{"string"==typeof ev[0]?.directionIcon&&Promise.all(ev.map(e=>y(e.directionIcon)))},[ev]);let{CloseCameraButton:eV}=q,e_=C(e,ee),ew=eT.current?0:eF/ev.length*100,{lang:eA}=m.useSDKSettings(),e$=l.useRef(0),eP=l.useRef({}),eH=l.useRef(t.ErrorDuration.SHORT),eN=l.useMemo(()=>{let{msg:e,duration:r=t.ErrorDuration.SHORT}=eC||{},n=e?.[eA];return Date.now()-e$.current>=eH.current&&(e$.current=Date.now(),eH.current=r,eP.current=n),eP.current},[eC,eF]),eO=l.useCallback(e=>{ed(e),eh?eD():e===g.LANDSCAPE?eI.current?.pause():eI.current?.play()},[eI,eD,eh]);return o.jsx(h,{onOrientationChange:eO,children:o.jsxs(p,{frontCamera:N,onVideoPlayed:eS,onClose:et,flipHorizontal:O??N,ref:eI,videoSettings:A,onError:er,scale:z,defaultCameraId:Y,closeButton:eV||null,children:[!eR&&o.jsx(x,{}),eE?o.jsxs(o.Fragment,{children:[ex.current?o.jsxs(F,{x:`${ex.current.x}px`,y:`${ex.current.y}px`,width:`${ex.current.width}px`,height:`${ex.current.height}px`,surroundStyle:ex.current.surroundStyle,children:[o.jsx(D,{}),o.jsx(S,{...e_,progress:ew,showErrorRing:!!eC&&i("Selfie.progressCircle.showErrorRing")({theme:ee})}),o.jsx(b,{children:(r=ej,f=ey,r?"string"==typeof r?o.jsx("img",{className:f,src:r,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):r:null)}),eL&&o.jsx(I,{})]}):null,eb?o.jsxs(o.Fragment,{children:[o.jsx(T,{top:ec+5,className:"instructions",children:eb}),o.jsx(v,{top:ec+35,children:ev.map((e,r)=>{let{name:t,image:{objUrl:n}}=e;return o.jsx(E,{active:eF>=r,className:"step-item",children:n?o.jsx("img",{className:"image_preview",src:n,alt:""}):o.jsx($,{stepNumber:r+1,type:t,theme:ee})},t)})})]}):null]}):null,(ek||J)&&o.jsx(L,{children:o.jsx("img",{src:ei,alt:"",className:"spin"})}),eu&&o.jsx(R,{top:ec-30,children:eu}),"string"==typeof eN?o.jsx(k,{top:el-15,className:"face-detection-error",children:eN}):null]})})}P.propTypes={apiCheck:r.bool,onLivenessDetectionDone:r.func,onClose:r.func,onError:r.func,onReset:r.func,captureFrameSettings:r.shape({}),onFramesCaptured:r.func,flipVideoHorizontal:r.bool,frontCamera:r.bool,isLoading:r.bool,customDirectionIcon:r.shape({}),customStepTimeConstraints:r.shape({}),onProcessing:r.func,customErrors:r.shape({}),apiCredentials:r.shape({accessKey:r.string,secretKey:r.string,apiUrl:r.string}),outputEncryptionSettings:r.shape({}),cameraScale:r.number,defaultCameraId:r.string,offsetFaceY:r.number,styledComponent:r.shape({CloseCameraButton:r.node}),serviceSettings:r.shape({})},P.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[t.FaceDirection.LEFT]:o.jsx(w,{type:t.FaceDirection.LEFT}),[t.FaceDirection.RIGHT]:o.jsx(w,{type:t.FaceDirection.RIGHT}),[t.FaceDirection.UP]:o.jsx(w,{type:t.FaceDirection.UP}),[t.FaceDirection.FRONTAL]:o.jsx(w,{type:t.FaceDirection.FRONTAL})},customStepTimeConstraints:{[t.FaceDirection.UP]:{delayTime:0},[t.FaceDirection.LEFT]:{delayTime:0},[t.FaceDirection.RIGHT]:{delayTime:0},[t.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
@@ -0,0 +1 @@
1
+ import{r as e,n as t,u as a,aG as n,s as s,c as i,a9 as r,d as l,I as c,ap as o,ao as m,f as g,L as u,b as _,aJ as f,aK as d,F as b,W as h,D as p,M as v,au as F,k as k,aA as w}from"./chunk-abc9d931.js";import{d as y}from"./chunk-05fa8f5c.js";import{t as I}from"./chunk-8eff00f2.js";import{w as T,m as R,n as S,t as L,u as x,o as B,q as D,r as E,v as A,s as M,x as O}from"./chunk-5a4684bb.js";import{m as N}from"./chunk-0da5ca80.js";import{u as P}from"./chunk-e1e2700f.js";let C=async({steps:e,apiClient:t,FaceDirection:a,outputEncryptionSettings:n,video:s})=>{let i=[];e.forEach(e=>{let{name:s,image:r,frontalFaceImage:l}=e;if(s!==a.FRONTAL){let e={label:"portrait",metadata:JSON.stringify({gesture_score:r.leftRightScore,gesture:s})};if(n&&n.key){let a=new Blob([r.encrypted.hex]);i.push(t.uploadImage({file:a,...e},{"X-TV-Key":n.key}))}else i.push(t.uploadImage({file:r.blob,...e}))}else i.push(Promise.resolve({data:{image_id:null}}));if(l.blob){let e={label:"portrait",metadata:JSON.stringify({gesture_score:l.leftRightScore,gesture:a.FRONTAL})};if(n&&n.key){let a=new Blob([l.encrypted.hex]);i.push(t.uploadImage({file:a,...e},{"X-TV-Key":n.key}))}else i.push(t.uploadImage({file:l.blob,...e}))}else i.push(Promise.resolve({data:{image_id:null}}))});let r=s?t.uploadFile({file:s,label:"video"}):Promise.resolve({data:{file_id:null}}),[l,...c]=await Promise.all([r,...i]);return e.forEach((e,t)=>{e.image.imageId=c[2*t].data.image_id,e.frontalFaceImage.imageId=c[2*t+1].data.image_id}),l},U=async({apiClient:e,faceVerificationFlowData:t,onLivenessDetectionDone:a,captureFrameSettings:n,FaceDirection:s,onError:i,outputEncryptionSettings:r,video:l,enabledServices:c,capturedFrames:o})=>{try{let i=t.current.steps;await C({steps:i,apiClient:e,FaceDirection:s,outputEncryptionSettings:r,video:l});let m=i.filter(e=>e.frontalFaceImage.imageId);if(0===m.length)a({error:"wrong_face_movement"});else{await T();let t=R(n);if(t){let n=null;c.enableVerifyFaceLiveness&&(n=e.verifyFaceLiveness({images:m.map(e=>({id:e.frontalFaceImage.imageId})),gesture_images:i.filter(e=>e.image.imageId&&e.name!==s.FRONTAL).map(({name:e,image:{imageId:t}})=>({gesture:e,images:[{id:t}]})),videos:t}));let r=null;c.enableVerifySanityPortrait&&(r=e.requestVerifyPortrait({image:{id:m[m.length-1].frontalFaceImage.imageId}}));let[l,g]=await Promise.all([n,r]),u=l?.data.is_live===!0;a({apiCheckPassed:u,verifyFaceLivenessResult:l?.data??null,verifyFacePortraitResult:g?.data??null,frontalFaces:m.map(e=>({id:e.frontalFaceImage.imageId,blob:e.frontalFaceImage.blob})),steps:i.filter(e=>e.image.imageId&&e.name!==s.FRONTAL).map(({name:e,image:t})=>({name:e,blob:t.blob,id:t.imageId})),uploadFramesResult:t,capturedFrames:o})}else a({error:"network_error"})}}catch(e){i({error:e})}},j=n.faceTracker(),V=new f,{FaceDirection:W,Errors:J,Messages:K,TrackLivenessEvents:$}=s,z={enable:!1,framesIntervalTime:180,framesBatchLength:0},q={[s.FaceDirection.UP]:{delayTime:0},[s.FaceDirection.LEFT]:{delayTime:0},[s.FaceDirection.RIGHT]:{delayTime:0},[s.FaceDirection.FRONTAL]:{delayTime:2e3}},G=()=>{},H=()=>{},X=()=>{};function Z({apiCheck:f,bgCameraMask:T,bgCameraMaskRed:R,surroundStyle:C,cropAreaDimension:Q,customInstructions:Y,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea=q,onLivenessDetectionDone:en,onError:es,frontalMinSize:ei,waitingTimeToGetBetterFrames:er=500,captureFrameSettings:el=z,setRemainingTime:ec=G,onProcessing:eo=X,customErrors:em,customMessages:eg,apiCredentials:eu={},onFramesCaptured:e_=H,initFirstGestureTimeout:ef=2e3,outputEncryptionSettings:ed,cameraScale:eb=1,sendCustomEvent:eh,serviceSettings:ep,currentOrientation:ev,onReset:eF}={}){let[ek,ew]=e.useState(!1),[ey,eI]=e.useState(!1),[eT,eR]=e.useState(!1),[eS,eL]=e.useState(!1),ex=e.useRef(null),{lang:eB,assetRoot:eD,customUrls:eE,exifKey:eA}=i.useSDKSettings(),eM=r.useSDKLocale(),{apiClient:eO}=l.useApiClient({apiCredentials:eu}),[,eN]=e.useReducer(e=>e+1,0),eP=e.useRef(null),eC=e.useRef(!1),[eU,ej]=e.useState(!1),eV=e.useRef({}),{sendEvent:eW}=c.useSDKTracking(),eJ=e.useRef(null);null===eJ.current&&(eJ.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Y,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea,Locale:eM,lang:eB}));let[eK,e$]=e.useState(),ez=e.useCallback(e=>{e$(e)},[]),eq=e.useMemo(()=>I(ez,500),[ez]),eG=e.useRef([]),eH=e.useRef(),eX=P(),{faceTrackingSetting:eZ,flowIntervalTimeMs:eQ,limitTimeLivenessCheck:eY,terminateIfNoFace:e0,closeEyeSettings:e1,captureFrameSettings:e4,exifDataSettings:e6,recordVideo:e2,waitBeforeStartFlowMs:e3,resetFlowOnOrientationChange:e5,autoGenFrameIds:e8}=function({captureFrameSettingsProp:n,clientSettings:s}){return e.useMemo(()=>{let e,i=N({},S,s),r={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.enable"),webTerminateThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.web_terminate_threshold"),webWarningThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.web_warning_threshold"),limitFor:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.limit_for"),maxWarningTime:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.max_warning_time")},l=t(i,"data.settings.sdk_settings.active_liveness_settings.reset_flow_on_orientation_change"),c=t(i,"data.settings.sdk_settings.active_liveness_settings.wait_before_start_flow_ms"),o=t(i,"data.settings.sdk_settings.active_liveness_settings.flow_interval_time_ms"),m=t(i,"data.settings.sdk_settings.active_liveness_settings.take_one_picture_time_ms"),g=a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.max_retry_count"),u={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.enable"),limitTimeSecond:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.limit_time_second"),remainTimeShow:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.remain_time_show"),format:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.format"),enableMaxRetries:g>0,totalMaxRetries:g,interruptible:!a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.non_stoppable")},_={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.enable"),maxInvalidFrame:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_invalid_frame"),maxTimeMs:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_time_ms")},f={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.enable"),webThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.web_threshold"),webTimeout:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.web_timeout"),forceCheck:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.force_check")},d={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.exif_data_settings.enable")},b={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.record_video.enable")},h=t(s,"data.settings.sdk_settings.active_liveness_settings.save_encoded_frames");e=h?{enable:h.enable,enableLogging:h.enable_logging,framesBatchLength:h.frames_batch_len,framesIntervalTime:h.frames_interval_ms}:n;let p={enable:a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.auto_gen_frame_ids.enable")&&u.enable,maxItems:a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.auto_gen_frame_ids.max_items")};return{faceTrackingSetting:r,resetFlowOnOrientationChange:l,waitBeforeStartFlowMs:c,flowIntervalTimeMs:o,takeOnePictureTimeMs:m,limitTimeLivenessCheck:u,terminateIfNoFace:_,closeEyeSettings:f,exifDataSettings:d,recordVideo:b,captureFrameSettings:e,autoGenFrameIds:p}},[n,s])}({captureFrameSettingsProp:el,clientSettings:eX}),e9=1e3*eY.limitTimeSecond/e4.framesIntervalTime,{uuids:e7,getNextUUID:te,reset:tt}=o({total:Math.min(e8.maxItems,Math.ceil(e9/e4.framesBatchLength*1.2))}),ta=e.useRef(m.createSingleUUID()),tn=e.useCallback(e=>{let t=e[e.length-1];try{let e=JSON.parse(t.metadata);e8.enable&&(e.global_batch_id=te()),e.global_session_id=ta.current,t.metadata=JSON.stringify(e)}catch(e){console.error("Unable to process last frame metadata",e)}},[e8.enable,te]),ts=e2?.enable,ti=e.useMemo(()=>g.getEnabledServices(ep,eX),[eX,ep]),tr=e.useRef(""),tl=e.useCallback(e=>{if(e?.event){if(e.event===$?.show_alert){let t=e.log?.alert;if(t===tr.current)return;tr.current=t}eW(e),eh&&eh(e)}},[eh,eW]),tc=e.useMemo(()=>I(e=>{tl(e)},2e3),[tl]),to=e.useRef(0),tm=e.useRef(),tg=e.useRef();e.useEffect(()=>{tl({tag:"selfie",event:$?.start_camera,log:{}})},[tl]),e.useEffect(()=>(V.start(),()=>{V.stop()}),[]),e.useEffect(()=>{let e=!1;return async function t(){!eU&&(eH.current=performance.now(),eV.current=await d(eE),await b.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]}),e||(ej(!0),tl({tag:"selfie",event:$?.show_warmup,log:{}}),tl({tag:"selfie",event:$?.finish_load_model,log:{status:"success",time_in_ms:performance.now()-eH.current}}),eH.current=null))}(),()=>{e=!0}},[eU,eE,tl]);let tu=e.useRef(!1),t_=e.useCallback(()=>{eJ.current.curStepIndex=eJ.current.steps.length,tu.current=!0,eR(!1),tg.current?.discardRecording()},[]),tf=e.useCallback(()=>{if(eJ.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Y,customIcon:ee,customDirectionIcon:et,Locale:eM,lang:eB}),to.current=0,tm.current=null,eG.current=[],eL(!1),e$(null),M(),tg.current?.start(),tu.current=!1,e8.enable){let e=tt();u.addExifData("frame_batch_ids",e)}"function"==typeof eF&&eF(),eN()},[eM,eD,e8.enable,et,ee,Y,eB,eF,tt]),td=e.useCallback(()=>{t_(),setTimeout(()=>{tf()},eQ)},[t_,eQ,tf]),tb=e.useMemo(()=>({...J,...em}),[em]),th=e.useMemo(()=>({...K,...eg}),[eg]),tp=e.useCallback(({remainTime:e})=>{if(e>0&&e<=eY.remainTimeShow){let t=L(th.REMAIN_TIME[eB]),a=e;switch(eY.format){case"mm:ss":a=e.toString().padStart(5,"00:00");break;case"ss":a=e.toString().padStart(2,"0")}ec(t({x:a}))}},[eB,eY.format,eY.remainTimeShow,th.REMAIN_TIME,ec]),tv=e.useCallback(()=>{let e={};Object.keys(tb.liveness_terminated_time_out?.msg).forEach(t=>{let a=L(tb.liveness_terminated_time_out?.msg[t]);e[t]=a({x:eY.limitTimeSecond})}),e$({...tb.liveness_terminated_time_out,msg:e,duration:.95*eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),V.stop(),ec(""),t_()},[tb.liveness_terminated_time_out,eQ,eY.limitTimeSecond,t_,tl,ec]),tF=e.useCallback(({attemptCount:e,fromBackground:t})=>{eY.enableMaxRetries&&e>=eY.totalMaxRetries&&es(s.Errors.max_retry_reached),t&&t_(),V.start(),tf()},[eY.enableMaxRetries,eY.totalMaxRetries,es,tf,t_]),{stopTimer:tk}=x({totalTime:eY.limitTimeSecond,totalDelayBetweenReset:eQ/1e3,interruptible:eY.interruptible,shouldStart:ey&&eY.enable&&eU,onTimesUp:tv,onTick:tp,onReset:tF}),tw=e.useCallback(({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:n,lostX:s,lostY:i})=>{let r,l;_.isMobile?l=r=a-40:(l=450,r=450);let c=Math.floor((a-r)/2)+s;eP.current={x:c,y:5+i,width:r,height:l,image:T,surroundStyle:C},"object"==typeof Q?eP.current={...eP.current,...Q}:"function"==typeof Q&&(eP.current={...eP.current,...Q({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:n,lostX:s,lostY:i,isMobile:_.isMobile,width:r,height:l})}),eN(),eI(!0)},[T,C,Q]),ty=e.useRef({});e.useEffect(()=>{ty.current.isFirstValidFrameFoundRef=eS},[eS]),e.useEffect(()=>{let e,t=ex.current,a=async()=>{let{steps:e}=eJ.current,t=[];e.map(e=>(t.push({name:e.name,blob:e.image.blob,captureTime:e.image.captureTime,gesture:e.name}),e.frontalFaceImage.blob&&t.push({name:e.name,blob:e.frontalFaceImage.blob,captureTime:e.frontalFaceImage.captureTime,gesture:W.FRONTAL}),0));let a=t.map(e=>h.resizeBlobImg(e.blob,400,400)),n=await Promise.all(a),s="0";if(e4.framesBatchLength>0){let e=`${Math.floor(eG.current.length/e4.framesBatchLength)}x${e4.framesBatchLength}`,t=eG.current.length%e4.framesBatchLength>0?`+${eG.current.length%e4.framesBatchLength}`:"";s=`${eG.current.length}:${e}${t}`}let i=n.map((e,a)=>{let n=u.parseLivenessImg({...t[a],frames:s});return u.writeCurrentExif({imageData:{blob:e},enableExifData:e6.enable,additionalData:n})}),r=await Promise.all(i),l=t.map((e,t)=>({name:e.name,blob:r[t]}));await Promise.all(e.map(async(t,a)=>{let n=l.filter(e=>e.name===t.name);if(e[a].image.blob=n[0].blob,t.frontalFaceImage.blob&&(e[a].frontalFaceImage.blob=n[1].blob),ed&&ed.key){let{key:s}=ed;e[a].image.encrypted=await v.encrypt({blob:n[0].blob,key:s}),t.frontalFaceImage.blob&&(e[a].frontalFaceImage.encrypted=await v.encrypt({blob:n[1].blob,key:s}))}return 0}))},i=async()=>{let{steps:e}=eJ.current,t=e[eJ.current.curStepIndex];if((t&&tl({tag:"selfie",event:{[s.FaceDirection.UP]:$?.capture_up_face,[s.FaceDirection.LEFT]:$?.capture_left_face,[s.FaceDirection.RIGHT]:$?.capture_right_face,[s.FaceDirection.FRONTAL]:$?.capture_frontal_face}[t.name],log:{time_capture_in_seconds:((performance.now()-eH.current)/1e3).toFixed(1)}}),eJ.current.curStepIndex++,eH.current=performance.now(),eZ.enable&&"each_gesture"===eZ.limitFor&&(to.current=0),eJ.current.curStepIndex===e.length)&&(eY.enable&&(V.stop(),tk(),ec("")),en)){let t=eG.current;if(ed&&ed.key){let e=await Promise.all(t.map(e=>e?.base64));if(t=t.map((t,a)=>({...t,base64:e[a]})),e4.enable&&e4.framesBatchLength>0&&t.length%e4.framesBatchLength>0){let e=t.slice(-1*(t.length%e4.framesBatchLength));e_(e),f&&B(ed,e,eO,t.length===e4.framesBatchLength)}}else if(e4.enable&&e4.framesBatchLength>0&&t.length%e4.framesBatchLength>0){let e=t.slice(-1*(t.length%e4.framesBatchLength));tn(e),e_(e.map(({base64:e,label:t,index:a,metadata:n})=>({base64:e,label:t,index:a,metadata:n}))),f&&ti.enableUploadFrames&&B(ed,e,eO)}tl({tag:"selfie",event:$?.finish_capture,log:{time_capture_in_seconds:V.duration("from_1st_frame")}}),eo(),await tg.current?.stopVideoRecording(),ew(!0),u.addExifData("user_action",{start_selfie:Date.now()-1e3*V.duration("from_1st_frame"),end_selfie:Date.now()}),u.addExifData("global_session_id",ta.current),e8.enable&&u.addExifData("frame_batch_ids",e7),await a();let n=eG.current;if(ed&&ed.key){let e=await Promise.all(n.map(e=>e?.base64));n=n.map((t,a)=>({...t,base64:e[a]}))}if(f&&ti.enableUploadImages)await U({apiClient:eO,faceVerificationFlowData:eJ,onLivenessDetectionDone:en,captureFrameSettings:e4,FaceDirection:W,onError:es,outputEncryptionSettings:ed,video:D().length?D()[0]:null,enabledServices:ti,capturedFrames:n});else{let t=e.filter(e=>e.name!==W.FRONTAL).map(e=>({name:e.name,image:{blob:e.image.blob,encrypted:e.image.encrypted}})),a=e.filter(e=>e.name!==W.FRONTAL).map(e=>e.frontalFaceImage.blob).filter(e=>null!==e),s=e.filter(e=>e.name!==W.FRONTAL).map(e=>e.frontalFaceImage.encrypted).filter(e=>e&&e.hex),i=e.find(e=>e.name===W.FRONTAL)?.image?.blob,r=e.find(e=>e.name===W.FRONTAL)?.image?.encrypted,l=i&&ei?await h.scaleImage(i,{minSize:ei}):null;i&&a.push(i),r&&s.push(r),tl({tag:"result",event:$?.liveness_detection_done,log:{result_object:{steps:t,frontalFaces:a,frontalScaledImage:l}}}),en({steps:t,frontalFaces:a,frontalFacesEncrypted:s,frontalScaledImage:l,capturedFrames:n,video:D().length?D()[0]:null}),E()}ew(!1)}eN()},r=y(()=>{let{curStepIndex:e,steps:t}=eJ.current,a=t[e],n=a?.image.blob!==null,s=a?.frontalFaceImage.blob!==null,r=t.filter(e=>e.frontalFaceImage.blob).length,l=!1;return n&&(s||![1].includes(e)||r>=1)?(eC.current=!1,i(),l=!0):n&&!s?eC.current=!0:eC.current=!1,eR(!1),l},er);async function l({faceDirection:e,canvas:t,blurScore:a,leftRightScore:n,isEyeClose:s}){let{curStepIndex:l,steps:c}=eJ.current;if(l<c.length){let o=c[l];if(O({faceDirection:e,curStep:o})||s)return;if(e===W.FRONTAL&&(null===o.frontalFaceImage.blurScore||F.hasBetterBlurScore(a,o.frontalFaceImage.blurScore))){o.frontalFaceImage.blurScore=a;let e=await p.takePicture({canvas:t});o.frontalFaceImage.blob=e,o.frontalFaceImage.leftRightScore=n,o.frontalFaceImage.captureTime=Date.now(),eC.current&&(eC.current=!1,i())}if(o.name===e&&(null===o.image.blurScore||F.hasBetterBlurScore(a,o.image.blurScore))){eR(!0),o.image.blurScore=a;let e=await p.takePicture({canvas:t});o.image.blob=e,o.image.leftRightScore=n,o.image.captureTime=Date.now(),o.image.objUrl&&URL.revokeObjectURL(o.image.objUrl),o.image.objUrl=URL.createObjectURL(e),r()}}}async function c(a,i){let r,o;if(i?.width===0||i?.height===0)return;let{isFirstValidFrameFoundRef:m}=ty.current,{cropX:g,cropY:u,cropWidth:_,cropHeight:d}=a;i.getContext("2d").drawImage(t,g,u,_,d,-((400*eb-400)/2)/eb,-((400*eb-400)/2)/eb,400,400);let{blazefaceModel:b,closeEyesModel:h}=eV.current,[p,v]=await Promise.all([F.calculateBlurScore(i),k.getModelPredictions({model:b,sCanvas:i})]),{error:y,fullFace:I,faceRatio:S,faceNotFrontalMinThreshold:L}=await n.validatePredictions({predictions:v,width:k.SIZE,height:k.SIZE});r=y,eP.current.image=T;let x=null,D=null,E=null,A=null,{curStepIndex:M,steps:O}=eJ.current;if(I){let e=O[M],t=e&&e.name===W.FRONTAL;E=I.landmarks;let a=await n.calculateFaceDirection({landmarks:E,getPerfectFrontal:t});a&&(x=a.gesture,D=a.leftRightScore);let l=e1?.webTimeout+ea[s.FaceDirection.FRONTAL].delayTime/1e3;if(t&&e1?.enable&&(-1===V.duration("limit_close_eye")||V.duration("limit_close_eye")<l)){e1?.forceCheck||-1!==V.duration("limit_close_eye")||V.start("limit_close_eye");let{isEyeClose:e}=await h.predict(i,E,e1?.webThreshold);(A=e)&&!r&&(r=J.close_eye)}}let N=r?.code==="no_face"||r?.code==="partial_face",P=M<O.length;!function({noFace:e,isFirstValidFrameFoundRef:t}){if(!e0.enable||!t)return;let{maxTimeMs:a}=e0;tm.current&&e||(tm.current={time:Date.now(),frame:0}),e&&tm.current.frame++;let{time:n}=tm.current;e&&Date.now()-n>=a&&(e$({...tb.liveness_terminated_no_face,duration:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_no_face"}}),td())}({noFace:N&&P,isFirstValidFrameFoundRef:m}),r?.code&&tc({tag:"selfie",event:$?.show_alert,log:{alert:r.code}}),!r||"face_too_small"===r.code&&x!==W.FRONTAL&&S>=L?(m||(eL(!0),eH.current=performance.now(),V.start("from_1st_frame")),function({trackingScore:e,isFirstValidFrameFoundRef:t}){if(!eZ.enable||null===e||!t)return!0;let{webWarningThreshold:a,webTerminateThreshold:n,maxWarningTime:s}=eZ;return!!(e<a)||(e<n&&to.current<s?(to.current++,to.current===s?(e$({...tb.liveness_terminated_face_tracking,duration:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_face_tracking"}})):e$({...tb.liveness_too_fast,duration:1500}),!0):(e$({...tb.liveness_terminated,duration:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated"}}),td(),!1))}({trackingScore:function(e,t,a,n){if(eG.current.length&&Date.now()-eG.current[eG.current.length-1].time<e4.framesIntervalTime)return null;if(e4.enable&&!n){let{topLeft:n,bottomRight:s}=e,i=[...n,...s],{score:r,time:l}=j(e,0===eG.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:eG.current.length,bbox:i,original_bbox:i,metadata:JSON.stringify({})};if(ed&&ed.key){if(c.base64=w.encryptFrameBase64(c.base64,ed.key),eG.current.push(c),e4.framesBatchLength>0&&eG.current.length%e4.framesBatchLength==0&&e_){let e=eG.current.slice(-e4.framesBatchLength);Promise.all(e.map(e=>e?.base64)).then(t=>{e_(e.map(({label:e,index:a},n)=>({base64:t[n],label:e,index:a}))),f&&ti.enableUploadFrames&&B(ed,e.map(({label:e,index:a},n)=>({base64:t[n],label:e,index:a})),eO,eG.current.length===e4.framesBatchLength)})}}else if(eG.current.push(c),e4.framesBatchLength>0&&eG.current.length%e4.framesBatchLength==0&&e_){let e=eG.current.slice(-e4.framesBatchLength);tn(e),e_(e.map(({base64:e,label:t,index:a,metadata:n})=>({base64:e,label:t,index:a,metadata:n}))),f&&ti.enableUploadFrames&&B(ed,e,eO,eG.current.length===e4.framesBatchLength)}return r}return null}(v[0],i,E,M>=O.length),isFirstValidFrameFoundRef:m})&&await l({faceDirection:x,canvas:i,blurScore:p,leftRightScore:D,isEyeClose:A})):M<O.length&&(o=tb[r.code],eP.current.image=R),eq(o),-1!==e&&(e=requestAnimationFrame(()=>c(a,i)))}async function o(){let e=p.analyzeVideoAndWindowSizes(t,eP.current),a=document.createElement("canvas");a.width=400,a.height=400;let n=a.getContext("2d");n.translate(400,0),n.scale(-1*eb,+eb);let{mediaRecorder:s}=ts&&t?await A({outputImagesSize:400,videoEl:t,resultAnalyzeVideoAndWindowSizes:e}):{};tg.current=s,tg.current&&tg.current.start(),c(e,a)}return ey&&eU&&setTimeout(()=>{o()},e3??ef),()=>{cancelAnimationFrame(e),e=-1}},[ev,e3,ef,ey,eB,eO,f,T,R,en,es,ei,er,e4,eo,eZ,eY.enable,ec,eq,ea,eQ,td,e0,tb,eU,tl,e_,ed,eb,e1?.enable,e1?.webThreshold,e1?.webTimeout,e1?.forceCheck,e6.enable,eA,tc,ts,ti,tk,e7,tn,e8.enable]);let{curStepIndex:tI,steps:tT}=eJ.current,tR=e.useMemo(()=>tT.find(e=>e.name===s.FaceDirection.FRONTAL),[tT]),tS=eC.current?tR:tT[tI],tL=tS&&eS?tS.instructions[eB]:null,tx=tS&&eS?tS.directionIcon:"";return{resetFlowOnOrientationChange:e5,cropArea:eP,curStepIndex:tI,directionIcon:tx,directionIconAnimation:tS?tS.directionIconAnimation:"",faceDetectionError:eK,resetFlow:td,handleVideoPlayed:tw,instructions:tL,refVideo:ex,refIsReseting:tu,steps:tT,videoPlayed:ey,activeCapturing:eT,isFirstValidFrameFound:eS,warmupDone:eU,showLoading:ek}}export{Z as u};
@@ -0,0 +1 @@
1
+ import{x as e,y as r,Q as s,r as t,e as n,aH as a,n as o,c as i,s as c,j as l,a2 as u,ay as m,a5 as p,U as d,P as h,b as f,aI as g}from"./chunk-abc9d931.js";import{M as x,O as j,W as y,C as C}from"./chunk-dbd45d78.js";import{u as F}from"./chunk-39bd8f09.js";import{D as D}from"./chunk-2c071949.js";import{p as S,d as b,e as v,A as T,f as I,I as k,h as E,F as _,i as V,j as L,T as R,L as w,k as H,l as P,S as A}from"./chunk-5a4684bb.js";import{u as N}from"./chunk-0da5ca80.js";import"./chunk-05fa8f5c.js";import"./chunk-8eff00f2.js";import"./chunk-e1e2700f.js";let M=f.isMobile?{width:{ideal:640}}:null,U=({stepNumber:e,type:r,theme:s})=>{let t=g(`instruction_${r}.svg`),n=o(s,`Selfie.Active.imageHolder.${r}`);return null===n?l.jsx(l.Fragment,{}):"string"==typeof n&&""!==n?l.jsx("img",{src:n,alt:""}):"v1"===o(s,"themeVersion")?l.jsx("span",{children:e}):l.jsx("img",{src:t,alt:""})};function $(h){var g,D;let{apiCheck:$,onLivenessDetectionDone:O,captureFrameSettings:B,onFramesCaptured:K,frontCamera:z,flipVideoHorizontal:G,customDirectionIcon:W,customStepTimeConstraints:Y,onProcessing:Q,customErrors:q,apiCredentials:J,outputEncryptionSettings:X,cameraScale:Z,defaultCameraId:ee,offsetFaceY:er,isLoading:es,serviceSettings:et,onReset:en}=h,ea=e(),{onErrorCallback:eo,onCloseCallback:ei}=N(),ec=r.useAsset("bg_camera_mask.png"),el=r.useAsset("bg_camera_mask_red.png"),eu=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[em,ep]=t.useState({}),{yFaceVerificationStepsWrapper:ed,yFaceDetectionError:eh,yCountdown:ef}=em,[eg,ex]=t.useState(""),[ej,ey]=t.useState(),eC=t.useMemo(()=>({backgroundColor:n("Selfie.backgroundColor")({theme:ea})}),[ea]);a(o(ea,"themeVersion"),"up_arrow.gif"),a(o(ea,"themeVersion"),"left_arrow.gif"),a(o(ea,"themeVersion"),"right_arrow.gif"),a(o(ea,"themeVersion"),"frontal_arrow.svg"),a(o(ea,"themeVersion"),"instruction_up.svg"),a(o(ea,"themeVersion"),"instruction_left.svg"),a(o(ea,"themeVersion"),"instruction_right.svg"),a(o(ea,"themeVersion"),"instruction_frontal.svg");let eF=t.useCallback(({lostY:e,height:r,clientHeight:s})=>{let t=f.isMobile?e:e+80,n=t+r+20,a=n+110;ep({yFaceDetectionError:a+30,yCountdown:a,yFaceVerificationStepsWrapper:n});let o=Math.floor(e),i=Math.floor(s-e),c=Math.floor(t);return 0!==er&&(c+er<o||c+er+r>i)?eo({code:`offsetFaceY must be in [-${c-o}, ${i-r-c}]`}):c+=er,{y:c}},[er,eo]),{shouldResetFlowOnOrientationChange:eD,cropArea:eS,curStepIndex:eb,directionIcon:ev,directionIconAnimation:eT,faceDetectionError:eI,resetFlow:ek,handleVideoPlayed:eE,instructions:e_,refVideo:eV,refIsReseting:eL,steps:eR,videoPlayed:ew,activeCapturing:eH,warmupDone:eP,showLoading:eA}=F({currentOrientation:ej,apiCheck:$,bgCameraMask:ec,bgCameraMaskRed:el,surroundStyle:eC,onLivenessDetectionDone:O,onError:eo,cropAreaDimension:eF,customDirectionIcon:W,captureFrameSettings:B,onFramesCaptured:K,setRemainingTime:ex,customStepTimeConstraints:Y,onProcessing:Q,customErrors:q,apiCredentials:J,outputEncryptionSettings:X,cameraScale:Z,serviceSettings:et,onReset:en});t.useEffect(()=>{"string"==typeof eR[0]?.directionIcon&&Promise.all(eR.map(e=>S(e.directionIcon)))},[eR]);let eN=b(h,ea),eM=eL.current?0:eb/eR.length*100,{lang:eU}=i.useSDKSettings(),e$=t.useRef(0),eO=t.useRef({}),eB=t.useRef(c.ErrorDuration.SHORT),eK=t.useMemo(()=>{let{msg:e,duration:r=c.ErrorDuration.SHORT}=eI||{},s=e?.[eU];return Date.now()-e$.current>=eB.current&&(e$.current=Date.now(),eB.current=r,eO.current=s),eO.current},[eI,eb]),ez=t.useCallback(e=>{ey(e),eD?ek():e===x.LANDSCAPE?eV.current?.pause():eV.current?.play()},[eV,ek,eD]);return l.jsx(j,{onOrientationChange:ez,children:l.jsxs(u,{frontCamera:z,onVideoPlayed:eE,onClose:ei,flipHorizontal:G??z,ref:eV,videoSettings:M,onError:eo,scale:Z,defaultCameraId:ee,closeButton:l.jsx(m,{}),children:[!eP&&l.jsx(y,{}),ew?l.jsxs(l.Fragment,{children:[eS.current?l.jsxs(C,{x:`${eS.current.x}px`,y:`${eS.current.y}px`,width:`${eS.current.width}px`,height:`${eS.current.height}px`,surroundStyle:eS.current.surroundStyle,children:[l.jsx(v,{padding:T}),l.jsx(I,{...eN,progress:eM,showErrorRing:!!eI}),l.jsx(k,{children:(g=ev,D=eT,g?"string"==typeof g?l.jsx("img",{className:D,src:g,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):g:null)}),eH&&l.jsx(E,{})]}):null,e_?l.jsxs(l.Fragment,{children:[l.jsx(_,{top:ed+5,className:"instructions",children:e_}),l.jsx(V,{top:ed+40,children:eR.map((e,r)=>{let{name:s,image:{objUrl:t}}=e;return l.jsx(L,{active:eb>=r,className:"step-item",children:t?l.jsx("img",{className:"image_preview",src:t,alt:""}):l.jsx(U,{stepNumber:r+1,type:s,theme:ea})},s)})})]}):null]}):null,l.jsx(R,{y:"20px",children:l.jsx(p,{id:"flash_liveness.title"})}),(eA||es)&&l.jsx(w,{children:l.jsx("img",{src:eu,alt:""})}),eg&&l.jsxs(H,{top:ef,children:[l.jsx(d,{color:n("Selfie.countdown.color")({theme:ea})}),l.jsx(P,{children:eg})]}),"string"==typeof eK?l.jsx(A,{top:eh,className:"face-detection-error",children:eK}):null]})})}$.propTypes={apiCheck:h.bool,onLivenessDetectionDone:h.func,onClose:h.func,onError:h.func,onReset:h.func,captureFrameSettings:h.shape({}),onFramesCaptured:h.func,flipVideoHorizontal:h.bool,frontCamera:h.bool,isLoading:h.bool,customDirectionIcon:h.shape({}),customStepTimeConstraints:h.shape({}),onProcessing:h.func,customErrors:h.shape({}),apiCredentials:h.shape({accessKey:h.string,secretKey:h.string,apiUrl:h.string}),outputEncryptionSettings:h.shape({}),cameraScale:h.number,defaultCameraId:h.string,offsetFaceY:h.number,styledComponent:h.shape({CloseCameraButton:h.node}),serviceSettings:h.shape({})},$.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[c.FaceDirection.LEFT]:l.jsx(D,{type:c.FaceDirection.LEFT}),[c.FaceDirection.RIGHT]:l.jsx(D,{type:c.FaceDirection.RIGHT}),[c.FaceDirection.UP]:l.jsx(D,{type:c.FaceDirection.UP}),[c.FaceDirection.FRONTAL]:l.jsx(D,{type:c.FaceDirection.FRONTAL})},customStepTimeConstraints:{[c.FaceDirection.UP]:{delayTime:0},[c.FaceDirection.LEFT]:{delayTime:0},[c.FaceDirection.RIGHT]:{delayTime:0},[c.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{$ as default};
@@ -0,0 +1,256 @@
1
+ import{aL as e,w as i,aM as r,aN as t,aO as o,e as s,n as n,ai as a,aj as l,aP as d,af as c,aQ as g,Y as f,r as u,H as h,P as p,z as m,s as _,V as b,j as w,o as v,v as k,B as R,b as y,aR as S}from"./chunk-abc9d931.js";import{r as C,f as x,g as $,h as j,i as W,j as O,k as I,l as E,n as A,o as D,p as T}from"./chunk-0da5ca80.js";var P,L,V,z,M,B,F,N,H,U,q,K,J,Y,Z,G,Q,X,ee,ei,er,et,eo,es,en,ea,el,ed,ec,eg,ef,eu,eh,ep,em=Object.freeze({__proto__:null,blink:e,flipY:i,slide:r,spin:t,splash:o});let e_=({curStep:e,faceDirection:i})=>{let r=n(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},eb=(e,i)=>({radius:e.radius??s("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??s("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??s("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??s("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??s("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??s("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??s("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??s("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??s("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??s("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??s("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??s("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??s("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??s("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??s("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??s("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??s("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??s("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??s("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??s("Selfie.progressCircle.showDashedRing")({theme:i})}),ew=(e,i)=>({radius:e.radius??s("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??s("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??s("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??s("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??s("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),ev=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function ek(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}function eR(){if(z)return V;z=1;var e=a(),i=l(),r=j();return V=function(t){if(!i(t))return!1;var o=e(t);return"[object Error]"==o||"[object DOMException]"==o||"string"==typeof t.message&&"string"==typeof t.name&&!r(t)}}function ey(){return ei?ee:(ei=1,ee=/<%=([\s\S]+?)%>/g)}var eS=f(function(){if(ep)return eh;ep=1;var e=function(){if(L)return P;L=1;var e=C(),i=x(),r=$();return P=i(function(i,t,o,s){e(t,r(t),i,s)})}(),i=function(){if(B)return M;B=1;var e=O(),i=W(),r=eR();return M=i(function(i,t){try{return e(i,void 0,t)}catch(e){return r(e)?e:Error(e)}})}(),r=function(){if(N)return F;N=1;var e=d();return F=function(i,r){return e(r,function(e){return i[e]})}}(),t=function(){if(U)return H;U=1;var e=c(),i=Object.prototype,r=i.hasOwnProperty;return H=function(t,o,s,n){return void 0===t||e(t,i[s])&&!r.call(n,s)?o:t}}(),o=function(){if(K)return q;K=1;var e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return q=function(i){return"\\"+e[i]}}(),s=eR(),n=T(),a=function(){if(X)return Q;X=1;var e=A(),i=function(){if(G)return Z;G=1;var e=E(),i=Y?J:(Y=1,J=I()(Object.keys,Object)),r=Object.prototype.hasOwnProperty;return Z=function(t){if(!e(t))return i(t);var o=[];for(var s in Object(t))r.call(t,s)&&"constructor"!=s&&o.push(s);return o}}(),r=D();return Q=function(t){return r(t)?e(t):i(t)}}(),l=ey(),f=function(){if(eu)return ef;eu=1;var e=function(){if(ea)return en;ea=1;var e=function(){if(es)return eo;es=1;var e=et?er:(et=1,er=function(e){return function(i){return null==e?void 0:e[i]}});return eo=e({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})}(),i=g(),r=/[&<>"']/g,t=RegExp(r.source);return en=function(o){return(o=i(o))&&t.test(o)?o.replace(r,e):o}}(),i=ed?el:(ed=1,el=/<%-([\s\S]+?)%>/g),r=eg?ec:(eg=1,ec=/<%([\s\S]+?)%>/g),t=ey();return ef={escape:i,evaluate:r,interpolate:t,variable:"",imports:{_:{escape:e}}}}(),u=g(),h=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,m=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_=/[()=,{}\[\]\/\s]/,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,w=/($^)/,v=/['\n\r\u2028\u2029\\]/g,k=Object.prototype.hasOwnProperty;return eh=function(d,c,g){var R=f.imports._.templateSettings||f;g&&n(d,c,g)&&(c=void 0),d=u(d),c=e({},c,R,t);var y=e({},c.imports,R.imports,t),S=a(y),C=r(y,S),x,$,j=0,W=c.interpolate||w,O="__p += '",I=RegExp((c.escape||w).source+"|"+W.source+"|"+(W===l?b:w).source+"|"+(c.evaluate||w).source+"|$","g"),E=k.call(c,"sourceURL")?"//# sourceURL="+(c.sourceURL+"").replace(/\s/g," ")+"\n":"";d.replace(I,function(e,i,r,t,s,n){return r||(r=t),O+=d.slice(j,n).replace(v,o),i&&(x=!0,O+="' +\n__e("+i+") +\n'"),s&&($=!0,O+="';\n"+s+";\n__p += '"),r&&(O+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),j=n+e.length,e}),O+="';\n";var A=k.call(c,"variable")&&c.variable;if(A){if(_.test(A))throw Error("Invalid `variable` option passed into `_.template`")}else O="with (obj) {\n"+O+"\n}\n";O=($?O.replace(h,""):O).replace(p,"$1").replace(m,"$1;"),O="function("+(A||"obj")+") {\n"+(A?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(x?", __e = _.escape":"")+($?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+O+"return __p\n}";var D=i(function(){return Function(S,E+"return "+O).apply(void 0,C)});if(D.source=O,s(D))throw D;return D}}());let eC=[],ex=()=>{eC=[]},e$=(e,i,r,t)=>{t&&ex(),eC.push({id:null});let o=eC.length-1;if(e&&e.key){let t=new Blob([JSON.stringify(i)]);r.uploadFile({file:t,metadata:JSON.stringify({type:"selfie"}),label:"video"},{"X-TV-Key":e.key}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}else{let e=new Blob([JSON.stringify(i)]);r.uploadFile({file:e,metadata:JSON.stringify({type:"selfie"}),label:"video"}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}},ej=()=>new Promise(e=>{let i=setInterval(()=>{eC.every(e=>e.id)&&(e(),clearInterval(i))},200)}),eW=e=>e.enable?eC.some(e=>-1===e.id)?null:eC:[],eO=[],eI=null,eE=!1,eA=()=>eO,eD=()=>{eE=!0,eO=[];try{eI instanceof MediaStream&&(eI.getTracks().forEach(e=>e.stop()),eI=null)}catch(e){}};async function eT({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;eD();let o=document.createElement("canvas");o.width=e,o.height=e;let s=o.getContext("2d");try{let n={mimeType:"video/webm"};try{let e=(eI=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(eE=!1,!function e(i,r,t,o){if(!i||!o)return;let{cropX:s,cropY:n,cropWidth:a,cropHeight:l}=o;i.drawImage(r,s,n,a,l,0,0,t,t),eE||requestAnimationFrame(()=>e(i,r,t,o))}(s,i,e,r),eI=o.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(eI,n);let a=async()=>{await new Promise((e,i)=>{t.ondataavailable=r=>(function(e,i,r){if(e.data.size>0){let r=new Blob([e.data],{type:"video/mp4"});eO.push(r),i()}else console.error("No video have recored!"),r()})(r,e,i),"inactive"!==t.state&&t.stop()})};t.stopVideoRecording=a,t.discardRecording=()=>{"inactive"!==t.state&&t.stop()}}catch(e){}return{mediaRecorder:t}}let eP={data:{settings:{sdk_settings:{passive_liveness_settings:{auto_capture:{enable:!0,show_capture_button:!0,show_countdown:!0,wait_for_best_image_time_ms_web:3e3},manual_capture:{show_countdown:!0,wait_for_best_image_time_ms_web:3e3},blur_check:{enable:!0,web_blurry_threshold:.4},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},web_is_required_frontal_face:!0},active_liveness_settings:{reset_flow_on_orientation_change:!0,wait_before_start_flow_ms:2e3,face_tracking_setting:{enable:!1,web_terminate_threshold:.0030152991993743408,web_warning_threshold:.0017317430600108828,limit_for:"all_flow",max_warning_time:5},flow_interval_time_ms:3e3,take_one_picture_time_ms:3e3,limit_time_liveness_check:{enable:!1,limit_time_second:45,remain_time_show:10,format:"s",max_retry_count:0,non_stoppable:!1},terminate_if_no_face:{enable:!1,max_invalid_frame:5,max_time_ms:1e3},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},exif_data_settings:{enable:!0},record_video:{enable:!1},save_encoded_frames:{enable:!1,enable_logging:!1,frames_batch_len:0,frames_interval_ms:180,quality_android:90,quality_ios:80},auto_gen_frame_ids:{enable:!1,max_items:50}}}}}},eL=30,eV=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:o=!0,onReset:s,onTick:n,onTimesUp:a}=e,l=u.useRef(new h({totalTime:r,totalDelayBetweenReset:t,interruptible:o}));return u.useEffect(()=>l.current.on("tick",({remainTime:e})=>{n({remainTime:e})}),[n]),u.useEffect(()=>l.current.on("delaystart",()=>{a()}),[a]),u.useEffect(()=>l.current.on("reset",({attemptCount:e,fromBackground:i})=>{s({attemptCount:e,fromBackground:i})}),[s]),u.useEffect(()=>i?l.current.start():()=>{},[i]),{stopTimer:u.useCallback(()=>{l.current.stop()},[])}},{ErrorDuration:ez}=_;function eM({children:e,errorMsg:i,className:r}){return b.isValidElement(e)?i?w.jsx("div",{className:r,children:b.cloneElement(e,{errorMsg:i})}):null:i?w.jsx("div",{className:r,children:i}):null}function eB({children:e,className:i,error:r}){let t=u.useRef(0),o=u.useRef(""),s=m(),n=u.useRef(ez.SHORT),{code:a,duration:l=ez.SHORT}=r||{},d=s(a);return Date.now()-t.current>=n.current?(t.current=Date.now(),n.current=l,o.current=d,eM({children:e,errorMsg:d,className:i})):eM({children:e,errorMsg:o.current,className:i})}eB.propTypes={children:p.node,className:p.string},eB.defaultProps={className:""};let eF=v.g`
2
+ transition: stroke-dashoffset 0.4s;
3
+ transform: rotate(-90deg);
4
+ transform-origin: 50% 50%;
5
+ `,eN=v.circle`
6
+ transition: stroke-dashoffset 0.4s, stroke 0.4s;
7
+ transform: rotate(-90deg);
8
+ transform-origin: 50% 50%;
9
+ fill: none;
10
+ `,eH=v.circle`
11
+ transition: stroke-dashoffset 0.4s;
12
+ transform: rotate(-90deg);
13
+ transform-origin: 50% 50%;
14
+ `;function eU({className:e,style:i,radius:r,strokeWidth:t,progress:o,showErrorRing:s,activeColor:n,innerPadding:a,outsideRingColor:l,outsideRingOpacity:d,insideRingColor:c,insideRingWidth:g,insideRingStrokeDash:f,errorRingWidth:u,errorRingColor:h,dashedRingColor:p,dashedRingOpacity:m,dashedRingWidth:_,dashedRingLineThick:b,dashedRingLineSpacing:v,dashedInsideRingColor:k,dashedInsideRingWidth:R,showOutsideRing:y,showInsideRing:S,showDashedRing:C}){let x=2*r,$=2*r,j=r-2*t,W=2*Math.PI*j,O=j-_/2-t/2-a,I=2*Math.PI*O,E=O-R/2-_/2,A=2*Math.PI*E,D=E-g/2-R/2,T=E-u/2-R/2;return w.jsxs("svg",{className:e,style:i,width:x,height:$,viewBox:`0 0 ${x} ${$}`,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y?w.jsxs(w.Fragment,{children:[w.jsx("circle",{"data-testid":"outsideRing",opacity:d,cx:r,cy:r,r:j,stroke:l}),w.jsx(eH,{"data-testid":"outsideAnimateRing",cx:r,cy:r,r:j,stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${W} ${W}`,style:{strokeDashoffset:W-o/100*W}})]}):null,C?w.jsxs(w.Fragment,{children:[w.jsx("circle",{"data-testid":"dashedRing",opacity:m,cx:r,cy:r,r:O,stroke:p,strokeWidth:_,strokeDasharray:`${b} ${v}`}),w.jsx("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",children:w.jsx("circle",{cx:r,cy:r,r:O,stroke:n,strokeWidth:_,strokeDasharray:`${b} ${v}`})}),w.jsx("g",{mask:"url(#mask0)",children:w.jsx(eH,{"data-testid":"dashedAnimateRing",cx:r,cy:r,r:O,stroke:n,strokeWidth:_,strokeDasharray:`${I} ${I}`,style:{strokeDashoffset:I-o/100*I}})}),w.jsx("circle",{"data-testid":"dashedInsideRing",opacity:m,cx:r,cy:r,r:E,stroke:k,strokeWidth:R}),w.jsx(eH,{"data-testid":"dashedInsideAnimateRing",cx:r,cy:r,r:E,stroke:n,strokeWidth:R,strokeLinecap:"round",strokeDasharray:`${A} ${A}`,style:{strokeDashoffset:A-o/100*A}})]}):null,S?w.jsx("circle",{"data-testid":"insideRing",strokeDasharray:f,cx:r,cy:r,r:D,stroke:c,strokeWidth:g}):null,s?w.jsx("circle",{"data-testid":"errorRing",strokeDasharray:f,cx:r,cy:r,r:T,stroke:h,strokeWidth:u}):null]})}eU.propTypes={className:p.string,style:p.shape({}),radius:p.number,strokeWidth:p.number,progress:p.number,showErrorRing:p.bool,activeColor:p.string,innerPadding:p.number,outsideRingColor:p.string,outsideRingOpacity:p.number,insideRingColor:p.string,insideRingWidth:p.number,insideRingStrokeDash:p.string,errorRingColor:p.string,errorRingWidth:p.number,dashedRingColor:p.string,dashedRingOpacity:p.number,dashedRingWidth:p.number,dashedRingLineThick:p.number,dashedRingLineSpacing:p.number,dashedInsideRingColor:p.string,dashedInsideRingWidth:p.number,showOutsideRing:p.bool,showDashedRing:p.bool,showInsideRing:p.bool},eU.defaultProps={className:"",style:null,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:3,insideRingStrokeDash:"0",errorRingColor:"#df0000",errorRingWidth:3,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!0,showDashedRing:!0,showInsideRing:!0};let{blink:eq,slide:eK,spin:eJ}=em,eY=k`
15
+ z-index: ${R+20};
16
+ color: #ffffff;
17
+ `,eZ=v.div`
18
+ ${eY}
19
+ `,eG=k`
20
+ ${eY}
21
+ ${({top:e})=>e&&k`
22
+ top: ${e}px;
23
+ `}
24
+ ${({bottom:e})=>e&&k`
25
+ bottom: ${e}px;
26
+ `}
27
+ ${({centerY:e})=>e&&k`
28
+ top: 50%;
29
+ transform: translateY(-50%);
30
+ `}
31
+ font-size: ${s("Selfie.error.fontSize")};
32
+ font-weight: ${s("Selfie.error.fontWeight")};
33
+ background: ${s("Selfie.error.backgroundColor")};
34
+ color: ${s("Selfie.error.color")};
35
+ padding: ${s("Selfie.error.padding")};
36
+ border-radius: ${s("Selfie.error.borderRadius")};
37
+ position: absolute;
38
+ white-space: pre-wrap;
39
+ text-align: center;
40
+ max-width: 80%;
41
+ `;v(eB)`
42
+ ${eG}
43
+ `;let eQ=v.div`
44
+ ${eG}
45
+ `,eX=v.div`
46
+ z-index: ${R+20};
47
+ display: flex;
48
+ align-items: center;
49
+ position: absolute;
50
+ left: 50%;
51
+ transform: translate(-50%, 0);
52
+ ${({top:e})=>e&&k`
53
+ top: ${e}px;
54
+ `}
55
+ `,e0=v(eZ)`
56
+ font-size: ${s("Selfie.countdown.fontSize")};
57
+ font-weight: ${s("Selfie.countdown.fontWeight")};
58
+ background: ${s("Selfie.countdown.backgroundColor")};
59
+ color: ${s("Selfie.countdown.color")};
60
+ padding: ${s("Selfie.countdown.padding")};
61
+ border-radius: ${s("Selfie.countdown.borderRadius")};
62
+ white-space: nowrap;
63
+ `,e1=v(e0)`
64
+ position: absolute;
65
+ left: 50%;
66
+ transform: translate(-50%, 0);
67
+ ${({top:e})=>e&&k`
68
+ top: ${e}px;
69
+ `}
70
+ `,e2=v(eZ)`
71
+ position: absolute;
72
+ ${({top:e})=>e&&k`
73
+ top: ${e}px;
74
+ `}
75
+ ${({bottom:e})=>e&&k`
76
+ bottom: ${e}px;
77
+ `}
78
+ color: ${s("Selfie.Active.instruction.color")};
79
+ font-size: ${s("Selfie.Active.instruction.fontSize")};
80
+ font-weight: ${s("Selfie.Active.instruction.fontWeight")};
81
+ text-shadow: ${s("Selfie.Active.instruction.textShadow")};
82
+ background-color: ${s("Selfie.Active.instruction.backgroundColor")};
83
+ border: ${s("Selfie.Active.instruction.border")};
84
+ border-radius: ${s("Selfie.Active.instruction.borderRadius")};
85
+ `,e3=v.div`
86
+ height: ${()=>y.isMobile?"50px":"70px"};
87
+ position: absolute;
88
+ ${({top:e})=>e&&k`
89
+ top: ${e}px;
90
+ `}
91
+ ${({bottom:e})=>e&&k`
92
+ bottom: ${e}px;
93
+ `}
94
+ width: 100%;
95
+ display: flex;
96
+ justify-content: center;
97
+ align-items: center;
98
+ z-index: ${R+20};
99
+ `,e5=v.div`
100
+ width: ${s("Selfie.Active.imageHolder.width")};
101
+ height: ${s("Selfie.Active.imageHolder.height")};
102
+ border-radius: ${s("Selfie.Active.imageHolder.borderRadius")};
103
+ font-size: ${s("Selfie.Active.imageHolder.fontSize")};
104
+ color: ${s("Selfie.Active.imageHolder.color")};
105
+ font-weight: ${s("Selfie.Active.imageHolder.fontWeight")};
106
+
107
+ ${({theme:e})=>"v2"===n(e,"themeVersion")?"border: unset;":`border: ${s("Selfie.Active.imageHolder.border")({theme:e})};`}
108
+
109
+ display: flex;
110
+ justify-content: center;
111
+ align-items: center;
112
+
113
+ & + & {
114
+ margin-left: 10px;
115
+ }
116
+
117
+ ${e=>e.active?k`
118
+ img:not(.image_preview) {
119
+ border: ${s("Selfie.Active.imageHolder.activeStepBorder")};
120
+ border-radius: ${s("Selfie.Active.imageHolder.activeStepBorderRadius")};
121
+ }
122
+ `:k`
123
+ opacity: 0.3;
124
+ `}
125
+
126
+ img {
127
+ width: 100%;
128
+ margin: 0;
129
+ border-radius: ${s("Selfie.Active.imageHolder.borderRadius")};
130
+ }
131
+ img.image_preview {
132
+ border: ${s("Selfie.Active.imageHolder.border")};
133
+ }
134
+ `,e4=v.div`
135
+ color: #ffffff;
136
+ height: 70px;
137
+ position: absolute;
138
+ bottom: 0;
139
+ width: 100%;
140
+ display: flex;
141
+ justify-content: center;
142
+ align-items: center;
143
+ z-index: ${R+20};
144
+ `,e8=v.div`
145
+ ${({disabled:e})=>e?k`
146
+ pointer-events: none;
147
+ `:k`
148
+ cursor: pointer;
149
+ `}
150
+ text-align: center;
151
+
152
+ img {
153
+ width: ${s("Selfie.captureIcon.width")};
154
+ }
155
+ `,e6=v.div`
156
+ position: absolute;
157
+ width: 100%;
158
+ top: 0;
159
+ bottom: 0;
160
+ display: flex;
161
+ justify-content: center;
162
+ align-items: center;
163
+ color: #ffffff;
164
+ font-size: 140px;
165
+ opacity: 0.6;
166
+ `,e9=v.div`
167
+ position: absolute;
168
+ width: 100%;
169
+ top: 0;
170
+ bottom: 0;
171
+ display: flex;
172
+ flex-direction: column;
173
+ justify-content: center;
174
+ align-items: center;
175
+ ${eK.default};
176
+ ${eq.default};
177
+ `,e7=v(eU)`
178
+ position: absolute;
179
+ top: 0;
180
+ left: 0;
181
+ width: 100%;
182
+ height: 100%;
183
+ `,ie=v(({className:e="",radius:i=80,neutralColor:r="#CBD5E1",activeColor:t="#0276F1",errorColor:o="#E84848",strokeWidth:s=2,tickWidth:n=15,numberOfTicks:a=200,progress:l=0,showErrorRing:d=!1})=>{let c=2*i,g=i-5,f=2*Math.PI*g,u=Array.from({length:a}).map((e,r)=>{let t=360*r/a+3;return w.jsx("use",{href:"#tick",transform:`rotate(${t} ${i} ${i})`},r)}),h=i-eL,p=2*Math.PI*h;return w.jsxs("svg",{height:c,width:c,viewBox:`0 0 ${c} ${c}`,className:e,xmlns:"http://www.w3.org/2000/svg",children:[d?w.jsx("circle",{cx:i,cy:i,r:i-eL,stroke:o,strokeWidth:s,fill:"none"}):w.jsxs(w.Fragment,{children:[w.jsx("circle",{cx:i,cy:i,r:h,stroke:r,strokeWidth:s,fill:"none"}),w.jsx(eN,{cx:i,cy:i,r:h,stroke:t,strokeWidth:s,strokeLinecap:"round",strokeDasharray:`${p} ${p}`,style:{strokeDashoffset:p-l/100*p}})]}),w.jsx("defs",{children:w.jsx("line",{id:"tick",x1:i,y1:"0",x2:i,y2:n,stroke:r,strokeWidth:s,strokeLinecap:"round"})}),w.jsx("g",{id:"border-segments",children:u}),w.jsx("mask",{id:"tickMask",maskUnits:"userSpaceOnUse",children:w.jsx("g",{id:"tick-mask-segments",children:u})}),w.jsx("g",{mask:"url(#tickMask)",children:w.jsx(eF,{strokeDasharray:`${f} ${f}`,style:{strokeDashoffset:f-l/100*f},children:w.jsx("circle",{cx:i,cy:i,r:g,stroke:t,strokeWidth:20,fill:"none"})})})]})})`
184
+ position: absolute;
185
+ top: 0;
186
+ left: 0;
187
+ width: 100%;
188
+ height: 100%;
189
+ `,ii=v(function({className:e=""}){return w.jsx("svg",{className:e,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"})})})`
190
+ width: 100%;
191
+ height: 100%;
192
+ vertical-align: middle;
193
+ margin: 0;
194
+ color: ${s("Selfie.backgroundColor")};
195
+ `,ir=v(function({className:e="",radius:i=160,backgroundColor:r="#fff",padding:t=0}){let o=2*i;return w.jsxs("svg",{className:e,width:o,height:o,viewBox:`0 0 ${o} ${o}`,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[w.jsxs("mask",{id:"CIRCLE_MASK",children:[w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white",mask:"url(#CIRCLE_MASK)"}),w.jsx("circle",{cx:i,cy:i,r:i-t,fill:"black"})]}),w.jsx("circle",{cx:i,cy:i,r:i,fill:"none"}),w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:r,mask:"url(#CIRCLE_MASK)"})]})})`
196
+ width: 100%;
197
+ height: 100%;
198
+ vertical-align: middle;
199
+ margin: 0;
200
+ color: ${s("Selfie.backgroundColor")};
201
+ `,it=v.div`
202
+ position: absolute;
203
+ z-index: -1;
204
+ background: rgba(223, 0, 0, 0.2);
205
+ border-radius: 50%;
206
+ width: 86%;
207
+ height: 86%;
208
+ top: 7%;
209
+ left: 7%;
210
+ `,io=S`
211
+ from {
212
+ opacity: 1;
213
+ }
214
+
215
+ to {
216
+ opacity: 0;
217
+ }
218
+ `,is=v.div`
219
+ position: absolute;
220
+ width: 100%;
221
+ top: 0;
222
+ bottom: 0;
223
+ z-index: -1;
224
+ background: rgba(255, 255, 255, 0.3);
225
+ animation: ${io} 1s infinite;
226
+ border-radius: 50%;
227
+ `,ia=v.div`
228
+ top: 0;
229
+ left: 0;
230
+ right: 0;
231
+ bottom: 0;
232
+ position: absolute;
233
+ margin: auto;
234
+ width: ${s("Selfie.loadingIcon.width")};
235
+ height: ${s("Selfie.loadingIcon.height")};
236
+
237
+ img {
238
+ width: 100%;
239
+ }
240
+
241
+ z-index: ${R+20};
242
+ ${eJ.default}
243
+ `,il=v.div`
244
+ text-align: center;
245
+ color: ${s("Selfie.title.color")};
246
+ font-size: ${s("Selfie.title.fontSize")};
247
+ font-weight: ${s("Selfie.title.fontWeight")};
248
+ background-color: ${s("Selfie.title.backgroundColor")};
249
+ position: absolute;
250
+ top: ${e=>e.y};
251
+ z-index: ${R+10};
252
+ display: flex;
253
+ align-items: center;
254
+ justify-content: center;
255
+ width: 100%;
256
+ `;export{eL as A,e4 as B,e6 as C,it as E,e2 as F,e9 as I,ia as L,e7 as O,eQ as S,il as T,ii as a,e1 as b,e8 as c,ew as d,ir as e,ie as f,eb as g,is as h,e3 as i,e5 as j,eX as k,e0 as l,eW as m,eP as n,e$ as o,ek as p,eA as q,eD as r,ex as s,eS as t,eV as u,eT as v,ej as w,e_ as x,ev as y};
@@ -0,0 +1 @@
1
+ import{x as e,y as r,Q as s,r as n,e as a,c as t,s as o,j as i,a2 as c,n as l,P as u,b as p}from"./chunk-abc9d931.js";import{p as d,g as m,S as f,a as g,O as h,C as C,E as y,b as j,B as D,c as F,L as x}from"./chunk-5a4684bb.js";import{u as S,C as b}from"./chunk-6633ffde.js";import{M as I,O as T,W as E,C as k}from"./chunk-dbd45d78.js";import{D as R}from"./chunk-2c071949.js";import{u as L}from"./chunk-0da5ca80.js";import"./chunk-8eff00f2.js";import"./chunk-e1e2700f.js";let v=p.isMobile?{width:{ideal:640}}:null;function P(u){let{apiCheck:p,onLivenessDetectionDone:R,captureFrameSettings:P,onFramesCaptured:A,frontCamera:M,flipVideoHorizontal:O,customDirectionIcon:H,customStepTimeConstraints:V,onProcessing:w,customErrors:U,apiCredentials:$,outputEncryptionSettings:_,cameraScale:B,defaultCameraId:K,passiveModeAuto:N,offsetFaceY:z,styledComponent:G,serviceSettings:Y,onReset:W,isLoading:Q}=u,q=e(),{onErrorCallback:J,onCloseCallback:X}=L(),Z=r.useAsset("bg_camera_mask.png"),ee=r.useAsset("bg_camera_mask_red.png"),er=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[es,en]=n.useState({}),{yFaceDetectionError:ea,yFaceVerificationStepsWrapper:et}=es,[eo,ei]=n.useState(""),[ec,el]=n.useState(),eu=n.useMemo(()=>({backgroundColor:a("Selfie.backgroundColor")({theme:q})}),[q]),ep=n.useCallback(({lostY:e,height:r,clientHeight:s})=>{let n=e+25,a=n+30;en({yFaceDetectionError:n,yFaceVerificationStepsWrapper:a+r+20});let t=Math.floor(e),o=Math.floor(s-e),i=Math.floor(a);return 0!==z&&(i+z<t||i+z+r>o)?J({code:`offsetFaceY must be in [-${i-t}, ${o-r-i}]`}):i+=z,{y:i}},[z,J]),{shouldResetFlowOnOrientationChange:ed,countdownToTakePicture:em,cropArea:ef,curStepIndex:eg,faceDetectionError:eh,resetFlow:eC,handleTriggerPassiveMode:ey,handleVideoPlayed:ej,refVideo:eD,showCountdown:eF,steps:ex,refIsReseting:eS,videoPlayed:eb,warmupDone:eI,showCaptureButton:eT,shouldShowCountdown:eE,showLoading:ek}=S({currentOrientation:ec,apiCheck:p,bgCameraMask:Z,bgCameraMaskRed:ee,surroundStyle:eu,onLivenessDetectionDone:R,onError:J,cropAreaDimension:ep,customDirectionIcon:H,captureFrameSettings:P,onFramesCaptured:A,setRemainingTime:ei,customStepTimeConstraints:V,onProcessing:w,customErrors:U,apiCredentials:$,outputEncryptionSettings:_,cameraScale:B,passiveModeAuto:N,serviceSettings:Y,onReset:W});n.useEffect(()=>{"string"==typeof ex[0]?.directionIcon&&Promise.all(ex.map(e=>d(e.directionIcon)))},[ex]);let{CloseCameraButton:eR}=G,eL=m(u,q),ev=eS.current?0:eg/ex.length*100,{lang:eP}=t.useSDKSettings(),eA=n.useRef(0),eM=n.useRef({}),eO=n.useRef(o.ErrorDuration.SHORT),eH=n.useMemo(()=>{let{msg:e,duration:r=o.ErrorDuration.SHORT}=eh||{},s=e?.[eP];return Date.now()-eA.current>=eO.current&&(eA.current=Date.now(),eO.current=r,eM.current=s),eM.current},[eh,eg]),eV=n.useCallback(e=>{el(e),ed?eC():e===I.LANDSCAPE?eD.current?.pause():eD.current?.play()},[eD,eC,ed]);return i.jsx(T,{onOrientationChange:eV,children:i.jsxs(c,{frontCamera:M,onVideoPlayed:ej,onClose:X,flipHorizontal:O??M,ref:eD,videoSettings:v,onError:J,scale:B,defaultCameraId:K,closeButton:eR||null,children:[!eI&&i.jsx(E,{}),eb?i.jsxs(i.Fragment,{children:["string"==typeof eH?i.jsx(f,{top:ea-15,className:"face-detection-error",children:eH}):null,ef.current?i.jsxs(k,{x:`${ef.current.x}px`,y:`${ef.current.y}px`,width:`${ef.current.width}px`,height:`${ef.current.height}px`,surroundStyle:ef.current.surroundStyle,children:[i.jsx(g,{}),i.jsx(h,{...eL,progress:ev,showErrorRing:!!eh&&a("Selfie.progressCircle.showErrorRing")({theme:q})}),eE?i.jsx(C,{children:em}):null,eh&&i.jsx(y,{})]}):null,eo&&i.jsx(j,{top:et-30,children:eo}),eT?i.jsx(D,{children:i.jsx(F,{onClick:ey,disabled:eF,children:l(q,"Selfie.captureIcon.src")?i.jsx("img",{src:l(q,"Selfie.captureIcon.src"),alt:""}):i.jsx(b,{fillColor:"rgba(193, 197, 204, 1)"})})}):null]}):null,(ek||Q)&&i.jsx(x,{children:i.jsx("img",{src:er,alt:""})})]})})}P.propTypes={apiCheck:u.bool,mode:u.string,onLivenessDetectionDone:u.func,onClose:u.func,onError:u.func,onReset:u.func,captureFrameSettings:u.shape({}),onFramesCaptured:u.func,frontCamera:u.bool,isLoading:u.bool,flipVideoHorizontal:u.bool,customDirectionIcon:u.shape({}),customStepTimeConstraints:u.shape({}),onProcessing:u.func,customErrors:u.shape({}),apiCredentials:u.shape({accessKey:u.string,secretKey:u.string,apiUrl:u.string}),outputEncryptionSettings:u.shape({}),cameraScale:u.number,defaultCameraId:u.string,passiveModeAuto:u.bool,offsetFaceY:u.number,styledComponent:u.shape({CloseCameraButton:u.node}),serviceSettings:u.shape({})},P.defaultProps={apiCheck:!1,mode:null,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},frontCamera:!0,isLoading:!1,flipVideoHorizontal:null,customDirectionIcon:{[o.FaceDirection.LEFT]:i.jsx(R,{type:o.FaceDirection.LEFT}),[o.FaceDirection.RIGHT]:i.jsx(R,{type:o.FaceDirection.RIGHT}),[o.FaceDirection.UP]:i.jsx(R,{type:o.FaceDirection.UP}),[o.FaceDirection.FRONTAL]:i.jsx(R,{type:o.FaceDirection.FRONTAL})},customStepTimeConstraints:{[o.FaceDirection.UP]:{delayTime:0},[o.FaceDirection.LEFT]:{delayTime:0},[o.FaceDirection.RIGHT]:{delayTime:0},[o.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,passiveModeAuto:!1,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
@@ -0,0 +1 @@
1
+ import{r as e,n as t,u as a,aG as s,s as n,c as i,a9 as r,d as l,I as c,f as o,b as u,aJ as _,aK as m,F as g,L as d,W as f,M as h,D as b,au as v,k as p,aA as w,j as k}from"./chunk-abc9d931.js";import{t as y}from"./chunk-8eff00f2.js";import{n as F,t as T,u as L,o as R,q as C,r as B,v as S,s as x,y as I}from"./chunk-5a4684bb.js";import{m as M}from"./chunk-0da5ca80.js";import{u as D}from"./chunk-e1e2700f.js";let E=s.faceTracker(),P=new _,{FaceDirection:j,Errors:A,Messages:W,TrackLivenessEvents:V}=n,N={enable:!1,framesIntervalTime:180,framesBatchLength:0},U={[n.FaceDirection.UP]:{delayTime:0},[n.FaceDirection.LEFT]:{delayTime:0},[n.FaceDirection.RIGHT]:{delayTime:0},[n.FaceDirection.FRONTAL]:{delayTime:2e3}},O=()=>{},z=()=>{},K=()=>{};function q({apiCheck:_,bgCameraMask:k,bgCameraMaskRed:G,surroundStyle:Z,cropAreaDimension:J,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y=U,onLivenessDetectionDone:$,onError:ee,frontalMinSize:et,waitingTimeToGetBetterFrames:ea=500,captureFrameSettings:es=N,setRemainingTime:en=O,onProcessing:ei=K,customErrors:er,customMessages:el,apiCredentials:ec={},onFramesCaptured:eo=z,initFirstGestureTimeout:eu=2e3,outputEncryptionSettings:e_,cameraScale:em=1,passiveModeAuto:eg=!1,sendCustomEvent:ed,serviceSettings:ef,currentOrientation:eh,onReset:eb}={}){let[ev,ep]=e.useState(!1),[ew,ek]=e.useState(!1),[ey,eF]=e.useState(!1),[eT,eL]=e.useState(!1),eR=e.useRef(null),{lang:eC,assetRoot:eB,customUrls:eS,exifKey:ex}=i.useSDKSettings(),eI=r.useSDKLocale(),{apiClient:eM}=l.useApiClient({apiCredentials:ec}),[,eD]=e.useReducer(e=>e+1,0),eE=e.useRef(null),[eP,ej]=e.useState(!1),eA=e.useRef({}),{sendEvent:eW}=c.useSDKTracking(),[eV,eN]=e.useState(3),[eU,eO]=e.useState(!1),ez=e.useRef(!1),eK=e.useCallback(e=>{eO(e),ez.current=e},[]),eq=e.useRef(null),eG=e.useRef([]),eZ=e.useRef(null),eJ=e.useRef(),eH=e.useRef(null);null===eH.current&&(eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y,Locale:eI,lang:eC}));let[eX,eQ]=e.useState(),eY=e.useCallback(e=>{eQ(e)},[]),e$=e.useMemo(()=>y(eY,500),[eY]),e0=e.useRef([]),e1=e.useRef(),e4=D(),{flowIntervalTimeMs:e2,limitTimeLivenessCheck:e3,terminateIfNoFace:e5,closeEyeDetectorSettings:e7,exifDataSettings:e6,recordVideo:e8,autoCaptureSettings:e9,manualCaptureSettings:te,blurCheckSettings:tt,webIsRequiredFrontalFace:ta,waitBeforeStartFlowMs:ts,resetFlowOnOrientationChange:tn,captureFrameSettings:ti}=function({clientSettings:s,captureFrameSettingsProp:n}){return e.useMemo(()=>{let e,i=M({},F,s),r={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.enable"),showCaptureButton:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_capture_button"),showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.wait_for_best_image_time_ms_web")},l={showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.wait_for_best_image_time_ms_web")},c={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.enable"),webBlurryThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.web_blurry_threshold")},o={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.enable"),webThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_threshold"),webTimeout:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_timeout"),forceCheck:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.force_check")},u=t(i,"data.settings.sdk_settings.passive_liveness_settings.web_is_required_frontal_face"),_=a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.max_retry_count"),m={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.enable"),limitTimeSecond:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.limit_time_second"),remainTimeShow:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.remain_time_show"),format:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.format"),enableMaxRetries:_>0,totalMaxRetries:_,interruptible:!a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.non_stoppable")},g={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.enable"),maxInvalidFrame:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_invalid_frame"),maxTimeMs:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_time_ms")},d={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.exif_data_settings.enable")},f={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.record_video.enable")},h=t(i,"data.settings.sdk_settings.active_liveness_settings.wait_before_start_flow_ms"),b=t(i,"data.settings.sdk_settings.active_liveness_settings.reset_flow_on_orientation_change"),v=t(i,"data.settings.sdk_settings.active_liveness_settings.flow_interval_time_ms"),p=t(s,"data.settings.sdk_settings.active_liveness_settings.save_encoded_frames");return{autoCaptureSettings:r,manualCaptureSettings:l,blurCheckSettings:c,closeEyeDetectorSettings:o,webIsRequiredFrontalFace:u,limitTimeLivenessCheck:m,terminateIfNoFace:g,exifDataSettings:d,recordVideo:f,waitBeforeStartFlowMs:h,resetFlowOnOrientationChange:b,flowIntervalTimeMs:v,captureFrameSettings:e=p?{enable:p.enable,enableLogging:p.enable_logging,framesBatchLength:p.frames_batch_len,framesIntervalTime:p.frames_interval_ms}:n}},[s,n])}({clientSettings:e4,captureFrameSettingsProp:es}),tr=e9?.enable?e9?.waitForBestImageTimeMsWeb:te?.waitForBestImageTimeMsWeb,tl=e8?.enable,tc=e.useMemo(()=>o.getEnabledServices(ef,e4),[e4,ef]),to=e.useRef(""),tu=e.useCallback(e=>{if(e?.event){if(e.event===V?.show_alert){let t=e.log?.alert;if(t===to.current)return;to.current=t}eW(e),ed&&ed(e)}},[ed,eW]),t_=e.useMemo(()=>y(e=>{tu(e)},2e3),[tu]),tm=e.useRef(0),tg=e.useRef(),td=e.useRef();e.useEffect(()=>{tu({tag:"selfie",event:V?.start_camera,log:{}})},[tu]),e.useEffect(()=>(P.start(),()=>{P.stop()}),[]),e.useEffect(()=>{let e=!1;return async function t(){!eP&&(e1.current=performance.now(),eA.current=await m(eS),await g.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]}),e||(ej(!0),tu({tag:"selfie",event:V?.show_warmup,log:{}}),tu({tag:"selfie",event:V?.finish_load_model,log:{status:"success",time_in_ms:performance.now()-e1.current}}),e1.current=null))}(),()=>{e=!0}},[eP,eS,tu]);let tf=e.useRef(!1),th=e.useCallback(()=>{eH.current.curStepIndex=eH.current.steps.length,tf.current=!0,eF(!1),td.current?.discardRecording(),clearInterval(eq.current)},[]),tb=e.useCallback(()=>{eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,Locale:eI,lang:eC}),tm.current=0,tg.current=null,e0.current=[],eL(!1),eQ(null),x(),td.current?.start(),tf.current=!1,eK(!1),eN(3),eZ.current=null,eG.current=[],eJ.current=null,"function"==typeof eb&&eb(),eD()},[eI,eB,Q,X,H,eK,eC,eb]),tv=e.useCallback(()=>{th(),setTimeout(()=>{tb()},e2)},[e2,tb,th]),tp=e.useMemo(()=>({...A,...er}),[er]),tw=e.useMemo(()=>({...W,...el}),[el]),tk=e.useCallback(()=>{let e={};Object.keys(tp.liveness_terminated_time_out?.msg).forEach(t=>{let a=T(tp.liveness_terminated_time_out?.msg[t]);e[t]=a({x:e3.limitTimeSecond})}),eQ({...tp.liveness_terminated_time_out,msg:e,duration:.95*e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),P.stop(),en(""),th()},[tp.liveness_terminated_time_out,e2,e3.limitTimeSecond,th,tu,en]),ty=e.useCallback(({remainTime:e})=>{if(e>0&&e<=e3.remainTimeShow){let t=T(tw.REMAIN_TIME[eC]),a=e;switch(e3.format){case"mm:ss":a=e.toString().padStart(5,"00:00");break;case"ss":a=e.toString().padStart(2,"0")}en(t({x:a}))}},[eC,e3.format,e3.remainTimeShow,tw.REMAIN_TIME,en]),tF=e.useCallback(({attemptCount:e,fromBackground:t})=>{e3.enableMaxRetries&&e>=e3.totalMaxRetries&&ee(n.Errors.max_retry_reached),t&&th(),P.start(),tb()},[e3.enableMaxRetries,e3.totalMaxRetries,ee,tb,th]),{stopTimer:tT}=L({totalTime:e3.limitTimeSecond,totalDelayBetweenReset:e2/1e3,interruptible:e3.interruptible,shouldStart:ew&&e3.enable&&eP,onTimesUp:tk,onTick:ty,onReset:tF}),tL=e.useCallback(({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i})=>{let r,l;u.isMobile?l=r=a:r=l=s-200;let c=Math.floor((a-r)/2)+n;eE.current={x:c,y:5+i,width:r,height:l,image:k,surroundStyle:Z},"object"==typeof J?eE.current={...eE.current,...J}:"function"==typeof J&&(eE.current={...eE.current,...J({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i,isMobile:u.isMobile,width:r,height:l})}),eD(),ek(!0)},[k,Z,J]),tR=e.useCallback(()=>{eN(3),clearInterval(eq.current),eK(!0);let e=async e=>{if(e-1==0){let e;P.stop(),tT(),clearInterval(eq.current),ei(),await td.current?.stopVideoRecording(),ep(!0),d.addExifData("user_action",{start_selfie:Date.now()-1e3*P.duration("from_1st_frame"),end_selfie:Date.now()});let t=(e=e9.enable?[eZ.current]:eG.current).map(e=>f.resizeBlobImg(e.blob,400,400)),a=(await Promise.all(t)).map((t,a)=>{let s=d.parseLivenessImg({...e[a],gesture:"frontal"});return d.writeCurrentExif({imageData:{blob:t},enableExifData:e6.enable,additionalData:s})}),s=await Promise.all(a),n={};if(e_&&e_.key){let{key:e}=e_,t=s.map(t=>h.encrypt({blob:t,key:e}));n={frontalFacesEncrypted:await Promise.all(t)}}let i=[...e0.current];if(e_&&e_.key){let e=await Promise.all(i.map(e=>e?.base64));if(i=i.map((t,a)=>({...t,base64:e[a]})),ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0){let e=i.slice(-1*(i.length%ti.framesBatchLength));eo(e),_&&tc.enableUploadFrames&&R(e_,e,eM,i.length===ti.framesBatchLength)}}else ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0&&(eo(i.slice(-1*(i.length%ti.framesBatchLength)).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,i.slice(-1*(i.length%ti.framesBatchLength)),eM));if(_&&tc.enableUploadImages){let t=e=>({label:"portrait",metadata:JSON.stringify({gesture_score:e,gesture:j.FRONTAL})}),a=e.map((e,a)=>eM.uploadImage({file:s[a],...t(e.leftRightScore)}));e_&&e_.key&&(a=e.map((e,a)=>{let s=new Blob([n.frontalFacesEncrypted[a].hex]);return eM.uploadImage({file:s,...t(e.leftRightScore)},{"X-TV-Key":e_.key})}));try{let t=await Promise.all(a),s=null;tc.enableVerifyFaceLiveness&&(s=eM.verifyFaceLiveness({images:t.map(e=>({id:e.data.image_id})),videos:[{frames:i}]}));let n=null;tc.enableVerifySanityPortrait&&(n=eM.requestVerifyPortrait({image:{id:t?.[t.length-1]?.data?.image_id}}));let[r,l]=await Promise.all([s,n]);$({apiCheckPassed:r?.data.is_live??!1,verifyFaceLivenessResult:r?.data??null,verifyFacePortraitResult:l?.data??null,frontalFaces:t.map((t,a)=>({id:t?.data?.image_id,blob:e?.[a]?.blob}))})}catch(e){ee({error:e})}}else $({frontalFaces:s,...n,capturedFrames:i,video:C()}),B()}};eq.current=setInterval(()=>{eN(t=>(e(t),t-1))},tr/3)},[eK,tr,tT,ei,e9.enable,e_,ti.enable,ti.framesBatchLength,_,tc.enableUploadImages,tc.enableUploadFrames,tc.enableVerifyFaceLiveness,tc.enableVerifySanityPortrait,e6.enable,eo,eM,$,ee]),tC=e.useRef({});e.useEffect(()=>{tC.current.isFirstValidFrameFoundRef=eT},[eT]),e.useEffect(()=>{let e,t=eR.current;async function a({faceDirection:e,canvas:t,leftRightScore:a,blurScore:s,isEyeClosed:n}){if(!0===ez.current&&(ta&&e===j.FRONTAL||!ta)){let e=await b.takePicture({canvas:t});e9?.enable&&Date.now()-eJ.current<e9?.waitForBestImageTimeMsWeb?(eZ.current||(eZ.current={blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()}),tt?.enable&&(eZ.current=I({incomingFrame:{blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()},currentBestFrame:eZ.current}))):eG.current.length<1&&eG.current.push({blob:e,leftRightScore:a,captureTime:Date.now(),blurScore:s})}}async function i(r,l){let c,o;if(l?.width===0||l?.height===0)return;let{isFirstValidFrameFoundRef:u}=tC.current,{cropX:m,cropY:g,cropWidth:d,cropHeight:f}=r;l.getContext("2d").drawImage(t,m,g,d,f,-((400*em-400)/2)/em,-((400*em-400)/2)/em,400,400);let{blazefaceModel:h,closeEyesModel:b}=eA.current,[y,F]=await Promise.all([v.calculateBlurScore(l),p.getModelPredictions({model:h,sCanvas:l})]),{error:T,fullFace:L,faceRatio:C,faceNotFrontalMinThreshold:B}=await s.validatePredictions({predictions:F,width:p.SIZE,height:p.SIZE});c=T,eE.current.image=k;let S=null,x=null,I=null,{curStepIndex:M,steps:D}=eH.current;if(L){I=L.landmarks;let e=await s.calculateFaceDirection({landmarks:I,getPerfectFrontal:!0});e&&(S=e.gesture,x=e.leftRightScore);let t=e7?.webTimeout+Y[n.FaceDirection.FRONTAL].delayTime/1e3;if(e7?.enable&&(-1===P.duration("limit_close_eye")||P.duration("limit_close_eye")<t)){e7?.forceCheck||-1!==P.duration("limit_close_eye")||P.start("limit_close_eye");let{isEyeClose:e}=await b.predict(l,I,e7?.webThreshold);e&&!c&&(c=A.close_eye)}}let W=c?.code==="no_face"||c?.code==="partial_face",N=M<D.length;if(!function({noFace:e,isFirstValidFrameFoundRef:t}){if(!e5.enable||!t)return;let{max_time_ms:a}=e5;tg.current&&e||(tg.current={time:Date.now(),frame:0}),e&&tg.current.frame++;let{time:s}=tg.current;e&&Date.now()-s>=a&&(eQ({...tp.liveness_terminated_no_face,duration:e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_no_face"}}),tv())}({noFace:W&&N,isFirstValidFrameFoundRef:u}),c?.code&&t_({tag:"selfie",event:V?.show_alert,log:{alert:c.code}}),!c||"face_too_small"===c.code&&S!==j.FRONTAL&&C>=B){if(!function(e,t,a,s){if(e0.current.length&&Date.now()-e0.current[e0.current.length-1].time<ti.framesIntervalTime)return;if(ti.enable&&!0){let{topLeft:s,bottomRight:n}=e,i=[...s,...n],{score:r,time:l}=E(e,0===e0.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:e0.current.length,bbox:i,original_bbox:i};if(e_&&e_.key){if(c.base64=w.encryptFrameBase64(c.base64,e_.key),e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo){let e=e0.current.slice(-ti.framesBatchLength);Promise.all(e.map(e=>e?.base64)).then(t=>{eo(e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a}))),_&&tc.enableUploadFrames&&R(e_,e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a})),eM,e0.current.length===ti.framesBatchLength)})}}else e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo&&(eo(e0.current.slice(-ti.framesBatchLength).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,e0.current.slice(-ti.framesBatchLength),eM,e0.current.length===ti.framesBatchLength));return};}(F[0],l,I),S!==j.FRONTAL&&ta)o=tp.not_frontal_face,eE.current.image=G;else if(!c){u||(eL(!0),P.start("from_1st_frame"));let e=e9?.enable&&!ez.current&&0===eG.current.length;tt?.enable?null!==y&&y>tt?.webBlurryThreshold?(o=null,e&&(eJ.current=Date.now(),tR())):ez.current||(o=tp.liveness_blurry):e&&(eJ.current=Date.now(),tR());let{isEyeClose:t}=await b.predict(l,I,e7?.webThreshold);await a({faceDirection:S,canvas:l,leftRightScore:x,blurScore:y,...null!==t?{isEyeClosed:t}:{}})}}else M<D.length&&(o=tp[c.code],eE.current.image=G);e$(o),-1!==e&&(e=requestAnimationFrame(()=>i(r,l)))}async function r(){let e=b.analyzeVideoAndWindowSizes(t,eE.current),a=document.createElement("canvas");a.width=400,a.height=400;let s=a.getContext("2d");s.translate(400,0),s.scale(-1*em,+em);let{mediaRecorder:n}=tl&&t?await S({outputImagesSize:400,videoEl:t,resultAnalyzeVideoAndWindowSizes:e}):{};td.current=n,td.current&&td.current.start(),i(e,a)}return ew&&eP&&setTimeout(()=>{r()},ts??eu),()=>{cancelAnimationFrame(e),e=-1}},[eh,ts,ta,tt?.enable,tt?.webBlurryThreshold,e9?.enable,e9?.waitForBestImageTimeMsWeb,eu,ew,eC,eM,_,k,G,$,ee,et,ea,ti,ei,e3.enable,en,e$,Y,e2,tv,e5,tp,eP,tu,eo,e_,em,tR,eg,e7?.enable,e7?.webThreshold,e7?.webTimeout,e7?.forceCheck,e6.enable,ex,t_,ti.framesBatchLength,tl,tc.enableUploadFrames]),e.useEffect(()=>{eX&&(eX?.code!==tp?.liveness_terminated_time_out&&eX?.code!==tp?.liveness_terminated_no_face&&e9?.enable&&ez.current||(clearInterval(eq.current),eK(!1),eZ.current=null,eG.current=[],eJ.current=null))},[e9?.enable,eX,eK,tp]);let{curStepIndex:tB,steps:tS}=eH.current,tx=eT&&!eX&&!eg&&(!e9?.enable||e9?.showCaptureButton),tI=eU&&!tf.current&&(e9?.enable?e9?.showCountdown:te?.showCountdown);return{resetFlowOnOrientationChange:tn,countdownToTakePicture:eV,cropArea:eE,curStepIndex:tB,faceDetectionError:eX,resetFlow:tv,handleTriggerPassiveMode:tR,handleVideoPlayed:tL,refVideo:eR,refIsReseting:tf,showCountdown:eU,steps:tS,videoPlayed:ew,activeCapturing:ey,isFirstValidFrameFound:eT,warmupDone:eP,showLoading:ev,showCaptureButton:tx,shouldShowCountdown:tI}}function G({className:e="",fillColor:t=null}){return k.jsxs("svg",{className:e,width:"38px",height:"32px",viewBox:"0 0 24 21","data-testid":"camera-icon",children:[k.jsx("title",{children:"FA45C15C-1E21-4D7B-9585-07FB9F999CB8"}),k.jsx("desc",{children:"Created with sketchtool."}),k.jsx("g",{id:"Web-demo",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:k.jsx("g",{id:"step1",transform:"translate(-950.000000, -380.000000)",fill:t??"currentColor",fillRule:"nonzero",children:k.jsx("g",{id:"Group",transform:"translate(950.000000, 380.000000)",children:k.jsx("g",{id:"Group-2",children:k.jsx("g",{id:"camera",children:k.jsx("path",{d:"M21,3 L17,3 L15,0 L9,0 L7,3 L3,3 C1.34314575,3 0,4.34314575 0,6 L0,18 C0,19.6568542 1.34314575,21 3,21 L21,21 C22.6568542,21 24,19.6568542 24,18 L24,6 C24,4.34314575 22.6568542,3 21,3 Z M12,17 C9.23857625,17 7,14.7614237 7,12 C7,9.23857625 9.23857625,7 12,7 C14.7614237,7 17,9.23857625 17,12 C17,14.7614237 14.7614237,17 12,17 L12,17 Z",id:"Shape"})})})})})})]})}export{G as C,q as u};