@tsocial/tvweb-sdk 5.35.1 → 5.36.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.
@@ -0,0 +1 @@
1
+ import{r as e,b as t,u as a,aH as n,s as s,c as i,ab as r,d as l,e as c,aq as o,ap as m,f as g,O as u,k as _,aK as f,aL as d,J as b,Y as h,F as p,Q as v,av as k,t as F,aB as w}from"./chunk-ed832fec.js";import{d as y}from"./chunk-ff693e7b.js";import{t as T}from"./chunk-e77bab5e.js";import{t as I}from"./chunk-81ce3c83.js";import{w as R,m as S,n as L,u as x,o as B,q as D,r as E,v as A,s as M,t as O}from"./chunk-7f5333af.js";import{m as N}from"./chunk-de5b2d76.js";import{u as P}from"./chunk-b87b1853.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},j=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 R();let t=S(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})}},U=n.faceTracker(),V=new f,{FaceDirection:W,Errors:J,Messages:K,TrackLivenessEvents:$}=s,z={enable:!1,framesIntervalTime:180,framesBatchLength:0},q={[s.FaceDirection.UP]:{delayTime:0},[s.FaceDirection.LEFT]:{delayTime:0},[s.FaceDirection.RIGHT]:{delayTime:0},[s.FaceDirection.FRONTAL]:{delayTime:2e3}},H=()=>{},G=()=>{},X=()=>{};function Z({apiCheck:f,bgCameraMask:R,bgCameraMaskRed:S,surroundStyle:C,cropAreaDimension:Q,customInstructions:Y,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea=q,onLivenessDetectionDone:en,onError:es,frontalMinSize:ei,waitingTimeToGetBetterFrames:er=500,captureFrameSettings:el=z,setRemainingTime:ec=H,onProcessing:eo=X,customErrors:em,customMessages:eg,apiCredentials:eu={},onFramesCaptured:e_=G,initFirstGestureTimeout:ef=2e3,outputEncryptionSettings:ed,cameraScale:eb=1,sendCustomEvent:eh,serviceSettings:ep,currentOrientation:ev,onReset:ek}={}){let[eF,ew]=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:eA}=i.useSDKSettings(),eM=r.useSDKLocale(),{apiClient:eO}=l.useApiClient({apiCredentials:eu}),[,eN]=e.useReducer(e=>e+1,0),eP=e.useRef(null),eC=e.useRef(!1),[ej,eU]=e.useState(!1),eV=e.useRef({}),{sendEvent:eW}=c.useSDKTracking(),eJ=e.useRef(null);null===eJ.current&&(eJ.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Y,customIcon:ee,customDirectionIcon:et,customStepTimeConstraints:ea,Locale:eM,lang:eB}));let[eK,e$]=e.useState(),ez=e.useCallback(e=>{e$(e)},[]),eq=e.useMemo(()=>T(ez,500),[ez]),eH=e.useRef([]),eG=e.useRef(),eX=P(),{faceTrackingSetting:eZ,flowIntervalTimeMs:eQ,limitTimeLivenessCheck:eY,terminateIfNoFace:e0,closeEyeSettings:e1,captureFrameSettings:e4,exifDataSettings:e6,recordVideo:e2,waitBeforeStartFlowMs:e3,resetFlowOnOrientationChange:e5,autoGenFrameIds:e8}=function({captureFrameSettingsProp:n,clientSettings:s}){return e.useMemo(()=>{let e,i=N({},L,s),r={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.enable"),webTerminateThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.web_terminate_threshold"),webWarningThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.web_warning_threshold"),limitFor:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.limit_for"),maxWarningTime:t(i,"data.settings.sdk_settings.active_liveness_settings.face_tracking_setting.max_warning_time")},l=t(i,"data.settings.sdk_settings.active_liveness_settings.reset_flow_on_orientation_change"),c=t(i,"data.settings.sdk_settings.active_liveness_settings.wait_before_start_flow_ms"),o=t(i,"data.settings.sdk_settings.active_liveness_settings.flow_interval_time_ms"),m=t(i,"data.settings.sdk_settings.active_liveness_settings.take_one_picture_time_ms"),g=a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.max_retry_count"),u={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.enable"),limitTimeSecond:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.limit_time_second"),remainTimeShow:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.remain_time_show"),format:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.format"),enableMaxRetries:g>0,totalMaxRetries:g,interruptible:!a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.non_stoppable")},_={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.enable"),maxInvalidFrame:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_invalid_frame"),maxTimeMs:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_time_ms")},f={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.enable"),webThreshold:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.web_threshold"),webTimeout:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.web_timeout"),forceCheck:t(i,"data.settings.sdk_settings.active_liveness_settings.close_eye_detector.force_check")},d={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.exif_data_settings.enable")},b={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.record_video.enable")},h=t(s,"data.settings.sdk_settings.active_liveness_settings.save_encoded_frames");e=h?{enable:h.enable,enableLogging:h.enable_logging,framesBatchLength:h.frames_batch_len,framesIntervalTime:h.frames_interval_ms}:n;let p={enable:a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.auto_gen_frame_ids.enable")&&u.enable,maxItems:a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.auto_gen_frame_ids.max_items")};return{faceTrackingSetting:r,resetFlowOnOrientationChange:l,waitBeforeStartFlowMs:c,flowIntervalTimeMs:o,takeOnePictureTimeMs:m,limitTimeLivenessCheck:u,terminateIfNoFace:_,closeEyeSettings:f,exifDataSettings:d,recordVideo:b,captureFrameSettings:e,autoGenFrameIds:p}},[n,s])}({captureFrameSettingsProp:el,clientSettings:eX}),e9=1e3*eY.limitTimeSecond/e4.framesIntervalTime,{uuids:e7,getNextUUID:te,reset:tt}=o({total:Math.min(e8.maxItems,Math.ceil(e9/e4.framesBatchLength*1.2))}),ta=e.useRef(m.createSingleUUID()),tn=e.useCallback(e=>{let t=e[e.length-1];try{let e=JSON.parse(t.metadata);e8.enable&&(e.global_batch_id=te()),e.global_session_id=ta.current,t.metadata=JSON.stringify(e)}catch(e){console.error("Unable to process last frame metadata",e)}},[e8.enable,te]),ts=e2?.enable,ti=e.useMemo(()=>g.getEnabledServices(ep,eX),[eX,ep]),tr=e.useRef(""),tl=e.useCallback(e=>{if(e?.event){if(e.event===$?.show_alert){let t=e.log?.alert;if(t===tr.current)return;tr.current=t}eW(e),eh&&eh(e)}},[eh,eW]),tc=e.useMemo(()=>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(){!ej&&(eG.current=performance.now(),eV.current=await d(eE),await b.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]}),e||(eU(!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}},[ej,eE,tl]);let tu=e.useRef(!1),t_=e.useCallback(()=>{eJ.current.curStepIndex=eJ.current.steps.length,tu.current=!0,eR(!1),tg.current?.discardRecording()},[]),tf=e.useCallback(()=>{if(eJ.current=n.initFaceVerificationData({assetRoot:eD,customInstructions:Y,customIcon:ee,customDirectionIcon:et,Locale:eM,lang:eB}),to.current=0,tm.current=null,eH.current=[],eL(!1),e$(null),M(),tg.current?.start(),tu.current=!1,e8.enable){let e=tt();u.addExifData("frame_batch_ids",e)}"function"==typeof ek&&ek(),eN()},[eM,eD,e8.enable,et,ee,Y,eB,ek,tt]),td=e.useCallback(()=>{t_(),setTimeout(()=>{tf()},eQ)},[t_,eQ,tf]),tb=e.useMemo(()=>({...J,...em}),[em]),th=e.useMemo(()=>({...K,...eg}),[eg]),tp=e.useCallback(({remainTime:e})=>{if(e>0&&e<=eY.remainTimeShow){let t=I(th.REMAIN_TIME[eB]),a=e;switch(eY.format){case"mm:ss":a=e.toString().padStart(5,"00:00");break;case"ss":a=e.toString().padStart(2,"0")}ec(t({x:a}))}},[eB,eY.format,eY.remainTimeShow,th.REMAIN_TIME,ec]),tv=e.useCallback(()=>{let e={};Object.keys(tb.liveness_terminated_time_out?.msg).forEach(t=>{let a=I(tb.liveness_terminated_time_out?.msg[t]);e[t]=a({x:eY.limitTimeSecond})}),e$({...tb.liveness_terminated_time_out,msg:e,duration:.95*eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),V.stop(),ec(""),t_()},[tb.liveness_terminated_time_out,eQ,eY.limitTimeSecond,t_,tl,ec]),tk=e.useCallback(({attemptCount:e,fromBackground:t})=>{eY.enableMaxRetries&&e>=eY.totalMaxRetries&&es(s.Errors.max_retry_reached),t&&t_(),V.start(),tf()},[eY.enableMaxRetries,eY.totalMaxRetries,es,tf,t_]),{stopTimer:tF}=x({totalTime:eY.limitTimeSecond,totalDelayBetweenReset:eQ/1e3,interruptible:eY.interruptible,shouldStart:ey&&eY.enable&&ej,onTimesUp:tv,onTick:tp,onReset:tk}),tw=e.useCallback(({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:n,lostX:s,lostY:i})=>{let r,l;_.isMobile?l=r=a-40:(l=450,r=450);let c=Math.floor((a-r)/2)+s;eP.current={x:c,y:5+i,width:r,height:l,image:R,surroundStyle:C},"object"==typeof Q?eP.current={...eP.current,...Q}:"function"==typeof Q&&(eP.current={...eP.current,...Q({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:n,lostX:s,lostY:i,isMobile:_.isMobile,width:r,height:l})}),eN(),eT(!0)},[R,C,Q]),ty=e.useRef({});e.useEffect(()=>{ty.current.isFirstValidFrameFoundRef=eS},[eS]),e.useEffect(()=>{let e,t=ex.current,a=async()=>{let{steps:e}=eJ.current,t=[];e.map(e=>(t.push({name:e.name,blob:e.image.blob,captureTime:e.image.captureTime,gesture:e.name}),e.frontalFaceImage.blob&&t.push({name:e.name,blob:e.frontalFaceImage.blob,captureTime:e.frontalFaceImage.captureTime,gesture:W.FRONTAL}),0));let a=t.map(e=>h.resizeBlobImg(e.blob,400,400)),n=await Promise.all(a),s="0";if(e4.framesBatchLength>0){let e=`${Math.floor(eH.current.length/e4.framesBatchLength)}x${e4.framesBatchLength}`,t=eH.current.length%e4.framesBatchLength>0?`+${eH.current.length%e4.framesBatchLength}`:"";s=`${eH.current.length}:${e}${t}`}let i=n.map((e,a)=>{let n=u.parseLivenessImg({...t[a],frames:s});return u.writeCurrentExif({imageData:{blob:e},enableExifData:e6.enable,additionalData:n})}),r=await Promise.all(i),l=t.map((e,t)=>({name:e.name,blob:r[t]}));await Promise.all(e.map(async(t,a)=>{let n=l.filter(e=>e.name===t.name);if(e[a].image.blob=n[0].blob,t.frontalFaceImage.blob&&(e[a].frontalFaceImage.blob=n[1].blob),ed&&ed.key){let{key:s}=ed;e[a].image.encrypted=await v.encrypt({blob:n[0].blob,key:s}),t.frontalFaceImage.blob&&(e[a].frontalFaceImage.encrypted=await v.encrypt({blob:n[1].blob,key:s}))}return 0}))},i=async()=>{let{steps:e}=eJ.current,t=e[eJ.current.curStepIndex];if((t&&tl({tag:"selfie",event:{[s.FaceDirection.UP]:$?.capture_up_face,[s.FaceDirection.LEFT]:$?.capture_left_face,[s.FaceDirection.RIGHT]:$?.capture_right_face,[s.FaceDirection.FRONTAL]:$?.capture_frontal_face}[t.name],log:{time_capture_in_seconds:((performance.now()-eG.current)/1e3).toFixed(1)}}),eJ.current.curStepIndex++,eG.current=performance.now(),eZ.enable&&"each_gesture"===eZ.limitFor&&(to.current=0),eJ.current.curStepIndex===e.length)&&(eY.enable&&(V.stop(),tF(),ec("")),en)){let t=eH.current;if(ed&&ed.key){let e=await Promise.all(t.map(e=>e?.base64));if(t=t.map((t,a)=>({...t,base64:e[a]})),e4.enable&&e4.framesBatchLength>0&&t.length%e4.framesBatchLength>0){let e=t.slice(-1*(t.length%e4.framesBatchLength));e_(e),f&&B(ed,e,eO,t.length===e4.framesBatchLength)}}else if(e4.enable&&e4.framesBatchLength>0&&t.length%e4.framesBatchLength>0){let e=t.slice(-1*(t.length%e4.framesBatchLength));tn(e),e_(e.map(({base64:e,label:t,index:a,metadata:n})=>({base64:e,label:t,index:a,metadata:n}))),f&&ti.enableUploadFrames&&B(ed,e,eO)}tl({tag:"selfie",event:$?.finish_capture,log:{time_capture_in_seconds:V.duration("from_1st_frame")}}),eo(),await tg.current?.stopVideoRecording(),ew(!0),u.addExifData("user_action",{start_selfie:Date.now()-1e3*V.duration("from_1st_frame"),end_selfie:Date.now()}),u.addExifData("global_session_id",ta.current),e8.enable&&u.addExifData("frame_batch_ids",e7),await a();let n=eH.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 j({apiClient:eO,faceVerificationFlowData:eJ,onLivenessDetectionDone:en,captureFrameSettings:e4,FaceDirection:W,onError:es,outputEncryptionSettings:ed,video:D().length?D()[0]:null,enabledServices:ti,capturedFrames:n});else{let t=e.filter(e=>e.name!==W.FRONTAL).map(e=>({name:e.name,image:{blob:e.image.blob,encrypted:e.image.encrypted}})),a=e.filter(e=>e.name!==W.FRONTAL).map(e=>e.frontalFaceImage.blob).filter(e=>null!==e),s=e.filter(e=>e.name!==W.FRONTAL).map(e=>e.frontalFaceImage.encrypted).filter(e=>e&&e.hex),i=e.find(e=>e.name===W.FRONTAL)?.image?.blob,r=e.find(e=>e.name===W.FRONTAL)?.image?.encrypted,l=i&&ei?await h.scaleImage(i,{minSize:ei}):null;i&&a.push(i),r&&s.push(r),tl({tag:"result",event:$?.liveness_detection_done,log:{result_object:{steps:t,frontalFaces:a,frontalScaledImage:l}}}),en({steps:t,frontalFaces:a,frontalFacesEncrypted:s,frontalScaledImage:l,capturedFrames:n,video:D().length?D()[0]:null}),E()}ew(!1)}eN()},r=y(()=>{let{curStepIndex:e,steps:t}=eJ.current,a=t[e],n=a?.image.blob!==null,s=a?.frontalFaceImage.blob!==null,r=t.filter(e=>e.frontalFaceImage.blob).length,l=!1;return n&&(s||![1].includes(e)||r>=1)?(eC.current=!1,i(),l=!0):n&&!s?eC.current=!0:eC.current=!1,eR(!1),l},er);async function l({faceDirection:e,canvas:t,blurScore:a,leftRightScore:n,isEyeClose:s}){let{curStepIndex:l,steps:c}=eJ.current;if(l<c.length){let o=c[l];if(O({faceDirection:e,curStep:o})||s)return;if(e===W.FRONTAL&&(null===o.frontalFaceImage.blurScore||k.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||k.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([k.calculateBlurScore(i),F.getModelPredictions({model:b,sCanvas:i})]),{error:y,fullFace:T,faceRatio:I,faceNotFrontalMinThreshold:L}=await n.validatePredictions({predictions:v,width:F.SIZE,height:F.SIZE});r=y,eP.current.image=R;let x=null,D=null,E=null,A=null,{curStepIndex:M,steps:O}=eJ.current;if(T){let e=O[M],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);(A=e)&&!r&&(r=J.close_eye)}}let N=r?.code==="no_face"||r?.code==="partial_face",P=M<O.length;!function({noFace:e,isFirstValidFrameFoundRef:t}){if(!e0.enable||!t)return;let{maxTimeMs:a}=e0;tm.current&&e||(tm.current={time:Date.now(),frame:0}),e&&tm.current.frame++;let{time:n}=tm.current;e&&Date.now()-n>=a&&(e$({...tb.liveness_terminated_no_face,duration:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_no_face"}}),td())}({noFace:N&&P,isFirstValidFrameFoundRef:m}),r?.code&&tc({tag:"selfie",event:$?.show_alert,log:{alert:r.code}}),!r||"face_too_small"===r.code&&x!==W.FRONTAL&&I>=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:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated_face_tracking"}})):e$({...tb.liveness_too_fast,duration:1500}),!0):(e$({...tb.liveness_terminated,duration:eQ}),tl({tag:"selfie",event:$?.show_alert,log:{alert:"liveness_terminated"}}),td(),!1))}({trackingScore:function(e,t,a,n){if(eH.current.length&&Date.now()-eH.current[eH.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}=U(e,0===eH.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:eH.current.length,bbox:i,original_bbox:i,metadata:JSON.stringify({})};if(ed&&ed.key){if(c.base64=w.encryptFrameBase64(c.base64,ed.key),eH.current.push(c),e4.framesBatchLength>0&&eH.current.length%e4.framesBatchLength==0&&e_){let e=eH.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,eH.current.length===e4.framesBatchLength)})}}else if(eH.current.push(c),e4.framesBatchLength>0&&eH.current.length%e4.framesBatchLength==0&&e_){let e=eH.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,eH.current.length===e4.framesBatchLength)}return r}return null}(v[0],i,E,M>=O.length),isFirstValidFrameFoundRef:m})&&await l({faceDirection:x,canvas:i,blurScore:p,leftRightScore:D,isEyeClose:A})):M<O.length&&(o=tb[r.code],eP.current.image=S),eq(o),-1!==e&&(e=requestAnimationFrame(()=>c(a,i)))}async function o(){let e=p.analyzeVideoAndWindowSizes(t,eP.current),a=document.createElement("canvas");a.width=400,a.height=400;let n=a.getContext("2d");n.translate(400,0),n.scale(-1*eb,+eb);let{mediaRecorder:s}=ts&&t?await A({outputImagesSize:400,videoEl:t,resultAnalyzeVideoAndWindowSizes:e}):{};tg.current=s,tg.current&&tg.current.start(),c(e,a)}return ey&&ej&&setTimeout(()=>{o()},e3??ef),()=>{cancelAnimationFrame(e),e=-1}},[ev,e3,ef,ey,eB,eO,f,R,S,en,es,ei,er,e4,eo,eZ,eY.enable,ec,eq,ea,eQ,td,e0,tb,ej,tl,e_,ed,eb,e1?.enable,e1?.webThreshold,e1?.webTimeout,e1?.forceCheck,e6.enable,eA,tc,ts,ti,tF,e7,tn,e8.enable]);let{curStepIndex:tT,steps:tI}=eJ.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:eK,resetFlow:td,handleVideoPlayed:tw,instructions:tL,refVideo:ex,refIsReseting:tu,steps:tI,videoPlayed:ey,activeCapturing:eI,isFirstValidFrameFound:eS,warmupDone:ej,showLoading:eF}}export{Z as u};
@@ -0,0 +1 @@
1
+ import{s as e,r as t,d as r,f as a,c as i,p as n,u as l,g as s,l as d,j as o,a as u,P as c}from"./chunk-ed832fec.js";import{g as p,S as g,R as f}from"./chunk-44cbd562.js";import{W as m}from"./chunk-de5b2d76.js";import"./chunk-e0f43811.js";let{IDCardSide:y,Errors:I}=e;async function b({image:e,cardType:t,cardSide:r,apiClient:a,outputEncryptionSettings:i}){let n={label:`id_card.${t}.${r}`};if(i&&i.key){let t=new File([e.encrypted.hex],`${Date.now()}.jpg`,{type:"image/jpeg"});return a.uploadImage({file:t,...n},{"X-TV-Key":i.key})}let l=new File([e.blob],`${Date.now()}.jpg`,{type:"image/jpeg"});return a.uploadImage({file:l,...n})}let S={data:{image_id:null}};async function _({image:e,apiClient:t,rawString:r,results:a,outputEncryptionSettings:i}){if(!e||!e.blob||!r)return Promise.resolve(S);let n={raw:r};a&&a.length>1&&(n=a.reduce((e,t,r)=>(e[0===r?"raw":`raw${r+1}`]=t,e),{}));let l={label:"qr_code",metadata:JSON.stringify(n)};if(i&&i.key){let r=new Blob([e.encrypted.hex]);return t.uploadImage({file:r,...l},{"X-TV-Key":i.key})}return t.uploadImage({file:e.blob,...l})}let C={data:{file_id:null}};async function h({video:e,apiClient:t,outputEncryptionSettings:r}){if(!e||!e.blob)return Promise.resolve(C);let a={label:"video"};if(r&&r.key){let i=new Blob([e.encrypted.hex]);return t.uploadFile({file:i,...a},{"X-TV-Key":r.key})}return t.uploadFile({file:e.blob,...a})}async function v({imageId:e,cardType:t,apiClient:r}){return r.requestVerifyIDCard({card_type:t,image1:{id:e}})}async function D({apiClient:e,cardType:t,frontCardId:r,isCapturingFrontSide:a,backCardId:i,recordedVideos:n=[],qrImageId:l,previousCapturingVideoId:s,previousFullVideoId:d,latestCapturingVideoId:o,latestFullVideoId:u}){let c=n.filter(e=>null!==e.id),p=n.filter(e=>null===e.id&&e.frames.length>0),g=await Promise.all(p.map(t=>e.fileService.request({frames:t.frames}))),f={card_type:t,image:{id:r},image2:a?void 0:{id:i},videos:[...[s,d,o,u].filter(e=>null!=e).map(e=>({id:e})),...c.map(e=>({id:e.id})),...g.map(e=>({id:e.data.file_id}))]};return l&&(f.qr1_images=[{id:l}]),e.detectIDTampering(f)}async function w({cardType:e,apiClient:t,cardImageId:r,qrImageId:a}){let i={card_type:e,image1:{id:r}};return a&&(i.qr1_images=[{id:a}]),t.readIDCard(i)}async function k({image:e,frontCardId:t,qrImageId:r,onError:a,recordedVideos:i,apiClient:n,cardType:l,cardSide:s,qrScannedResult:d,outputEncryptionSettings:o,enabledServices:u,fullVideo:c,capturingVideo:p,previousCapturingVideoId:g,previousFullVideoId:f}){let m=[b({image:e,cardType:l,cardSide:s,apiClient:n,outputEncryptionSettings:o})];m.push(_({image:d?.image,apiClient:n,rawString:d?.result,results:d?.results,outputEncryptionSettings:o})),m.push(h({video:c,apiClient:n,outputEncryptionSettings:o}),h({video:p,apiClient:n,outputEncryptionSettings:o}));let[S,C,k,E]=await Promise.all(m);if(S.errors)return void a({...I.upload_error,details:S.errors});let V=S.data.image_id,j=C?.data?.image_id||r,R={data:null};if(u?.enableVerifySanityIDCard){let e=await v({imageId:V,cardType:l,apiClient:n});if(e.errors)return void a({...I.sanity_check_error,details:e.errors});R.data=e.data}let B={data:null};if(u?.enableReadIDCardInfo){let e=await w({cardType:l,apiClient:n,cardImageId:V,qrImageId:j});if(e.errors)return void a({...I.read_id_card_error,details:e.errors});B.data=e.data}let F=k?.data?.file_id||null,T=E?.data?.file_id||null,K={data:null};if(u?.enableDetectIDCardTampering){let e,r;if(s===y.BACK&&!t)return void a(I.missing_front_id_card);let d=s===y.FRONT;d?e=V:(e=t,r=V);let o=await D({apiClient:n,cardType:l,frontCardId:e,isCapturingFrontSide:d,backCardId:r,recordedVideos:i,qrImageId:j,previousCapturingVideoId:g,previousFullVideoId:f,latestCapturingVideoId:T,latestFullVideoId:F});if(o.errors)return void a({...I.detect_id_tampering_error,details:o.errors});K.data=o.data}return{sanityResult:R.data,tamperingInfo:K.data,cardInfo:B.data,cardImageId:V,qrImageId:j,mp4VideoIds:{full:F,capturing:T}}}let{Errors:E}=e,V=({readIDCardUIOnlyComponent:c,...f})=>{let{onError:y,onStepDone:I,apiCredentials:b,logCredentials:S,outputEncryptionSettings:_,serviceSettings:C,flowId:h,clientSettings:v,...D}=f,[w,V]=t.useState(v),[j,R]=t.useState(!1),{apiClient:B}=r.useApiClient({apiCredentials:b,logCredentials:S}),F=t.useRef(""),T=t.useRef(""),K=t.useRef(null),U=t.useRef(null),q=a.getEnabledServices(C,w),{billingSettings:O,enableBilling:P}=i.useSDKSettings(),x=n.buildBillingInput(f),A=l.getWebSetting(w,"data.settings.sdk_settings.billing_settings.billing_config"),{submitBilling:W}=s({enable:P,onError:y,billingSettings:O??{json:A??{}},billingUrl:l.getWebSetting(w,"data.settings.sdk_settings.billing_settings.url")}),$=t.useCallback(t=>{if(e.ErrorsWithoutBilling.includes(t.code))return void y(t);let r={error:t,sdkStatus:e.BillingStatus.fail};W({service:p(D.steps),input:x,output:r}),y&&y(t)},[W,D.steps,x,y]),G=t.useCallback((t,r)=>{if(r){let r={sdkStatus:e.BillingStatus.success,result:n.buildBillingOutput(t)},a={service:p(D.steps),input:x,output:r};if(Array.isArray(D.steps)&&1===D.steps.length&&D.steps[0].scannerType===g.QR_CODE){let{qrScannedResult:r={}}=t,i=r.result;if(i){let e=i.split("|")[0];a.id_num=d.SHA256(e),a.full_hash=d.SHA256(i)}else a.output={...a.output,sdkStatus:e.BillingStatus.cancel}}W(a)}I&&I(t)},[I,D.steps,x,W]);t.useEffect(()=>{async function e(){try{let e=await B.clientSettings({flow_id:h});V(e)}catch(e){console.error("Error fetching client settings:",e)}finally{R(!0)}}q.enableGetClientSettings&&e()},[B,q.enableGetClientSettings,h]);let N=t.useCallback(async(t,{shouldBilling:r})=>{let{cardType:a,cardSide:i,recordedVideos:n,qrScannedResult:l,image:s,fullVideo:d,capturingVideo:o}=t;try{if(!q.enableUploadImages||!s.blob)return void G(t,r);let u=null;(u=await k({image:s,cardSide:i,frontCardId:F.current,qrImageId:T.current,onError:$,apiClient:B,cardType:a,recordedVideos:n,qrScannedResult:l,outputEncryptionSettings:_,enabledServices:q,fullVideo:d,capturingVideo:o,previousCapturingVideoId:U.current,previousFullVideoId:K.current}))&&(i===e.IDCardSide.FRONT&&(F.current=u.cardImageId),U.current=u?.mp4VideoIds?.capturing,K.current=u?.mp4VideoIds?.full,T.current=u.qrImageId,G({...t,apiResult:u},r))}catch(e){$({...E.api_call_error,details:e})}},[B,q,$,G,_]);return q.enableGetClientSettings&&!j?null:o.jsx(u.LicenseProvider,{clientSettings:w,onError:y,children:o.jsx(m,{isWrappedBy:"id_with_api_call",children:o.jsx(c,{logCredentials:S,onError:y,onStepDone:N,outputEncryptionSettings:_,...D,clientSettings:w})})})};V.propTypes={onError:c.func,onStepDone:c.func,apiCredentials:c.shape({accessKey:c.string,secretKey:c.string,apiUrl:c.string}),logCredentials:c.shape({}),outputEncryptionSettings:c.shape({}),readIDCardUIOnlyComponent:c.func,serviceSettings:c.shape({}),flowId:c.string,clientSettings:c.shape({})},V.defaultProps={onError:()=>{},onStepDone:()=>{},apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},logCredentials:{enable:!1},outputEncryptionSettings:{key:""},readIDCardUIOnlyComponent:f,serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0},flowId:"",clientSettings:null};export{V as default};
@@ -0,0 +1,3 @@
1
+ import{i as e,P as r,s as t,A as n,T as s,m as i,b as a,j as o,C as c,r as l,aI as u,c as m,a4 as p,k as d,aJ as f}from"./chunk-ed832fec.js";import{M as g,O as h,W as j,C as x}from"./chunk-e0f43811.js";import{u as F}from"./chunk-571e89c0.js";import{p as y,g as C,a as D,O as S,I as b,h as T,F as I,i as v,j as E,L as k,b as L,S as R}from"./chunk-7f5333af.js";import{u as V}from"./chunk-de5b2d76.js";import"./chunk-ff693e7b.js";import"./chunk-e77bab5e.js";import"./chunk-81ce3c83.js";import"./chunk-b87b1853.js";let _=e.img`
2
+ width: ${({width:e})=>e};
3
+ `;function w({type:e}){let r=n(),t=s(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),c=i(`Selfie.Active.directionIcon.${e}Width`)({theme:r}),l=a(r,`Selfie.Active.directionIcon.${e}`);return null===l?o.jsx(o.Fragment,{}):l&&null!==l?o.jsx(_,{src:a(r,`Selfie.Active.directionIcon.${e}`),width:c,alt:""}):o.jsx(_,{src:t,alt:"",width:c})}w.propTypes={type:r.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},w.defaultProps={type:t.FaceDirection.LEFT};let A=d.isMobile?{width:{ideal:640}}:null,$=({stepNumber:e,type:r,theme:t})=>{let n=f(`instruction_${r}.svg`),s=a(t,`Selfie.Active.imageHolder.${r}`);return null===s?o.jsx(o.Fragment,{}):"string"==typeof s&&""!==s?o.jsx("img",{src:s,alt:""}):"v1"===a(t,"themeVersion")?o.jsx("span",{children:e}):o.jsx("img",{src:n,alt:""})};function P(e){var r,f;let{apiCheck:_,onLivenessDetectionDone:w,captureFrameSettings:P,onFramesCaptured:N,frontCamera:H,flipVideoHorizontal:O,customDirectionIcon:M,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,defaultCameraId:Y,offsetFaceY:J,styledComponent:q,isLoading:Q,serviceSettings:X,onReset:Z}=e,ee=n(),{onErrorCallback:er,onCloseCallback:et}=V(),en=c.useAsset("bg_camera_mask.png"),es=c.useAsset("bg_camera_mask_red.png"),ei=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[ea,eo]=l.useState({}),{yFaceVerificationStepsWrapper:ec,yFaceDetectionError:el}=ea,[eu,em]=l.useState(""),[ep,ed]=l.useState(),ef=l.useMemo(()=>({backgroundColor:i("Selfie.backgroundColor")({theme:ee})}),[ee]);u(a(ee,"themeVersion"),"up_arrow.gif"),u(a(ee,"themeVersion"),"left_arrow.gif"),u(a(ee,"themeVersion"),"right_arrow.gif"),u(a(ee,"themeVersion"),"frontal_arrow.gif"),u(a(ee,"themeVersion"),"instruction_up.svg"),u(a(ee,"themeVersion"),"instruction_left.svg"),u(a(ee,"themeVersion"),"instruction_right.svg"),u(a(ee,"themeVersion"),"instruction_frontal.svg");let eg=l.useCallback(({clientHeight:e,videoAreaWidth:r,videoAreaHeight:t,lostX:n,lostY:s})=>{let i,a;d.isMobile?a=i=r:i=a=t-200;let o=Math.floor((r-i)/2)+n,c=5+s,l=s+25,u=l+30;eo({yFaceDetectionError:l,yFaceVerificationStepsWrapper:u+a+20});let m=Math.floor(s),p=Math.floor(e-s);return c=Math.floor(u),0!==J&&(c+J<m||c+J+a>p)?er({code:`offsetFaceY must be in [-${c-m}, ${p-a-c}]`}):c+=J,{x:o,y:c,width:i,height:a}},[J,er]),{shouldResetFlowOnOrientationChange:eh,cropArea:ej,curStepIndex:ex,directionIcon:eF,directionIconAnimation:ey,faceDetectionError:eC,resetFlow:eD,handleVideoPlayed:eS,instructions:eb,refVideo:eT,refIsReseting:eI,steps:ev,videoPlayed:eE,activeCapturing:ek,warmupDone:eL,showLoading:eR}=F({currentOrientation:ep,apiCheck:_,bgCameraMask:en,bgCameraMaskRed:es,surroundStyle:ef,onLivenessDetectionDone:w,onError:er,cropAreaDimension:eg,customDirectionIcon:M,captureFrameSettings:P,onFramesCaptured:N,setRemainingTime:em,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,serviceSettings:X,onReset:Z});l.useEffect(()=>{"string"==typeof ev[0]?.directionIcon&&Promise.all(ev.map(e=>y(e.directionIcon)))},[ev]);let{CloseCameraButton:eV}=q,e_=C(e,ee),ew=eI.current?0:ex/ev.length*100,{lang:eA}=m.useSDKSettings(),e$=l.useRef(0),eP=l.useRef({}),eN=l.useRef(t.ErrorDuration.SHORT),eH=l.useMemo(()=>{let{msg:e,duration:r=t.ErrorDuration.SHORT}=eC||{},n=e?.[eA];return Date.now()-e$.current>=eN.current&&(e$.current=Date.now(),eN.current=r,eP.current=n),eP.current},[eC,ex]),eO=l.useCallback(e=>{ed(e),eh?eD():e===g.LANDSCAPE?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:eV||null,children:[!eL&&o.jsx(j,{}),eE?o.jsxs(o.Fragment,{children:[ej.current?o.jsxs(x,{x:`${ej.current.x}px`,y:`${ej.current.y}px`,width:`${ej.current.width}px`,height:`${ej.current.height}px`,surroundStyle:ej.current.surroundStyle,children:[o.jsx(D,{}),o.jsx(S,{...e_,progress:ew,showErrorRing:!!eC&&i("Selfie.progressCircle.showErrorRing")({theme:ee})}),o.jsx(b,{children:(r=eF,f=ey,r?"string"==typeof r?o.jsx("img",{className:f,src:r,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):r:null)}),ek&&o.jsx(T,{})]}):null,eb?o.jsxs(o.Fragment,{children:[o.jsx(I,{top:ec+5,className:"instructions",children:eb}),o.jsx(v,{top:ec+35,children:ev.map((e,r)=>{let{name:t,image:{objUrl:n}}=e;return o.jsx(E,{active:ex>=r,className:"step-item",children:n?o.jsx("img",{className:"image_preview",src:n,alt:""}):o.jsx($,{stepNumber:r+1,type:t,theme:ee})},t)})})]}):null]}):null,(eR||Q)&&o.jsx(k,{children:o.jsx("img",{src:ei,alt:"",className:"spin"})}),eu&&o.jsx(L,{top:ec-30,children:eu}),"string"==typeof eH?o.jsx(R,{top:el-15,className:"face-detection-error",children:eH}):null]})})}P.propTypes={apiCheck:r.bool,onLivenessDetectionDone:r.func,onClose:r.func,onError:r.func,onReset:r.func,captureFrameSettings:r.shape({}),onFramesCaptured:r.func,flipVideoHorizontal:r.bool,frontCamera:r.bool,isLoading:r.bool,customDirectionIcon:r.shape({}),customStepTimeConstraints:r.shape({}),onProcessing:r.func,customErrors:r.shape({}),apiCredentials:r.shape({accessKey:r.string,secretKey:r.string,apiUrl:r.string}),outputEncryptionSettings:r.shape({}),cameraScale:r.number,defaultCameraId:r.string,offsetFaceY:r.number,styledComponent:r.shape({CloseCameraButton:r.node}),serviceSettings:r.shape({})},P.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[t.FaceDirection.LEFT]:o.jsx(w,{type:t.FaceDirection.LEFT}),[t.FaceDirection.RIGHT]:o.jsx(w,{type:t.FaceDirection.RIGHT}),[t.FaceDirection.UP]:o.jsx(w,{type:t.FaceDirection.UP}),[t.FaceDirection.FRONTAL]:o.jsx(w,{type:t.FaceDirection.FRONTAL})},customStepTimeConstraints:{[t.FaceDirection.UP]:{delayTime:0},[t.FaceDirection.LEFT]:{delayTime:0},[t.FaceDirection.RIGHT]:{delayTime:0},[t.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
@@ -0,0 +1 @@
1
+ import{A as e,C as r,T as s,r as t,m as n,aI as a,b as o,c as i,s as c,j as l,a4 as u,az as m,a7 as p,W as d,P as h,k as g,aJ as f}from"./chunk-ed832fec.js";import{M as j,O as x,W as y,C as C}from"./chunk-e0f43811.js";import{u as F}from"./chunk-571e89c0.js";import{D as D}from"./chunk-3475f25e.js";import{p as S,d as b,e as v,A as T,f as k,I as I,h as E,F as _,i as V,j as L,T as R,L as w,k as A,l as P,S as H}from"./chunk-7f5333af.js";import{u as N}from"./chunk-de5b2d76.js";import"./chunk-ff693e7b.js";import"./chunk-e77bab5e.js";import"./chunk-81ce3c83.js";import"./chunk-b87b1853.js";let M=g.isMobile?{width:{ideal:640}}:null,$=({stepNumber:e,type:r,theme:s})=>{let t=f(`instruction_${r}.svg`),n=o(s,`Selfie.Active.imageHolder.${r}`);return null===n?l.jsx(l.Fragment,{}):"string"==typeof n&&""!==n?l.jsx("img",{src:n,alt:""}):"v1"===o(s,"themeVersion")?l.jsx("span",{children:e}):l.jsx("img",{src:t,alt:""})};function O(h){var f,D;let{apiCheck:O,onLivenessDetectionDone:U,captureFrameSettings:B,onFramesCaptured:K,frontCamera:z,flipVideoHorizontal:W,customDirectionIcon:G,customStepTimeConstraints:Y,onProcessing:J,customErrors:q,apiCredentials:Q,outputEncryptionSettings:X,cameraScale:Z,defaultCameraId:ee,offsetFaceY:er,isLoading:es,serviceSettings:et,onReset:en}=h,ea=e(),{onErrorCallback:eo,onCloseCallback:ei}=N(),ec=r.useAsset("bg_camera_mask.png"),el=r.useAsset("bg_camera_mask_red.png"),eu=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[em,ep]=t.useState({}),{yFaceVerificationStepsWrapper:ed,yFaceDetectionError:eh,yCountdown:eg}=em,[ef,ej]=t.useState(""),[ex,ey]=t.useState(),eC=t.useMemo(()=>({backgroundColor:n("Selfie.backgroundColor")({theme:ea})}),[ea]);a(o(ea,"themeVersion"),"up_arrow.gif"),a(o(ea,"themeVersion"),"left_arrow.gif"),a(o(ea,"themeVersion"),"right_arrow.gif"),a(o(ea,"themeVersion"),"frontal_arrow.svg"),a(o(ea,"themeVersion"),"instruction_up.svg"),a(o(ea,"themeVersion"),"instruction_left.svg"),a(o(ea,"themeVersion"),"instruction_right.svg"),a(o(ea,"themeVersion"),"instruction_frontal.svg");let eF=t.useCallback(({lostY:e,height:r,clientHeight:s})=>{let t=g.isMobile?e:e+80,n=t+r+20,a=n+110;ep({yFaceDetectionError:a+30,yCountdown:a,yFaceVerificationStepsWrapper:n});let o=Math.floor(e),i=Math.floor(s-e),c=Math.floor(t);return 0!==er&&(c+er<o||c+er+r>i)?eo({code:`offsetFaceY must be in [-${c-o}, ${i-r-c}]`}):c+=er,{y:c}},[er,eo]),{shouldResetFlowOnOrientationChange:eD,cropArea:eS,curStepIndex:eb,directionIcon:ev,directionIconAnimation:eT,faceDetectionError:ek,resetFlow:eI,handleVideoPlayed:eE,instructions:e_,refVideo:eV,refIsReseting:eL,steps:eR,videoPlayed:ew,activeCapturing:eA,warmupDone:eP,showLoading:eH}=F({currentOrientation:ex,apiCheck:O,bgCameraMask:ec,bgCameraMaskRed:el,surroundStyle:eC,onLivenessDetectionDone:U,onError:eo,cropAreaDimension:eF,customDirectionIcon:G,captureFrameSettings:B,onFramesCaptured:K,setRemainingTime:ej,customStepTimeConstraints:Y,onProcessing:J,customErrors:q,apiCredentials:Q,outputEncryptionSettings:X,cameraScale:Z,serviceSettings:et,onReset:en});t.useEffect(()=>{"string"==typeof eR[0]?.directionIcon&&Promise.all(eR.map(e=>S(e.directionIcon)))},[eR]);let eN=b(h,ea),eM=eL.current?0:eb/eR.length*100,{lang:e$}=i.useSDKSettings(),eO=t.useRef(0),eU=t.useRef({}),eB=t.useRef(c.ErrorDuration.SHORT),eK=t.useMemo(()=>{let{msg:e,duration:r=c.ErrorDuration.SHORT}=ek||{},s=e?.[e$];return Date.now()-eO.current>=eB.current&&(eO.current=Date.now(),eB.current=r,eU.current=s),eU.current},[ek,eb]),ez=t.useCallback(e=>{ey(e),eD?eI():e===j.LANDSCAPE?eV.current?.pause():eV.current?.play()},[eV,eI,eD]);return l.jsx(x,{onOrientationChange:ez,children:l.jsxs(u,{frontCamera:z,onVideoPlayed:eE,onClose:ei,flipHorizontal:W??z,ref:eV,videoSettings:M,onError:eo,scale:Z,defaultCameraId:ee,closeButton:l.jsx(m,{}),children:[!eP&&l.jsx(y,{}),ew?l.jsxs(l.Fragment,{children:[eS.current?l.jsxs(C,{x:`${eS.current.x}px`,y:`${eS.current.y}px`,width:`${eS.current.width}px`,height:`${eS.current.height}px`,surroundStyle:eS.current.surroundStyle,children:[l.jsx(v,{padding:T}),l.jsx(k,{...eN,progress:eM,showErrorRing:!!ek}),l.jsx(I,{children:(f=ev,D=eT,f?"string"==typeof f?l.jsx("img",{className:D,src:f,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):f:null)}),eA&&l.jsx(E,{})]}):null,e_?l.jsxs(l.Fragment,{children:[l.jsx(_,{top:ed+5,className:"instructions",children:e_}),l.jsx(V,{top:ed+40,children:eR.map((e,r)=>{let{name:s,image:{objUrl:t}}=e;return l.jsx(L,{active:eb>=r,className:"step-item",children:t?l.jsx("img",{className:"image_preview",src:t,alt:""}):l.jsx($,{stepNumber:r+1,type:s,theme:ea})},s)})})]}):null]}):null,l.jsx(R,{y:"20px",children:l.jsx(p,{id:"flash_liveness.title"})}),(eH||es)&&l.jsx(w,{children:l.jsx("img",{src:eu,alt:""})}),ef&&l.jsxs(A,{top:eg,children:[l.jsx(d,{color:n("Selfie.countdown.color")({theme:ea})}),l.jsx(P,{children:ef})]}),"string"==typeof eK?l.jsx(H,{top:eh,className:"face-detection-error",children:eK}):null]})})}O.propTypes={apiCheck:h.bool,onLivenessDetectionDone:h.func,onClose:h.func,onError:h.func,onReset:h.func,captureFrameSettings:h.shape({}),onFramesCaptured:h.func,flipVideoHorizontal:h.bool,frontCamera:h.bool,isLoading:h.bool,customDirectionIcon:h.shape({}),customStepTimeConstraints:h.shape({}),onProcessing:h.func,customErrors:h.shape({}),apiCredentials:h.shape({accessKey:h.string,secretKey:h.string,apiUrl:h.string}),outputEncryptionSettings:h.shape({}),cameraScale:h.number,defaultCameraId:h.string,offsetFaceY:h.number,styledComponent:h.shape({CloseCameraButton:h.node}),serviceSettings:h.shape({})},O.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[c.FaceDirection.LEFT]:l.jsx(D,{type:c.FaceDirection.LEFT}),[c.FaceDirection.RIGHT]:l.jsx(D,{type:c.FaceDirection.RIGHT}),[c.FaceDirection.UP]:l.jsx(D,{type:c.FaceDirection.UP}),[c.FaceDirection.FRONTAL]:l.jsx(D,{type:c.FaceDirection.FRONTAL})},customStepTimeConstraints:{[c.FaceDirection.UP]:{delayTime:0},[c.FaceDirection.LEFT]:{delayTime:0},[c.FaceDirection.RIGHT]:{delayTime:0},[c.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{O as default};
@@ -0,0 +1,256 @@
1
+ import{aM as e,z as i,aN as r,aO as t,aP as s,m as o,b as n,r as a,K as l,P as d,D as c,s as g,X as h,j as f,i as u,y as p,B as m,k as w,aQ as k}from"./chunk-ed832fec.js";var b=Object.freeze({__proto__:null,blink:e,flipY:i,slide:r,spin:t,splash:s});let R=({curStep:e,faceDirection:i})=>{let r=n(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},S=(e,i)=>({radius:e.radius??o("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??o("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??o("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??o("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??o("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??o("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??o("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??o("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??o("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??o("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??o("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??o("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??o("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??o("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??o("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??o("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??o("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??o("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??o("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??o("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??o("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??o("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??o("Selfie.progressCircle.showDashedRing")({theme:i})}),_=(e,i)=>({radius:e.radius??o("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??o("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??o("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??o("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??o("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??o("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??o("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??o("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),y=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function C(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}let x=[],v=()=>{x=[]},$=(e,i,r,t)=>{t&&v(),x.push({id:null});let s=x.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?x[s].id=e.data.file_id:x[s].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?x[s].id=e.data.file_id:x[s].id=-1})}},W=()=>new Promise(e=>{let i=setInterval(()=>{x.every(e=>e.id)&&(e(),clearInterval(i))},200)}),j=e=>e.enable?x.some(e=>-1===e.id)?null:x:[],I=[],O=null,D=!1,A=()=>I,T=()=>{D=!0,I=[];try{O instanceof MediaStream&&(O.getTracks().forEach(e=>e.stop()),O=null)}catch(e){}};async function E({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;T();let s=document.createElement("canvas");s.width=e,s.height=e;let o=s.getContext("2d");try{let n={mimeType:"video/webm"};try{let e=(O=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(D=!1,!function e(i,r,t,s){if(!i||!s)return;let{cropX:o,cropY:n,cropWidth:a,cropHeight:l}=s;i.drawImage(r,o,n,a,l,0,0,t,t),D||requestAnimationFrame(()=>e(i,r,t,s))}(o,i,e,r),O=s.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(O,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"});I.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 P={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}}}}}},V=30,L=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:s=!0,onReset:o,onTick:n,onTimesUp:d}=e,c=a.useRef(new l({totalTime:r,totalDelayBetweenReset:t,interruptible:s}));return a.useEffect(()=>c.current.on("tick",({remainTime:e})=>{n({remainTime:e})}),[n]),a.useEffect(()=>c.current.on("delaystart",()=>{d()}),[d]),a.useEffect(()=>c.current.on("reset",({attemptCount:e,fromBackground:i})=>{o({attemptCount:e,fromBackground:i})}),[o]),a.useEffect(()=>i?c.current.start():()=>{},[i]),{stopTimer:a.useCallback(()=>{c.current.stop()},[])}},{ErrorDuration:z}=g;function M({children:e,errorMsg:i,className:r}){return h.isValidElement(e)?i?f.jsx("div",{className:r,children:h.cloneElement(e,{errorMsg:i})}):null:i?f.jsx("div",{className:r,children:i}):null}function B({children:e,className:i,error:r}){let t=a.useRef(0),s=a.useRef(""),o=c(),n=a.useRef(z.SHORT),{code:l,duration:d=z.SHORT}=r||{},g=o(l);return Date.now()-t.current>=n.current?(t.current=Date.now(),n.current=d,s.current=g,M({children:e,errorMsg:g,className:i})):M({children:e,errorMsg:s.current,className:i})}B.propTypes={children:d.node,className:d.string},B.defaultProps={className:""};let N=u.g`
2
+ transition: stroke-dashoffset 0.4s;
3
+ transform: rotate(-90deg);
4
+ transform-origin: 50% 50%;
5
+ `,F=u.circle`
6
+ transition: stroke-dashoffset 0.4s, stroke 0.4s;
7
+ transform: rotate(-90deg);
8
+ transform-origin: 50% 50%;
9
+ fill: none;
10
+ `,H=u.circle`
11
+ transition: stroke-dashoffset 0.4s;
12
+ transform: rotate(-90deg);
13
+ transform-origin: 50% 50%;
14
+ `;function K({className:e,style:i,radius:r,strokeWidth:t,progress:s,showErrorRing:o,activeColor:n,innerPadding:a,outsideRingColor:l,outsideRingOpacity:d,insideRingColor:c,insideRingWidth:g,insideRingStrokeDash:h,errorRingWidth:u,errorRingColor:p,dashedRingColor:m,dashedRingOpacity:w,dashedRingWidth:k,dashedRingLineThick:b,dashedRingLineSpacing:R,dashedInsideRingColor:S,dashedInsideRingWidth:_,showOutsideRing:y,showInsideRing:C,showDashedRing:x}){let v=2*r,$=2*r,W=r-2*t,j=2*Math.PI*W,I=W-k/2-t/2-a,O=2*Math.PI*I,D=I-_/2-k/2,A=2*Math.PI*D,T=D-g/2-_/2,E=D-u/2-_/2;return f.jsxs("svg",{className:e,style:i,width:v,height:$,viewBox:`0 0 ${v} ${$}`,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y?f.jsxs(f.Fragment,{children:[f.jsx("circle",{"data-testid":"outsideRing",opacity:d,cx:r,cy:r,r:W,stroke:l}),f.jsx(H,{"data-testid":"outsideAnimateRing",cx:r,cy:r,r:W,stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${j} ${j}`,style:{strokeDashoffset:j-s/100*j}})]}):null,x?f.jsxs(f.Fragment,{children:[f.jsx("circle",{"data-testid":"dashedRing",opacity:w,cx:r,cy:r,r:I,stroke:m,strokeWidth:k,strokeDasharray:`${b} ${R}`}),f.jsx("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",children:f.jsx("circle",{cx:r,cy:r,r:I,stroke:n,strokeWidth:k,strokeDasharray:`${b} ${R}`})}),f.jsx("g",{mask:"url(#mask0)",children:f.jsx(H,{"data-testid":"dashedAnimateRing",cx:r,cy:r,r:I,stroke:n,strokeWidth:k,strokeDasharray:`${O} ${O}`,style:{strokeDashoffset:O-s/100*O}})}),f.jsx("circle",{"data-testid":"dashedInsideRing",opacity:w,cx:r,cy:r,r:D,stroke:S,strokeWidth:_}),f.jsx(H,{"data-testid":"dashedInsideAnimateRing",cx:r,cy:r,r:D,stroke:n,strokeWidth:_,strokeLinecap:"round",strokeDasharray:`${A} ${A}`,style:{strokeDashoffset:A-s/100*A}})]}):null,C?f.jsx("circle",{"data-testid":"insideRing",strokeDasharray:h,cx:r,cy:r,r:T,stroke:c,strokeWidth:g}):null,o?f.jsx("circle",{"data-testid":"errorRing",strokeDasharray:h,cx:r,cy:r,r:E,stroke:p,strokeWidth:u}):null]})}K.propTypes={className:d.string,style:d.shape({}),radius:d.number,strokeWidth:d.number,progress:d.number,showErrorRing:d.bool,activeColor:d.string,innerPadding:d.number,outsideRingColor:d.string,outsideRingOpacity:d.number,insideRingColor:d.string,insideRingWidth:d.number,insideRingStrokeDash:d.string,errorRingColor:d.string,errorRingWidth:d.number,dashedRingColor:d.string,dashedRingOpacity:d.number,dashedRingWidth:d.number,dashedRingLineThick:d.number,dashedRingLineSpacing:d.number,dashedInsideRingColor:d.string,dashedInsideRingWidth:d.number,showOutsideRing:d.bool,showDashedRing:d.bool,showInsideRing:d.bool},K.defaultProps={className:"",style:null,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:3,insideRingStrokeDash:"0",errorRingColor:"#df0000",errorRingWidth:3,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!0,showDashedRing:!0,showInsideRing:!0};let{blink:U,slide:q,spin:J}=b,X=p`
15
+ z-index: ${m+20};
16
+ color: #ffffff;
17
+ `,Y=u.div`
18
+ ${X}
19
+ `,Z=p`
20
+ ${X}
21
+ ${({top:e})=>e&&p`
22
+ top: ${e}px;
23
+ `}
24
+ ${({bottom:e})=>e&&p`
25
+ bottom: ${e}px;
26
+ `}
27
+ ${({centerY:e})=>e&&p`
28
+ top: 50%;
29
+ transform: translateY(-50%);
30
+ `}
31
+ font-size: ${o("Selfie.error.fontSize")};
32
+ font-weight: ${o("Selfie.error.fontWeight")};
33
+ background: ${o("Selfie.error.backgroundColor")};
34
+ color: ${o("Selfie.error.color")};
35
+ padding: ${o("Selfie.error.padding")};
36
+ border-radius: ${o("Selfie.error.borderRadius")};
37
+ position: absolute;
38
+ white-space: pre-wrap;
39
+ text-align: center;
40
+ max-width: 80%;
41
+ `;u(B)`
42
+ ${Z}
43
+ `;let G=u.div`
44
+ ${Z}
45
+ `,Q=u.div`
46
+ z-index: ${m+20};
47
+ display: flex;
48
+ align-items: center;
49
+ position: absolute;
50
+ left: 50%;
51
+ transform: translate(-50%, 0);
52
+ ${({top:e})=>e&&p`
53
+ top: ${e}px;
54
+ `}
55
+ `,ee=u(Y)`
56
+ font-size: ${o("Selfie.countdown.fontSize")};
57
+ font-weight: ${o("Selfie.countdown.fontWeight")};
58
+ background: ${o("Selfie.countdown.backgroundColor")};
59
+ color: ${o("Selfie.countdown.color")};
60
+ padding: ${o("Selfie.countdown.padding")};
61
+ border-radius: ${o("Selfie.countdown.borderRadius")};
62
+ white-space: nowrap;
63
+ `,ei=u(ee)`
64
+ position: absolute;
65
+ left: 50%;
66
+ transform: translate(-50%, 0);
67
+ ${({top:e})=>e&&p`
68
+ top: ${e}px;
69
+ `}
70
+ `,er=u(Y)`
71
+ position: absolute;
72
+ ${({top:e})=>e&&p`
73
+ top: ${e}px;
74
+ `}
75
+ ${({bottom:e})=>e&&p`
76
+ bottom: ${e}px;
77
+ `}
78
+ color: ${o("Selfie.Active.instruction.color")};
79
+ font-size: ${o("Selfie.Active.instruction.fontSize")};
80
+ font-weight: ${o("Selfie.Active.instruction.fontWeight")};
81
+ text-shadow: ${o("Selfie.Active.instruction.textShadow")};
82
+ background-color: ${o("Selfie.Active.instruction.backgroundColor")};
83
+ border: ${o("Selfie.Active.instruction.border")};
84
+ border-radius: ${o("Selfie.Active.instruction.borderRadius")};
85
+ `,et=u.div`
86
+ height: ${()=>w.isMobile?"50px":"70px"};
87
+ position: absolute;
88
+ ${({top:e})=>e&&p`
89
+ top: ${e}px;
90
+ `}
91
+ ${({bottom:e})=>e&&p`
92
+ bottom: ${e}px;
93
+ `}
94
+ width: 100%;
95
+ display: flex;
96
+ justify-content: center;
97
+ align-items: center;
98
+ z-index: ${m+20};
99
+ `,es=u.div`
100
+ width: ${o("Selfie.Active.imageHolder.width")};
101
+ height: ${o("Selfie.Active.imageHolder.height")};
102
+ border-radius: ${o("Selfie.Active.imageHolder.borderRadius")};
103
+ font-size: ${o("Selfie.Active.imageHolder.fontSize")};
104
+ color: ${o("Selfie.Active.imageHolder.color")};
105
+ font-weight: ${o("Selfie.Active.imageHolder.fontWeight")};
106
+
107
+ ${({theme:e})=>"v2"===n(e,"themeVersion")?"border: unset;":`border: ${o("Selfie.Active.imageHolder.border")({theme:e})};`}
108
+
109
+ display: flex;
110
+ justify-content: center;
111
+ align-items: center;
112
+
113
+ & + & {
114
+ margin-left: 10px;
115
+ }
116
+
117
+ ${e=>e.active?p`
118
+ img:not(.image_preview) {
119
+ border: ${o("Selfie.Active.imageHolder.activeStepBorder")};
120
+ border-radius: ${o("Selfie.Active.imageHolder.activeStepBorderRadius")};
121
+ }
122
+ `:p`
123
+ opacity: 0.3;
124
+ `}
125
+
126
+ img {
127
+ width: 100%;
128
+ margin: 0;
129
+ border-radius: ${o("Selfie.Active.imageHolder.borderRadius")};
130
+ }
131
+ img.image_preview {
132
+ border: ${o("Selfie.Active.imageHolder.border")};
133
+ }
134
+ `,eo=u.div`
135
+ color: #ffffff;
136
+ height: 70px;
137
+ position: absolute;
138
+ bottom: 0;
139
+ width: 100%;
140
+ display: flex;
141
+ justify-content: center;
142
+ align-items: center;
143
+ z-index: ${m+20};
144
+ `,en=u.div`
145
+ ${({disabled:e})=>e?p`
146
+ pointer-events: none;
147
+ `:p`
148
+ cursor: pointer;
149
+ `}
150
+ text-align: center;
151
+
152
+ img {
153
+ width: ${o("Selfie.captureIcon.width")};
154
+ }
155
+ `,ea=u.div`
156
+ position: absolute;
157
+ width: 100%;
158
+ top: 0;
159
+ bottom: 0;
160
+ display: flex;
161
+ justify-content: center;
162
+ align-items: center;
163
+ color: #ffffff;
164
+ font-size: 140px;
165
+ opacity: 0.6;
166
+ `,el=u.div`
167
+ position: absolute;
168
+ width: 100%;
169
+ top: 0;
170
+ bottom: 0;
171
+ display: flex;
172
+ flex-direction: column;
173
+ justify-content: center;
174
+ align-items: center;
175
+ ${q.default};
176
+ ${U.default};
177
+ `,ed=u(K)`
178
+ position: absolute;
179
+ top: 0;
180
+ left: 0;
181
+ width: 100%;
182
+ height: 100%;
183
+ `,ec=u(({className:e="",radius:i=80,neutralColor:r="#CBD5E1",activeColor:t="#0276F1",errorColor:s="#E84848",strokeWidth:o=2,tickWidth:n=15,numberOfTicks:a=200,progress:l=0,showErrorRing:d=!1})=>{let c=2*i,g=i-5,h=2*Math.PI*g,u=Array.from({length:a}).map((e,r)=>{let t=360*r/a+3;return f.jsx("use",{href:"#tick",transform:`rotate(${t} ${i} ${i})`},r)}),p=i-V,m=2*Math.PI*p;return f.jsxs("svg",{height:c,width:c,viewBox:`0 0 ${c} ${c}`,className:e,xmlns:"http://www.w3.org/2000/svg",children:[d?f.jsx("circle",{cx:i,cy:i,r:i-V,stroke:s,strokeWidth:o,fill:"none"}):f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:i,cy:i,r:p,stroke:r,strokeWidth:o,fill:"none"}),f.jsx(F,{cx:i,cy:i,r:p,stroke:t,strokeWidth:o,strokeLinecap:"round",strokeDasharray:`${m} ${m}`,style:{strokeDashoffset:m-l/100*m}})]}),f.jsx("defs",{children:f.jsx("line",{id:"tick",x1:i,y1:"0",x2:i,y2:n,stroke:r,strokeWidth:o,strokeLinecap:"round"})}),f.jsx("g",{id:"border-segments",children:u}),f.jsx("mask",{id:"tickMask",maskUnits:"userSpaceOnUse",children:f.jsx("g",{id:"tick-mask-segments",children:u})}),f.jsx("g",{mask:"url(#tickMask)",children:f.jsx(N,{strokeDasharray:`${h} ${h}`,style:{strokeDashoffset:h-l/100*h},children:f.jsx("circle",{cx:i,cy:i,r:g,stroke:t,strokeWidth:20,fill:"none"})})})]})})`
184
+ position: absolute;
185
+ top: 0;
186
+ left: 0;
187
+ width: 100%;
188
+ height: 100%;
189
+ `,eg=u(function({className:e=""}){return f.jsx("svg",{className:e,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"})})})`
190
+ width: 100%;
191
+ height: 100%;
192
+ vertical-align: middle;
193
+ margin: 0;
194
+ color: ${o("Selfie.backgroundColor")};
195
+ `,eh=u(function({className:e="",radius:i=160,backgroundColor:r="#fff",padding:t=0}){let s=2*i;return f.jsxs("svg",{className:e,width:s,height:s,viewBox:`0 0 ${s} ${s}`,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsxs("mask",{id:"CIRCLE_MASK",children:[f.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white",mask:"url(#CIRCLE_MASK)"}),f.jsx("circle",{cx:i,cy:i,r:i-t,fill:"black"})]}),f.jsx("circle",{cx:i,cy:i,r:i,fill:"none"}),f.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:r,mask:"url(#CIRCLE_MASK)"})]})})`
196
+ width: 100%;
197
+ height: 100%;
198
+ vertical-align: middle;
199
+ margin: 0;
200
+ color: ${o("Selfie.backgroundColor")};
201
+ `,ef=u.div`
202
+ position: absolute;
203
+ z-index: -1;
204
+ background: rgba(223, 0, 0, 0.2);
205
+ border-radius: 50%;
206
+ width: 86%;
207
+ height: 86%;
208
+ top: 7%;
209
+ left: 7%;
210
+ `,eu=k`
211
+ from {
212
+ opacity: 1;
213
+ }
214
+
215
+ to {
216
+ opacity: 0;
217
+ }
218
+ `,ep=u.div`
219
+ position: absolute;
220
+ width: 100%;
221
+ top: 0;
222
+ bottom: 0;
223
+ z-index: -1;
224
+ background: rgba(255, 255, 255, 0.3);
225
+ animation: ${eu} 1s infinite;
226
+ border-radius: 50%;
227
+ `,em=u.div`
228
+ top: 0;
229
+ left: 0;
230
+ right: 0;
231
+ bottom: 0;
232
+ position: absolute;
233
+ margin: auto;
234
+ width: ${o("Selfie.loadingIcon.width")};
235
+ height: ${o("Selfie.loadingIcon.height")};
236
+
237
+ img {
238
+ width: 100%;
239
+ }
240
+
241
+ z-index: ${m+20};
242
+ ${J.default}
243
+ `,ew=u.div`
244
+ text-align: center;
245
+ color: ${o("Selfie.title.color")};
246
+ font-size: ${o("Selfie.title.fontSize")};
247
+ font-weight: ${o("Selfie.title.fontWeight")};
248
+ background-color: ${o("Selfie.title.backgroundColor")};
249
+ position: absolute;
250
+ top: ${e=>e.y};
251
+ z-index: ${m+10};
252
+ display: flex;
253
+ align-items: center;
254
+ justify-content: center;
255
+ width: 100%;
256
+ `;export{V as A,eo as B,ea as C,ef as E,er as F,el as I,em as L,ed as O,G as S,ew as T,eg as a,ei as b,en as c,_ as d,eh as e,ec as f,S as g,ep as h,et as i,es as j,Q as k,ee as l,j as m,P as n,$ as o,C as p,A as q,T as r,v as s,R as t,L as u,E as v,W as w,y as x};
@@ -0,0 +1 @@
1
+ import{aj as r,ak as n,aR as t,ag as e,aS as u,$ as o}from"./chunk-ed832fec.js";import{r as a,f as i,g as c,h as s,i as p,j as f,k as l,l as _,n as v,o as g,p as b}from"./chunk-de5b2d76.js";function j(){if(d)return O;d=1;var t=r(),e=n(),u=s();return O=function(r){if(!e(r))return!1;var n=t(r);return"[object Error]"==n||"[object DOMException]"==n||"string"==typeof r.message&&"string"==typeof r.name&&!u(r)}}function m(){return M?I:(M=1,I=/<%=([\s\S]+?)%>/g)}var y,h,O,d,w,E,R,$,k,S,x,L,P,U,q,A,D,F,I,M,z,B,C,G,H,J,K,N,Q,T,V,W,X,Y,Z=o(function(){if(Y)return X;Y=1;var r=function(){if(h)return y;h=1;var r=a(),n=i(),t=c();return y=n(function(n,e,u,o){r(e,t(e),n,o)})}(),n=function(){if(E)return w;E=1;var r=f(),n=p(),t=j();return w=n(function(n,e){try{return r(n,void 0,e)}catch(r){return t(r)?r:Error(r)}})}(),o=function(){if($)return R;$=1;var r=t();return R=function(n,t){return r(t,function(r){return n[r]})}}(),s=function(){if(S)return k;S=1;var r=e(),n=Object.prototype,t=n.hasOwnProperty;return k=function(e,u,o,a){return void 0===e||r(e,n[o])&&!t.call(a,o)?u:e}}(),O=function(){if(L)return x;L=1;var r={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return x=function(n){return"\\"+r[n]}}(),d=j(),I=b(),M=function(){if(F)return D;F=1;var r=v(),n=function(){if(A)return q;A=1;var r=_(),n=U?P:(U=1,P=l()(Object.keys,Object)),t=Object.prototype.hasOwnProperty;return q=function(e){if(!r(e))return n(e);var u=[];for(var o in Object(e))t.call(e,o)&&"constructor"!=o&&u.push(o);return u}}(),t=g();return D=function(e){return t(e)?r(e):n(e)}}(),Z=m(),rr=function(){if(W)return V;W=1;var r=function(){if(J)return H;J=1;var r=function(){if(G)return C;G=1;var r=B?z:(B=1,z=function(r){return function(n){return null==r?void 0:r[n]}});return C=r({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})}(),n=u(),t=/[&<>"']/g,e=RegExp(t.source);return H=function(u){return(u=n(u))&&e.test(u)?u.replace(t,r):u}}(),n=N?K:(N=1,K=/<%-([\s\S]+?)%>/g),t=T?Q:(T=1,Q=/<%([\s\S]+?)%>/g),e=m();return V={escape:n,evaluate:t,interpolate:e,variable:"",imports:{_:{escape:r}}}}(),rn=u(),rt=/\b__p \+= '';/g,re=/\b(__p \+=) '' \+/g,ru=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ro=/[()=,{}\[\]\/\s]/,ra=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ri=/($^)/,rc=/['\n\r\u2028\u2029\\]/g,rs=Object.prototype.hasOwnProperty;return X=function(t,e,u){var a=rr.imports._.templateSettings||rr;u&&I(t,e,u)&&(e=void 0),t=rn(t),e=r({},e,a,s);var i=r({},e.imports,a.imports,s),c=M(i),p=o(i,c),f,l,_=0,v=e.interpolate||ri,g="__p += '",b=RegExp((e.escape||ri).source+"|"+v.source+"|"+(v===Z?ra:ri).source+"|"+(e.evaluate||ri).source+"|$","g"),j=rs.call(e,"sourceURL")?"//# sourceURL="+(e.sourceURL+"").replace(/\s/g," ")+"\n":"";t.replace(b,function(r,n,e,u,o,a){return e||(e=u),g+=t.slice(_,a).replace(rc,O),n&&(f=!0,g+="' +\n__e("+n+") +\n'"),o&&(l=!0,g+="';\n"+o+";\n__p += '"),e&&(g+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),_=a+r.length,r}),g+="';\n";var m=rs.call(e,"variable")&&e.variable;if(m){if(ro.test(m))throw Error("Invalid `variable` option passed into `_.template`")}else g="with (obj) {\n"+g+"\n}\n";g=(l?g.replace(rt,""):g).replace(re,"$1").replace(ru,"$1;"),g="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(f?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+g+"return __p\n}";var y=n(function(){return Function(c,j+"return "+g).apply(void 0,p)});if(y.source=g,d(y))throw y;return y}}());export{Z as t};
@@ -0,0 +1 @@
1
+ import{r as e,u as t,k as s,b as a,A as i,m as n,ap as r,aq as l,M as o,O as _,Q as g,j as d,ar as c,as as m,at as f,au as u,av as v,aC as b,aD as h,az as p,F as k,R as y,d as S,f as C,s as F,aA as x,aB as w,Y as E,P as W}from"./chunk-ed832fec.js";import{d as R}from"./chunk-ff693e7b.js";import{t as M}from"./chunk-e77bab5e.js";import{C as L,O as O}from"./chunk-e0f43811.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 J,h as G,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-0811f0b9.js";import{m as ei,u as en,b as er}from"./chunk-de5b2d76.js";import{u as el}from"./chunk-b87b1853.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=el();return e.useMemo(()=>{let e=ei({},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}=en(),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:el,blurCheckFarSettings:eo,outputImageSettings:e_,autoGenFrameIds:eg}=E,ef=e.useRef(),eu=D(),ev=er(),[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:eJ,largeScale:eG}=V(ee,{width:ex.width,height:ex.height},{width:eQ.width,height:eQ.height}),eH=1e3*el.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(eJ),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}),[eJ,e2,eq,eT,eg.enable,s,eX]),e1=q({offset:ee.ovalVerticalOffset,ovalPadding:ee.ovalPadding,largeScale:eG,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]),e3=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]),e9=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){e3({prediction:t,canvas:s}),i(n),await e8();return}if(!eT.isAutoCapturing()){await e2("please_hold_still"),ey(!0),e3({prediction:t,canvas:s}),eT.startCapturing({onDone:async e=>{i(e),await e8()},initialFrame:n});return}e3({prediction:t,canvas:s}),eT.captureFrame(n)},[e_.farImageOrder,es.enable,es.framesIntervalTime,eo.enable,eT,e3,e5,ei.validFaceRatio,ei.enableCropCenterFar,ei.detectionToWholeFaceRatio,ei.imageQuality,eQ,e8,e2]),{warmupDone:e4}=J({onError:x,isVideoPlaying:eN,step:eS,cropArea:eQ,videoRef:ew,onFarFaceDetected:e9,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});G(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(eJ),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&&el.enable,onTimeout:te,onDelayEnd:tt,onError:x,totalTime:el.total,totalDelay:3,maxRetriesSettings:{enable:el.enableMaxRetryCount,total:el.maxRetryCount},interruptible:el.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:el.countdown,total:el.total,shouldStart:eO&&el.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=el(),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}=en(),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
+ let e;import{d as t,r as s,j as n,a as i,aa as l,c as r,a9 as a,ab as o,o as c,u as u,g as g,p as d,s as S,e as h,X as v}from"./chunk-ed832fec.js";import{e as f,d as j,c as p,D as b,S as x}from"./chunk-de5b2d76.js";let k=s.createContext({}),y={},C=({children:e,enableGetClientSettings:i,clientSettings:l,apiCredentials:r,flowId:a})=>{let{apiClient:o}=t.useApiClient({apiCredentials:r}),[c,u]=s.useState({}),[g,d]=s.useState(!1);s.useEffect(()=>{i?async function e(){try{if(!o||"function"!=typeof o.clientSettings)return;let e=await o.clientSettings({flow_id:a});u(e)}catch(e){console.error(e)}finally{d(!0)}}():d(!0)},[i,o,a]);let S=y;return(l&&Object.keys(l).length>0?S=l:i&&(S=c),g)?n.jsx(k.Provider,{value:S,children:e}):null},m=()=>s.useContext(k),_=({children:e,onError:t})=>{let s=m();return n.jsx(i.LicenseProvider,{clientSettings:s,onError:t,children:e})},E=({children:e,onError:t,type:s})=>{let i=m();return n.jsx(l.Provider,{clientSettings:i,type:s,onError:t,children:e})},D={},P=({children:e,customTexts:t=D})=>{let s=m(),{lang:i,uiSettings:l}=r.useSDKSettings(),c=a({customTexts:t,clientSettings:s,lang:i,uiSettings:l});return n.jsx(o.SDKLocaleProvider,{value:c,children:e})},L={},B=({children:e,customTheme:t=L})=>{let s=m(),{uiSettings:i,themeVersion:l}=r.useSDKSettings(),a=f({customTheme:t,clientSettings:s,themeVersion:l,uiSettings:i,defaultThemes:j});return n.jsx(c,{theme:a,children:e})},z=v.lazy(()=>import("./chunk-e289e491.js")),w=v.lazy(()=>import("./chunk-e3a48659.js")),A=v.lazy(()=>import("./chunk-abf5e014.js")),K=v.lazy(()=>import("./chunk-6e830372.js")),I=v.lazy(()=>import("./chunk-6b0b5adc.js")),V=v.lazy(()=>import("./chunk-ee9ed408.js"));var T=(e=e=>{var t,i,l;let a,{logCredentials:o={enable:!1},livenessComponent:c,customTheme:v={},customTexts:f,...j}=e,{mode:k,flowId:y,onError:C,onClose:D,debug:L,onLivenessDetectionDone:T}=j,W=m(),{billingSettings:M,enableBilling:O,themeVersion:G}=r.useSDKSettings(),F=u.getWebSetting(W,"data.settings.sdk_settings.billing_settings.billing_config"),{submitBilling:U}=g({enable:O,onError:C,billingSettings:M??{json:F??{}},billingUrl:u.getWebSetting(W,"data.settings.sdk_settings.billing_settings.url")}),X=d.buildBillingInput(e),$=p(),q="face_authen"===$?S.BillingService.faceAuth:S.BillingService.selfie,H=s.useCallback(async(...e)=>{if("face_authen"===$)return void await T(...e);try{if(!await U({service:q,input:X,output:{...d.buildBillingOutput(e?.[0]||{}),sdkStatus:S.BillingStatus.success}}))return}catch(e){console.error(e)}await T(...e)},[X,q,$,T,U]),J=s.useCallback(e=>{S.ErrorsWithoutBilling.includes(e.code)?C(e):(U({service:q,input:X,output:{error:e,sdkStatus:S.BillingStatus.fail}}),C&&C(e))},[U,q,X,C]),N=s.useCallback(()=>{U({service:q,input:X,output:{sdkStatus:S.BillingStatus.cancel}}),D&&D()},[U,q,X,D]),Q=(t=k,i=c,l=G,a=K,t===S.Mode.ACTIVE&&(a=i?.ActiveLiveness??("v1"===l?I:K)),t===S.Mode.PASSIVE_V2&&(a=i?.PassiveLivenessV2??A),t===S.Mode.PASSIVE&&(a=i?.PassiveLiveness??("v1"===l?V:w)),"string"==typeof t&&t.startsWith("flash")&&(a=i?.FlashLiveness??z),a);return n.jsx(b,{debug:L,children:n.jsx(x,{onDone:T,onError:J,onClose:N,children:n.jsx(P,{customTexts:f,children:n.jsx(E,{onError:J,type:"face_authen"===y?"face_auth":"liveness",children:n.jsx(_,{onError:C,children:n.jsx(B,{customTheme:v,children:n.jsx(h.SDKTrackingProvider,{value:{tracking:{...o}},children:n.jsx(s.Suspense,{fallback:null,children:n.jsx(Q,{...j,onLivenessDetectionDone:H})})})})})})})})})},function(t){let{apiCheck:s,apiCredentials:i,serviceSettings:l,flowId:r,clientSettings:a}=t,o=s&&(l?.enableGetClientSettings??!0);return n.jsx(C,{enableGetClientSettings:o,clientSettings:a,apiCredentials:i,flowId:r,children:n.jsx(e,{...t})})}),W=Object.freeze({__proto__:null,default:T});export{C as C,T as L,P as S,W as i,m as u};
@@ -0,0 +1 @@
1
+ let e,t;import{b as n,s as a,d as s,r as r,P as i,L as o,j as l,f as u,c as c,u as f,p as p,g as d}from"./chunk-ed832fec.js";import{L as g,C as m,S as h,u as v}from"./chunk-b87b1853.js";import{W as A}from"./chunk-de5b2d76.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:L,customTexts:V,extraConfig:H}=e,B=v(),G=r.useMemo(()=>{let e={..._,...R};return u.getEnabledServices(e,B)},[B,_]),{FaceAuthenticationLoading:O}=L,[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:H,customComponent:L,apiCheck:t,apiCredentials:m,serviceSettings:G,flowId:x,customTexts:V}),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(h,{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(m,{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};
@@ -0,0 +1 @@
1
+ import{j as r,r as e,s as o,a2 as n,ac as t,ad as i,ae as a,af as u,ag as s,ah as d,ai as c,aj as l,ak as g,al as f,am as p,an as h,$ as b,u as y,ao as x}from"./chunk-ed832fec.js";let k=e.createContext(!1),C=({children:e,debug:o=!1})=>r.jsx(k.Provider,{value:o,children:e}),T=()=>e.useContext(k),v={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"},m={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},titleBack:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},instruction:{padding:"unset",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"},captured:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"}},error:{padding:"5px 10px",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},toggle:{color:"#d1d1d1",fontSize:"16px",fontWeight:"500",gap:"16px",backgroundColor:"#fff",active:{backgroundColor:"#2196f3"},inactive:{backgroundColor:"#ccc"}},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:"60px",height:"60px",disabled:{src:""}},loadingIcon:{src:"",width:"100px",height:"100px"},rectangleMask:{width:600,height:400,strokeWidth:2,strokeStyles:{},radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:"#fff",strokeWidth:2,strokeDasharray:"7, 4",opacity:.6},error:{fill:"rgba(234,50,35, 0.1)",strokeWidth:2,stroke:"#ea3223"}}},IDConfirmPopup:{image:{borderRadius:"5px"}},QRStep:{title:{color:"#fff",fontSize:"20px",fontWeight:"700",backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:"5px",backgroundColor:"#e7e6e6"},guideText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"},countdownText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"}},scanTooltip:{backgroundColor:"#00ce78",borderRadius:"8px",color:"#fff",padding:"10px",textAlign:"center"},scanCountdown:{textAlign:"center",color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"none",borderRadius:"3px",padding:"5px 10px"},invalidPopup:{padding:"10px",title:{display:"block",color:v.tsSecondary,fontSize:"16px",fontWeight:"bold",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{color:"#fff",fontSize:"1rem",fontWeight:"normal",backgroundColor:v.tsBlue,border:"none",borderRadius:"3px",outline:"none",height:"66px",margin:"30px 0 0 0"},skipButton:{color:v.tsBlue,fontSize:"1rem",fontWeight:"normal",backgroundColor:"unset",border:"none",borderRadius:"unset",outline:"none",height:"unset",margin:"20px 0"}},resultText:{success:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#34ce60"},error:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#ff9532"}}}},D={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{...o.DesignToken.Typography.h4,color:o.DesignToken.Color.base.white,backgroundColor:"unset"},titleBack:{...o.DesignToken.Typography.h4,color:o.DesignToken.Color.base.white,backgroundColor:"unset"},instruction:{...o.DesignToken.Typography.body,padding:"5px 10px",color:"rgba(255, 255, 255, 0.8)",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{...o.DesignToken.Typography.label,color:o.DesignToken.Color.base.white,padding:`6px ${o.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},captured:{...o.DesignToken.Typography.label,color:o.DesignToken.Color.base.white,padding:`6px ${o.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"}},error:{...o.DesignToken.Typography.body,padding:"5px 10px",color:o.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:o.DesignToken.CornerRadius["2xs"]},toggle:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.base.white,gap:o.DesignToken.Spacing.base,backgroundColor:o.DesignToken.Color.base.white,active:{backgroundColor:o.DesignToken.Color.base.blue},inactive:{backgroundColor:o.DesignToken.Color.neutral[300]}},countdown:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:o.DesignToken.CornerRadius["2xs"]},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:o.DesignToken.Height["7xl"],height:o.DesignToken.Height["7xl"],disabled:{src:""}},loadingIcon:{src:"",width:"47px",height:"47px"},rectangleMask:{width:600,height:400,strokeWidth:n.getCSSNumericValue(o.DesignToken.BorderWidth["3xl"]),strokeStyles:{},radius:n.getCSSNumericValue(o.DesignToken.CornerRadius.base),paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:o.DesignToken.Color.neutral[400],strokeWidth:n.getCSSNumericValue(o.DesignToken.BorderWidth["3xl"])},error:{fill:"none",strokeWidth:n.getCSSNumericValue(o.DesignToken.BorderWidth["3xl"]),stroke:o.DesignToken.Color.semantic.error[400]}}},IDConfirmPopup:{image:{borderRadius:o.DesignToken.CornerRadius["2xs"]}},QRStep:{title:{...o.DesignToken.Typography.h4,backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:o.DesignToken.CornerRadius["2xs"],backgroundColor:"transparent"},guideText:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.neutral[600],textAlign:"center"},countdownText:{...o.DesignToken.UIText.medium,color:o.DesignToken.Color.neutral[500],textAlign:"center"}},scanTooltip:{backgroundColor:"transparent",borderRadius:o.DesignToken.CornerRadius.xs,color:o.DesignToken.Color.base.white,padding:"10px",textAlign:"center"},scanCountdown:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.semantic.error[400],textAlign:"center",backgroundColor:"transparent",border:"none",borderRadius:o.DesignToken.CornerRadius["2xs"],padding:"0px"},invalidPopup:{padding:"10px",title:{...o.DesignToken.Typography.h6,color:o.DesignToken.Color.content.primary,display:"none",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.content.secondary,textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.base.white,backgroundColor:o.DesignToken.Color.base.blue,borderRadius:o.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:o.DesignToken.Height["3xl"],margin:"24px 0 0 0"},skipButton:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.content.primary,backgroundColor:o.DesignToken.Color.background.tertiary,borderRadius:o.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:o.DesignToken.Height["3xl"],margin:"12px 0"}},resultText:{success:{...o.DesignToken.Typography.body,textColor:o.DesignToken.Color.content.primary,mainColor:o.DesignToken.Color.semantic.success[400]},error:{...o.DesignToken.Typography.body,textColor:o.DesignToken.Color.content.primary,mainColor:o.DesignToken.Color.semantic.warning[500]}}}},R=m,S=D,{DesignToken:W}=o,w={FlashLiveness:{maskFill:"#fff",mask:{strokeColor:W.Color.separators.secondary,strokeColorError:W.Color.semantic.error[400],strokeWidth:4,path:"M118.5 2.5C54.2233 2.5 2.5 59.5579 2.5 129.447C2.5 146.072 3.68394 172.618 8.16415 200.483C12.6369 228.301 20.4309 257.673 33.7816 279.787C46.9667 301.626 59.6817 317.047 73.3658 327.003C87.1207 337.011 101.735 341.41 118.5 341.41C135.265 341.41 149.879 337.011 163.634 327.003C177.318 317.047 190.033 301.626 203.218 279.787C216.569 257.673 224.363 228.301 228.836 200.483C233.316 172.618 234.5 146.072 234.5 129.447C234.5 59.5579 182.777 2.5 118.5 2.5Z",width:237,height:344},title:{hidden:!1,height:"auto",color:W.Color.content.primary,fontSize:W.Typography.h5.fontSize,fontWeight:W.Typography.h5.fontWeight,lineHeight:W.Typography.h5.lineHeight},guideline:{text:{close:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},far:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},flashing:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",padding:"12px 16px"}},icon:{color:W.Color.blue[900],src:""}},instruction:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},timeoutText:{color:W.Color.semantic.error[400],fontSize:W.Typography.body.fontSize,fontWeight:W.Typography.body.fontWeight,padding:"0"},errorOverlay:{backgroundColor:"transparent",opacity:0},progressBar:{mainColor:W.Color.blue[900],secondaryColor:W.Color.blue[100],textColor:W.Color.blue[900],fontSize:W.Typography.body.fontSize,fontWeight:W.FontWeight["semi-bold"]},flashing:{logo:{src:"",width:"140px",height:"auto"},backgroundPattern:{srcMobile:"",srcDesktop:"",width:"100%",height:"auto"}}}},z=w,j=w,{DesignToken:_}=o,A={Selfie:{backgroundColor:"#FFF",title:{...o.DesignToken.Typography.h5,color:o.DesignToken.Color.content.primary},countdown:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"0px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{activeColor:"rgba(52, 152, 211, 1)",innerPadding:3,showDashedRing:!0,showOutsideRing:!1,dashedRingLineThick:"2",dashedRingLineSpacing:"3.5",dashedRingColor:"rgba(193, 197, 204, 1)",dashedRingOpacity:1,insideRingColor:"#fff",insideRingWidth:10,insideRingStrokeDash:"0",outsideRingOpacity:1,outsideRingColor:"#fff",errorRingWidth:0,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,errorRingColor:"#df0000",dashedRingWidth:10,dashedInsideRingColor:"#fff",dashedInsideRingWidth:3,showInsideRing:!0},progressCircleV2:{activeColor:_.Color.blue[900],neutralColor:_.Color.neutral[300],errorColor:_.Color.semantic.error[400],radius:160,strokeWidth:2,progress:0,tickWidth:15,numberOfTicks:200},Active:{instruction:{color:_.Color.content.primary,fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,textShadow:"none",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"168px",left:"",leftWidth:"150px",right:"",rightWidth:"150px",up:"",upWidth:"150px"},imageHolder:{width:"72px",height:"72px",borderRadius:"50%",border:`3px solid ${_.Color.blue[900]}`,fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:"",activeStepBorder:`1px solid ${_.Color.separators.tertiary}`,activeStepBorderRadius:"50%"}}}},I={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:""}}}},O=A,{DesignToken:P}=o,B={PassiveLiveness:{instruction:{color:P.Color.content["on-bg-color"],fontSize:P.Typography.label.fontSize,fontWeight:P.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",padding:"12px 12px"}}},F=B,q=B,H={closeButton:{top:o.DesignToken.Spacing.base,right:o.DesignToken.Spacing.base,left:"auto",bottom:"auto",display:"block",src:"",width:"24px",height:"auto"},popup:{backgroundColor:o.DesignToken.Color.base.white,padding:"10px",border:"none",borderRadius:o.DesignToken.CornerRadius.sm,overlay:{backgroundColor:o.DesignToken.Color.mask[70]},title:{...o.DesignToken.Typography.h6,fontWeight:o.DesignToken.FontWeight["semi-bold"],color:o.DesignToken.Color.content.primary,textAlign:"center",display:"initial",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.content.secondary,textAlign:"center",border:"unset",borderRadius:"unset",margin:"30px 0 0 0",padding:"0 0 0 0"},primaryButton:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.base.white,backgroundColor:o.DesignToken.Color.base.blue,borderRadius:o.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:o.DesignToken.Height["3xl"],maxWidth:"unset"},secondaryButton:{...o.DesignToken.Typography.body,color:o.DesignToken.Color.content.primary,backgroundColor:o.DesignToken.Color.background.tertiary,borderRadius:o.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:o.DesignToken.Height["3xl"],maxWidth:"unset"}}},$={v1:{...R,...z,...I,...F,...H},v2:{...S,...j,...O,...q,...H}};function L(){if(rn)return ro;rn=1;var r=u();return ro=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(r){}}()}function M(){if(ri)return rt;ri=1;var r=L();return rt=function(e,o,n){"__proto__"==o&&r?r(e,o,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[o]=n}}function U(){if(ru)return ra;ru=1;var r=M(),e=s();return ra=function(o,n,t){(void 0===t||e(o[n],t))&&(void 0!==t||n in o)||r(o,n,t)}}var E,V,K,N,Q,Z,G,J,X,Y,rr,re,ro,rn,rt,ri,ra,ru,rs,rd,rc,rl,rg,rf,rp,rh,rb,ry,rx,rk,rC,rT,rv,rm,rD,rR,rS,rW,rw,rz,rj,r_,rA,rI,rO,rP,rB,rF,rq,rH,r$,rL,rM,rU,rE,rV,rK,rN,rQ,rZ,rG,rJ,rX,rY,r0,r1,r2,r3,r5,r6,r4,r7,r8,r9,er,ee,eo,en,et,ei,ea,eu,es,ed,ec,el,eg,ef,ep,eh,eb,ey,ex,ek,eC,eT,ev,em,eD,eR,eS,eW,ew,ez,ej,e_,eA,eI,eO,eP={exports:{}};eP.exports;function eB(){return rD?rm:(rD=1,rm=function(r,e){return function(o){return r(e(o))}})}function eF(){return rS?rR:(rS=1,rR=eB()(Object.getPrototypeOf,Object))}function eq(){if(rw)return rW;rw=1;var r=Object.prototype;return rW=function(e){var o=e&&e.constructor;return e===("function"==typeof o&&o.prototype||r)}}function eH(){if(rO)return rI;rO=1;var r=function(){if(rA)return r_;rA=1;var r=l(),e=g();return r_=function(o){return e(o)&&"[object Arguments]"==r(o)}}(),e=g(),o=Object.prototype,n=o.hasOwnProperty,t=o.propertyIsEnumerable;return rI=r(function(){return arguments}())?r:function(r){return e(r)&&n.call(r,"callee")&&!t.call(r,"callee")}}function e$(){return rB?rP:(rB=1,rP=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=0x1fffffffffffff})}function eL(){if(rq)return rF;rq=1;var r=f(),e=e$();return rF=function(o){return null!=o&&e(o.length)&&!r(o)}}var eM={exports:{}};function eU(){var r,e,o,n,t,i,a,u;if(rU)return eM.exports;return rU=1,r=eM,e=eM.exports,o=d(),n=rM?rL:(rM=1,rL=function(){return!1}),u=(a=(i=(t=e&&!e.nodeType&&e)&&r&&!r.nodeType&&r)&&i.exports===t?o.Buffer:void 0)?a.isBuffer:void 0,r.exports=u||n,eM.exports}function eE(){if(rV)return rE;rV=1;var r=l(),e=eF(),o=g(),n=Object.prototype,t=Function.prototype.toString,i=n.hasOwnProperty,a=t.call(Object);return rE=function(n){if(!o(n)||"[object Object]"!=r(n))return!1;var u=e(n);if(null===u)return!0;var s=i.call(u,"constructor")&&u.constructor;return"function"==typeof s&&s instanceof s&&t.call(s)==a}}eM.exports;var eV={exports:{}};eV.exports;function eK(){if(rX)return rJ;rX=1;var r=function(){if(rN)return rK;rN=1;var r=l(),e=e$(),o=g(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,rK=function(t){return o(t)&&e(t.length)&&!!n[r(t)]}}(),e=rZ?rQ:(rZ=1,rQ=function(r){return function(e){return r(e)}}),o=function(){var r,e,o,n,t,i;if(rG)return eV.exports;return rG=1,r=eV,e=eV.exports,o=p(),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){}}(),eV.exports}(),n=o&&o.isTypedArray;return rJ=n?e(n):r}function eN(){return r0?rY:(r0=1,rY=function(r,e){if("constructor"!==e||"function"!=typeof r[e]){if("__proto__"!=e)return r[e]}})}function eQ(){if(r5)return r3;r5=1;var r=function(){if(r2)return r1;r2=1;var r=M(),e=s(),o=Object.prototype.hasOwnProperty;return r1=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=M();return r3=function(o,n,t,i){var a=!t;t||(t={});for(var u=-1,s=n.length;++u<s;){var d=n[u],c=i?i(t[d],o[d],d,t,o):void 0;void 0===c&&(c=o[d]),a?e(t,d,c):r(t,d,c)}return t}}function eZ(){if(r8)return r7;r8=1;var r=/^(?:0|[1-9]\d*)$/;return r7=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 eG(){if(er)return r9;er=1;var r=r4?r6:(r4=1,r6=function(r,e){for(var o=-1,n=Array(r);++o<r;)n[o]=e(o);return n}),e=eH(),o=h(),n=eU(),t=eZ(),i=eK(),a=Object.prototype.hasOwnProperty;return r9=function(u,s){var d=o(u),c=!d&&e(u),l=!d&&!c&&n(u),g=!d&&!c&&!l&&i(u),f=d||c||l||g,p=f?r(u.length,String):[],h=p.length;for(var b in u)(s||a.call(u,b))&&!(f&&("length"==b||l&&("offset"==b||"parent"==b)||g&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||t(b,h)))&&p.push(b);return p}}function eJ(){if(ea)return ei;ea=1;var r=eG(),e=function(){if(et)return en;et=1;var r=c(),e=eq(),o=eo?ee:(eo=1,ee=function(r){var e=[];if(null!=r)for(var o in Object(r))e.push(o);return e}),n=Object.prototype.hasOwnProperty;return en=function(t){if(!r(t))return o(t);var i=e(t),a=[];for(var u in t)"constructor"==u&&(i||!n.call(t,u))||a.push(u);return a}}(),o=eL();return ei=function(n){return o(n)?r(n,!0):e(n)}}function eX(){return ep?ef:(ep=1,ef=function(r){return r})}function eY(){return eb?eh:(eb=1,eh=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 e0(){if(ew)return eW;ew=1;var r=eX(),e=function(){if(ex)return ey;ex=1;var r=eY(),e=Math.max;return ey=function(o,n,t){return n=e(void 0===n?o.length-1:n,0),function(){for(var i=arguments,a=-1,u=e(i.length-n,0),s=Array(u);++a<u;)s[a]=i[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=i[a];return d[n]=t(s),r(o,this,d)}}}(),o=function(){if(eS)return eR;eS=1;var r=function(){if(ev)return eT;ev=1;var r=eC?ek:(eC=1,ek=function(r){return function(){return r}}),e=L(),o=eX();return eT=e?function(o,n){return e(o,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:o}();return eR=(function(){if(eD)return em;eD=1;var r=Date.now;return em=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 eW=function(n,t){return o(e(n,t,r),n+"")}}function e1(){if(ej)return ez;ej=1;var r=s(),e=eL(),o=eZ(),n=c();return ez=function(t,i,a){if(!n(a))return!1;var u=typeof i;return("number"==u?!!(e(a)&&o(i,a.length)):"string"==u&&i in a)&&r(a[i],t)}}function e2(){if(eA)return e_;eA=1;var r=e0(),e=e1();return e_=function(o){return r(function(r,n){var t=-1,i=n.length,a=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(a=o.length>3&&"function"==typeof a?(i--,a):void 0,u&&e(n[0],n[1],u)&&(a=i<3?void 0:a,i=1),r=Object(r);++t<i;){var s=n[t];s&&o(r,s,t,a)}return r})}}var e3=b(function(){if(eO)return eI;eO=1;var r=function(){if(eg)return el;eg=1;var r=function(){if(re)return rr;re=1;var r=t(),e=function(){if(V)return E;V=1;var r=t();return E=function(){this.__data__=new r,this.size=0}}(),o=N?K:(N=1,K=function(r){var e=this.__data__,o=e.delete(r);return this.size=e.size,o}),n=Z?Q:(Z=1,Q=function(r){return this.__data__.get(r)}),u=J?G:(J=1,G=function(r){return this.__data__.has(r)}),s=function(){if(Y)return X;Y=1;var r=t(),e=i(),o=a();return X=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=u,d.prototype.set=s,rr=d}(),e=U(),o=rl?rc:(rl=1,rc=(rd?rs:(rd=1,rs=function(r){return function(e,o,n){for(var t=-1,i=Object(e),a=n(e),u=a.length;u--;){var s=a[r?u:++t];if(!1===o(i[s],s,i))break}return e}}))()),n=function(){if(ec)return ed;ec=1;var r=U(),e=function(){var r,e,o,n,t,i,a;if(rg)return eP.exports;return rg=1,r=eP,e=eP.exports,o=d(),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},eP.exports}(),o=function(){if(rx)return ry;rx=1;var r=function(){if(rb)return rh;rb=1;var r=rp?rf:(rp=1,rf=d().Uint8Array);return rh=function(e){var o=new e.constructor(e.byteLength);return new r(o).set(new r(e)),o}}();return ry=function(e,o){var n=o?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}(),n=rC?rk:(rC=1,rk=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(rj)return rz;rj=1;var r=function(){if(rv)return rT;rv=1;var r=c(),e=Object.create;return rT=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=eF(),o=eq();return rz=function(n){return"function"!=typeof n.constructor||o(n)?{}:r(e(n))}}(),i=eH(),a=h(),u=function(){if(r$)return rH;r$=1;var r=eL(),e=g();return rH=function(o){return e(o)&&r(o)}}(),s=eU(),l=f(),p=c(),b=eE(),y=eK(),x=eN(),k=function(){if(es)return eu;es=1;var r=eQ(),e=eJ();return eu=function(o){return r(o,e(o))}}();return ed=function(d,c,g,f,h,C,T){var v=x(d,g),m=x(c,g),D=T.get(m);if(D)return void r(d,g,D);var R=C?C(v,m,g+"",d,c,T):void 0,S=void 0===R;if(S){var W=a(m),w=!W&&s(m),z=!W&&!w&&y(m);R=m,W||w||z?a(v)?R=v:u(v)?R=n(v):w?(S=!1,R=e(m,!0)):z?(S=!1,R=o(m,!0)):R=[]:b(m)||i(m)?(R=v,i(v)?R=k(v):(!p(v)||l(v))&&(R=t(m))):S=!1}S&&(T.set(m,R),h(R,m,f,C,T),T.delete(m)),r(d,g,R)}}(),u=c(),s=eJ(),l=eN();return el=function t(i,a,d,c,g){i!==a&&o(a,function(o,s){if(g||(g=new r),u(o))n(i,a,s,d,t,c,g);else{var f=c?c(l(i,s),o,s+"",i,a,g):void 0;void 0===f&&(f=o),e(i,s,f)}},s)}}();return eI=e2()(function(e,o,n){r(e,o,n)})}());let e5=r=>{let{customTheme:o,clientSettings:n,themeVersion:t,uiSettings:i,defaultThemes:a=$}=r,u=y.getWebSetting(n,"data.settings.sdk_settings.ui_custom_settings");return e.useMemo(()=>{let r=x.selectUiSettings(i,u);return{...e3({},x.mapUISettingsToCustomTheme(r),o),themeVersion:t,defaultThemes:a}},[o,a,t,i,u])},e6=()=>{},e4=e.createContext({onDoneCallback:e6,onErrorCallback:e6,onCloseCallback:e6}),e7=({children:o,onDone:n=e6,onError:t=e6,onClose:i=e6})=>{let a=e.useCallback(r=>{n&&n(r)},[n]),u=e.useCallback(r=>{t&&t(r)},[t]),s=e.useCallback(()=>{i&&i()},[i]),d=e.useMemo(()=>({onDoneCallback:a,onErrorCallback:u,onCloseCallback:s}),[a,u,s]);return r.jsx(e4.Provider,{value:d,children:o})},e8=()=>{let r=e.useContext(e4);if(void 0===r)throw Error("useSDKCallback must be used within a SDKCallbackProvider");return r},e9=e.createContext(""),or=({children:e,isWrappedBy:o=""})=>r.jsx(e9.Provider,{value:o,children:e}),oe=()=>e.useContext(e9);export{C as D,e7 as S,or as W,D as a,T as b,oe as c,$ as d,e5 as e,e2 as f,eJ as g,eE as h,e0 as i,eY as j,eB as k,eq as l,e3 as m,eG as n,eL as o,e1 as p,eQ as r,v as t,e8 as u};