@sekyro/elements 0.1.0-rc.24 → 0.1.0-rc.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cdn/chunks/{capture-session-doc-BGLEMR2J-LN5RQDCK.js → capture-session-doc-56O6IQ3D-FTWOAELH.js} +1 -1
- package/dist/cdn/chunks/challenge-frame-LWDSKM5K-J3CNO3XT.js +1 -0
- package/dist/cdn/chunks/{chunk-MXKAKHUA.js → chunk-23W5VB46.js} +1 -1
- package/dist/cdn/chunks/{chunk-YFZ54VRE.js → chunk-34QKBDWM.js} +1 -1
- package/dist/cdn/chunks/{chunk-VHJIEZ5D.js → chunk-43I6I3SU.js} +1 -1
- package/dist/cdn/chunks/{chunk-SGAGSEY4.js → chunk-4EWD6VW3.js} +1 -1
- package/dist/cdn/chunks/{chunk-ICGDGBER.js → chunk-4VFGV3VA.js} +1 -1
- package/dist/cdn/chunks/{chunk-IX5EXDOC.js → chunk-53PI7QVO.js} +1 -1
- package/dist/cdn/chunks/chunk-5ZUDZLHN.js +1 -0
- package/dist/cdn/chunks/chunk-AXCBMN2S.js +33 -0
- package/dist/cdn/chunks/{chunk-SX373VNU.js → chunk-B5QW2GSC.js} +1 -1
- package/dist/cdn/chunks/{chunk-X7U4LD32.js → chunk-E7S6A26U.js} +1 -1
- package/dist/cdn/chunks/chunk-IHKI3APK.js +25 -0
- package/dist/cdn/chunks/{chunk-CCPSNJ26.js → chunk-PNQ5TDY5.js} +1 -1
- package/dist/cdn/chunks/{chunk-BE4SRRNK.js → chunk-PPERVFSD.js} +1 -1
- package/dist/cdn/chunks/{chunk-UJ2FDGWQ.js → chunk-SS7SVE6O.js} +1 -1
- package/dist/cdn/chunks/{chunk-L2FCXJYM.js → chunk-UALTP6H4.js} +1 -1
- package/dist/cdn/chunks/chunk-VD2BADU2.js +1 -0
- package/dist/cdn/chunks/chunk-VQSFTT4B.js +3 -0
- package/dist/cdn/chunks/{chunk-H4EO527J.js → chunk-W5QMFEZY.js} +1 -1
- package/dist/cdn/chunks/chunk-XYXBZEKH.js +1 -0
- package/dist/cdn/chunks/{chunk-TD2XP34G.js → chunk-YR7GTH7M.js} +1 -1
- package/dist/cdn/chunks/{chunk-6JA64VAB.js → chunk-YWAPDHEW.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-KATGPNCR-KPF7ZYWX.js → create-document-capture-TTMHZP7R-YI3GL7MF.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-PTB5A72I-LW2M5LK2.js → document-capture-view-5EYETVEI-UMC6FOKY.js} +1 -1
- package/dist/cdn/chunks/{eid-view-B2M6AJ3J-ASEHPZBH.js → eid-view-INQTMVDU-FRHHODOC.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-FLSDWKJU-TQOH44CO.js → email-otp-view-OO535PQT-6N2IPXEG.js} +1 -1
- package/dist/cdn/chunks/flow-views-EW2KEEFU-7LTB52QC.js +1 -0
- package/dist/cdn/chunks/{form-view-26PNMO6Q-DNIJNLLU.js → form-view-LJLYP54G-N2BB5ZXR.js} +1 -1
- package/dist/cdn/chunks/overlay-de-VGC75M5R-ZUC7ZPRY.js +1 -0
- package/dist/cdn/chunks/overlay-es-CSXBWVAG-IQMHKRYH.js +1 -0
- package/dist/cdn/chunks/overlay-pt-RGTYSSOJ-EH2IJ6QI.js +1 -0
- package/dist/cdn/chunks/plan-runner-FW3EAJCC-H4N5NEL4.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-IFT7B4OG-EYDBLNTC.js → portrait-capture-view-N36CKIFR-JIO6P6XN.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-BISWT5BQ-YJ6TLEKW.js → portrait-review-view-OG23OEMA-E4JD5Q5S.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-UXF6OH5N-6HTCJNXW.js → proof-of-address-view-CHM5JRHI-PUHZCNXH.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-VK6DRWZL.js → chunk-2PJRIGH2.js} +1 -1
- package/dist/{chunk-L5QAOX6C.js → chunk-2QEYDBI7.js} +1 -1
- package/dist/{chunk-DEVOHXNC.js → chunk-FFRJKCZK.js} +1 -1
- package/dist/chunk-GDADEN5C.js +33 -0
- package/dist/{chunk-73G4CDPH.js → chunk-JAEOFYLJ.js} +1 -1
- package/dist/chunk-JW4QXADM.js +25 -0
- package/dist/{chunk-VWAWL2QM.js → chunk-KEN7JBVG.js} +1 -1
- package/dist/{chunk-YD6JLLO5.js → chunk-MLH4M6JP.js} +1 -1
- package/dist/chunk-NMUB5C2E.js +1 -0
- package/dist/{chunk-R7M4HNG5.js → chunk-OEZKZQC4.js} +1 -1
- package/dist/{chunk-W6RHH3ZZ.js → chunk-RAF7Z7I3.js} +1 -1
- package/dist/{chunk-TPO4FOFT.js → chunk-RJVZHRDP.js} +1 -1
- package/dist/{chunk-QLIY4W2U.js → chunk-RXILZ6JM.js} +1 -1
- package/dist/{chunk-2N6CQWVG.js → chunk-SD4A47RM.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-PTB5A72I-J2XPPS5A.js → document-capture-view-5EYETVEI-ZQ5RAN4Y.js} +1 -1
- package/dist/{eid-view-B2M6AJ3J-ASHVXRTP.js → eid-view-INQTMVDU-H7KHUN3L.js} +1 -1
- package/dist/{email-otp-view-FLSDWKJU-3KB6CCWB.js → email-otp-view-OO535PQT-6EYUU43N.js} +1 -1
- package/dist/flow-views-EW2KEEFU-H7LOLIEJ.js +1 -0
- package/dist/{form-view-26PNMO6Q-6W54V6CN.js → form-view-LJLYP54G-OUW66I62.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -1
- package/dist/overlay-de-VGC75M5R-C6XYWRT5.js +1 -0
- package/dist/overlay-es-CSXBWVAG-MSMVW5KX.js +1 -0
- package/dist/overlay-pt-RGTYSSOJ-QA5FJP3U.js +1 -0
- package/dist/{portrait-capture-view-IFT7B4OG-RA2APHRL.js → portrait-capture-view-N36CKIFR-S2H37PI5.js} +1 -1
- package/dist/{portrait-review-view-BISWT5BQ-HV4F6WC7.js → portrait-review-view-OG23OEMA-MO3FN432.js} +1 -1
- package/dist/{proof-of-address-view-UXF6OH5N-4HTOLYIT.js → proof-of-address-view-CHM5JRHI-U6ARAGX7.js} +1 -1
- package/dist/styles.css +14 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/challenge-frame-3JHCNDHE-IYU6HGYD.js +0 -1
- package/dist/cdn/chunks/chunk-75QP4SUF.js +0 -1
- package/dist/cdn/chunks/chunk-EAHT3Y3Z.js +0 -1
- package/dist/cdn/chunks/chunk-HBIVE2ZZ.js +0 -33
- package/dist/cdn/chunks/chunk-HPTAAPIB.js +0 -1
- package/dist/cdn/chunks/chunk-QVU5SNFG.js +0 -25
- package/dist/cdn/chunks/chunk-XXYPLLFI.js +0 -3
- package/dist/cdn/chunks/flow-views-UZRN6BIU-HPYJIEOF.js +0 -1
- package/dist/cdn/chunks/overlay-de-TP7ROFVF-5EEFWZ4E.js +0 -1
- package/dist/cdn/chunks/overlay-es-LLTS3D6J-U2DPYDC2.js +0 -1
- package/dist/cdn/chunks/overlay-pt-UUJUOJNJ-E57Q5MWT.js +0 -1
- package/dist/cdn/chunks/plan-runner-XGT4VKVF-NDQH73OS.js +0 -1
- package/dist/chunk-CO3QPDWV.js +0 -25
- package/dist/chunk-NEP66INV.js +0 -33
- package/dist/chunk-S5CM7A4T.js +0 -1
- package/dist/flow-views-UZRN6BIU-SEDEA5AH.js +0 -1
- package/dist/overlay-de-TP7ROFVF-5EB3LXPD.js +0 -1
- package/dist/overlay-es-LLTS3D6J-4M7PVHUX.js +0 -1
- package/dist/overlay-pt-UUJUOJNJ-LDRAURGT.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as H}from"./chunk-2N6CQWVG.js";import{a as T,b as C,c as D}from"./chunk-CO3QPDWV.js";import{a as s,b as L,c as N,i as u}from"./chunk-SSU37LFQ.js";var V=L(l=>{"use strict";var Q=T();function I(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(I,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(I(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(I(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var B=L((de,U)=>{"use strict";function j(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(j)}catch(r){console.error(r)}}s(j,"checkDCE");j(),U.exports=V()});var W=N(T(),1),f=N(C(),1),a=N(C(),1),E=N(T(),1),Z=N(B(),1),v=N(C(),1);import{screenRampColourValue as Y}from"@sekyro/web";var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function z(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(z,"T");u(z,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function F({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:z(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(F,"x");u(F,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=H(),R=i==="checking",_=R||i==="frozen",A=_&&m?b("capture.checking"):e,w=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(F,{progress:o,phase:i,draining:y}),S?.(r),w!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:w}):null,x!==null&&!_?(0,a.jsx)(G,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,R&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(K,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function G({view:r,className:e,kind:t}){let n=(0,W.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)($,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(D,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s(G,"H");u(G,"ModeSwitchChip");function $(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s($,"D");u($,"FlipCameraIcon");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(K,"G");u(K,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,P="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(P);return n.setAttribute(P,""),o||e.push(()=>n.removeAttribute(P)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:Y(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:Y(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{B as a,ne as b,G as c,oe as d};
|
|
1
|
+
import{d as H}from"./chunk-SD4A47RM.js";import{a as T,b as C,c as D}from"./chunk-JW4QXADM.js";import{a as s,b as L,c as N,i as u}from"./chunk-SSU37LFQ.js";var V=L(l=>{"use strict";var Q=T();function I(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(I,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(I(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(I(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var B=L((de,U)=>{"use strict";function j(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(j)}catch(r){console.error(r)}}s(j,"checkDCE");j(),U.exports=V()});var W=N(T(),1),f=N(C(),1),a=N(C(),1),E=N(T(),1),Z=N(B(),1),v=N(C(),1);import{screenRampColourValue as Y}from"@sekyro/web";var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function z(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(z,"T");u(z,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function F({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:z(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(F,"x");u(F,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=H(),R=i==="checking",_=R||i==="frozen",A=_&&m?b("capture.checking"):e,w=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(F,{progress:o,phase:i,draining:y}),S?.(r),w!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:w}):null,x!==null&&!_?(0,a.jsx)(G,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,R&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(K,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function G({view:r,className:e,kind:t}){let n=(0,W.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)($,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(D,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s(G,"H");u(G,"ModeSwitchChip");function $(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s($,"D");u($,"FlipCameraIcon");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(K,"G");u(K,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,P="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(P);return n.setAttribute(P,""),o||e.push(()=>n.removeAttribute(P)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:Y(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:Y(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{B as a,ne as b,G as c,oe as d};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
react-dom/cjs/react-dom.production.js:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-JW4QXADM.js";import{a as i,c as r,i as t}from"./chunk-SSU37LFQ.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-2QEYDBI7.js";import{K as b,a as k,b as y,c as x}from"./chunk-JW4QXADM.js";import{a as c,c as f,i as n}from"./chunk-SSU37LFQ.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-EW2KEEFU-H7LOLIEJ.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var B=(0,l.createContext)(void 0);function H({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(B),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(H,"K");n(H,"PhoneHandoff");export{j as a,S as b,B as c,H as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as hr,d as fr}from"./chunk-R7M4HNG5.js";import{b as kr,c as bt}from"./chunk-W6RHH3ZZ.js";import{a as br}from"./chunk-XXCBLQ53.js";import{c as Ct}from"./chunk-S5CM7A4T.js";import{a as ur,b as dr,c as pr,d as Ae}from"./chunk-2N6CQWVG.js";import{G as yr,L as gr,M as vr,a as K,b as de,c as te,m as lr,n as Je,p as or,q as et,r as ir,s as cr,t as kt,u as oe,v as Le,w as tt,y as mr}from"./chunk-CO3QPDWV.js";import{a as l,c as U,i as s}from"./chunk-SSU37LFQ.js";var _r=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),D=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Gr=U(K(),1),X=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),B=U(de(),1),it=U(K(),1),pe=U(K(),1),Q=U(K(),1),L=U(K(),1),me=U(K(),1),Te=U(K(),1),Rt=U(de(),1),v=U(de(),1);import{subscribeCameraPermission as Tn}from"@sekyro/web";import{getLivenessAssetsStatus as Pn,preloadLivenessAssets as Bn,subscribeLivenessAssets as On}from"@sekyro/web";import{createLivenessCapture as Vn}from"@sekyro/web";function ce({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ce,"ne");s(ce,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function wr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(wr,"ln");s(wr,"SunIcon");function Sr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Sr,"un");s(Sr,"FaceUncoveredIcon");function xr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(xr,"dn");s(xr,"PhoneEyeLevelIcon");function Nr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Nr,"pn");s(Nr,"LookStraightIcon");function Rr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Rr,"fn");s(Rr,"CameraCheckIcon");function Mr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(Mr,"mn");s(Mr,"CameraAskIcon");function Ar(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Ar,"yn");s(Ar,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Lr(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Lr,"gn");s(Lr,"CheckIcon");function Er(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Er,"hn");s(Er,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Nn={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(wr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Sr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(xr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Nr,{}),"icon")}};function Ir({tips:e}){let t=Ae(),n=(0,_r.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Nn[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(Ir,"Cn");s(Ir,"TipList");var Rn=220;function Ur({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=kt(),[j,R]=(0,ye.useState)(null),O=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{O.current!==null&&clearTimeout(O.current)},[]);let q=s(M=>{r||j!==null||(R(M),O.current=setTimeout(()=>{O.current=null,R(null),p(M)},Rn))},"choose");return(0,D.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,D.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,D.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,D.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,D.jsx)(oe,{tone:"danger",children:(0,D.jsx)("span",{children:a})}):null,d==="buttons"?(0,D.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((M,J)=>(0,D.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(M.id),"onClick"),children:M.label},M.id))}):(0,D.jsx)("div",{className:"sekyro-choices",children:n.map(M=>(0,D.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===M.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==M.id,onClick:l(()=>q(M.id),"onClick"),children:[M.glyph!==void 0?(0,D.jsx)("span",{className:"sekyro-card__tile",children:M.glyph}):null,(0,D.jsxs)("span",{className:"sekyro-card__body",children:[(0,D.jsx)("span",{className:"sekyro-card__title",children:M.label}),M.sub!==void 0?(0,D.jsx)("span",{className:"sekyro-card__sub",children:M.sub}):null]}),(0,D.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},M.id))})]})}l(Ur,"bn");s(Ur,"ChoiceScreen");var jr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&jr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Mn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Mn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(je,"resolveClip");var An="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Ln={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(ie,"re");s(ie,"synth");function Tr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Tr,"Lr");s(Tr,"speechAvailable");function wt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(wt,"Sn");s(wt,"baseLang");function At(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=wt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>wt(a.lang)===r)}l(At,"Mn");s(At,"pickVoice");function Pr(e){if(!Tr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||At(t,e)!==void 0}l(Pr,"wn");s(Pr,"speechUsable");function Br(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Br,"Ln");s(Br,"subscribeVoices");function $e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}l($e,"Ke");s($e,"clipIdentity");function St(e){e.pause(),e.removeAttribute("src"),e.load()}l(St,"Rn");s(St,"release");function Or(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),O=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let A=At(S,x);if(S.length===0||A!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,A!==void 0&&(I.voice=A),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=$=>{k!==void 0&&$.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),M=s(h=>{for(let x of h){let _=$e(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),A=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let $=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then($,T=>{if($(),!u())return;let P=T?.name;if(P!=="AbortError"){if(P==="NotAllowedError")return A();h.speech?O(h.text,h.lang,_,A):_?.()}});return}h.speech?O(h.text,h.lang,_,A):_?.()},"start");return{say(h){let x=h.url!==null?$e(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&J(u.utterance,u.generation,u.end);let A=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(An),P=>P.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=A.paused===!1&&t!==null&&A.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(A.muted=!0,A.onended=null,A.src=t,A.play()?.catch(()=>{}));let $=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&$!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,$.speak(T)}M(_??[])},prefetch:M,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&St(e),e=null;for(let h of p.values())St(h);p.clear()}}}l(Or,"_n");s(Or,"createVoicePlayer");var En="sekyro.voiceGuidance";function qr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}l(qr,"xn");s(qr,"readVoicePreference");function Vr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Vr,"En");s(Vr,"writeVoicePreference");var Ve="capture.tips.summary",In=typeof window<"u"?C.useLayoutEffect:C.useEffect,Un=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of jr){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function $r({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?En:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,O]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[M,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Or()),h.current),[]),_=Ln[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),A=a.clips??t??Un,I=(0,C.useRef)(!1),$=(0,C.useRef)(A);In(()=>{$.current=A,S.current=c}),(0,C.useEffect)(()=>{if(r||o===null)return;let E=qr(o);E!==null&&(S.current=E,d(E))},[r,o]),(0,C.useEffect)(()=>{if(!(r||!u))return Br(()=>J(E=>E+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let E=u&&Pr(_);w(rt(A,e).length>0||E),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(A,Ve,e)!==null||E?"default":"none")},[r,A,i,e,u,_,M]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let E=rt(A,e);E.length>0&&x().prefetch(E)},[r,c,A,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(E=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...E?{prefetch:rt($.current,e)}:{}}))},[r,x,_,u,e]),P=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,O(!1)},[]),F=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&F()},[F]),he=(0,C.useCallback)((E,xe)=>{if(r)return;if(q.current){F();return}let ve=x();ve.stop(),q.current=!0,O(!0);let V=xe?.clip===!1?null:je($.current,Ve,e);ve.say({url:V,text:E,lang:_,speech:u,onEnd:z})},[r,F,x,e,_,u,z]),Y=(0,C.useCallback)(E=>{r||(E?T(!0):F(),o!==null&&Vr(o,E),S.current=E,d(E))},[r,T,F,o]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((E,xe)=>{if(r||!c)return;q.current&&z();let ve=je($.current,E,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:P,speakKey:ne,stop:F,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,P,ne,F,N,R,he,ge])}l($r,"vt");s($r,"useVoiceGuidance");function Fr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(Fr,"Ct");s(Fr,"useSpeakGuidance");function lt(e,t){let n=Dr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(lt,"Pn");s(lt,"retryCoachingOf");function Dr(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}l(Dr,"Pr");s(Dr,"coachingOfReason");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Hr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Ae(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(Fe[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:Fe[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Hr,"Tn");s(Hr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}l(Lt,"nt");s(Lt,"isDevBuild");var jn=(0,Gr.createContext)(null);function Kr({state:e}){let t=Ae(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Rr,{}):e==="denied"?(0,we.jsx)(Ar,{}):(0,we.jsx)(Mr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Kr,"On");s(Kr,"PermissionRow");function Zr({voice:e}){let t=Ae();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Lr,{className:"sekyro-switch__check"}):null})})]})}l(Zr,"Hn");s(Zr,"VoiceSwitch");function zr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Ae(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),O=(0,X.useRef)(null),q=(0,X.useRef)(e),M=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let A=M.current;e!=="loading"&&(M.current=!1),Yr(j.current)&&(e==="failed"?O.current?.focus():A&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{M.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,B.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,B.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,B.jsx)(te,{kind:"ghost",ref:O,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,B.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,B.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Er,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,B.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,B.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,B.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,B.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,B.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,B.jsx)(Ir,{tips:o}):null,c!==void 0?(0,B.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,B.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,B.jsx)(Kr,{state:n}),(0,B.jsx)(Zr,{voice:a}),(0,B.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,B.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(zr,"Fn");s(zr,"PreCaptureScreen");function Yr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(Yr,"Hr");s(Yr,"focusIsOurs");function Wr(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>Tn(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(Wr,"Dn");s(Wr,"useCameraStatus");function Qr(e){return Et(e,"mobileRequired")}l(Qr,"qn");s(Qr,"useMobileRequired");function Xr(e){return Et(e,"returning").required}l(Xr,"jn");s(Xr,"useReturning");function Et(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(Et,"Yn");s(Et,"useFlag");function Jr(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(Jr,"$n");s(Jr,"useCaptureMode");function en(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(en,"zn");s(en,"useBusy");var qn=s(()=>"idle","serverSnapshot");function xt(e){return Bn(e!==void 0?{assetBaseUrl:e}:{})}l(xt,"Qn");s(xt,"preload");function tn(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>On(p,e),[e]),()=>Pn(e),qn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{xt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{xt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(tn,"Jn");s(tn,"useLivenessAssets");var Cr={progress:0,hint:null,faceDetected:!1};function rn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,L.useRef)(e.verification).current,a=(0,L.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,L.useRef)(null),[c,d]=(0,L.useState)("idle"),[S,p]=(0,L.useState)(Cr),[w,N]=(0,L.useState)(!1),[j,R]=(0,L.useState)(!1),[O,q]=(0,L.useState)(null),[M,J]=(0,L.useState)(!1),[h,x]=(0,L.useState)(null),[_,k]=(0,L.useState)(null),[u,A]=(0,L.useState)(null),[I,$]=(0,L.useState)(null),[i,T]=(0,L.useState)(null),[P,z]=(0,L.useState)(!1),F=(0,L.useRef)(null),ge=(0,L.useRef)("idle"),he=(0,L.useRef)(-1),[Y,W]=(0,L.useState)(0),ne=(0,L.useRef)(e);ne.current=e,(0,L.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ue):Vn(ue);o.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let De=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),A(null),p(Cr),R(!1),N(!1),q(null),x(null),F.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),F.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=F.current;F.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>J(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),$(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{A(b);let ke=r?.reportCaptureIssue;ke!==void 0&&bt(Ee=>ke.call(r,Ee),kr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{$(b),ne.current.onResult?.(b)})];return()=>{for(let b of De)b?.();o.current=null,H.destroy()}},[r,t,n]);let E=(0,L.useCallback)(()=>{o.current?.start()},[]),xe=(0,L.useCallback)(()=>{o.current?.retry()},[]),ve=(0,L.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,L.useCallback)(async ee=>{let ue=o.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let H=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ue.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:O,reduceMotion:M,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:E,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:P,attempt:Y}}l(rn,"er");s(rn,"useLivenessHandle");var $n=new Set(["national_number"]);function Nt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>$n.has(n));return t.length>0?{...e,options:t}:null}l(Nt,"tr");s(Nt,"pending");function nn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(O=>{N&&n(Nt(O))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",O=>n(Nt(O)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(nn,"nr");s(nn,"useMethodChoice");var Fn=["ar","fr","en"];function sn(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}l(sn,"io");s(sn,"isClipUrl");function an(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Fn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!sn(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(an,"ao");s(an,"toVoiceClipMap");function ln(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?an(t):null,[t]);return e===void 0?null:r}l(ln,"rr");s(ln,"useServerVoiceClips");function on({voice:e}){let t=Ae();return(0,Rt.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Rt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(on,"sr");s(on,"VoiceChip");var Dn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function cn(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}l(cn,"mo");s(cn,"isDefaultTips");function un(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}l(un,"yo");s(un,"carriesActivation");function dn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(dn,"go");s(dn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function pn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(pn,"vo");s(pn,"isCapturing");function hn(e){return e==="captured"||e==="uploading"||e==="checking"}l(hn,"Co");s(hn,"isPostCapture");function Zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:O,onResult:q,onError:M,onStateChange:J,assetBaseUrl:h,className:x}){let _=dr(t),k=(0,m.useMemo)(()=>ur(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),A=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),$=(0,m.useContext)(jn),i=rn({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:O,onResult:q,onError:M,onStateChange:J}),T=tn(h,i.state==="idle"&&i.error===null),P=nn(e),z=P.choice!==null,F=Qr(e),ge=Xr(e),he=en(e),Y=Wr(),W=Jr(e),ne=W.session==="choice",E=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=ln(xe?e:void 0),V=$r({locale:t,defaultClips:ve,options:j}),ee=E?"environment":"user",ue=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),De=(0,m.useRef)(V.unlock);De.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let le=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of le)g.removeEventListener(qe,Me,!0)},"disarm");function Me(qe){if(Ne.current){_e();return}un(qe)&&(Ne.current=!0,_e(),De.current())}l(Me,"Re"),s(Me,"onGesture");for(let qe of le)g.addEventListener(qe,Me,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Ee=(0,m.useRef)(!1),Pe=i.state==="idle"&&i.error===null,Ut=!z&&!F.required&&(o===!0||o==="when-permitted"&&Y.permission==="granted"),jt=Ut&&P.settled&&F.settled&&ue,yn=o==="when-permitted"&&!Y.permissionSettled&&!Ee.current,Tt=Ut&&Pe&&!Ee.current,ut=(yn||Tt||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!jt||!Pe||T.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[jt,Pe,T.gate,ke]);let gn=Pe&&!z&&!F.required&&!(Tt&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:Ot,setCaptureMode:qt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return Ot().then(le=>{g&&Bt(le)}),()=>{g=!1}},[W.settled,ne,Ot]);let{choose:Vt}=W,Ie=E?"self":"assisted",vn=(0,m.useCallback)(async()=>{await qt(Ie)&&Vt(Ie)},[qt,Vt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=pn(i.state),be=hn(i.state),Ge=Z||be,se=i.result,Dt=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=$!==null,Ht=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{vn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Be=be||dt,Gt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":lr(Ye),[kn,Kt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Kt(We);return}if(!Z)return;let g=setTimeout(()=>Kt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",Zt=E&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:kn:null,ht=pt?N:Re===null?"":u(Re);Fr(V,Re,ht,Z);let zt=(0,m.useRef)(R);zt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{zt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Oe=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Yt=ft!==void 0,Wt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Yt||!Wt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Yt,Wt]);let bn=ft!==void 0?(g,le,_e)=>ft(g,le,_e,Oe):V.supported?()=>(0,v.jsx)(on,{voice:Oe}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:Jt,stopSummary:er}=V,Qe=w!==void 0&&w!=="",tr=Qe?w:u("capture.tips.summary"),rr=Qe?mt!=="none":mt==="partner"||mt==="default"&&cn(p),Cn=(0,m.useMemo)(()=>rr?{playing:Xt,toggle:s(()=>Jt(tr,{clip:!Qe}),"toggle"),stop:er}:void 0,[rr,Xt,Jt,tr,er,Qe]),_n=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Oe}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Oe]),wn=dn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Dt&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Dt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,le)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Me=ir(t,le);if(Me!==null)return u(Me.key).replace("{time}",Me.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let le=g.retakeHint===void 0?null:Je(g.retakeHint);return le===null?yt(g.reasonCode):u(le)},"retryText"),nr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Dn.has(Ce.reason)?u("errors.session_expired"):null),Sn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,sr=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Xe)||bt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,sr)})},[G,Xe,sr,e]);let ar=kt(),xn=z&&P.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await P.select(g)&&i.state==="done"&&i.retry()},[P.select,i.state,i.retry]);return(0,m.useEffect)(()=>{P.auto!==null&&!P.busy&&!Z&&!be&&vt(P.auto)},[P.auto,P.busy,Z,be,vt]),(0,v.jsx)(pr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:A,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&>(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,F.required&&Pe?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(or(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Sn?(0,v.jsx)(te,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,nr!==null&&Ce!==null?(0,v.jsx)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:nr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?$({videoRef:I,guidance:Be&&Ue?u("capture.checking"):ht,coached:pt&&!(Be&&Ue),note:Be?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):Zt),settled:Be&&Ue,progress:i.gate.progress,phase:Gt,still:Be?Ft:null,live:Ge,modeSwitch:Ht,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(hr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Gt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:Zt,voicePrompt:bn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(fr,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Ht})}),xn&&P.choice!==null?(0,v.jsx)(Ur,{title:u("method.title"),description:u("method.description"),options:P.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:P.busy,error:P.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,gn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,wn,a?.intro!==void 0?a.intro(b,_n):(0,v.jsx)(zr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Oe,tips:p??_t,summary:Cn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Hr,{showCoaching:ae!==null,coaching:lt(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?cr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Zn,"Ei");s(Zn,"LivenessCapture");var It=U(K(),1),ct=U(K(),1),f=U(de(),1);import{isInAppBrowser as ts}from"@sekyro/web/client";var bs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},Cs={population_registry:"hashtag",national_eid:"key"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}l(zn,"D");s(zn,"identityLabel");function Yn(e,t){let[n,r]=(0,It.useState)(!1),[a,o]=(0,It.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(br(d,e.strings))),t?.(d)})},"run")}}l(Yn,"q");s(Yn,"useChoiceAction");function fn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(fn,"O");s(fn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Qn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}l(Qn,"ne");s(Qn,"faceIntroRetryOf");var Xn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Jn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=Ct(),{t:p}=S,w=d===void 0?"face":lt(d.reason,d.retakeHint),N=w==="face"?null:Fe[w].tips,j=(0,ct.useContext)(yr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(fn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(mn,{retry:d,title:Fe[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:Xn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(mr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Le,{name:"camera"}),p("capture.start")]})})]})}l(Jn,"re");s(Jn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function mn({retry:e,title:t}){let n=Ct(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(gr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(mn,"K");s(mn,"RetryNotice");function rs(e){return ts(e)}l(rs,"ce");s(rs,"isInAppBrowser");function ns(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(ns,"le");s(ns,"androidBrowserIntent");export{Ur as a,Lt as b,jn as c,Jr as d,Zn as e,bs as f,Cs as g,zn as h,Yn as i,Qn as j,Jn as k,rs as l,ns as m};
|
|
1
|
+
import{b as hr,d as fr}from"./chunk-OEZKZQC4.js";import{b as kr,c as bt}from"./chunk-RAF7Z7I3.js";import{a as br}from"./chunk-XXCBLQ53.js";import{c as Ct}from"./chunk-NMUB5C2E.js";import{a as ur,b as dr,c as pr,d as Ae}from"./chunk-SD4A47RM.js";import{F as yr,K as gr,L as vr,a as K,b as de,c as te,m as lr,n as Je,p as or,q as et,r as ir,s as cr,t as kt,u as oe,v as Le,w as tt,y as mr}from"./chunk-JW4QXADM.js";import{a as l,c as U,i as s}from"./chunk-SSU37LFQ.js";var _r=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),D=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Gr=U(K(),1),X=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),O=U(de(),1),it=U(K(),1),pe=U(K(),1),Q=U(K(),1),L=U(K(),1),me=U(K(),1),Te=U(K(),1),Rt=U(de(),1),v=U(de(),1);import{subscribeCameraPermission as Pn}from"@sekyro/web";import{getLivenessAssetsStatus as On,preloadLivenessAssets as Bn,subscribeLivenessAssets as qn}from"@sekyro/web";import{createLivenessCapture as $n}from"@sekyro/web";function ce({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ce,"ne");s(ce,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function wr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(wr,"ln");s(wr,"SunIcon");function Sr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Sr,"un");s(Sr,"FaceUncoveredIcon");function xr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(xr,"dn");s(xr,"PhoneEyeLevelIcon");function Nr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Nr,"pn");s(Nr,"LookStraightIcon");function Rr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Rr,"fn");s(Rr,"CameraCheckIcon");function Mr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(Mr,"mn");s(Mr,"CameraAskIcon");function Ar(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Ar,"yn");s(Ar,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Lr(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Lr,"gn");s(Lr,"CheckIcon");function Er(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Er,"hn");s(Er,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Rn={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(wr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Sr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(xr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Nr,{}),"icon")}};function Ir({tips:e}){let t=Ae(),n=(0,_r.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Rn[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(Ir,"Cn");s(Ir,"TipList");var Mn=220;function Ur({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=kt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(M=>{r||j!==null||(R(M),B.current=setTimeout(()=>{B.current=null,R(null),p(M)},Mn))},"choose");return(0,D.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,D.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,D.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,D.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,D.jsx)(oe,{tone:"danger",children:(0,D.jsx)("span",{children:a})}):null,d==="buttons"?(0,D.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((M,J)=>(0,D.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(M.id),"onClick"),children:M.label},M.id))}):(0,D.jsx)("div",{className:"sekyro-choices",children:n.map(M=>(0,D.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===M.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==M.id,onClick:l(()=>q(M.id),"onClick"),children:[M.glyph!==void 0?(0,D.jsx)("span",{className:"sekyro-card__tile",children:M.glyph}):null,(0,D.jsxs)("span",{className:"sekyro-card__body",children:[(0,D.jsx)("span",{className:"sekyro-card__title",children:M.label}),M.sub!==void 0?(0,D.jsx)("span",{className:"sekyro-card__sub",children:M.sub}):null]}),(0,D.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},M.id))})]})}l(Ur,"bn");s(Ur,"ChoiceScreen");var jr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&jr.includes(e)}l(st,"he");s(st,"isVoiceKey");var An=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&An(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(je,"resolveClip");var Ln="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",En={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(ie,"re");s(ie,"synth");function Tr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Tr,"Lr");s(Tr,"speechAvailable");function wt(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(wt,"Sn");s(wt,"baseLang");function At(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=wt(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>wt(a.lang)===r)}l(At,"Mn");s(At,"pickVoice");function Pr(e){if(!Tr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||At(t,e)!==void 0}l(Pr,"wn");s(Pr,"speechUsable");function Or(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Or,"Ln");s(Or,"subscribeVoices");function $e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}l($e,"Ke");s($e,"clipIdentity");function St(e){e.pause(),e.removeAttribute("src"),e.load()}l(St,"Rn");s(St,"release");function Br(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let A=At(S,x);if(S.length===0||A!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,A!==void 0&&(I.voice=A),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=$=>{k!==void 0&&$.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),M=s(h=>{for(let x of h){let _=$e(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),A=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let $=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then($,T=>{if($(),!u())return;let P=T?.name;if(P!=="AbortError"){if(P==="NotAllowedError")return A();h.speech?B(h.text,h.lang,_,A):_?.()}});return}h.speech?B(h.text,h.lang,_,A):_?.()},"start");return{say(h){let x=h.url!==null?$e(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&J(u.utterance,u.generation,u.end);let A=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(Ln),P=>P.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=A.paused===!1&&t!==null&&A.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(A.muted=!0,A.onended=null,A.src=t,A.play()?.catch(()=>{}));let $=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&$!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,$.speak(T)}M(_??[])},prefetch:M,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&St(e),e=null;for(let h of p.values())St(h);p.clear()}}}l(Br,"_n");s(Br,"createVoicePlayer");var In="sekyro.voiceGuidance";function qr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}l(qr,"xn");s(qr,"readVoicePreference");function Vr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Vr,"En");s(Vr,"writeVoicePreference");var Ve="capture.tips.summary",Un=typeof window<"u"?C.useLayoutEffect:C.useEffect,jn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of jr){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function $r({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?In:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[M,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Br()),h.current),[]),_=En[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),A=a.clips??t??jn,I=(0,C.useRef)(!1),$=(0,C.useRef)(A);Un(()=>{$.current=A,S.current=c}),(0,C.useEffect)(()=>{if(r||o===null)return;let E=qr(o);E!==null&&(S.current=E,d(E))},[r,o]),(0,C.useEffect)(()=>{if(!(r||!u))return Or(()=>J(E=>E+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let E=u&&Pr(_);w(rt(A,e).length>0||E),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(A,Ve,e)!==null||E?"default":"none")},[r,A,i,e,u,_,M]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let E=rt(A,e);E.length>0&&x().prefetch(E)},[r,c,A,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(E=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...E?{prefetch:rt($.current,e)}:{}}))},[r,x,_,u,e]),P=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),F=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&F()},[F]),he=(0,C.useCallback)((E,xe)=>{if(r)return;if(q.current){F();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je($.current,Ve,e);ve.say({url:V,text:E,lang:_,speech:u,onEnd:z})},[r,F,x,e,_,u,z]),W=(0,C.useCallback)(E=>{r||(E?T(!0):F(),o!==null&&Vr(o,E),S.current=E,d(E))},[r,T,F,o]),Y=(0,C.useCallback)(()=>W(!S.current),[W]),ne=(0,C.useCallback)((E,xe)=>{if(r||!c)return;q.current&&z();let ve=je($.current,E,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:W,toggle:Y,unlock:P,speakKey:ne,stop:F,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,W,Y,P,ne,F,N,R,he,ge])}l($r,"vt");s($r,"useVoiceGuidance");function Fr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(Fr,"Ct");s(Fr,"useSpeakGuidance");function lt(e,t){let n=Dr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(lt,"Pn");s(lt,"retryCoachingOf");function Dr(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}l(Dr,"Pr");s(Dr,"coachingOfReason");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Hr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Ae(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o(Fe[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:Fe[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Hr,"Tn");s(Hr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}l(Lt,"nt");s(Lt,"isDevBuild");var Tn=(0,Gr.createContext)(null);function Kr({state:e}){let t=Ae(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Rr,{}):e==="denied"?(0,we.jsx)(Ar,{}):(0,we.jsx)(Mr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Kr,"On");s(Kr,"PermissionRow");function Zr({voice:e}){let t=Ae();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Lr,{className:"sekyro-switch__check"}):null})})]})}l(Zr,"Hn");s(Zr,"VoiceSwitch");function zr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Ae(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),M=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let A=M.current;e!=="loading"&&(M.current=!1),Wr(j.current)&&(e==="failed"?B.current?.focus():A&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{M.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,O.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,O.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,O.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,O.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,O.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Er,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,O.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,O.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,O.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,O.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,O.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,O.jsx)(Ir,{tips:o}):null,c!==void 0?(0,O.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,O.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,O.jsx)(Kr,{state:n}),(0,O.jsx)(Zr,{voice:a}),(0,O.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,O.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(zr,"Fn");s(zr,"PreCaptureScreen");function Wr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(Wr,"Hr");s(Wr,"focusIsOurs");function Yr(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>Pn(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(Yr,"Dn");s(Yr,"useCameraStatus");function Qr(e){return Et(e,"mobileRequired")}l(Qr,"qn");s(Qr,"useMobileRequired");function Xr(e){return Et(e,"returning").required}l(Xr,"jn");s(Xr,"useReturning");function Et(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(Et,"Yn");s(Et,"useFlag");function Jr(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(Jr,"$n");s(Jr,"useCaptureMode");function en(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(en,"zn");s(en,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function xt(e){return Bn(e!==void 0?{assetBaseUrl:e}:{})}l(xt,"Qn");s(xt,"preload");function tn(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>qn(p,e),[e]),()=>On(e),Vn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{xt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{xt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(tn,"Jn");s(tn,"useLivenessAssets");var Cr={progress:0,hint:null,faceDetected:!1};function rn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,L.useRef)(e.verification).current,a=(0,L.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,L.useRef)(null),[c,d]=(0,L.useState)("idle"),[S,p]=(0,L.useState)(Cr),[w,N]=(0,L.useState)(!1),[j,R]=(0,L.useState)(!1),[B,q]=(0,L.useState)(null),[M,J]=(0,L.useState)(!1),[h,x]=(0,L.useState)(null),[_,k]=(0,L.useState)(null),[u,A]=(0,L.useState)(null),[I,$]=(0,L.useState)(null),[i,T]=(0,L.useState)(null),[P,z]=(0,L.useState)(!1),F=(0,L.useRef)(null),ge=(0,L.useRef)("idle"),he=(0,L.useRef)(-1),[W,Y]=(0,L.useState)(0),ne=(0,L.useRef)(e);ne.current=e,(0,L.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ue):$n(ue);o.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let De=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,Y(Math.max(0,he.current))),k(null),A(null),p(Cr),R(!1),N(!1),q(null),x(null),F.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),F.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=F.current;F.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>J(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),$(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{A(b);let ke=r?.reportCaptureIssue;ke!==void 0&&bt(Ee=>ke.call(r,Ee),kr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{$(b),ne.current.onResult?.(b)})];return()=>{for(let b of De)b?.();o.current=null,H.destroy()}},[r,t,n]);let E=(0,L.useCallback)(()=>{o.current?.start()},[]),xe=(0,L.useCallback)(()=>{o.current?.retry()},[]),ve=(0,L.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,L.useCallback)(async ee=>{let ue=o.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let H=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ue.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:M,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:E,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:P,attempt:W}}l(rn,"er");s(rn,"useLivenessHandle");var Fn=new Set(["national_number"]);function Nt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Fn.has(n));return t.length>0?{...e,options:t}:null}l(Nt,"tr");s(Nt,"pending");function nn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Nt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Nt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(nn,"nr");s(nn,"useMethodChoice");var Dn=["ar","fr","en"];function sn(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}l(sn,"io");s(sn,"isClipUrl");function an(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Dn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!sn(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(an,"ao");s(an,"toVoiceClipMap");function ln(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?an(t):null,[t]);return e===void 0?null:r}l(ln,"rr");s(ln,"useServerVoiceClips");function on({voice:e}){let t=Ae();return(0,Rt.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Rt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(on,"sr");s(on,"VoiceChip");var Hn=new Set(["abandoned","not_opened","cancelled","superseded"]),Gn=800,Kn="capture.lookAtColours";function cn(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}l(cn,"mo");s(cn,"isDefaultTips");function un(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}l(un,"yo");s(un,"carriesActivation");function dn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(dn,"go");s(dn,"isNoticeObject");var Zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function pn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(pn,"vo");s(pn,"isCapturing");function hn(e){return e==="captured"||e==="uploading"||e==="checking"}l(hn,"Co");s(hn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:M,onStateChange:J,assetBaseUrl:h,className:x}){let _=dr(t),k=(0,m.useMemo)(()=>ur(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),A=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),$=(0,m.useContext)(Tn),i=rn({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:M,onStateChange:J}),T=tn(h,i.state==="idle"&&i.error===null),P=nn(e),z=P.choice!==null,F=Qr(e),ge=Xr(e),he=en(e),W=Yr(),Y=Jr(e),ne=Y.session==="choice",E=Y.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=ln(xe?e:void 0),V=$r({locale:t,defaultClips:ve,options:j}),ee=E?"environment":"user",ue=Y.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),De=(0,m.useRef)(V.unlock);De.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let le=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of le)g.removeEventListener(qe,Me,!0)},"disarm");function Me(qe){if(Ne.current){_e();return}un(qe)&&(Ne.current=!0,_e(),De.current())}l(Me,"Re"),s(Me,"onGesture");for(let qe of le)g.addEventListener(qe,Me,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Ee=(0,m.useRef)(!1),Pe=i.state==="idle"&&i.error===null,Ut=!z&&!F.required&&(o===!0||o==="when-permitted"&&W.permission==="granted"),jt=Ut&&P.settled&&F.settled&&ue,gn=o==="when-permitted"&&!W.permissionSettled&&!Ee.current,Tt=Ut&&Pe&&!Ee.current,ut=(gn||Tt||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!jt||!Pe||T.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[jt,Pe,T.gate,ke]);let vn=Pe&&!z&&!F.required&&!(Tt&&T.gate==="ready"),[Pt,Ot]=(0,m.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=i;(0,m.useEffect)(()=>{if(!Y.settled||!ne){Ot(!1);return}let g=!0;return Bt().then(le=>{g&&Ot(le)}),()=>{g=!1}},[Y.settled,ne,Bt]);let{choose:Vt}=Y,Ie=E?"self":"assisted",kn=(0,m.useCallback)(async()=>{await qt(Ie)&&Vt(Ie)},[qt,Vt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=pn(i.state),be=hn(i.state),Ge=Z||be,se=i.result,Dt=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=$!==null,Ht=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{kn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Oe=be||dt,Gt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",We=Z?i.gate.hint:null,Ye=i.state==="starting"?"capture.preparing.title":We===null?null:We==="center"&&!i.gate.faceDetected?"fcv3.no_face":lr(We),[bn,Kt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(Ye!=="fcv3.no_face"){Kt(Ye);return}if(!Z)return;let g=setTimeout(()=>Kt(Ye),Gn);return()=>clearTimeout(g)},[Ye,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",Zt=E&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Kn:bn:null,ht=pt?N:Re===null?"":u(Re);Fr(V,Re,ht,Z);let zt=(0,m.useRef)(R);zt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{zt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Yt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Yt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Yt]);let Cn=ft!==void 0?(g,le,_e)=>ft(g,le,_e,Be):V.supported?()=>(0,v.jsx)(on,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:Jt,stopSummary:er}=V,Qe=w!==void 0&&w!=="",tr=Qe?w:u("capture.tips.summary"),rr=Qe?mt!=="none":mt==="partner"||mt==="default"&&cn(p),_n=(0,m.useMemo)(()=>rr?{playing:Xt,toggle:s(()=>Jt(tr,{clip:!Qe}),"toggle"),stop:er}:void 0,[rr,Xt,Jt,tr,er,Qe]),wn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:W.permission,permissionSettled:W.permissionSettled,captureMode:Y.mode,facing:ee,voice:Be}),[ut,T.retry,W.permission,W.permissionSettled,Y.mode,ee,Be]),Sn=dn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Dt&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Dt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,le)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Me=ir(t,le);if(Me!==null)return u(Me.key).replace("{time}",Me.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let le=g.retakeHint===void 0?null:Je(g.retakeHint);return le===null?yt(g.reasonCode):u(le)},"retryText"),nr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Hn.has(Ce.reason)?u("errors.session_expired"):null),xn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,sr=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||Zn.has(Xe)||bt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,sr)})},[G,Xe,sr,e]);let ar=kt(),Nn=z&&P.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await P.select(g)&&i.state==="done"&&i.retry()},[P.select,i.state,i.retry]);return(0,m.useEffect)(()=>{P.auto!==null&&!P.busy&&!Z&&!be&&vt(P.auto)},[P.auto,P.busy,Z,be,vt]),(0,v.jsx)(pr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:A,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&>(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,F.required&&Pe?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(or(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),xn?(0,v.jsx)(te,{ref:ar,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,nr!==null&&Ce!==null?(0,v.jsx)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:nr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?$({videoRef:I,guidance:Oe&&Ue?u("capture.checking"):ht,coached:pt&&!(Oe&&Ue),note:Oe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):Zt),settled:Oe&&Ue,progress:i.gate.progress,phase:Gt,still:Oe?Ft:null,live:Ge,modeSwitch:Ht,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(hr,{videoRef:I,guidanceText:ht,guidanceHint:We,guidanceKey:Re,progress:i.gate.progress,phase:Gt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:Zt,voicePrompt:Cn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(fr,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Ht})}),Nn&&P.choice!==null?(0,v.jsx)(Ur,{title:u("method.title"),description:u("method.description"),options:P.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:P.busy,error:P.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,vn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,Sn,a?.intro!==void 0?a.intro(b,wn):(0,v.jsx)(zr,{assets:ut,onRetryAssets:T.retry,permission:W.permission,captureMode:Y.mode,voice:Be,tips:p??_t,summary:_n,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Hr,{showCoaching:ae!==null,coaching:lt(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?cr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(zn,"Ei");s(zn,"LivenessCapture");var It=U(K(),1),ct=U(K(),1),f=U(de(),1);import{methodNameOf as fn}from"@sekyro/web";import{isInAppBrowser as rs}from"@sekyro/web/client";var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Wn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return fn(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return fn(e,t.locale)??t.t("method.nationalEid");default:return null}}l(Wn,"D");s(Wn,"identityLabel");function Yn(e,t){let[n,r]=(0,It.useState)(!1),[a,o]=(0,It.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(br(d,e.strings))),t?.(d)})},"run")}}l(Yn,"W");s(Yn,"useChoiceAction");function mn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(mn,"B");s(mn,"FaceMark");var Qn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Xn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}l(Xn,"re");s(Xn,"faceIntroRetryOf");var Jn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function es({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=Ct(),{t:p}=S,w=d===void 0?"face":lt(d.reason,d.retakeHint),N=w==="face"?null:Fe[w].tips,j=(0,ct.useContext)(yr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(mn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(yn,{retry:d,title:Fe[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:Jn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:Qn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Le,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(mr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Le,{name:"camera"}),p("capture.start")]})})]})}l(es,"ae");s(es,"FaceIntro");var ts=new Set(["match_inconclusive","no_face_source","below_threshold"]);function yn({retry:e,title:t}){let n=Ct(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":ts.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(gr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(yn,"M");s(yn,"RetryNotice");function ns(e){return rs(e)}l(ns,"ce");s(ns,"isInAppBrowser");function ss(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(ss,"pe");s(ss,"androidBrowserIntent");export{Ur as a,Lt as b,Tn as c,Jr as d,zn as e,_s as f,Wn as g,Yn as h,Xn as i,es as j,ns as k,ss as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-
|
|
1
|
+
import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-JW4QXADM.js";import{a as o,c as b,i}from"./chunk-SSU37LFQ.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
|