@tsocial/tvweb-sdk.abb 5.38.5 → 5.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/{chunk-4f82fbfc.js → chunk-0b699686.js} +1 -1
- package/build/esm/chunk-0fed2317.js +1 -0
- package/build/esm/{chunk-bf00f7c2.js → chunk-1111b17d.js} +1 -1
- package/build/esm/{chunk-d0e5ef18.js → chunk-1d87d657.js} +1 -1
- package/build/esm/chunk-43a27060.js +1 -0
- package/build/esm/chunk-56bc523d.js +1 -0
- package/build/esm/chunk-59d3e3b1.js +1357 -0
- package/build/esm/chunk-64124059.js +1 -0
- package/build/esm/{chunk-8c820873.js → chunk-67c92f43.js} +2 -2
- package/build/esm/chunk-6f0718f1.js +1 -0
- package/build/esm/{chunk-b8d4b6f4.js → chunk-78261800.js} +152 -70
- package/build/esm/{chunk-7493d2aa.js → chunk-7ad882a2.js} +2 -2
- package/build/esm/chunk-8b8e62dd.js +1 -0
- package/build/esm/chunk-8fcd8b8a.js +1 -0
- package/build/esm/chunk-a8f6c8fc.js +1 -0
- package/build/esm/chunk-a989c084.js +1 -0
- package/build/esm/chunk-b28a6288.js +1 -0
- package/build/esm/chunk-b6299572.js +1 -0
- package/build/esm/{chunk-6274463c.js → chunk-bbe1b8aa.js} +1 -1
- package/build/esm/{chunk-b96ccb97.js → chunk-c5b7ee1d.js} +1 -1
- package/build/esm/{chunk-42153803.js → chunk-d2a607bb.js} +1 -1
- package/build/esm/chunk-e9dc3cb2.js +1 -0
- package/build/esm/tvweb-sdk.abb.esm.min.js +1 -1
- package/build/tvweb-sdk.abb.cjs.min.js +953 -789
- package/build/tvweb-sdk.abb.standalone.js +6321 -5358
- package/build/tvweb-sdk.abb.standalone.min.js +953 -789
- package/build/types/index.d.ts +77 -12
- package/package.json +7 -7
- package/build/esm/chunk-0021229e.js +0 -1
- package/build/esm/chunk-035634f3.js +0 -1
- package/build/esm/chunk-0c1dea67.js +0 -1
- package/build/esm/chunk-0c5d3a35.js +0 -1275
- package/build/esm/chunk-1e8e7387.js +0 -1
- package/build/esm/chunk-28a4352c.js +0 -1
- package/build/esm/chunk-48719a79.js +0 -1
- package/build/esm/chunk-96281005.js +0 -1
- package/build/esm/chunk-b69ecff8.js +0 -1
- package/build/esm/chunk-cc591a4d.js +0 -1
- package/build/esm/chunk-d2d2bfa9.js +0 -1
- package/build/esm/chunk-d3c713c4.js +0 -1
- package/build/esm/chunk-df7bc767.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{d as e,P as r,s as t,n as n,u as s,g as
|
|
1
|
+
import{d as e,P as r,s as t,n as n,u as s,g as a,b as i,j as o,K as c,r as l,aK as u,q as m,C as p,a as d,aL as f}from"./chunk-59d3e3b1.js";import{M as g,O as h,W as x,C as F}from"./chunk-d2a607bb.js";import{u as j}from"./chunk-a8f6c8fc.js";import{p as y,g as C,a as D,O as S,I as b,i as T,j as v,k as I,l as E,L as L,b as R,S as V}from"./chunk-c5b7ee1d.js";import{a as _}from"./chunk-a989c084.js";import"./chunk-e9dc3cb2.js";import"./chunk-43a27060.js";let k=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=
|
|
3
|
+
`;function w({type:e}){let r=n(),t=s(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),c=a(`Selfie.Active.directionIcon.${e}Width`)({theme:r}),l=i(r,`Selfie.Active.directionIcon.${e}`);return null===l?o.jsx(o.Fragment,{}):l&&null!==l?o.jsx(k,{src:i(r,`Selfie.Active.directionIcon.${e}`),width:c,alt:""}):o.jsx(k,{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=i(t,`Selfie.Active.imageHolder.${r}`);return null===s?o.jsx(o.Fragment,{}):"string"==typeof s&&""!==s?o.jsx("img",{src:s,alt:""}):"v1"===i(t,"themeVersion")?o.jsx("span",{children:e}):o.jsx("img",{src:n,alt:""})};function P(e){var r,f;let{apiCheck:k,onLivenessDetectionDone:w,captureFrameSettings:P,onFramesCaptured:N,frontCamera:H,flipVideoHorizontal:O,customDirectionIcon:M,customStepTimeConstraints:U,onProcessing:K,customErrors:B,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,defaultCameraId:Y,offsetFaceY:q,styledComponent:J,isLoading:Q,serviceSettings:X,onReset:Z}=e,ee=n(),{onErrorCallback:er,onCloseCallback:et}=_(),en=c.useAsset("bg_camera_mask.png"),es=c.useAsset("bg_camera_mask_red.png"),ea=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[ei,eo]=l.useState({}),{yFaceVerificationStepsWrapper:ec,yFaceDetectionError:el}=ei,[eu,em]=l.useState(""),[ep,ed]=l.useState(),ef=l.useMemo(()=>({backgroundColor:a("Selfie.backgroundColor")({theme:ee})}),[ee]);u(i(ee,"themeVersion"),"up_arrow.gif"),u(i(ee,"themeVersion"),"left_arrow.gif"),u(i(ee,"themeVersion"),"right_arrow.gif"),u(i(ee,"themeVersion"),"frontal_arrow.gif"),u(i(ee,"themeVersion"),"instruction_up.svg"),u(i(ee,"themeVersion"),"instruction_left.svg"),u(i(ee,"themeVersion"),"instruction_right.svg"),u(i(ee,"themeVersion"),"instruction_frontal.svg");let eg=l.useCallback(({clientHeight:e,videoAreaWidth:r,videoAreaHeight:t,lostX:n,lostY:s})=>{let a,i;d.isMobile?i=a=r:a=i=t-200;let o=Math.floor((r-a)/2)+n,c=5+s,l=s+25,u=l+30;eo({yFaceDetectionError:l,yFaceVerificationStepsWrapper:u+i+20});let m=Math.floor(s),p=Math.floor(e-s);return c=Math.floor(u),0!==q&&(c+q<m||c+q+i>p)?er({code:`offsetFaceY must be in [-${c-m}, ${p-i-c}]`}):c+=q,{x:o,y:c,width:a,height:i}},[q,er]),{shouldResetFlowOnOrientationChange:eh,cropArea:ex,curStepIndex:eF,directionIcon:ej,directionIconAnimation:ey,faceDetectionError:eC,resetFlow:eD,handleVideoPlayed:eS,instructions:eb,refVideo:eT,refIsReseting:ev,steps:eI,videoPlayed:eE,activeCapturing:eL,warmupDone:eR,showLoading:eV}=j({currentOrientation:ep,apiCheck:k,bgCameraMask:en,bgCameraMaskRed:es,surroundStyle:ef,onLivenessDetectionDone:w,onError:er,cropAreaDimension:eg,customDirectionIcon:M,captureFrameSettings:P,onFramesCaptured:N,setRemainingTime:em,customStepTimeConstraints:U,onProcessing:K,customErrors:B,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,serviceSettings:X,onReset:Z});l.useEffect(()=>{"string"==typeof eI[0]?.directionIcon&&Promise.all(eI.map(e=>y(e.directionIcon)))},[eI]);let{CloseCameraButton:e_}=J,ek=C(e,ee),ew=ev.current?0:eF/eI.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,eF]),eO=l.useCallback(e=>{ed(e),eh?eD():e===g.LANDSCAPE?eT.current?.pause():eT.current?.play()},[eT,eD,eh]);return o.jsx(h,{onOrientationChange:eO,children:o.jsxs(p,{frontCamera:H,onVideoPlayed:eS,onClose:et,flipHorizontal:O??H,ref:eT,videoSettings:A,onError:er,scale:z,defaultCameraId:Y,closeButton:e_||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,{...ek,progress:ew,showErrorRing:!!eC&&a("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(T,{})]}):null,eb?o.jsxs(o.Fragment,{children:[o.jsx(v,{top:ec+5,className:"instructions",children:eb}),o.jsx(I,{top:ec+35,children:eI.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,(eV||Q)&&o.jsx(L,{children:o.jsx("img",{src:ea,alt:"",className:"spin"})}),eu&&o.jsx(R,{top:ec-30,children:eu}),"string"==typeof eH?o.jsx(V,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,s as t,P as s,j as a,b as n,v as i,a as r,n as l,g as o,as as _,at as g,V as c,X as d,au as f,av as h,aw as u,ax as m,ay as b,az as p,aA as v,aB as y,aC as S,O as k,Z as C,m as F,p as x,Y as E,aD as w,aE as M,a1 as R}from"./chunk-59d3e3b1.js";import{d as L}from"./chunk-e9dc3cb2.js";import{t as W}from"./chunk-43a27060.js";import{C as I,O as A}from"./chunk-d2a607bb.js";import{u as D,S as T,a as B,F as O,b as q,c as P,d as j,n as V,l as Q,e as N,s as U,f as H,R as $,g as G,h as J,i as z,j as K,W as X,k as Y,m as Z,o as ee,p as et,q as es,r as ea,A as en,O as ei}from"./chunk-67c92f43.js";import{f as er,m as el,a as eo,u as e_}from"./chunk-a989c084.js";let eg=e.createContext(t.Mode.FLASH_ADVANCED),ec=({flashMode:e,children:s})=>{let n=e===t.Mode.FLASH||e.startsWith("flash_")?e:t.Mode.FLASH;return a.jsx(eg.Provider,{value:n,children:s})};ec.defaultProps={flashMode:t.Mode.FLASH_ADVANCED},ec.propTypes={flashMode(e,t,s){if(!/(^flash_|^flash$)/.test(e[t]))return Error(`Invalid prop \`${t}\` of value \`${e[t]}\` supplied to \`${s}\`. \`${t}\` is either 'flash' or begins with 'flash_'. Falling back to 'flash'.`)},children:s.node.isRequired};let ed=()=>{let t=e.useContext(eg);if(void 0===t)throw Error("useFlashMode must be used within a FlashModeProvider");return t},ef=0,eh=1,eu={data:{settings:{flashing_modes:{flash:{frames_per_color:8,frames_per_color_web:8,colors:"r r rrr",colors_web:"r r rrr"}},sdk_settings:{flash_liveness_settings:{frontal_face_check:{enable:!0,up_down_bound_min:.35,up_down_bound_max:.7},capture_frame_settings:{enable:!1,frames_batch_length:10,frames_interval_time:0,frame_quality:.8,frame_scale:1,auto_capture_min_frames:0,auto_capture_min_frames_far:0,auto_capture_min_frames_close:0},not_qualified_settings:{enable_far:!1,enable_close:!1,threshold_far:.11,threshold_close:.11},close_eyes_settings:{enable:!1,timeout:5,force_check:!1},face_settings:{close_face_ratio:.82,max_far_face_ratio:.9,min_far_face_ratio:.8,mobile:{close_face_ratio:.95,max_far_face_ratio:.9,min_far_face_ratio:.85}},flash_settings:{colors_length:10,flash_color:"rgb(255, 0, 0)",secondary_flash_color:"rgba(0,0,0,0.6)",delay_between_colors:120,flash_intensity:1,frames_per_color:4,use_face_detector_when_flashing:!1,flash_frame_interval:0},liveness_settings:{enable_far_step:!0},timeout_settings:{enable:!0,total:30,countdown:10,max_retry_count:0,non_stoppable:!1},exif_data_settings:{enable:!0},mask_settings:{chin_to_mask_bottom_padding:20,large_scale:.85,mobile:{chin_to_mask_bottom_padding:20,large_scale:.9,oval_padding:{bottom:20,left:20,right:20,top:0},oval_vertical_offset:60,small_scale:.65},oval_padding:{bottom:20,left:30,right:30,top:0},oval_vertical_offset:0,small_scale:.6},image_settings:{valid_face_ratio:.6,image_quality:1,crop_center_far:!0,crop_center_close:!1,detection_to_whole_face_ratio:.8},blur_far_settings:{enable:!0,blurry_threshold:.4,wait_for_best_image_time_ms:1e3},blur_close_settings:{enable:!0,blurry_threshold:.4,wait_for_best_image_time_ms:1e3},brightness_detection_far_settings:{enable_too_bright_check:!1,enable_too_dark_check:!1,too_bright_threshold:.83,too_dark_threshold:.195},brightness_detection_close_settings:{enable_too_bright_check:!1,enable_too_dark_check:!1,too_bright_threshold:.83,too_dark_threshold:.195},output_image_settings:{image_ordering:["close","far"]},auto_gen_frame_ids:{enable:!1,max_items:50}}}}}},em=()=>{let s=er(),a=ed();return e.useMemo(()=>{let e=el({},eu,s),l=n(e,`data.settings.flashing_modes.${t.Mode.FLASH}`),o=n(e,`data.settings.flashing_modes.${a}`,l),_={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.enable"),framesIntervalTime:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.frames_interval_time"),framesBatchLength:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.frames_batch_length"),frameScale:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.frame_scale"),frameQuality:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.frame_quality"),autoCaptureMinFramesFar:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.auto_capture_min_frames_far"),autoCaptureMinFramesClose:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.capture_frame_settings.auto_capture_min_frames_close")},g={enableFarStep:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.liveness_settings.enable_far_step")},c={flashColor:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.flash_color"),secondaryFlashColor:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.secondary_flash_color"),colors:i.getWebSetting(o,"colors"),delayBetweenColors:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.delay_between_colors"),framesPerColor:i.getWebSetting(o,"frames_per_color"),flashIntensity:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.flash_intensity"),useFaceDetectorWhenFlashing:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.use_face_detector_when_flashing"),flashFrameInterval:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.flash_settings.flash_frame_interval")},d={smallScale:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.small_scale":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.small_scale"),largeScale:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.large_scale":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.large_scale"),ovalPadding:{left:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.oval_padding.left":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.oval_padding.left"),right:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.oval_padding.right":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.oval_padding.right"),top:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.oval_padding.top":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.oval_padding.top"),bottom:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.oval_padding.bottom":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.oval_padding.bottom")},ovalVerticalOffset:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.oval_vertical_offset":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.oval_vertical_offset"),chinToMaskBottomPadding:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.mask_settings.mobile.chin_to_mask_bottom_padding":"data.settings.sdk_settings.flash_liveness_settings.mask_settings.chin_to_mask_bottom_padding")},f={minFarFaceRatio:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.face_settings.mobile.min_far_face_ratio":"data.settings.sdk_settings.flash_liveness_settings.face_settings.min_far_face_ratio"),maxFarFaceRatio:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.face_settings.mobile.max_far_face_ratio":"data.settings.sdk_settings.flash_liveness_settings.face_settings.max_far_face_ratio"),closeFaceRatio:i.getWebSetting(e,r.isMobile?"data.settings.sdk_settings.flash_liveness_settings.face_settings.mobile.close_face_ratio":"data.settings.sdk_settings.flash_liveness_settings.face_settings.close_face_ratio")},h={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.close_eyes_settings.enable"),timeout:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.close_eyes_settings.timeout"),forceCheck:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.close_eyes_settings.force_check")},u={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.exif_data_settings.enable")},m={imageQuality:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.image_settings.image_quality"),validFaceRatio:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.image_settings.valid_face_ratio"),enableCropCenterFar:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.image_settings.crop_center_far"),enableCropCenterClose:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.image_settings.crop_center_close"),detectionToWholeFaceRatio:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.image_settings.detection_to_whole_face_ratio")},b=i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.timeout_settings.max_retry_count"),p={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.timeout_settings.enable"),total:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.timeout_settings.total"),countdown:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.timeout_settings.countdown"),enableMaxRetryCount:b>0,maxRetryCount:b,interruptible:!i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.timeout_settings.non_stoppable")},v={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_far_settings.enable"),threshold:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_far_settings.blurry_threshold"),duration:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_far_settings.wait_for_best_image_time_ms")},y={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_close_settings.enable"),threshold:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_close_settings.blurry_threshold"),duration:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.blur_close_settings.wait_for_best_image_time_ms")},S={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.not_qualified_settings.enable_far"),threshold:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.not_qualified_settings.threshold_far")},k={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.not_qualified_settings.enable_close"),threshold:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.not_qualified_settings.threshold_close")},C={enableTooBrightCheck:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_far_settings.enable_too_bright_check"),enableTooDarkCheck:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_far_settings.enable_too_dark_check"),tooBrightThreshold:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_far_settings.too_bright_threshold"),tooDarkThreshold:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_far_settings.too_dark_threshold")},F={enableTooBrightCheck:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_close_settings.enable_too_bright_check"),enableTooDarkCheck:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_close_settings.enable_too_dark_check"),tooBrightThreshold:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_close_settings.too_bright_threshold"),tooDarkThreshold:n(e,"data.settings.sdk_settings.flash_liveness_settings.brightness_detection_close_settings.too_dark_threshold")},x={imageOrdering:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.output_image_settings.image_ordering"),farImageOrder:eh,closeImageOrder:ef};Array.isArray(x.imageOrdering)&&2===x.imageOrdering.length&&"far"===x.imageOrdering[0]&&"close"===x.imageOrdering[1]&&(x.farImageOrder=0,x.closeImageOrder=1);let E={enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.auto_gen_frame_ids.enable")&&p.enable,maxItems:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.auto_gen_frame_ids.max_items")};return{captureFrameSettings:_,livenessSettings:g,flashSettings:c,maskSettings:d,faceSettings:f,closeEyesSettings:h,exifSettings:u,imageSettings:m,timeoutSettings:p,blurCheckFarSettings:v,blurCheckCloseSettings:y,notQualifiedFarSettings:S,notQualifiedCloseSettings:k,brightnessDetectionFarSettings:C,brightnessDetectionCloseSettings:F,outputImageSettings:x,autoGenFrameIds:E,frontalFaceCheckSettings:{enable:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.frontal_face_check.enable"),upDownBoundMin:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.frontal_face_check.up_down_bound_min"),upDownBoundMax:i.getWebSetting(e,"data.settings.sdk_settings.flash_liveness_settings.frontal_face_check.up_down_bound_max")}}},[s,a])},eb=r.isMobile?{width:{ideal:640},whiteBalanceMode:"none"}:{width:{ideal:9999},whiteBalanceMode:"none"},ep=(e,t)=>""===t.faceError&&(!!e.isEyeClosed&&!t.isEyeClosed||(!!e.isEyeClosed||!t.isEyeClosed)&&(!!m.hasBetterBrightnessScore(t.brightnessScore,e.brightnessScore)||!!m.hasSameBrightnessScore(t.brightnessScore,e.brightnessScore)&&b.hasBetterBlurScore(t.blurScore,e.blurScore)));function ev(s){let{onReset:n,onFlashDone:i,frontCamera:r,styledComponent:m,onFramesCaptured:b,customComponent:F,extraConfig:x,onImageCaptured:E}=s,{onCloseCallback:w,onErrorCallback:M}=eo(),R=em(),A=F?.FlashLivenessBody??p,ee=F?.FlashLivenessOverlay??v,et=F?.FlashLivenessError??y,es=F?.FlashLivenessCloseIcon??S,{maskSettings:ea,flashSettings:en,faceSettings:ei,livenessSettings:er,captureFrameSettings:el,imageSettings:eg,timeoutSettings:ec,blurCheckFarSettings:ef,blurCheckCloseSettings:eh,exifSettings:eu,autoGenFrameIds:ev}=R;if(ea.smallScale>ea.largeScale)throw Error("smallScale must be smaller than largeScale");let ey=e.useRef(),eS=D(),ek=e_(),{framesPerColor:eC,delayBetweenColors:eF,useFaceDetectorWhenFlashing:ex,flashIntensity:eE,flashColor:ew,colors:eM,flashFrameInterval:eR,secondaryFlashColor:eL}=en,[eW,eI]=e.useState(""),eA=e.useMemo(()=>W(eI,1e3),[]),[eD,eT]=e.useState(!1),[eB,eO]=e.useState(T.LOADING),eq=l(),eP={width:o("FlashLiveness.mask.width")({theme:eq}),height:o("FlashLiveness.mask.height")({theme:eq}),strokeColor:(eB===T.FAR_FACE||eB===T.CLOSE_FACE)&&eW&&!eD?o("FlashLiveness.mask.strokeColorError")({theme:eq}):o("FlashLiveness.mask.strokeColor")({theme:eq}),strokeWidth:2*o("FlashLiveness.mask.strokeWidth")({theme:eq}),path:o("FlashLiveness.mask.path")({theme:eq}),backgroundColor:o("FlashLiveness.maskFill")({theme:eq})},ej=e.useRef(null),[eV,eQ,eN,eU]=B(),[eH,e$]=e.useState(0),[eG,eJ]=e.useState(!1),ez=e.useRef({frames:[],total:{[O.FAR_FACE]:0,[O.CLOSE_FACE]:0}}),eK=e.useRef(!1),eX=e.useRef(!1),eY=e.useRef(!1),eZ=q({compareFn:ep,duration:ef.duration,minFrames:el.autoCaptureMinFramesFar}),e0=q({compareFn:ep,duration:eh.duration,minFrames:el.autoCaptureMinFramesClose}),e1=ed(),[e2,e3]=e.useState(!1),{sessionId:e5,updateSessionId:e8}=P(),e9=e.useRef(_.createSingleUUID()),{onVideoPlayed:e6,cropArea:e4,isPlaying:e7}=j({}),{smallScale:te,largeScale:tt}=V(ea,{width:eP.width,height:eP.height},{width:e4.width,height:e4.height}),ts=e.useRef(null),ta=e.useRef(null),tn=1e3*ec.total/el.framesIntervalTime+eM.length*eC,{uuids:ti,getNextUUID:tr,reset:tl}=g({total:Math.min(ev.maxItems,Math.ceil(tn/el.framesBatchLength))}),to=e.useCallback(e=>{let t=e[e.length-1];try{let e=JSON.parse(t.metadata);ev.enable&&(e.global_batch_id=tr()),e.global_session_id=e9.current,t.metadata=JSON.stringify(e)}catch(e){console.error("Unable to process last frame metadata",e)}},[ev.enable,tr]),{playVoice:t_}=c.useVoicePlayer(),tg=e.useMemo(()=>L(({reason:e})=>{if(eY.current=!1,ez.current.frames=[],ez.current.total[O.FAR_FACE]=0,ez.current.total[O.CLOSE_FACE]=0,eK.current=!1,eX.current=!1,ts.current=null,ta.current=null,er.enableFarStep?(e$(te),eO(T.FAR_FACE),t_("move_face_into_frame")):t_("move_face_closer"),e8(),ev.enable){let e=tl();d.addExifData("frame_batch_ids",e)}n({reason:e})},200,{leading:!0}),[er.enableFarStep,e8,ev.enable,n,te,t_,tl]),tc=Q({offset:ea.ovalVerticalOffset,ovalPadding:ea.ovalPadding,largeScale:tt,maskHeight:e4.height,ovalHeight:eP.height}),{flashingColors:td,currentColor:tf,colorIndex:th,startFlashing:tu,goToNextColor:tm,colorInfoRef:tb,checkIsLastColor:tp}=(({colors:s="",onFlashDone:a,onErrorCallback:n,framesPerColor:i,flashColor:r,secondaryFlashColor:l})=>{let[o,_]=e.useState(null),g=e.useRef({colorIndex:null,frameIndex:null,colorStringIndex:null}),c=e.useMemo(()=>s.split("").reduce((e,t)=>e+t.repeat(i),""),[s,i]),d=" "===c[o]?l:r,f=e.useCallback(()=>g.current.colorStringIndex===c.length-1,[c.length]),h=e.useCallback(()=>{if(g.current.colorIndex+=Math.floor((g.current.frameIndex+1)/i),g.current.frameIndex=(g.current.frameIndex+1)%i,g.current.colorStringIndex+=1,!(g.current.colorStringIndex>c.length)){if(g.current.colorStringIndex<c.length)return void _(e=>e+1);_(null),g.current={colorIndex:null,frameIndex:null,colorStringIndex:null},"function"==typeof a&&a()}},[c.length,i,a]),u=e.useCallback(()=>{_(0),g.current={colorIndex:0,frameIndex:0,colorStringIndex:0}},[]);return e.useEffect(()=>{0===c.length&&"function"==typeof n&&n(t.Errors.flashing_color_error)},[c.length,n]),{flashingColors:c,colorIndex:o,currentColor:d,goToNextColor:h,startFlashing:u,colorInfoRef:g,checkIsLastColor:f}})({colors:eM,onFlashDone:e.useCallback(async()=>{eO(T.STOP_DECTECTING),eS("selfie_flash","user_activity.finish_flash"),eS("selfie_flash","user_activity",({lastTimeLog:e})=>({flash_liveness_in_ms:e-ey.current}));let{frames:e}=ez.current;if(el.enable&&el.framesBatchLength>0){let t=e.length%el.framesBatchLength;if(0!==t){let s=e.slice(-1*t);to(s),"function"==typeof b&&b(s)}}try{"function"==typeof i&&await i({frames:ez.current.frames})}catch(e){M({error:e})}},[eS,el.enable,el.framesBatchLength,to,b,i,M]),onErrorCallback:M,framesPerColor:eC,flashColor:ew,secondaryFlashColor:eL}),tv=e.useCallback(()=>{!er.enableFarStep||(0===ez.current.total[O.FAR_FACE]&&(eY.current=!0),el.enable&&(ez.current.total[O.FAR_FACE]+=1))},[el.enable,er.enableFarStep]),ty=e.useMemo(()=>({x:Math.max(eQ?.left,0),y:Math.max(eQ?.top,0),width:Math.min(eQ?.right-eQ?.left,e4.width),height:Math.min(eQ?.bottom-eQ?.top,e4.height)}),[e4.height,e4.width,eQ?.bottom,eQ?.left,eQ?.right,eQ?.top]),tS=e.useCallback(({frame:e,prediction:t,originalRatio:s})=>{if(eK.current)return;let a=e=>{let t=Y({maskBoundingBox:ty,faceRatio:e.faceRatio,validFaceRatio:eg.validFaceRatio,video:ej.current,shouldCropCenterSquare:eg.enableCropCenterFar,cropArea:e4,frame:e.snapshot,facePrediction:e.facePrediction,detectionToWholeFaceRatio:eg.detectionToWholeFaceRatio}),s={blob:k.takePicture({canvas:t,quality:eg.imageQuality}),gesture:"frontal",captureTime:e.captureTime,selfieLabel:O.FAR_FACE,qualifyScore:e.qualifyScore,blurScore:e.blurScore,brightnessScore:e.brightnessScore,realQualifyScore:e.realQualifyScore,qualifyModelMessage:e.qualifyModelMessage};eK.current=!0,d.addExifData("flash_liveness.number_of_frames.far_frames",ez.current.total[O.FAR_FACE]),d.addExifData("model_score.face_blurry_score",s.blurScore),d.addExifData("model_score.face_brightness_score",s.brightnessScore),d.addExifData("model_score.face_qualify_score",s.qualifyScore),d.addExifData("debug_log.face_real_qualify_score",s.realQualifyScore),d.addExifData("debug_log.face_qualify_model_message",s.qualifyModelMessage),d.addExifData("selfie_label",s.selfieLabel),d.addExifData("capture_time",s.captureTime),d.addExifData("type",s.gesture),E(s),eI(""),e$(tt),eU(!0),eO(T.CLOSE_FACE),t_("move_face_closer")},n={qualifyScore:e.qualifyScore,blurScore:e.blurScore,isEyeClosed:e.isEyeClosed,faceRatio:e.faceRatio,snapshot:N(ej.current),captureTime:Date.now(),facePrediction:U(t,s),brightnessScore:e.brightnessScore,faceError:e.faceError,realQualifyScore:e.realQualifyScore,qualifyModelMessage:e.qualifyModelMessage};if(!ef.enable)return void a(n);if(!eZ.isAutoCapturing()){eT(!0),eZ.startCapturing({onDone:e=>{eT(!1),a(e)},initialFrame:n});return}eZ.captureFrame(n)},[ef.enable,eZ,ty,eg.validFaceRatio,eg.enableCropCenterFar,eg.detectionToWholeFaceRatio,eg.imageQuality,e4,E,tt,eU,t_]),tk=e.useCallback(({frame:e,prediction:t,originalRatio:s})=>{if(eX.current)return;let a=e=>{let t=Y({maskBoundingBox:ty,faceRatio:e.faceRatio,validFaceRatio:eg.validFaceRatio,video:ej.current,shouldCropCenterSquare:eg.enableCropCenterClose,cropArea:e4,frame:e.snapshot,facePrediction:e.facePrediction,detectionToWholeFaceRatio:eg.detectionToWholeFaceRatio}),s={blob:k.takePicture({canvas:t,quality:eg.imageQuality}),gesture:"frontal",captureTime:e.captureTime,selfieLabel:O.CLOSE_FACE,qualifyScore:e.qualifyScore,blurScore:e.blurScore,brightnessScore:e.brightnessScore,realQualifyScore:e.realQualifyScore,qualifyModelMessage:e.qualifyModelMessage};eX.current=!0,d.addExifData("flash_liveness.number_of_frames.close_frames",ez.current.total[O.CLOSE_FACE]),d.addExifData("model_score.face_blurry_score",s.blurScore),d.addExifData("model_score.face_brightness_score",s.brightnessScore),d.addExifData("model_score.face_qualify_score",s.qualifyScore),d.addExifData("debug_log.face_real_qualify_score",s.realQualifyScore),d.addExifData("debug_log.face_qualify_model_message",s.qualifyModelMessage),d.addExifData("selfie_label",s.selfieLabel),d.addExifData("capture_time",s.captureTime),d.addExifData("type",s.gesture),E(s),eI(""),eJ(!1),eO(T.START_FLASHING),tu()},n={qualifyScore:e.qualifyScore,blurScore:e.blurScore,isEyeClosed:e.isEyeClosed,faceRatio:e.faceRatio,snapshot:N(ej.current),captureTime:Date.now(),facePrediction:U(t,s),brightnessScore:e.brightnessScore,faceError:e.faceError,realQualifyScore:e.realQualifyScore,qualifyModelMessage:e.qualifyModelMessage};if(!eh.enable)return void a(n);if(!e0.isAutoCapturing()){t_("please_hold_still"),eT(!0),e0.startCapturing({onDone:e=>{eT(!1),a(e)},initialFrame:n});return}e0.captureFrame(n)},[eh.enable,e0,ty,eg.validFaceRatio,eg.enableCropCenterClose,eg.detectionToWholeFaceRatio,eg.imageQuality,e4,E,tu,t_]),tC=e.useMemo(()=>{if("number"==typeof th&&th%eC==0){let e=td[th-1];return e===td[th]?eR:Math.max(eF,eR)}return eR},[th,eF,eR,td,eC]),tF=null!==th&&eB===T.START_FLASHING,tx=e.useRef(!1),tE=e.useCallback(({prediction:e,canvas:t})=>{if(!tF||tx.current||null===tb.current.colorIndex||null===tb.current.frameIndex)return;if(!el.enable)return void tm();let s=performance.now();if(null!==ta.current&&s-ta.current<tC)return;ta.current=s;let{frames:a}=ez.current,n=H({prediction:e,canvas:t,index:a.length,quality:el.frameQuality}),i={color:tf,type:O.FLASHING,time:Math.round(performance.now()),colorIndex:tb.current.colorIndex,frameIndex:tb.current.frameIndex,colorStringIndex:tb.current.colorStringIndex,pattern:eM,session_id:e5},r=tp();if(r&&eu.enable&&(d.addExifData("flash_liveness.flash_liveness_in_ms",Math.round(performance.now()-ey.current)),i.exif=d.getCurrentExif()),n.metadata=JSON.stringify(i),a.push(n),el.framesBatchLength>0&&a.length%el.framesBatchLength==0){let e=a.slice(-1*el.framesBatchLength);to(e),"function"==typeof b&&b(e)}r&&(tx.current=!0),tm()},[tF,el.enable,el.frameQuality,el.framesBatchLength,tC,tf,tb,eM,e5,tp,eu.enable,tm,to,b]),tw=e.useCallback(({error:e})=>{eA(e),("no_face"===e||"multiple_faces"===e)&&"no_face"===e&&eY.current&&!eD&&tg({reason:$.no_face})},[eD,tg,eA]),{warmupDone:tM}=G({onError:M,isVideoPlaying:e7,step:eB,cropArea:e4,videoRef:ej,onFarFaceDetected:tv,onFarFullFaceDetected:tS,onCloseFaceDetected:e.useCallback(({prediction:e,canvas:t})=>{let{frames:s}=ez.current;if(er.enableFarStep||0!==s.length||(eY.current=!0),!el.enable)return;let a=performance.now();if(null!==ta.current&&a-ta.current<el.framesIntervalTime)return;ta.current=a;let n=H({prediction:e,canvas:t,index:s.length,quality:el.frameQuality});if(n.metadata=JSON.stringify({color:"",type:O.CLOSE_FACE,time:Math.round(performance.now()),colorIndex:tb.current.colorIndex,pattern:eM,session_id:e5}),ez.current.total[O.CLOSE_FACE]+=1,s.push(n),el.framesBatchLength>0&&s.length%el.framesBatchLength==0){let e=s.slice(-1*el.framesBatchLength);to(e),"function"==typeof b&&b(e)}},[er.enableFarStep,el.enable,el.framesIntervalTime,el.frameQuality,el.framesBatchLength,tb,eM,e5,to,b]),onCloseFullFaceDetected:tk,onFlashingFramesCaptured:tE,useFaceDetectorWhenFlashing:ex,onFaceError:tw,maskBoundingRect:eQ,shouldPauseFaceDetection:eN||e2,faceDetectionSettings:R,shouldContinueOnError:eD,debug:ek});J(ej.current);z(()=>{!async function(){let{resourceReport:e,measureReport:t}=await C.reportAll();Object.values(e).forEach(e=>{eS("selfie_flash","sdk.download_model",e)}),Object.values(t).forEach(e=>{eS("selfie_flash","sdk.init_model",e)})}()},tM),z(()=>{er.enableFarStep?(t_("move_face_into_frame"),eO(T.FAR_FACE),e$(te)):(t_("move_face_closer"),eO(T.CLOSE_FACE),e$(tt)),eJ(!0),d.addExifData("selfie_type",e1),d.addExifData("flash_liveness",{flash_settings:{delay_between_colors:en.delayBetweenColors,flash_color:en.flashColor,secondary_flash_color:en.secondaryFlashColor},face_settings:{close_face_ratio:ei.closeFaceRatio,max_far_face_ratio:ei.maxFarFaceRatio,min_far_face_ratio:ei.minFarFaceRatio},mask_settings:{oval_vertical_offset:ea.ovalVerticalOffset,small_scale:ea.smallScale,large_scale:ea.largeScale},image_settings:{valid_face_ratio:eg.validFaceRatio}}),d.addExifData("global_session_id",e9.current),d.addExifData("pattern",eM),ev.enable&&d.addExifData("frame_batch_ids",ti),ey.current||(ey.current=performance.now())},tM&&e7),z(()=>eS("selfie_flash","user_activity.start"),!0),z(()=>eS("selfie_flash","user_activity.start_far"),eB===T.FAR_FACE),z(()=>eS("selfie_flash","user_activity.start_close"),eB===T.CLOSE_FACE),z(()=>eS("selfie_flash","user_activity.start_flash"),eB===T.START_FLASHING);let tR=null===th?0:Math.min(Math.round((th+1)/(eM.length*eC)*100),100),{Loading:tL}=m,tW=e.useCallback(()=>{eT(!1),eZ.stopCapturing(),e0.stopCapturing(),e3(!0)},[e0,eZ]),tI=e.useCallback(()=>{e3(!1),tg({reason:$.timeout})},[tg]),{remaining:tA}=K({shouldStart:eG&&ec.enable,onTimeout:tW,onDelayEnd:tI,onError:M,totalTime:ec.total,totalDelay:3,maxRetriesSettings:{enable:ec.enableMaxRetryCount,total:ec.maxRetryCount},interruptible:ec.interruptible}),tD=Z(eW),tT=e4.y+e4.height/2+tc;return a.jsxs(a.Fragment,{children:[a.jsx(f,{frontCamera:r,onVideoPlayed:e6,onClose:w,flipHorizontal:r,ref:ej,onError:M,videoSettings:eb,closeButton:a.jsx(es,{}),children:a.jsxs(X,{overlay:!tM||!e7,loadingComponent:tL,children:[""!==eW&&a.jsx(h,{}),a.jsx(I,{x:`${Math.round(e4.x)}px`,y:`${Math.round(e4.y)}px`,width:`${e4.width}px`,height:`${e4.height}px`,surroundStyle:{background:o("FlashLiveness.maskFill")({theme:eq})},children:a.jsx(u,{ref:eV,scale:eH,debug:ek,width:e4.width,height:e4.height,padding:ea.ovalPadding,verticalOffset:tc,mask:eP})}),!eD&&""!==tD&&"start_flashing"!==eB&&a.jsx(et,{errorY:tT,errorMessage:tD})]})}),a.jsx(A,{step:eB,currentProgress:tR,errorCode:eW,timeoutProps:{remaining:tA,warningThreshold:ec.countdown,total:ec.total,shouldStart:eG&&ec.enable},isFlashingColor:tf===ew,isAutoCapturing:eD,extraConfig:x}),a.jsx(ee,{step:eB,currentColor:tf,flashIntensity:eE,flashColor:ew,secondaryFlashColor:eL})]})}let ey=s=>{let{apiCheck:n,onLivenessDetectionDone:i,frontalMinSize:r,serviceSettings:l,apiCredentials:o,..._}=s,g=_.customComponent?.FlashLivenessLoading??w,[c,f]=e.useState(!1),h=ee(),u=ed(),m=er(),b=x.getEnabledServices(l,m),{verifyFlashLiveness:p,uploadImage:v}=function({outputEncryptionSettings:t,selfieType:s,enabledServices:a,apiCredentials:n}){let{apiClient:i}=F.useApiClient({apiCredentials:n}),r=e.useCallback(async e=>{if(!t.enable)return i.uploadImage({label:"portrait",file:e.blob,metadata:JSON.stringify({label:e.selfieLabel})});let s=new Blob([e.encrypted.hex]);return i.uploadImage({file:s,label:"portrait",metadata:JSON.stringify({label:e.selfieLabel})},{"X-TV-Key":t.key})},[i,t.enable,t.key]);return{verifyFlashLiveness:e.useCallback(async({videos:e,uploadedImages:t,metadata:n})=>{try{let r=null;a.enableVerifyFaceLiveness&&(r=i.verifyFaceLiveness({images:t.map(e=>({id:e?.data?.image_id,label:"portrait"})),videos:e,metadata:n,selfie_type:s}));let l=null;a.enableVerifySanityPortrait&&(l=i.requestVerifyPortrait({image:{id:t[t.length-1]?.data?.image_id},selfie_type:s}));let[o,_]=await Promise.all([r,l]);return{uploadedImages:t,faceLivenessResult:o,portraitResult:_}}catch(e){return console.error(e),{}}},[i,a.enableVerifyFaceLiveness,a.enableVerifySanityPortrait,s]),uploadImage:r}}({outputEncryptionSettings:h,selfieType:u,enabledServices:b,apiCredentials:o}),{captureFrameSettings:y,flashSettings:S,exifSettings:k,outputImageSettings:C}=em(),{framesIntervalTime:L}=y,{onFramesCaptured:W,onReset:I}=s,{onErrorCallback:A}=eo(),D=et(),T=e.useRef([]),B=e.useRef([]),q=async e=>{let t=e;if(h.enable&&(t=await M.encryptFrames(t,h.key)),"function"==typeof W&&W(t),n&&b.enableUploadFrames){let e={};h.enable&&(e["X-TV-Key"]=h.key),es.uploadFrameBatch(ea(t),D,e)}},P=e.useCallback(async e=>{let t,s=e.selfieLabel===O.FAR_FACE?C.farImageOrder:C.closeImageOrder;if(T.current[s])return;let a=new Promise(e=>{t=e});B.current.push(a);let i={...e,blob:await e.blob},r=await d.writeCurrentExif({imageData:i,enableExifData:k.enable});i.blob=r,h.enable&&(i.encrypted=await E.encrypt({blob:i.blob,key:h.key})),T.current[s]={image:i,uploadPromise:n&&b.enableUploadImages?v(i):null},t()},[n,b.enableUploadImages,k.enable,h.enable,h.key,C.closeImageOrder,C.farImageOrder,v]),j=async e=>{f(!0),await Promise.all(B.current);let s={flash_color:S.flashColor,colors:S.colors,frames_per_color:S.framesPerColor,frame_interval:L,delay_between_colors:S.delayBetweenColors,use_face_detector_when_flashing:S.useFaceDetectorWhenFlashing};T.current=T.current.filter(e=>!!e);let a=T.current.map(e=>e.image).filter(e=>"frontal"===e.gesture),l=a.map(e=>e.blob),o=a.map(e=>e.encrypted),_=l[l.length-1],g=_&&"number"==typeof r?await R.scaleImage(_,{minsize:r}):null,c=e.frames;if(h.enable&&(c=await M.encryptFrames(c,h.key)),!n||!b.enableUploadImages){await i({capturedFrames:c,frontalFaces:l,frontalFacesEncrypted:o,frontalScaledImage:g,steps:[],metadata:s}),f(!1);return}try{let e=null;e=y.enable?await es.getAllUploadedBatches():[{frames:ea(c)}];let t=await Promise.all(T.current.map(e=>e.uploadPromise)),{faceLivenessResult:a,portraitResult:n}=await p({videos:e,uploadedImages:t,metadata:s});if(es.resetUploadBatches(),f(!1),a?.errors)throw a.errors;if(n?.errors)throw n.errors;await i({capturedFrames:c,steps:[],frontalFaces:l.map((e,s)=>({blob:e,id:t?.[s]?.data?.image_id})),frontalFacesEncrypted:o,frontalScaledImage:g,apiCheckPassed:a?.data.is_live??!1,verifyFaceLivenessResult:a?.data??null,verifyPortraitResult:n?.data??null,uploadFramesResult:e})}catch(e){console.error(e),f(!1),A({...t.Errors.api_call_error,details:e})}};return a.jsxs(a.Fragment,{children:[a.jsx(ev,{..._,apiCheck:n,onFlashDone:j,onFramesCaptured:q,onReset:()=>{T.current=[],B.current=[],es.resetUploadBatches(),"function"==typeof I&&I()},onImageCaptured:P}),a.jsx(g,{loading:c})]})},eS=e=>{let{apiCredentials:t,outputEncryptionSettings:s,mode:n}=e;return a.jsx(A,{version:"v2",unmountOnHidden:!0,children:a.jsx(en,{apiCredentials:t,children:a.jsx(ec,{flashMode:n,children:a.jsx(ei,{settings:s,children:a.jsx(ey,{...e})})})})})};eS.propTypes={apiCheck:s.bool,apiCredentials:s.shape({accessKey:s.string,secretKey:s.string,apiUrl:s.string}),onReset:s.func,onLivenessDetectionDone:s.func,onClose:s.func,onError:s.func,onFramesCaptured:s.func,frontCamera:s.bool,styledComponent:s.shape({CloseCameraButton:s.node}),outputEncryptionSettings:s.shape({key:s.string}),frontalMinSize:s.number,serviceSettings:s.shape({enableGetClientSettings:s.bool,enableUploadFrames:s.bool,enableUploadImages:s.bool,enableVerifySanityPortrait:s.bool,enableVerifyFaceLiveness:s.bool}),mode:s.string,flowId:s.string,customTexts:s.shape({}),customComponents:s.shape({FlashLivenessBody:s.elementType,FlashLivenessOverlay:s.elementType}),extraConfig:s.shape({})},eS.defaultProps={apiCheck:!1,apiCredentials:{},onReset:()=>{},onLivenessDetectionDone:()=>{},onClose:()=>{},onError:()=>{},onFramesCaptured:()=>{},frontCamera:!0,styledComponent:{CloseCameraButton:null},outputEncryptionSettings:{key:""},frontalMinSize:null,serviceSettings:{enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifyFaceLiveness:!0},mode:t.Mode.FLASH_ADVANCED,flowId:"",customTexts:{},customComponents:{FlashLivenessBody:null,FlashLivenessOverlay:null},extraConfig:null};export{eS as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,v as t,a as s,b as a,n as i,g as n,as as r,at as l,V as o,X as _,Y as g,j as d,au as c,av as m,aw as f,ax as u,ay as v,aF as b,aG as h,aC as p,O as k,Z as y,m as S,p as C,s as F,aD as x,aE as w,a1 as E,P as W}from"./chunk-59d3e3b1.js";import{d as R}from"./chunk-e9dc3cb2.js";import{t as M}from"./chunk-43a27060.js";import{C as L,O as O}from"./chunk-d2a607bb.js";import{u as D,S as B,a as I,o as P,b as T,c as j,d as A,n as V,l as q,f as U,F as z,e as Q,s as N,g as G,h as J,i as H,j as K,W as $,k as X,m as Y,p as Z,q as ee,r as et,A as es,O as ea}from"./chunk-67c92f43.js";import{f as ei,m as en,a as er,u as el}from"./chunk-a989c084.js";let eo=0,e_=1,eg={data:{settings:{sdk_settings:{passive_liveness_v2_settings:{frontal_face_check:{enable:!0,up_down_bound_min:.35,up_down_bound_max:.7},capture_frame_settings:{enable:!1,frames_batch_length:10,frames_interval_time:0,frame_quality:.8,frame_scale:1,auto_capture_min_frames:8,auto_capture_min_frames_far:8,auto_capture_min_frames_close:0},not_qualified_settings:{enable_far:!1,threshold_far:.11},close_eyes_settings:{enable:!1,timeout:5,force_check:!1},face_settings:{chin_height:20,max_far_face_ratio:.9,min_far_face_ratio:.8,mobile:{chin_height:20,max_far_face_ratio:.9,min_far_face_ratio:.85}},timeout_settings:{enable:!0,total:30,countdown:10,max_retry_count:0,non_stoppable:!1},exif_data_settings:{enable:!0},mask_settings:{mobile:{oval_vertical_padding:20,oval_horizontal_padding:20,oval_vertical_offset:60,small_scale:.65},oval_horizontal_padding:20,oval_vertical_padding:20,oval_vertical_offset:0,small_scale:.6},image_settings:{valid_face_ratio:.6,image_quality:1,crop_center_far:!0,crop_center_close:!1,detection_to_whole_face_ratio:.8},blur_far_settings:{enable:!0,blurry_threshold:.4,wait_for_best_image_time_ms:1e3},brightness_detection_far_settings:{enable_too_bright_check:!1,enable_too_dark_check:!1,too_bright_threshold:.83,too_dark_threshold:.195},output_image_settings:{image_ordering:["far","close"]},auto_gen_frame_ids:{enable:!1,max_items:50}}}}}},ed=()=>{let i=ei();return e.useMemo(()=>{let e=en({},eg,i),n={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.enable"),framesIntervalTime:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.frames_interval_time"),framesBatchLength:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.frames_batch_length"),frameScale:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.frame_scale"),frameQuality:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.frame_quality"),autoCaptureMinFrames:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.auto_capture_min_frames"),autoCaptureMinFramesFar:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.auto_capture_min_frames_far"),autoCaptureMinFramesClose:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.capture_frame_settings.auto_capture_min_frames_close")},r={smallScale:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.small_scale":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.small_scale"),largeScale:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.small_scale":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.small_scale"),ovalPadding:{left:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.oval_horizontal_padding":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.oval_horizontal_padding"),right:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.oval_horizontal_padding":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.oval_horizontal_padding"),top:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.oval_vertical_padding":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.oval_vertical_padding"),bottom:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.oval_vertical_padding":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.oval_vertical_padding")},ovalVerticalOffset:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.mobile.oval_vertical_offset":"data.settings.sdk_settings.passive_liveness_v2_settings.mask_settings.oval_vertical_offset"),chinToMaskBottomPadding:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.mobile.chin_height":"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.chin_height")},l={minFarFaceRatio:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.mobile.min_far_face_ratio":"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.min_far_face_ratio"),maxFarFaceRatio:t.getWebSetting(e,s.isMobile?"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.mobile.max_far_face_ratio":"data.settings.sdk_settings.passive_liveness_v2_settings.face_settings.max_far_face_ratio")},o={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.close_eyes_settings.enable"),timeout:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.close_eyes_settings.timeout"),forceCheck:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.close_eyes_settings.force_check")},_={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.exif_data_settings.enable")},g={imageQuality:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.image_settings.image_quality"),validFaceRatio:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.image_settings.valid_face_ratio"),enableCropCenterFar:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.image_settings.crop_center_far"),detectionToWholeFaceRatio:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.image_settings.detection_to_whole_face_ratio")},d=t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.timeout_settings.max_retry_count"),c={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.timeout_settings.enable"),total:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.timeout_settings.total"),countdown:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.timeout_settings.countdown"),enableMaxRetryCount:d>0,maxRetryCount:d,interruptible:!t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.timeout_settings.non_stoppable")},m={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.blur_far_settings.enable"),threshold:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.blur_far_settings.blurry_threshold"),duration:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.blur_far_settings.wait_for_best_image_time_ms")},f={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.not_qualified_settings.enable_far"),threshold:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.not_qualified_settings.threshold_far")},u={enableTooBrightCheck:a(e,"data.settings.sdk_settings.passive_liveness_v2_settings.brightness_detection_far_settings.enable_too_bright_check"),enableTooDarkCheck:a(e,"data.settings.sdk_settings.passive_liveness_v2_settings.brightness_detection_far_settings.enable_too_dark_check"),tooBrightThreshold:a(e,"data.settings.sdk_settings.passive_liveness_v2_settings.brightness_detection_far_settings.too_bright_threshold"),tooDarkThreshold:a(e,"data.settings.sdk_settings.passive_liveness_v2_settings.brightness_detection_far_settings.too_dark_threshold")},v={imageOrdering:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.output_image_settings.image_ordering"),farImageOrder:e_,closeImageOrder:eo};Array.isArray(v.imageOrdering)&&2===v.imageOrdering.length&&"far"===v.imageOrdering[0]&&"close"===v.imageOrdering[1]&&(v.farImageOrder=0,v.closeImageOrder=1);let b={enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.auto_gen_frame_ids.enable")&&c.enable,maxItems:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.auto_gen_frame_ids.max_items")};return{captureFrameSettings:n,livenessSettings:{},flashSettings:{},maskSettings:r,faceSettings:l,closeEyesSettings:o,exifSettings:_,imageSettings:g,timeoutSettings:c,blurCheckFarSettings:m,blurCheckCloseSettings:{},notQualifiedFarSettings:f,notQualifiedCloseSettings:{},brightnessDetectionFarSettings:u,brightnessDetectionCloseSettings:{},outputImageSettings:v,autoGenFrameIds:b,frontalFaceCheckSettings:{enable:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.frontal_face_check.enable"),upDownBoundMin:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.frontal_face_check.up_down_bound_min"),upDownBoundMax:t.getWebSetting(e,"data.settings.sdk_settings.passive_liveness_v2_settings.frontal_face_check.up_down_bound_max")}}},[i])},ec=s.isMobile?{width:{ideal:640},whiteBalanceMode:"none"}:{width:{ideal:9999},whiteBalanceMode:"none"},em=(e,t)=>""===t.faceError&&(!!e.isEyeClosed&&!t.isEyeClosed||(!!e.isEyeClosed||!t.isEyeClosed)&&(!!u.hasBetterBrightnessScore(t.brightnessScore,e.brightnessScore)||!!u.hasSameBrightnessScore(t.brightnessScore,e.brightnessScore)&&v.hasBetterBlurScore(t.blurScore,e.blurScore)));function ef(t){let{onReset:s,onDone:a,frontCamera:u,styledComponent:v,onFramesCaptured:S,customComponent:C,extraConfig:F}=t,{onErrorCallback:x,onCloseCallback:w}=er(),E=ed(),W=C?.PassiveLivenessBody??b,O=C?.PassiveLivenessError??h,Z=C?.PassiveLivenessCloseIcon??p,{maskSettings:ee,faceSettings:et,captureFrameSettings:es,exifSettings:ea,imageSettings:ei,timeoutSettings:en,blurCheckFarSettings:eo,outputImageSettings:e_,autoGenFrameIds:eg}=E,ef=e.useRef(),eu=D(),ev=el(),[eb,eh]=e.useState(""),ep=e.useMemo(()=>M(eh,1e3),[]),[ek,ey]=e.useState(!1),[eS,eC]=e.useState(B.LOADING),eF=i(),ex={width:n("FlashLiveness.mask.width")({theme:eF}),height:n("FlashLiveness.mask.height")({theme:eF}),strokeColor:(eS===B.FAR_FACE||eS===B.CLOSE_FACE)&&eb&&!ek?n("FlashLiveness.mask.strokeColorError")({theme:eF}):n("FlashLiveness.mask.strokeColor")({theme:eF}),strokeWidth:2*n("FlashLiveness.mask.strokeWidth")({theme:eF}),path:n("FlashLiveness.mask.path")({theme:eF}),backgroundColor:n("FlashLiveness.maskFill")({theme:eF})},ew=e.useRef(null),[eE,eW,eR]=I(),[eM,eL]=e.useState(0),[eO,eD]=e.useState(!1),eB=e.useRef({frames:[],images:[]}),eI=e.useRef(!1),eP=P(),eT=T({compareFn:em,duration:eo.duration,minFrames:es.autoCaptureMinFrames}),[ej,eA]=e.useState(!1),{sessionId:eV,updateSessionId:eq}=j(),eU=e.useRef(r.createSingleUUID()),{onVideoPlayed:ez,cropArea:eQ,isPlaying:eN}=A({}),{smallScale:eG,largeScale:eJ}=V(ee,{width:ex.width,height:ex.height},{width:eQ.width,height:eQ.height}),eH=1e3*en.total/es.framesIntervalTime,{uuids:eK,getNextUUID:e$,reset:eX}=l({total:Math.min(eg.maxItems,Math.ceil(eH/es.framesBatchLength*1.2))}),eY=e.useCallback(e=>{let t=e[e.length-1];try{let e=JSON.parse(t.metadata);eg.enable&&(e.global_batch_id=e$()),e.global_session_id=eU.current,t.metadata=JSON.stringify(e)}catch(e){console.error("Unable to process last frame metadata",e)}},[eg.enable,e$]),eZ=e.useRef(null),{playVoice:e2}=o.useVoicePlayer(),e0=e.useMemo(()=>R(()=>{if(eI.current=!1,eB.current.frames=[],eB.current.images=[],eZ.current=null,eL(eG),eC(B.FAR_FACE),e2("move_face_into_frame"),eq(),eT.stopCapturing(),ey(!1),eg.enable){let e=eX();_.addExifData("frame_batch_ids",e)}s()},200,{leading:!0}),[eG,e2,eq,eT,eg.enable,s,eX]),e1=q({offset:ee.ovalVerticalOffset,ovalPadding:ee.ovalPadding,largeScale:eJ,maskHeight:eQ.height,ovalHeight:ex.height}),e8=e.useCallback(async()=>{eC(B.STOP_DECTECTING),eu("selfie_passive_v2","user_activity",()=>({passive_liveness_in_ms:performance.now()-ef.current}));let{frames:e}=eB.current;if(es.enable&&es.framesBatchLength>0){let t=e.length%es.framesBatchLength;if(0!==t){let s=e.slice(-1*t);eY(s),"function"==typeof S&&S(s)}}eB.current.images[e_.farImageOrder].blob=await eB.current.images[e_.farImageOrder].blob,_.addExifData("selfie_type","passive_v2"),_.addExifData("passive_liveness_v2",{number_of_frames:{far_frames:e.length},passive_liveness_in_ms:Math.round(performance.now()-ef.current),face_settings:{max_far_face_ratio:et.maxFarFaceRatio,min_far_face_ratio:et.minFarFaceRatio},mask_settings:{oval_vertical_offset:ee.ovalVerticalOffset,small_scale:ee.smallScale},image_settings:{valid_face_ratio:ei.validFaceRatio}});let t=await _.writeCurrentExif({imageData:eB.current.images[e_.farImageOrder],enableExifData:ea.enable});eB.current.images[e_.farImageOrder].blob=t,eP.enable&&(eB.current.images[e_.farImageOrder].encrypted=await g.encrypt({blob:eB.current.images[e_.farImageOrder].blob,key:eP.key})),eB.current.images=eB.current.images.filter(e=>!!e);try{"function"==typeof a&&await a({images:eB.current.images,frames:eB.current.frames})}catch(e){x({error:e})}},[eu,es.enable,es.framesBatchLength,e_.farImageOrder,et.maxFarFaceRatio,et.minFarFaceRatio,ee.ovalVerticalOffset,ee.smallScale,ei.validFaceRatio,ea.enable,eP.enable,eP.key,eY,S,a,x]),e9=e.useCallback(({prediction:e,canvas:t})=>{if(!es.enable)return;let{frames:s}=eB.current,a=U({prediction:e,canvas:t,index:s.length,quality:es.frameQuality});if(a.metadata=JSON.stringify({type:z.FAR_FACE,time:Math.round(performance.now()),session_id:eV}),s.push(a),es.framesBatchLength<=0||s.length%es.framesBatchLength!=0)return;let i=s.slice(-1*es.framesBatchLength);eY(i),"function"==typeof S&&S(i)},[es.enable,es.frameQuality,es.framesBatchLength,S,eY,eV]),e3=e.useCallback(async()=>{let{frames:e}=eB.current;0===e.length&&(eI.current=!0)},[]),e5=e.useMemo(()=>({x:Math.max(eW?.left,0),y:Math.max(eW?.top,0),width:Math.min(eW?.right-eW?.left,eQ.width),height:Math.min(eW?.bottom-eW?.top,eQ.height)}),[eQ.height,eQ.width,eW?.bottom,eW?.left,eW?.right,eW?.top]),e6=e.useCallback(async({frame:e,prediction:t,canvas:s,originalRatio:a})=>{if("no_face"===e.faceError||eB.current.images[e_.farImageOrder])return;if(es.enable){let e=performance.now();if(null!==eZ.current&&e-eZ.current<es.framesIntervalTime)return;eZ.current=e}let i=e=>{let t=X({maskBoundingBox:e5,faceRatio:e.faceRatio,validFaceRatio:ei.validFaceRatio,video:ew.current,shouldCropCenterSquare:ei.enableCropCenterFar,cropArea:eQ,frame:e.snapshot,facePrediction:e.facePrediction,detectionToWholeFaceRatio:ei.detectionToWholeFaceRatio}),s={blob:k.takePicture({canvas:t,quality:ei.imageQuality}),gesture:"frontal",captureTime:e.captureTime,selfieLabel:z.FAR_FACE,qualifyScore:e.qualifyScore,blurScore:e.blurScore,brightnessScore:e.brightnessScore};_.addExifData("model_score.face_blurry_score",s.blurScore),_.addExifData("model_score.face_brightness_score",s.brightnessScore),_.addExifData("model_score.face_qualify_score",s.qualifyScore),_.addExifData("selfie_label",s.selfieLabel),_.addExifData("capture_time",s.captureTime),_.addExifData("type",s.gesture),eB.current.images[e_.farImageOrder]=s},n={qualifyScore:e.qualifyScore,blurScore:e.blurScore,isEyeClosed:e.isEyeClosed,faceRatio:e.faceRatio,snapshot:Q(ew.current),captureTime:Date.now(),facePrediction:N(t,a),brightnessScore:e.brightnessScore,faceError:e.faceError};if(!eo.enable){e9({prediction:t,canvas:s}),i(n),await e8();return}if(!eT.isAutoCapturing()){await e2("please_hold_still"),ey(!0),e9({prediction:t,canvas:s}),eT.startCapturing({onDone:async e=>{i(e),await e8()},initialFrame:n});return}e9({prediction:t,canvas:s}),eT.captureFrame(n)},[e_.farImageOrder,es.enable,es.framesIntervalTime,eo.enable,eT,e9,e5,ei.validFaceRatio,ei.enableCropCenterFar,ei.detectionToWholeFaceRatio,ei.imageQuality,eQ,e8,e2]),{warmupDone:e4}=G({onError:x,isVideoPlaying:eN,step:eS,cropArea:eQ,videoRef:ew,onFarFaceDetected:e3,onFarFullFaceDetected:e6,onFaceError:e.useCallback(({error:e})=>{ep(e),("no_face"===e||"multiple_faces"===e)&&"no_face"===e&&eI.current&&e0()},[e0,ep]),faceSettings:et,maskBoundingRect:eW,shouldPauseFaceDetection:eR||ej,faceDetectionSettings:E,shouldContinueOnError:ek,debug:ev});J(ew.current);H(()=>{!async function(){let{resourceReport:e,measureReport:t}=await y.reportAll();Object.values(e).forEach(e=>{eu("selfie_passive_v2","sdk.download_model",e)}),Object.values(t).forEach(e=>{eu("selfie_passive_v2","sdk.init_model",e)})}()},e4),H(()=>{eC(B.FAR_FACE),eL(eG),e2("move_face_into_frame"),eD(!0),eg.enable&&_.addExifData("frame_batch_ids",eK),_.addExifData("global_session_id",eU.current),ef.current||(ef.current=performance.now())},e4&&eN),H(()=>eu("selfie_passive_v2","user_activity.start"),!0),H(()=>eu("selfie_passive_v2","user_activity.start_far"),eS===B.FAR_FACE);let{Loading:e7}=v,te=e.useCallback(()=>{ey(!1),eT.stopCapturing(),eA(!0)},[eT]),tt=e.useCallback(()=>{eA(!1),e0()},[e0]),{remaining:ts}=K({shouldStart:eO&&en.enable,onTimeout:te,onDelayEnd:tt,onError:x,totalTime:en.total,totalDelay:3,maxRetriesSettings:{enable:en.enableMaxRetryCount,total:en.maxRetryCount},interruptible:en.interruptible}),ta=Y(eb),ti=eQ.y+eQ.height/2+e1,tn=eo.duration,tr=Math.max(tn,es.autoCaptureMinFrames*es.framesIntervalTime);return d.jsxs(d.Fragment,{children:[d.jsx(c,{frontCamera:u,onVideoPlayed:ez,onClose:w,flipHorizontal:u,ref:ew,onError:x,videoSettings:ec,closeButton:d.jsx(Z,{}),children:d.jsxs($,{overlay:!e4||!eN,loadingComponent:e7,children:[!ek&&""!==eb&&d.jsx(m,{}),d.jsx(L,{x:`${Math.round(eQ.x)}px`,y:`${Math.round(eQ.y)}px`,width:`${eQ.width}px`,height:`${eQ.height}px`,surroundStyle:{background:n("FlashLiveness.maskFill")({theme:eF})},children:d.jsx(f,{ref:eE,scale:eM,debug:ev,width:eQ.width,height:eQ.height,padding:ee.ovalPadding,verticalOffset:e1,mask:ex})}),!ek&&""!==ta&&d.jsx(O,{errorY:ti,errorMessage:ta})]})}),d.jsx(W,{step:eS,errorCode:eb,timeoutProps:{remaining:ts,warningThreshold:en.countdown,total:en.total,shouldStart:eO&&en.enable},isAutoCapturing:ek,autoCaptureDuration:tr,extraConfig:F})]})}let eu=t=>{let{apiCheck:s,onLivenessDetectionDone:a,frontalMinSize:i,serviceSettings:n,apiCredentials:r,...l}=t,o=l.customComponent?.FlashLivenessLoading??x,[_,g]=e.useState(!1),c=P(),m=ei(),f=C.getEnabledServices(n,m),{verifyLiveness:u}=function({outputEncryptionSettings:t,selfieType:s,enabledServices:a,apiCredentials:i}){let{apiClient:n}=S.useApiClient({apiCredentials:i});return{verifyLiveness:e.useCallback(async({videos:e,images:i,metadata:r})=>{try{let l=await Promise.all(i.map(e=>{if(!t.enable)return n.uploadImage({label:"portrait",file:e.blob,metadata:JSON.stringify({label:e.selfieLabel})});let s=new Blob([e.encrypted.hex]);return n.uploadImage({file:s,label:"portrait",metadata:JSON.stringify({label:e.selfieLabel})},{"X-TV-Key":t.key})})),o=null;a.enableVerifyFaceLiveness&&(o=n.verifyFaceLiveness({images:l.map(e=>({id:e?.data?.image_id,label:"portrait"})),videos:e,metadata:r,selfie_type:s}));let _=null;a.enableVerifySanityPortrait&&(_=n.requestVerifyPortrait({image:{id:l[l.length-1]?.data?.image_id},selfie_type:s}));let[g,d]=await Promise.all([o,_]);return{uploadedImages:l,faceLivenessResult:g,portraitResult:d}}catch(e){return console.error(e),{}}},[n,a.enableVerifyFaceLiveness,a.enableVerifySanityPortrait,t.enable,t.key,s])}}({apiCredentials:r,outputEncryptionSettings:c,selfieType:F.Mode.PASSIVE_V2,enabledServices:f}),{captureFrameSettings:v}=ed(),{framesIntervalTime:b}=v,{onFramesCaptured:h,onReset:p}=t,{onErrorCallback:k}=er(),y=Z(),W=async e=>{let t=e;if(c.enable&&(t=await w.encryptFrames(t,c.key)),"function"==typeof h&&h(t),s&&f.enableUploadFrames){let e={};c.enable&&(e["X-TV-Key"]=c.key),ee.uploadFrameBatch(et(t),y,e)}},R=async e=>{let t={frame_interval:b},n=e.images.filter(e=>"frontal"===e.gesture),r=n.map(e=>e.blob),l=n.map(e=>e.encrypted),o=r[r.length-1],_=o&&"number"==typeof i?await E.scaleImage(o,{minsize:i}):null,d=e.frames;if(c.enable&&(d=await w.encryptFrames(d,c.key)),!s||!f.enableUploadImages)return void await a({capturedFrames:d,frontalFaces:r,frontalFacesEncrypted:l,frontalScaledImage:_,steps:[],metadata:t});try{g(!0);let s=null;s=v.enable?await ee.getAllUploadedBatches():[{frames:et(d)}];let{uploadedImages:i,faceLivenessResult:n,portraitResult:o}=await u({videos:s,images:e.images,metadata:t});if(ee.resetUploadBatches(),g(!1),n?.errors)throw n.errors;if(o?.errors)throw o.errors;await a({capturedFrames:d,steps:[],frontalFaces:r.map((e,t)=>({blob:e,id:i?.[t]?.data?.image_id})),frontalFacesEncrypted:l,frontalScaledImage:_,apiCheckPassed:n?.data.is_live??!1,verifyFaceLivenessResult:n?.data??null,verifyPortraitResult:o?.data??null,uploadFramesResult:s})}catch(e){console.error(e),g(!1),k({error:e})}};return d.jsxs(d.Fragment,{children:[d.jsx(ef,{...l,apiCheck:s,onDone:R,onFramesCaptured:W,onReset:()=>{ee.resetUploadBatches(),"function"==typeof p&&p()}}),s&&d.jsx(o,{loading:_})]})},ev=e=>{let{apiCredentials:t,outputEncryptionSettings:s}=e;return d.jsx(O,{version:"v2",unmountOnHidden:!0,children:d.jsx(es,{apiCredentials:t,children:d.jsx(ea,{settings:s,children:d.jsx(eu,{...e})})})})};ev.propTypes={apiCheck:W.bool,apiCredentials:W.shape({accessKey:W.string,secretKey:W.string,apiUrl:W.string}),onReset:W.func,onLivenessDetectionDone:W.func,onClose:W.func,onError:W.func,onFramesCaptured:W.func,frontCamera:W.bool,styledComponent:W.shape({CloseCameraButton:W.node}),outputEncryptionSettings:W.shape({key:W.string}),frontalMinSize:W.number,serviceSettings:W.shape({enableGetClientSettings:W.bool,enableUploadFrames:W.bool,enableUploadImages:W.bool,enableVerifySanityPortrait:W.bool,enableVerifyFaceLiveness:W.bool}),mode:W.string,flowId:W.string,customTexts:W.shape({}),customComponents:W.shape({PassiveLivenessBody:W.elementType}),extraConfig:W.shape({})},ev.defaultProps={apiCheck:!1,apiCredentials:{},onReset:()=>{},onLivenessDetectionDone:()=>{},onClose:()=>{},onError:()=>{},onFramesCaptured:()=>{},frontCamera:!0,styledComponent:{CloseCameraButton:null},outputEncryptionSettings:{key:""},frontalMinSize:null,serviceSettings:{enableGetClientSettings:!0,enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifyFaceLiveness:!0},flowId:"",customTexts:{},customComponents:{PassiveLivenessBody:null},extraConfig:null};export{ev as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,b as t,v as a,aJ as n,s as s,q as i,ad as r,m as l,U as c,at as o,as as m,p as g,X as u,a as _,aM as f,aN as d,c as b,a1 as h,O as p,Y as v,ay as w,E as F,aE as k}from"./chunk-59d3e3b1.js";import{d as y}from"./chunk-e9dc3cb2.js";import{t as T}from"./chunk-43a27060.js";import{w as I,o as R,q as S,t as L,u as x,r as B,s as D,v as E,x as M,y as A,z as O}from"./chunk-c5b7ee1d.js";import{m as N,f as P}from"./chunk-a989c084.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 I();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:z,Messages:J,TrackLivenessEvents:$}=s,K={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}},X=()=>{},G=()=>{},H=()=>{};function Z({apiCheck:f,bgCameraMask:I,bgCameraMaskRed:R,surroundStyle:C,cropAreaDimension:Y,customInstructions:Q,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea=q,onLivenessDetectionDone:en,onError:es,frontalMinSize:ei,waitingTimeToGetBetterFrames:er=500,captureFrameSettings:el=K,setRemainingTime:ec=X,onProcessing:eo=H,customErrors:em,customMessages:eg,apiCredentials:eu={},onFramesCaptured:e_=G,initFirstGestureTimeout:ef=2e3,outputEncryptionSettings:ed,cameraScale:eb=1,sendCustomEvent:eh,serviceSettings:ep,currentOrientation:ev,onReset:ew}={}){let[eF,ek]=e.useState(!1),[ey,eT]=e.useState(!1),[eI,eR]=e.useState(!1),[eS,eL]=e.useState(!1),ex=e.useRef(null),{lang:eB,assetRoot:eD,customUrls:eE,exifKey:eM}=i.useSDKSettings(),eA=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(),ez=e.useRef(null);null===ez.current&&(ez.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Q,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea,Locale:eA,lang:eB}));let[eJ,e$]=e.useState(),eK=e.useCallback(e=>{e$(e)},[]),eq=e.useMemo(()=>T(eK,500),[eK]),eX=e.useRef([]),eG=e.useRef(),eH=P(),{faceTrackingSetting:eZ,flowIntervalTimeMs:eY,limitTimeLivenessCheck:eQ,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:eH}),e9=1e3*eQ.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,eH),[eH,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(()=>T(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&&(eG.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()-eG.current}}),eG.current=null))}(),()=>{e=!0}},[eU,eE,tl]);let tu=e.useRef(!1),t_=e.useCallback(()=>{ez.current.curStepIndex=ez.current.steps.length,tu.current=!0,eR(!1),tg.current?.discardRecording()},[]),tf=e.useCallback(()=>{if(ez.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Q,customIcon:ee,customDirectionIcon:et,Locale:eA,lang:eB}),to.current=0,tm.current=null,eX.current=[],eL(!1),e$(null),A(),tg.current?.start(),tu.current=!1,e8.enable){let e=tt();u.addExifData("frame_batch_ids",e)}"function"==typeof ew&&ew(),eN()},[eA,eD,e8.enable,et,ee,Q,eB,ew,tt]),td=e.useCallback(()=>{t_(),setTimeout(()=>{tf()},eY)},[t_,eY,tf]),tb=e.useMemo(()=>({...z,...em}),[em]),th=e.useMemo(()=>({...J,...eg}),[eg]),tp=e.useCallback(({remainTime:e})=>{if(e>0&&e<=eQ.remainTimeShow){let t=L(th.REMAIN_TIME[eB]),a=e;switch(eQ.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,eQ.format,eQ.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:eQ.limitTimeSecond})}),e$({...tb.liveness_terminated_time_out,msg:e,duration:.95*eY}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),V.stop(),ec(""),t_()},[tb.liveness_terminated_time_out,eY,eQ.limitTimeSecond,t_,tl,ec]),tw=e.useCallback(({attemptCount:e,fromBackground:t})=>{eQ.enableMaxRetries&&e>=eQ.totalMaxRetries&&es(s.Errors.max_retry_reached),t&&t_(),V.start(),tf()},[eQ.enableMaxRetries,eQ.totalMaxRetries,es,tf,t_]),{stopTimer:tF}=x({totalTime:eQ.limitTimeSecond,totalDelayBetweenReset:eY/1e3,interruptible:eQ.interruptible,shouldStart:ey&&eQ.enable&&eU,onTimesUp:tv,onTick:tp,onReset:tw}),tk=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:I,surroundStyle:C},"object"==typeof Y?eP.current={...eP.current,...Y}:"function"==typeof Y&&(eP.current={...eP.current,...Y({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:n,lostX:s,lostY:i,isMobile:_.isMobile,width:r,height:l})}),eN(),eT(!0)},[I,C,Y]),ty=e.useRef({});e.useEffect(()=>{ty.current.isFirstValidFrameFoundRef=eS},[eS]),e.useEffect(()=>{let e,t=ex.current,a=async()=>{let{steps:e}=ez.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(eX.current.length/e4.framesBatchLength)}x${e4.framesBatchLength}`,t=eX.current.length%e4.framesBatchLength>0?`+${eX.current.length%e4.framesBatchLength}`:"";s=`${eX.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}=ez.current,t=e[ez.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()-eG.current)/1e3).toFixed(1)}}),ez.current.curStepIndex++,eG.current=performance.now(),eZ.enable&&"each_gesture"===eZ.limitFor&&(to.current=0),ez.current.curStepIndex===e.length)&&(eQ.enable&&(V.stop(),tF(),ec("")),en)){let t=eX.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(),ek(!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=eX.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:ez,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()}ek(!1)}eN()},r=y(()=>{let{curStepIndex:e,steps:t}=ez.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}=ez.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||w.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||w.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([w.calculateBlurScore(i),F.getModelPredictions({model:b,sCanvas:i})]),{error:y,fullFace:T,faceRatio:S,faceNotFrontalMinThreshold:L}=await n.validatePredictions({predictions:v,width:F.SIZE,height:F.SIZE});r=y,eP.current.image=I;let x=null,D=null,E=null,M=null,{curStepIndex:A,steps:O}=ez.current;if(T){let e=O[A],t=e&&e.name===W.FRONTAL;E=T.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);(M=e)&&!r&&(r=z.close_eye)}}let N=r?.code==="no_face"||r?.code==="partial_face",P=A<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:eY}),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),eG.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:eY}),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:eY}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated"}}),td(),!1))}({trackingScore:function(e,t,a,n){if(eX.current.length&&Date.now()-eX.current[eX.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===eX.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:eX.current.length,bbox:i,original_bbox:i,metadata:JSON.stringify({})};if(ed&&ed.key){if(c.base64=k.encryptFrameBase64(c.base64,ed.key),eX.current.push(c),e4.framesBatchLength>0&&eX.current.length%e4.framesBatchLength==0&&e_){let e=eX.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,eX.current.length===e4.framesBatchLength)})}}else if(eX.current.push(c),e4.framesBatchLength>0&&eX.current.length%e4.framesBatchLength==0&&e_){let e=eX.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,eX.current.length===e4.framesBatchLength)}return r}return null}(v[0],i,E,A>=O.length),isFirstValidFrameFoundRef:m})&&await l({faceDirection:x,canvas:i,blurScore:p,leftRightScore:D,isEyeClose:M})):A<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 M({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,I,R,en,es,ei,er,e4,eo,eZ,eQ.enable,ec,eq,ea,eY,td,e0,tb,eU,tl,e_,ed,eb,e1?.enable,e1?.webThreshold,e1?.webTimeout,e1?.forceCheck,e6.enable,eM,tc,ts,ti,tF,e7,tn,e8.enable]);let{curStepIndex:tT,steps:tI}=ez.current,tR=e.useMemo(()=>tI.find(e=>e.name===s.FaceDirection.FRONTAL),[tI]),tS=eC.current?tR:tI[tT],tL=tS&&eS?tS.instructions[eB]:null,tx=tS&&eS?tS.directionIcon:"";return{resetFlowOnOrientationChange:e5,cropArea:eP,curStepIndex:tT,directionIcon:tx,directionIconAnimation:tS?tS.directionIconAnimation:"",faceDetectionError:eJ,resetFlow:td,handleVideoPlayed:tk,instructions:tL,refVideo:ex,refIsReseting:tu,steps:tI,videoPlayed:ey,activeCapturing:eI,isFirstValidFrameFound:eS,warmupDone:eU,showLoading:eF}}export{Z as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as r,r as e,j as o,s as n,a6 as t,af as i,ag as a,ah as s,ai as u,aj as d,ak as l,al as c,am as g,an as f,ao as p,ap as b,aq as h,a3 as x,v as y,ar as k,U as C}from"./chunk-59d3e3b1.js";let T=e.createContext({}),v={},m=({children:n,enableGetClientSettings:t,clientSettings:i,apiCredentials:a,flowId:s})=>{let{apiClient:u}=r.useApiClient({apiCredentials:a}),[d,l]=e.useState({}),[c,g]=e.useState(!1);e.useEffect(()=>{t?async function r(){try{if(!u||"function"!=typeof u.clientSettings)return;let r=await u.clientSettings({flow_id:s});l(r)}catch(r){console.error(r)}finally{g(!0)}}():g(!0)},[t,u,s]);let f=v;return(i&&Object.keys(i).length>0?f=i:t&&(f=d),c)?o.jsx(T.Provider,{value:f,children:n}):null},D=()=>e.useContext(T),S=e.createContext(!1),R=({children:r,debug:e=!1})=>o.jsx(S.Provider,{value:e,children:r}),W=()=>e.useContext(S),w={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"},z={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"},IDUploadTypeMenu:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:"8px",color:"#ffffff",fontSize:"16px",itemPadding:"12px 16px",dividerColor:"rgba(255, 255, 255, 0.25)",minWidth:"200px",maxWidthInset:"48px",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:w.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"},countdownText:{color:w.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:w.tsSecondary,fontSize:"16px",fontWeight:"bold",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{color:w.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:w.tsBlue,border:"none",borderRadius:"3px",outline:"none",height:"66px",margin:"30px 0 0 0"},skipButton:{color:w.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"}}}},_={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{...n.DesignToken.Typography.h4,color:n.DesignToken.Color.base.white,backgroundColor:"unset"},titleBack:{...n.DesignToken.Typography.h4,color:n.DesignToken.Color.base.white,backgroundColor:"unset"},instruction:{...n.DesignToken.Typography.body,padding:"5px 10px",color:"rgba(255, 255, 255, 0.8)",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{...n.DesignToken.Typography.label,color:n.DesignToken.Color.base.white,padding:`6px ${n.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},captured:{...n.DesignToken.Typography.label,color:n.DesignToken.Color.base.white,padding:`6px ${n.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"}},error:{...n.DesignToken.Typography.body,padding:"5px 10px",color:n.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:n.DesignToken.CornerRadius["2xs"]},toggle:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.base.white,gap:n.DesignToken.Spacing.base,backgroundColor:n.DesignToken.Color.base.white,active:{backgroundColor:n.DesignToken.Color.base.blue},inactive:{backgroundColor:n.DesignToken.Color.neutral[300]}},countdown:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:n.DesignToken.CornerRadius["2xs"]},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:n.DesignToken.Height["7xl"],height:n.DesignToken.Height["7xl"],disabled:{src:""}},loadingIcon:{src:"",width:"47px",height:"47px"},rectangleMask:{width:600,height:400,strokeWidth:t.getCSSNumericValue(n.DesignToken.BorderWidth["3xl"]),strokeStyles:{},radius:t.getCSSNumericValue(n.DesignToken.CornerRadius.base),paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:n.DesignToken.Color.neutral[400],strokeWidth:t.getCSSNumericValue(n.DesignToken.BorderWidth["3xl"])},error:{fill:"none",strokeWidth:t.getCSSNumericValue(n.DesignToken.BorderWidth["3xl"]),stroke:n.DesignToken.Color.semantic.error[400]}}},IDConfirmPopup:{image:{borderRadius:n.DesignToken.CornerRadius["2xs"]}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:n.DesignToken.CornerRadius.xs,color:n.DesignToken.Color.base.white,padding:n.DesignToken.Spacing.sm,leftOffset:"24px",focusOutlineColor:n.DesignToken.Color.base.white},IDUploadTypeMenu:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:n.DesignToken.CornerRadius.xs,color:n.DesignToken.Color.base.white,fontSize:"16px",itemPadding:"12px 16px",dividerColor:"rgba(255, 255, 255, 0.25)",minWidth:"200px",maxWidthInset:"48px",focusOutlineColor:n.DesignToken.Color.base.white},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:n.DesignToken.Color.base.white,borderRadius:n.DesignToken.CornerRadius.xs,fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{...n.DesignToken.Typography.h4,backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:n.DesignToken.CornerRadius["2xs"],backgroundColor:"transparent"},guideText:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.neutral[600],textAlign:"center"},countdownText:{...n.DesignToken.UIText.medium,color:n.DesignToken.Color.neutral[500],textAlign:"center"}},scanTooltip:{backgroundColor:"transparent",borderRadius:n.DesignToken.CornerRadius.xs,color:n.DesignToken.Color.base.white,padding:"10px",textAlign:"center"},scanCountdown:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.semantic.error[400],textAlign:"center",backgroundColor:"transparent",border:"none",borderRadius:n.DesignToken.CornerRadius["2xs"],padding:"0px"},invalidPopup:{padding:"10px",title:{...n.DesignToken.Typography.h6,color:n.DesignToken.Color.content.primary,display:"none",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.content.secondary,textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.base.white,backgroundColor:n.DesignToken.Color.base.blue,borderRadius:n.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:n.DesignToken.Height["3xl"],margin:"24px 0 0 0"},skipButton:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.content.primary,backgroundColor:n.DesignToken.Color.background.tertiary,borderRadius:n.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:n.DesignToken.Height["3xl"],margin:"12px 0"}},resultText:{success:{...n.DesignToken.Typography.body,textColor:n.DesignToken.Color.content.primary,mainColor:n.DesignToken.Color.semantic.success[400]},error:{...n.DesignToken.Typography.body,textColor:n.DesignToken.Color.content.primary,mainColor:n.DesignToken.Color.semantic.warning[500]}}}},j=z,I=_,{DesignToken:O}=n,A={FlashLiveness:{maskFill:"#fff",mask:{strokeColor:O.Color.separators.secondary,strokeColorError:O.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:O.Color.content.primary,fontSize:O.Typography.h5.fontSize,fontWeight:O.Typography.h5.fontWeight,lineHeight:O.Typography.h5.lineHeight},guideline:{text:{close:{color:O.Color.content.primary,fontSize:O.Typography.h6.fontSize,fontWeight:O.FontWeight["semi-bold"],background:O.Color.background.secondary,border:`${O.BorderWidth.base} solid ${O.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},far:{color:O.Color.content.primary,fontSize:O.Typography.h6.fontSize,fontWeight:O.FontWeight["semi-bold"],background:O.Color.background.secondary,border:`${O.BorderWidth.base} solid ${O.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},flashing:{color:O.Color.content["on-bg-color"],fontSize:O.Typography.label.fontSize,fontWeight:O.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",padding:"12px 16px"}},icon:{color:O.Color.blue[900],src:""}},instruction:{color:O.Color.content["on-bg-color"],fontSize:O.Typography.label.fontSize,fontWeight:O.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",maxWidth:"200px"},timeoutText:{color:O.Color.semantic.error[400],fontSize:O.Typography.body.fontSize,fontWeight:O.Typography.body.fontWeight,padding:"0"},errorOverlay:{backgroundColor:"transparent",opacity:0},progressBar:{mainColor:O.Color.blue[900],secondaryColor:O.Color.blue[100],textColor:O.Color.blue[900],fontSize:O.Typography.body.fontSize,fontWeight:O.FontWeight["semi-bold"]},flashing:{logo:{src:"",width:"140px",height:"auto"},backgroundPattern:{srcMobile:"",srcDesktop:"",width:"100%",height:"auto"}}}},P=A,B=A,{DesignToken:F}=n,U={Selfie:{backgroundColor:"#FFF",title:{...n.DesignToken.Typography.h5,color:n.DesignToken.Color.content.primary},countdown:{color:F.Color.semantic.error[400],fontSize:F.Typography.body.fontSize,fontWeight:F.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"0px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:F.Color.semantic.error[400],fontSize:F.Typography.body.fontSize,fontWeight:F.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:F.Color.blue[900],neutralColor:F.Color.neutral[300],errorColor:F.Color.semantic.error[400],radius:160,strokeWidth:2,progress:0,tickWidth:15,numberOfTicks:200},Active:{instruction:{color:F.Color.content.primary,fontSize:F.Typography.body.fontSize,fontWeight:F.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 ${F.Color.blue[900]}`,fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:"",activeStepBorder:`1px solid ${F.Color.separators.tertiary}`,activeStepBorderRadius:"50%"}}}},q={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:""}}}},H=U,{DesignToken:M}=n,E={PassiveLiveness:{instruction:{color:M.Color.content["on-bg-color"],fontSize:M.Typography.label.fontSize,fontWeight:M.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",padding:"12px 12px"}}},L=E,$=E,K={closeButton:{top:n.DesignToken.Spacing.base,right:n.DesignToken.Spacing.base,left:"auto",bottom:"auto",display:"block",src:"",width:"24px",height:"auto"},popup:{backgroundColor:n.DesignToken.Color.base.white,padding:"10px",border:"none",borderRadius:n.DesignToken.CornerRadius.sm,overlay:{backgroundColor:n.DesignToken.Color.mask[70]},title:{...n.DesignToken.Typography.h6,fontWeight:n.DesignToken.FontWeight["semi-bold"],color:n.DesignToken.Color.content.primary,textAlign:"center",display:"initial",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.content.secondary,textAlign:"center",border:"unset",borderRadius:"unset",margin:"30px 0 0 0",padding:"0 0 0 0"},primaryButton:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.base.white,backgroundColor:n.DesignToken.Color.base.blue,borderRadius:n.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:n.DesignToken.Height["3xl"],maxWidth:"unset"},secondaryButton:{...n.DesignToken.Typography.body,color:n.DesignToken.Color.content.primary,backgroundColor:n.DesignToken.Color.background.tertiary,borderRadius:n.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:n.DesignToken.Height["3xl"],maxWidth:"unset"}}},V={v1:{...j,...P,...q,...L,...K},v2:{...I,...B,...H,...$,...K}};function N(){if(rd)return ru;rd=1;var r=u();return ru=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(r){}}()}function Q(){if(rc)return rl;rc=1;var r=N();return rl=function(e,o,n){"__proto__"==o&&r?r(e,o,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[o]=n}}function Z(){if(rf)return rg;rf=1;var r=Q(),e=d();return rg=function(o,n,t){(void 0===t||e(o[n],t))&&(void 0!==t||n in o)||r(o,n,t)}}var G,J,X,Y,rr,re,ro,rn,rt,ri,ra,rs,ru,rd,rl,rc,rg,rf,rp,rb,rh,rx,ry,rk,rC,rT,rv,rm,rD,rS,rR,rW,rw,rz,r_,rj,rI,rO,rA,rP,rB,rF,rU,rq,rH,rM,rE,rL,r$,rK,rV,rN,rQ,rZ,rG,rJ,rX,rY,r0,r1,r2,r5,r3,r6,r4,r7,r8,r9,er,ee,eo,en,et,ei,ea,es,eu,ed,el,ec,eg,ef,ep,eb,eh,ex,ey,ek,eC,eT,ev,em,eD,eS,eR,eW,ew,ez,e_,ej,eI,eO,eA,eP,eB,eF,eU,eq,eH,eM={exports:{}};eM.exports;function eE(){return r_?rz:(r_=1,rz=function(r,e){return function(o){return r(e(o))}})}function eL(){return rI?rj:(rI=1,rj=eE()(Object.getPrototypeOf,Object))}function e$(){if(rA)return rO;rA=1;var r=Object.prototype;return rO=function(e){var o=e&&e.constructor;return e===("function"==typeof o&&o.prototype||r)}}function eK(){if(rH)return rq;rH=1;var r=function(){if(rU)return rF;rU=1;var r=g(),e=f();return rF=function(o){return e(o)&&"[object Arguments]"==r(o)}}(),e=f(),o=Object.prototype,n=o.hasOwnProperty,t=o.propertyIsEnumerable;return rq=r(function(){return arguments}())?r:function(r){return e(r)&&n.call(r,"callee")&&!t.call(r,"callee")}}function eV(){return rE?rM:(rE=1,rM=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=0x1fffffffffffff})}function eN(){if(r$)return rL;r$=1;var r=p(),e=eV();return rL=function(o){return null!=o&&e(o.length)&&!r(o)}}var eQ={exports:{}};function eZ(){var r,e,o,n,t,i,a,s;if(rZ)return eQ.exports;return rZ=1,r=eQ,e=eQ.exports,o=l(),n=rQ?rN:(rQ=1,rN=function(){return!1}),s=(a=(i=(t=e&&!e.nodeType&&e)&&r&&!r.nodeType&&r)&&i.exports===t?o.Buffer:void 0)?a.isBuffer:void 0,r.exports=s||n,eQ.exports}function eG(){if(rJ)return rG;rJ=1;var r=g(),e=eL(),o=f(),n=Object.prototype,t=Function.prototype.toString,i=n.hasOwnProperty,a=t.call(Object);return rG=function(n){if(!o(n)||"[object Object]"!=r(n))return!1;var s=e(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}}eQ.exports;var eJ={exports:{}};eJ.exports;function eX(){if(r3)return r5;r3=1;var r=function(){if(rY)return rX;rY=1;var r=g(),e=eV(),o=f(),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,rX=function(t){return o(t)&&e(t.length)&&!!n[r(t)]}}(),e=r1?r0:(r1=1,r0=function(r){return function(e){return r(e)}}),o=function(){var r,e,o,n,t,i;if(r2)return eJ.exports;return r2=1,r=eJ,e=eJ.exports,o=b(),i=(t=(n=e&&!e.nodeType&&e)&&r&&!r.nodeType&&r)&&t.exports===n&&o.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){}}(),eJ.exports}(),n=o&&o.isTypedArray;return r5=n?e(n):r}function eY(){return r4?r6:(r4=1,r6=function(r,e){if("constructor"!==e||"function"!=typeof r[e]){if("__proto__"!=e)return r[e]}})}function e0(){if(er)return r9;er=1;var r=function(){if(r8)return r7;r8=1;var r=Q(),e=d(),o=Object.prototype.hasOwnProperty;return r7=function(n,t,i){var a=n[t];o.call(n,t)&&e(a,i)&&(void 0!==i||t in n)||r(n,t,i)}}(),e=Q();return r9=function(o,n,t,i){var a=!t;t||(t={});for(var s=-1,u=n.length;++s<u;){var d=n[s],l=i?i(t[d],o[d],d,t,o):void 0;void 0===l&&(l=o[d]),a?e(t,d,l):r(t,d,l)}return t}}function e1(){if(et)return en;et=1;var r=/^(?:0|[1-9]\d*)$/;return en=function(e,o){var n=typeof e;return!!(o=null==o?0x1fffffffffffff:o)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<o}}function e2(){if(ea)return ei;ea=1;var r=eo?ee:(eo=1,ee=function(r,e){for(var o=-1,n=Array(r);++o<r;)n[o]=e(o);return n}),e=eK(),o=h(),n=eZ(),t=e1(),i=eX(),a=Object.prototype.hasOwnProperty;return ei=function(s,u){var d=o(s),l=!d&&e(s),c=!d&&!l&&n(s),g=!d&&!l&&!c&&i(s),f=d||l||c||g,p=f?r(s.length,String):[],b=p.length;for(var h in s)(u||a.call(s,h))&&!(f&&("length"==h||c&&("offset"==h||"parent"==h)||g&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||t(h,b)))&&p.push(h);return p}}function e5(){if(eg)return ec;eg=1;var r=e2(),e=function(){if(el)return ed;el=1;var r=c(),e=e$(),o=eu?es:(eu=1,es=function(r){var e=[];if(null!=r)for(var o in Object(r))e.push(o);return e}),n=Object.prototype.hasOwnProperty;return ed=function(t){if(!r(t))return o(t);var i=e(t),a=[];for(var s in t)"constructor"==s&&(i||!n.call(t,s))||a.push(s);return a}}(),o=eN();return ec=function(n){return o(n)?r(n,!0):e(n)}}function e3(){return eC?ek:(eC=1,ek=function(r){return r})}function e6(){return ev?eT:(ev=1,eT=function(r,e,o){switch(o.length){case 0:return r.call(e);case 1:return r.call(e,o[0]);case 2:return r.call(e,o[0],o[1]);case 3:return r.call(e,o[0],o[1],o[2])}return r.apply(e,o)})}function e4(){if(eA)return eO;eA=1;var r=e3(),e=function(){if(eD)return em;eD=1;var r=e6(),e=Math.max;return em=function(o,n,t){return n=e(void 0===n?o.length-1:n,0),function(){for(var i=arguments,a=-1,s=e(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(o,this,d)}}}(),o=function(){if(eI)return ej;eI=1;var r=function(){if(ew)return eW;ew=1;var r=eR?eS:(eR=1,eS=function(r){return function(){return r}}),e=N(),o=e3();return eW=e?function(o,n){return e(o,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:o}();return ej=(function(){if(e_)return ez;e_=1;var r=Date.now;return ez=function(e){var o=0,n=0;return function(){var t=r(),i=16-(t-n);if(n=t,i>0){if(++o>=800)return arguments[0]}else o=0;return e.apply(void 0,arguments)}}})()(r)}();return eO=function(n,t){return o(e(n,t,r),n+"")}}function e7(){if(eB)return eP;eB=1;var r=d(),e=eN(),o=e1(),n=c();return eP=function(t,i,a){if(!n(a))return!1;var s=typeof i;return("number"==s?!!(e(a)&&o(i,a.length)):"string"==s&&i in a)&&r(a[i],t)}}function e8(){if(eU)return eF;eU=1;var r=e4(),e=e7();return eF=function(o){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=o.length>3&&"function"==typeof a?(i--,a):void 0,s&&e(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),r=Object(r);++t<i;){var u=n[t];u&&o(r,u,t,a)}return r})}}var e9=x(function(){if(eH)return eq;eH=1;var r=function(){if(ey)return ex;ey=1;var r=function(){if(rs)return ra;rs=1;var r=i(),e=function(){if(J)return G;J=1;var r=i();return G=function(){this.__data__=new r,this.size=0}}(),o=Y?X:(Y=1,X=function(r){var e=this.__data__,o=e.delete(r);return this.size=e.size,o}),n=re?rr:(re=1,rr=function(r){return this.__data__.get(r)}),t=rn?ro:(rn=1,ro=function(r){return this.__data__.has(r)}),u=function(){if(ri)return rt;ri=1;var r=i(),e=a(),o=s();return rt=function(n,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!e||a.length<199)return a.push([n,t]),this.size=++i.size,this;i=this.__data__=new o(a)}return i.set(n,t),this.size=i.size,this}}();function d(e){var o=this.__data__=new r(e);this.size=o.size}return d.prototype.clear=e,d.prototype.delete=o,d.prototype.get=n,d.prototype.has=t,d.prototype.set=u,ra=d}(),e=Z(),o=rx?rh:(rx=1,rh=(rb?rp:(rb=1,rp=function(r){return function(e,o,n){for(var t=-1,i=Object(e),a=n(e),s=a.length;s--;){var u=a[r?s:++t];if(!1===o(i[u],u,i))break}return e}}))()),n=function(){if(eh)return eb;eh=1;var r=Z(),e=function(){var r,e,o,n,t,i,a;if(ry)return eM.exports;return ry=1,r=eM,e=eM.exports,o=l(),a=(i=(t=(n=e&&!e.nodeType&&e)&&r&&!r.nodeType&&r)&&t.exports===n?o.Buffer:void 0)?i.allocUnsafe:void 0,r.exports=function(r,e){if(e)return r.slice();var o=r.length,n=a?a(o):new r.constructor(o);return r.copy(n),n},eM.exports}(),o=function(){if(rD)return rm;rD=1;var r=function(){if(rv)return rT;rv=1;var r=rC?rk:(rC=1,rk=l().Uint8Array);return rT=function(e){var o=new e.constructor(e.byteLength);return new r(o).set(new r(e)),o}}();return rm=function(e,o){var n=o?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}(),n=rR?rS:(rR=1,rS=function(r,e){var o=-1,n=r.length;for(e||(e=Array(n));++o<n;)e[o]=r[o];return e}),t=function(){if(rB)return rP;rB=1;var r=function(){if(rw)return rW;rw=1;var r=c(),e=Object.create;return rW=function(){function o(){}return function(n){if(!r(n))return{};if(e)return e(n);o.prototype=n;var t=new o;return o.prototype=void 0,t}}()}(),e=eL(),o=e$();return rP=function(n){return"function"!=typeof n.constructor||o(n)?{}:r(e(n))}}(),i=eK(),a=h(),s=function(){if(rV)return rK;rV=1;var r=eN(),e=f();return rK=function(o){return e(o)&&r(o)}}(),u=eZ(),d=p(),g=c(),b=eG(),x=eX(),y=eY(),k=function(){if(ep)return ef;ep=1;var r=e0(),e=e5();return ef=function(o){return r(o,e(o))}}();return eb=function(l,c,f,p,h,C,T){var v=y(l,f),m=y(c,f),D=T.get(m);if(D)return void r(l,f,D);var S=C?C(v,m,f+"",l,c,T):void 0,R=void 0===S;if(R){var W=a(m),w=!W&&u(m),z=!W&&!w&&x(m);S=m,W||w||z?a(v)?S=v:s(v)?S=n(v):w?(R=!1,S=e(m,!0)):z?(R=!1,S=o(m,!0)):S=[]:b(m)||i(m)?(S=v,i(v)?S=k(v):(!g(v)||d(v))&&(S=t(m))):R=!1}R&&(T.set(m,S),h(S,m,p,C,T),T.delete(m)),r(l,f,S)}}(),t=c(),u=e5(),d=eY();return ex=function i(a,s,l,c,g){a!==s&&o(s,function(o,u){if(g||(g=new r),t(o))n(a,s,u,l,i,c,g);else{var f=c?c(d(a,u),o,u+"",a,s,g):void 0;void 0===f&&(f=o),e(a,u,f)}},u)}}();return eq=e8()(function(e,o,n){r(e,o,n)})}());let or=r=>{let{customTheme:o,clientSettings:n,themeVersion:t,uiSettings:i,defaultThemes:a=V}=r,s=y.getWebSetting(n,"data.settings.sdk_settings.ui_custom_settings");return e.useMemo(()=>{let r=k.selectUiSettings(i,s);return{...e9({},k.mapUISettingsToCustomTheme(r),o),themeVersion:t,defaultThemes:a}},[o,a,t,i,s])},oe=()=>{},oo=e.createContext({onDoneCallback:oe,onErrorCallback:oe,onCloseCallback:oe}),on=({children:r,onDone:n=oe,onError:t=oe,onClose:i=oe})=>{let a=e.useCallback(r=>{n&&n(r)},[n]),s=e.useCallback(r=>{t&&t(r)},[t]),u=e.useCallback(()=>{i&&i()},[i]),d=e.useMemo(()=>({onDoneCallback:a,onErrorCallback:s,onCloseCallback:u}),[a,s,u]);return o.jsx(oo.Provider,{value:d,children:r})},ot=()=>{let r=e.useContext(oo);if(void 0===r)throw Error("useSDKCallback must be used within a SDKCallbackProvider");return r},oi=e.createContext(""),oa=({children:r,isWrappedBy:e=""})=>o.jsx(oi.Provider,{value:e,children:r}),os=()=>e.useContext(oi),ou=({tracking:r,clientSettings:e,children:n})=>{let t=D(),i=y.getWebSetting(e??t,"data.settings.sdk_settings.server_log_settings");return o.jsx(C.SDKTrackingProvider,{value:{tracking:{...r},serverLogSettings:i},children:n})};export{m as C,R as D,on as S,oa as W,ot as a,os as b,or as c,_ as d,ou as e,D as f,V as g,e8 as h,e5 as i,eG as j,e4 as k,e6 as l,e9 as m,eE as n,e$ as o,e2 as p,eN as q,e0 as r,e7 as s,w as t,W as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./chunk-59d3e3b1.js";import o from"./chunk-0b699686.js";import"./chunk-78261800.js";import"./chunk-a989c084.js";import"./chunk-d2a607bb.js";import"./chunk-6f0718f1.js";import"./chunk-c5b7ee1d.js";import"./chunk-1111b17d.js";import t from"./chunk-1d87d657.js";import"./chunk-8b8e62dd.js";import"./chunk-bbe1b8aa.js";import"./chunk-8fcd8b8a.js";import"./chunk-a8f6c8fc.js";import"./chunk-e9dc3cb2.js";import"./chunk-43a27060.js";import"./chunk-b6299572.js";import"./chunk-67c92f43.js";let m=m=>r.jsx(t,{...m,readIDCardUIOnlyComponent:o});export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,b as t,v as a,aJ as s,s as n,q as i,ad as r,m as l,U as c,p as o,a as u,aM as _,aN as m,c as g,X as d,a1 as f,Y as h,O as b,ay as v,E as p,aE as w,j as k}from"./chunk-59d3e3b1.js";import{t as y}from"./chunk-43a27060.js";import{q as F,t as T,u as L,r as R,s as C,v as B,x as S,y as x,D as I}from"./chunk-c5b7ee1d.js";import{m as M,f as D}from"./chunk-a989c084.js";let E=s.faceTracker(),P=new _,{FaceDirection:j,Errors:A,Messages:N,TrackLivenessEvents:U}=n,V={enable:!1,framesIntervalTime:180,framesBatchLength:0},W={[n.FaceDirection.UP]:{delayTime:0},[n.FaceDirection.LEFT]:{delayTime:0},[n.FaceDirection.RIGHT]:{delayTime:0},[n.FaceDirection.FRONTAL]:{delayTime:2e3}},O=()=>{},q=()=>{},z=()=>{};function K({apiCheck:_,bgCameraMask:k,bgCameraMaskRed:Z,surroundStyle:G,cropAreaDimension:J,customInstructions:X,customIcon:H,customDirectionIcon:Y,customStepTimeConstraints:Q=W,onLivenessDetectionDone:$,onError:ee,frontalMinSize:et,waitingTimeToGetBetterFrames:ea=500,captureFrameSettings:es=V,setRemainingTime:en=O,onProcessing:ei=z,customErrors:er,customMessages:el,apiCredentials:ec={},onFramesCaptured:eo=q,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:eN}=c.useSDKTracking(),[eU,eV]=e.useState(3),[eW,eO]=e.useState(!1),eq=e.useRef(!1),ez=e.useCallback(e=>{eO(e),eq.current=e},[]),eK=e.useRef(null),eZ=e.useRef([]),eG=e.useRef(null),eJ=e.useRef(),eX=e.useRef(null);null===eX.current&&(eX.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:X,customIcon:H,customDirectionIcon:Y,customStepTimeConstraints:Q,Locale:eI,lang:eC}));let[eH,eY]=e.useState(),eQ=e.useCallback(e=>{eY(e)},[]),e$=e.useMemo(()=>y(eQ,500),[eQ]),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===U?.show_alert){let t=e.log?.alert;if(t===to.current)return;to.current=t}eN(e),ed&&ed(e)}},[ed,eN]),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:U?.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:U?.show_warmup,log:{}}),tu({tag:"selfie",event:U?.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(()=>{eX.current.curStepIndex=eX.current.steps.length,tf.current=!0,eF(!1),td.current?.discardRecording(),clearInterval(eK.current)},[]),tb=e.useCallback(()=>{eX.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:X,customIcon:H,customDirectionIcon:Y,Locale:eI,lang:eC}),tm.current=0,tg.current=null,e0.current=[],eL(!1),eY(null),x(),td.current?.start(),tf.current=!1,ez(!1),eV(3),eG.current=null,eZ.current=[],eJ.current=null,"function"==typeof eb&&eb(),eD()},[eI,eB,Y,H,X,ez,eC,eb]),tv=e.useCallback(()=>{th(),setTimeout(()=>{tb()},e2)},[e2,tb,th]),tp=e.useMemo(()=>({...A,...er}),[er]),tw=e.useMemo(()=>({...N,...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})}),eY({...tp.liveness_terminated_time_out,msg:e,duration:.95*e2}),tu({tag:"selfie",event:U?.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:G},"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,G,J]),tR=e.useCallback(()=>{eV(3),clearInterval(eK.current),ez(!0);let e=async e=>{if(e-1==0){let e;P.stop(),tT(),clearInterval(eK.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?[eG.current]:eZ.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()}};eK.current=setInterval(()=>{eV(t=>(e(t),t-1))},tr/3)},[ez,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===eq.current&&(ta&&e===j.FRONTAL||!ta)){let e=await b.takePicture({canvas:t});e9?.enable&&Date.now()-eJ.current<e9?.waitForBestImageTimeMsWeb?(eG.current||(eG.current={blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()}),tt?.enable&&(eG.current=I({incomingFrame:{blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()},currentBestFrame:eG.current}))):eZ.current.length<1&&eZ.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}=eX.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+Q[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 N=c?.code==="no_face"||c?.code==="partial_face",V=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&&(eY({...tp.liveness_terminated_no_face,duration:e2}),tu({tag:"selfie",event:U?.show_alert,log:{alert:"liveness_terminated_no_face"}}),tv())}({noFace:N&&V,isFirstValidFrameFoundRef:u}),c?.code&&t_({tag:"selfie",event:U?.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=Z;else if(!c){u||(eL(!0),P.start("from_1st_frame"));let e=e9?.enable&&!eq.current&&0===eZ.current.length;tt?.enable?null!==y&&y>tt?.webBlurryThreshold?(o=null,e&&(eJ.current=Date.now(),tR())):eq.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=Z);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,Z,$,ee,et,ea,ti,ei,e3.enable,en,e$,Q,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(()=>{eH&&(eH?.code!==tp?.liveness_terminated_time_out&&eH?.code!==tp?.liveness_terminated_no_face&&e9?.enable&&eq.current||(clearInterval(eK.current),ez(!1),eG.current=null,eZ.current=[],eJ.current=null))},[e9?.enable,eH,ez,tp]);let{curStepIndex:tB,steps:tS}=eX.current,tx=eT&&!eH&&!eg&&(!e9?.enable||e9?.showCaptureButton),tI=eW&&!tf.current&&(e9?.enable?e9?.showCountdown:te?.showCountdown);return{resetFlowOnOrientationChange:tn,countdownToTakePicture:eU,cropArea:eE,curStepIndex:tB,faceDetectionError:eH,resetFlow:tv,handleTriggerPassiveMode:tR,handleVideoPlayed:tL,refVideo:eR,refIsReseting:tf,showCountdown:eW,steps:tS,videoPlayed:ew,activeCapturing:ey,isFirstValidFrameFound:eT,warmupDone:eP,showLoading:ev,showCaptureButton:tx,shouldShowCountdown:tI}}function Z({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{Z as C,K as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e,t;import{b as n,s as a,m as s,r as r,P as i,
|
|
1
|
+
let e,t;import{b as n,s as a,m as s,r as r,P as i,ae as o,j as l,p as u,q as c,v as f,t as p,w as d}from"./chunk-59d3e3b1.js";import{L as g,S as m}from"./chunk-6f0718f1.js";import{C as h,f as v,W as A}from"./chunk-a989c084.js";var C,S,b,y,F,T,E,I,x,_={exports:{}};function M(){if(C)return _.exports;C=1;var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(e){var t=new Uint8Array(16);_.exports=function(){return e(t),t}}else{var n=Array(16);_.exports=function(){for(var e,t=0;t<16;t++)(3&t)==0&&(e=0x100000000*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}return _.exports}function D(){if(b)return S;b=1;for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);return S=function(t,n){var a=n||0;return""+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]}}var U=function(){if(x)return I;x=1;var e=function(){if(F)return y;F=1;var e,t,n=M(),a=D(),s=0,r=0;return y=function(i,o,l){var u=o&&l||0,c=o||[],f=(i=i||{}).node||e,p=void 0!==i.clockseq?i.clockseq:t;if(null==f||null==p){var d=n();null==f&&(f=e=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=t=(d[6]<<8|d[7])&16383)}var g=void 0!==i.msecs?i.msecs:new Date().getTime(),m=void 0!==i.nsecs?i.nsecs:r+1,h=g-s+(m-r)/1e4;if(h<0&&void 0===i.clockseq&&(p=p+1&16383),(h<0||g>s)&&void 0===i.nsecs&&(m=0),m>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");s=g,r=m,t=p;var v=((0xfffffff&(g+=122192928e5))*1e4+m)%0x100000000;c[u++]=v>>>24&255,c[u++]=v>>>16&255,c[u++]=v>>>8&255,c[u++]=255&v;var A=g/0x100000000*1e4&0xfffffff;c[u++]=A>>>8&255,c[u++]=255&A,c[u++]=A>>>24&15|16,c[u++]=A>>>16&255,c[u++]=p>>>8|128,c[u++]=255&p;for(var C=0;C<6;++C)c[u+C]=f[C];return o||a(c)}}(),t=function(){if(E)return T;E=1;var e=M(),t=D();return T=function(n,a,s){var r=a&&s||0;"string"==typeof n&&(a="binary"===n?Array(16):null,n=null);var i=(n=n||{}).random||(n.rng||e)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,a)for(var o=0;o<16;++o)a[r+o]=i[o];return a||t(i)}}();return t.v1=e,t.v4=t,I=t}();let k=e=>{let t={};return Object.entries(e).forEach(([e,n])=>{if(n){if("customerUserId"===e){t.cus_user_id=n;return}if("faces"===e){t.faces=n.map(e=>({id:e.id}));return}if("gestureFaces"===e){t.gesture_faces=n.map(e=>({gesture:e.gesture,images:e.images.map(e=>({id:e.id}))}));return}if("videos"===e){t.videos=n;return}t[e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)]=n}}),t},R={enableVerifySanityPortrait:!1,enableVerifyFaceLiveness:!1};function w(e){let{apiCheck:t,mode:i,authType:o,authMethod:g,apiCredentials:m,onDone:h,onError:C,onClose:S,onReset:b,captureFrameSettings:y,onFramesCaptured:F,clientSettings:T,outputEncryptionSettings:E,logCredentials:I,flowId:x,serviceSettings:_,cameraScale:M,offsetFaceY:D,frontalMinSize:w,customTheme:N,livenessDetectionComponent:j,customComponent:V,customTexts:H,extraConfig:L}=e,B=v(),G=r.useMemo(()=>{let e={..._,...R};return u.getEnabledServices(e,B)},[B,_]),{FaceAuthenticationLoading:O}=V,[P,K]=r.useState(!1),{registerFace:W,authenFace:q}=function({apiCredentials:e,authMethod:t,enabledServices:a,authType:i}){let{apiClient:o}=s.useApiClient({apiCredentials:e}),l=r.useCallback(async e=>{let n=e.frontalFaces?.map(e=>({id:e.id}))??[],s=e.steps?.map(e=>({gesture:e.name,images:[{id:e.id}]})),r=[];return{selfieType:t,faces:n,gestureFaces:s,videos:r=a.enableUploadFrames?e.uploadFramesResult??[]:e.capturedFrames??[]}},[t,a.enableUploadFrames]),u=r.useCallback(async({sdkResult:e})=>{let t=await l(e),s=U.v4();t={...t,faceType:"selfie",customerUserId:s};let r=null;if(a.enableRegisterFace){let e=k(t);"success"===n(r=await o.httpClient.post("/v1/face_auth_register",e),"data.status")&&localStorage.setItem("tv:cus-user-id",s)}return{...t,apiResult:r}},[o.httpClient,l,a.enableRegisterFace]);return{registerFace:u,authenFace:r.useCallback(async({sdkResult:e})=>{let t=await l(e),n=localStorage.getItem("tv:cus-user-id");t={...t,customerUserId:n,authType:i};let s=null;if(a.enableAuthenticateFace){let e=k(t);s=await o.httpClient.post("/v1/face_auth",e)}return{...t,apiResult:s}},[o.httpClient,i,l,a.enableAuthenticateFace])}}({apiCredentials:m,authMethod:g,enabledServices:G,authType:o}),{billingSettings:z,enableBilling:Y}=c.useSDKSettings(),Z=f.getWebSetting(B,"data.settings.sdk_settings.billing_settings.billing_config"),$=f.getWebSetting(B,"data.settings.sdk_settings.billing_settings.url"),J=p.buildBillingInput(e),{submitBilling:Q}=d({enable:Y,onError:C,billingSettings:z??{json:Z??{}},billingUrl:$}),X=r.useCallback(e=>{let t={sdkStatus:a.BillingStatus.success,result:p.buildBillingOutput(e)};Q({service:a.BillingService.faceAuth,input:J,output:t}),h&&h(e)},[J,h,Q]),ee=r.useCallback(e=>{if(a.ErrorsWithoutBilling.includes(e.code))return void C(e);let t={error:e,sdkStatus:a.BillingStatus.fail};Q({service:a.BillingService.faceAuth,input:J,output:t}),C&&C(e)},[J,C,Q]),et=r.useCallback(e=>{var t,s;let r,l,u,c=(s={...e,frontalFaces:(r=n(t=e,"frontalFaces",[]),l=n(t,"frontalFacesEncrypted",[]),r.map((e,t)=>({blob:e,encrypted:l[t]??null})))},u={},u.faces=n(s,"frontalFaces"),u.videos=Array.isArray(n(s,"capturedFrames"))&&n(s,"capturedFrames").length>0?[{frames:n(s,"capturedFrames")}]:null,u.gestureFaces=Array.isArray(n(s,"steps"))&&n(s,"steps").length>0?n(s,"steps").map(e=>{let{name:t}=e;return{gesture:t,images:[{...e?.image}]}}):null,u);i===a.FaceAuthenticationMode.REGISTRATION&&(c={...c,customerUserID:U.v4(),faceType:"selfie",selfieType:g}),i===a.FaceAuthenticationMode.AUTHENTICATION&&(c={...c,selfieType:g,authType:o}),X(c)},[i,X,g,o]),en=r.useCallback(async e=>{if(!t||!G.enableUploadImages)return void et(e);try{let t;K(!0),i===a.FaceAuthenticationMode.REGISTRATION&&(t=await W({sdkResult:e})),i===a.FaceAuthenticationMode.AUTHENTICATION&&(t=await q({sdkResult:e})),X(t)}catch(e){console.error(e),ee({...a.Errors.api_call_error,details:e})}finally{K(!1)}},[t,G.enableUploadImages,et,i,X,W,q,ee]);return l.jsxs(A,{isWrappedBy:"face_authen",children:[l.jsx(j,{mode:(e=>{switch(e){case a.FaceAuthMethod.STANDARD_AUTHEN:return a.Mode.PASSIVE;case a.FaceAuthMethod.ADVANCED_AUTHEN_ACTIVE:return a.Mode.ACTIVE;case a.FaceAuthMethod.EDGE_AUTHEN:return a.Mode.FLASH_EDGE;case a.FaceAuthMethod.ADVANCED_AUTHEN_FLASH:return a.Mode.FLASH_ADVANCED;case a.FaceAuthMethod.LIGHT_AUTHEN:return a.Mode.PASSIVE;default:return e}})(g),cameraScale:M,offsetFaceY:D,frontalMinSize:w,captureFrameSettings:y,logCredentials:I,onLivenessDetectionDone:en,outputEncryptionSettings:E,onFramesCaptured:F,onError:C,onClose:S,onReset:b,clientSettings:T,customTheme:N,extraConfig:L,customComponent:V,apiCheck:t,apiCredentials:m,serviceSettings:G,flowId:x,customTexts:H}),l.jsx(O,{loading:P})]})}w.propTypes={apiCheck:i.bool,mode:i.string,authMethod:i.string,authType:i.string,onDone:i.func,onError:i.func,onClose:i.func,outputEncryptionSettings:i.shape({}),captureFrameSettings:i.shape({enable:i.bool,framesIntervalTime:i.number,framesBatchLength:i.number}),cameraScale:i.number,offsetFaceY:i.number,frontalMinSize:i.number,apiCredentials:i.shape({accessKey:i.string,secretKey:i.string,apiUrl:i.string}),logCredentials:i.shape({}),customTheme:i.shape({}),serviceSettings:i.shape({}),flowId:i.string,clientSettings:i.shape({}),livenessDetectionComponent:i.elementType,customComponent:i.shape({FaceAuthenticationLoading:i.elementType}),extraConfig:i.shape({}),onReset:i.func,onFramesCaptured:i.func,customTexts:i.shape({})},w.defaultProps={apiCheck:!1,mode:a.FaceAuthenticationMode.REGISTRATION,authMethod:a.FaceAuthMethod.EDGE_AUTHEN,authType:"transfer",onDone:()=>{},onError:()=>{},onClose:()=>{},outputEncryptionSettings:null,captureFrameSettings:{enable:!0,framesIntervalTime:180,framesBatchLength:15},cameraScale:1,offsetFaceY:0,frontalMinSize:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},logCredentials:null,customTheme:null,serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableRegisterFace:!0,enableAuthenticateFace:!0},flowId:"face_authen",clientSettings:null,livenessDetectionComponent:g,customComponent:{FaceAuthenticationLoading:o},extraConfig:null,onReset:()=>{},onFramesCaptured:()=>{},customTexts:{}};var N=(e=w,t=function(t){let{customTexts:n}=t;return l.jsx(m,{customTexts:n,children:l.jsx(e,{...t})})},function(e){let{apiCheck:n,apiCredentials:a,serviceSettings:s,flowId:r,clientSettings:i}=e,o=n&&(s?.enableGetClientSettings??!0);return l.jsx(h,{enableGetClientSettings:o,clientSettings:i,apiCredentials:a,flowId:r,children:l.jsx(t,{...e})})});function j(e){return l.jsx(N,{...e})}j.propTypes={logCredentials:i.shape({}),clientSettings:i.shape({})},j.defaultProps={logCredentials:null,clientSettings:null};export{j as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aN as e,I as i,aO as r,aP as t,aQ as o,P as s,r as n,e as a,s as l,a0 as d,j as c,al as g,am as f,aR as u,ai as h,aS as p,a3 as m,g as _,b as b,T as w,d as v,l as k,B as R,a as y,aT as S}from"./chunk-0c5d3a35.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 D,o as A,p as T}from"./chunk-0c1dea67.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{ErrorDuration:e_}=l;function eb({children:e,errorMsg:i,className:r}){return d.isValidElement(e)?i?c.jsx("div",{className:r,children:d.cloneElement(e,{errorMsg:i})}):null:i?c.jsx("div",{className:r,children:i}):null}function ew({children:e,className:i,error:r}){let t=n.useRef(0),o=n.useRef(""),s=a(),l=n.useRef(e_.SHORT),{code:d,duration:c=e_.SHORT}=r||{},g=s(d);return Date.now()-t.current>=l.current?(t.current=Date.now(),l.current=c,o.current=g,eb({children:e,errorMsg:g,className:i})):eb({children:e,errorMsg:o.current,className:i})}ew.propTypes={children:s.node,className:s.string},ew.defaultProps={className:""};function ev(){if(z)return V;z=1;var e=g(),i=f(),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 ek(){return ei?ee:(ei=1,ee=/<%=([\s\S]+?)%>/g)}var eR=m(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=ev();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=u();return F=function(i,r){return e(r,function(e){return i[e]})}}(),t=function(){if(U)return H;U=1;var e=h(),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=ev(),n=T(),a=function(){if(X)return Q;X=1;var e=D(),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=A();return Q=function(t){return r(t)?e(t):i(t)}}(),l=ek(),d=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({"&":"&","<":"<",">":">",'"':""","'":"'"})}(),i=p(),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=ek();return ef={escape:i,evaluate:r,interpolate:t,variable:"",imports:{_:{escape:e}}}}(),c=p(),g=/\b__p \+= '';/g,f=/\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(u,h,p){var R=d.imports._.templateSettings||d;p&&n(u,h,p)&&(h=void 0),u=c(u),h=e({},h,R,t);var y=e({},h.imports,R.imports,t),S=a(y),C=r(y,S),x,$,j=0,W=h.interpolate||w,O="__p += '",I=RegExp((h.escape||w).source+"|"+W.source+"|"+(W===l?b:w).source+"|"+(h.evaluate||w).source+"|$","g"),E=k.call(h,"sourceURL")?"//# sourceURL="+(h.sourceURL+"").replace(/\s/g," ")+"\n":"";u.replace(I,function(e,i,r,t,s,n){return r||(r=t),O+=u.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 D=k.call(h,"variable")&&h.variable;if(D){if(_.test(D))throw Error("Invalid `variable` option passed into `_.template`")}else O="with (obj) {\n"+O+"\n}\n";O=($?O.replace(g,""):O).replace(f,"$1").replace(m,"$1;"),O="function("+(D||"obj")+") {\n"+(D?"":"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 A=i(function(){return Function(S,E+"return "+O).apply(void 0,C)});if(A.source=O,s(A))throw A;return A}}());let ey=({curStep:e,faceDirection:i})=>{let r=b(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},eS=(e,i)=>({radius:e.radius??_("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??_("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??_("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??_("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??_("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??_("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??_("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??_("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??_("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??_("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??_("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??_("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??_("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??_("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??_("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??_("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??_("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??_("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??_("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??_("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??_("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??_("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??_("Selfie.progressCircle.showDashedRing")({theme:i})}),eC=(e,i)=>({radius:e.radius??_("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??_("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??_("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??_("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??_("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??_("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??_("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??_("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),ex=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function e$(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}let ej=[],eW=()=>{ej=[]},eO=(e,i,r,t)=>{t&&eW(),ej.push({id:null});let o=ej.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?ej[o].id=e.data.file_id:ej[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?ej[o].id=e.data.file_id:ej[o].id=-1})}},eI=()=>new Promise(e=>{let i=setInterval(()=>{ej.every(e=>e.id)&&(e(),clearInterval(i))},200)}),eE=e=>e.enable?ej.some(e=>-1===e.id)?null:ej:[],eD=[],eA=null,eT=!1,eP=()=>eD,eL=()=>{eT=!0,eD=[];try{eA instanceof MediaStream&&(eA.getTracks().forEach(e=>e.stop()),eA=null)}catch(e){}};async function eV({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;eL();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=(eA=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(eT=!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),eT||requestAnimationFrame(()=>e(i,r,t,o))}(s,i,e,r),eA=o.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(eA,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"});eD.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 ez={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}}}}}},eM=30,eB=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:o=!0,onReset:s,onTick:a,onTimesUp:l}=e,d=n.useRef(new w({totalTime:r,totalDelayBetweenReset:t,interruptible:o}));return n.useEffect(()=>d.current.on("tick",({remainTime:e})=>{a({remainTime:e})}),[a]),n.useEffect(()=>d.current.on("delaystart",()=>{l()}),[l]),n.useEffect(()=>d.current.on("reset",({attemptCount:e,fromBackground:i})=>{s({attemptCount:e,fromBackground:i})}),[s]),n.useEffect(()=>i?d.current.start():()=>{},[i]),{stopTimer:n.useCallback(()=>{d.current.stop()},[])}},eF=v.g`
|
|
1
|
+
import{aO as e,I as i,aP as r,aQ as t,aR as o,P as s,r as n,e as a,s as l,_ as d,j as c,am as g,an as f,aS as u,aj as h,aT as p,a3 as m,g as _,b as b,T as w,d as v,l as k,B as R,a as y,aU as S}from"./chunk-59d3e3b1.js";import{r as C,h as x,i as $,j as j,k as W,l as O,n as I,o as E,p as D,q as A,s as T}from"./chunk-a989c084.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{ErrorDuration:e_}=l;function eb({children:e,errorMsg:i,className:r}){return d.isValidElement(e)?i?c.jsx("div",{className:r,children:d.cloneElement(e,{errorMsg:i})}):null:i?c.jsx("div",{className:r,children:i}):null}function ew({children:e,className:i,error:r}){let t=n.useRef(0),o=n.useRef(""),s=a(),l=n.useRef(e_.SHORT),{code:d,duration:c=e_.SHORT}=r||{},g=s(d);return Date.now()-t.current>=l.current?(t.current=Date.now(),l.current=c,o.current=g,eb({children:e,errorMsg:g,className:i})):eb({children:e,errorMsg:o.current,className:i})}ew.propTypes={children:s.node,className:s.string},ew.defaultProps={className:""};function ev(){if(z)return V;z=1;var e=g(),i=f(),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 ek(){return ei?ee:(ei=1,ee=/<%=([\s\S]+?)%>/g)}var eR=m(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=ev();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=u();return F=function(i,r){return e(r,function(e){return i[e]})}}(),t=function(){if(U)return H;U=1;var e=h(),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=ev(),n=T(),a=function(){if(X)return Q;X=1;var e=D(),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=A();return Q=function(t){return r(t)?e(t):i(t)}}(),l=ek(),d=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({"&":"&","<":"<",">":">",'"':""","'":"'"})}(),i=p(),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=ek();return ef={escape:i,evaluate:r,interpolate:t,variable:"",imports:{_:{escape:e}}}}(),c=p(),g=/\b__p \+= '';/g,f=/\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(u,h,p){var R=d.imports._.templateSettings||d;p&&n(u,h,p)&&(h=void 0),u=c(u),h=e({},h,R,t);var y=e({},h.imports,R.imports,t),S=a(y),C=r(y,S),x,$,j=0,W=h.interpolate||w,O="__p += '",I=RegExp((h.escape||w).source+"|"+W.source+"|"+(W===l?b:w).source+"|"+(h.evaluate||w).source+"|$","g"),E=k.call(h,"sourceURL")?"//# sourceURL="+(h.sourceURL+"").replace(/\s/g," ")+"\n":"";u.replace(I,function(e,i,r,t,s,n){return r||(r=t),O+=u.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 D=k.call(h,"variable")&&h.variable;if(D){if(_.test(D))throw Error("Invalid `variable` option passed into `_.template`")}else O="with (obj) {\n"+O+"\n}\n";O=($?O.replace(g,""):O).replace(f,"$1").replace(m,"$1;"),O="function("+(D||"obj")+") {\n"+(D?"":"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 A=i(function(){return Function(S,E+"return "+O).apply(void 0,C)});if(A.source=O,s(A))throw A;return A}}());let ey=({curStep:e,faceDirection:i})=>{let r=b(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},eS=(e,i)=>({radius:e.radius??_("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??_("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??_("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??_("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??_("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??_("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??_("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??_("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??_("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??_("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??_("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??_("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??_("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??_("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??_("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??_("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??_("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??_("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??_("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??_("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??_("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??_("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??_("Selfie.progressCircle.showDashedRing")({theme:i})}),eC=(e,i)=>({radius:e.radius??_("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??_("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??_("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??_("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??_("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??_("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??_("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??_("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),ex=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function e$(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}let ej=[],eW=()=>{ej=[]},eO=(e,i,r,t)=>{t&&eW(),ej.push({id:null});let o=ej.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?ej[o].id=e.data.file_id:ej[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?ej[o].id=e.data.file_id:ej[o].id=-1})}},eI=()=>new Promise(e=>{let i=setInterval(()=>{ej.every(e=>e.id)&&(e(),clearInterval(i))},200)}),eE=e=>e.enable?ej.some(e=>-1===e.id)?null:ej:[],eD=[],eA=null,eT=!1,eP=()=>eD,eL=()=>{eT=!0,eD=[];try{eA instanceof MediaStream&&(eA.getTracks().forEach(e=>e.stop()),eA=null)}catch(e){}};async function eV({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;eL();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=(eA=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(eT=!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),eT||requestAnimationFrame(()=>e(i,r,t,o))}(s,i,e,r),eA=o.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(eA,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"});eD.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 ez={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}}}}}},eM=30,eB=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:o=!0,onReset:s,onTick:a,onTimesUp:l}=e,d=n.useRef(new w({totalTime:r,totalDelayBetweenReset:t,interruptible:o}));return n.useEffect(()=>d.current.on("tick",({remainTime:e})=>{a({remainTime:e})}),[a]),n.useEffect(()=>d.current.on("delaystart",()=>{l()}),[l]),n.useEffect(()=>d.current.on("reset",({attemptCount:e,fromBackground:i})=>{s({attemptCount:e,fromBackground:i})}),[s]),n.useEffect(()=>i?d.current.start():()=>{},[i]),{stopTimer:n.useCallback(()=>{d.current.stop()},[])}},eF=v.g`
|
|
2
2
|
transition: stroke-dashoffset 0.4s;
|
|
3
3
|
transform: rotate(-90deg);
|
|
4
4
|
transform-origin: 50% 50%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e,P as t,j as n,B as o,r as r,
|
|
1
|
+
import{d as e,P as t,j as n,B as o,r as r,_ as i,aW as a,a7 as u,g as l,q as s,e as c,a as d,b as p,aX as f}from"./chunk-59d3e3b1.js";let h=e.table`
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
4
|
td {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a3 as r}from"./chunk-59d3e3b1.js";import{r as o}from"./chunk-43a27060.js";var a=r(o());export{a as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{s as Constants,
|
|
1
|
+
export{s as Constants,b1 as SDK,aY as SDKAdapter,a_ as ScannerType,b0 as defaultClientSettings,a$ as defaultReadIDCardSteps,aZ as getSDKVersion}from"./chunk-59d3e3b1.js";
|