@sekyro/elements 0.1.0-rc.0 → 0.1.0-rc.2
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 +21 -0
- package/dist/cdn/chunks/{background-monitor-GCMNCJMG-UXYQ5GX7.js → background-monitor-A7FKJOAG-K3WF3C2D.js} +1 -1
- package/dist/cdn/chunks/{camera-trait-HVV5ZEDI-JB4HN6S3.js → camera-trait-V4UAOPIQ-TFCPOCSU.js} +1 -1
- package/dist/cdn/chunks/{capture-session-doc-K6LVXAGQ-SY3B27LY.js → capture-session-doc-O33KRXH7-X5MKSSBA.js} +1 -1
- package/dist/cdn/chunks/challenge-frame-NUGPTWFP-V3GGQN65.js +1 -0
- package/dist/cdn/chunks/{chunk-TCW6XNLI.js → chunk-3NAYOW43.js} +1 -1
- package/dist/cdn/chunks/{chunk-OIJVTJML.js → chunk-4ECYTYEB.js} +1 -1
- package/dist/cdn/chunks/chunk-CSM63KBJ.js +3 -0
- package/dist/cdn/chunks/{chunk-D334IAZJ.js → chunk-CW56KMMH.js} +1 -1
- package/dist/cdn/chunks/{chunk-KPGTFHQU.js → chunk-EPEHFY6J.js} +1 -1
- package/dist/cdn/chunks/chunk-GRJNZG6Y.js +33 -0
- package/dist/cdn/chunks/{chunk-XYQGAQBQ.js → chunk-HTLQX2R3.js} +1 -1
- package/dist/cdn/chunks/{chunk-2SENV5CV.js → chunk-JAIRD73U.js} +1 -1
- package/dist/cdn/chunks/{chunk-OBPBHX2J.js → chunk-KQQ6BZAH.js} +1 -1
- package/dist/cdn/chunks/chunk-LNQJGD3J.js +1 -0
- package/dist/cdn/chunks/{chunk-IFGPCCJH.js → chunk-M2F5OJOZ.js} +1 -1
- package/dist/cdn/chunks/{chunk-2ZVKLBJD.js → chunk-NQHMZQZA.js} +1 -1
- package/dist/cdn/chunks/{chunk-UYAVCSQ4.js → chunk-OTGSYUHN.js} +1 -1
- package/dist/cdn/chunks/{chunk-7XAIG23G.js → chunk-OVRHETMK.js} +1 -1
- package/dist/cdn/chunks/chunk-P3OIDL7Y.js +1 -0
- package/dist/cdn/chunks/{chunk-T4M2J44L.js → chunk-Q5ZVLMKQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-3VYQXVW4.js → chunk-SVIHEXDZ.js} +1 -1
- package/dist/cdn/chunks/{chunk-6MEPT5ZS.js → chunk-UJSGILV7.js} +1 -1
- package/dist/cdn/chunks/{chunk-C66GZ7NN.js → chunk-UQ5AELS3.js} +1 -1
- package/dist/cdn/chunks/{chunk-JM3CYFFZ.js → chunk-UQKRYXN5.js} +1 -1
- package/dist/cdn/chunks/{chunk-YMGCOMYZ.js → chunk-WQW232LA.js} +1 -1
- package/dist/cdn/chunks/{chunk-X767DBO7.js → chunk-Y27EXTAY.js} +1 -1
- package/dist/cdn/chunks/{chunk-IBOJTLL7.js → chunk-Y6PC7FZV.js} +1 -1
- package/dist/cdn/chunks/{chunk-Z3EEB4CI.js → chunk-Y7VOIKUK.js} +1 -1
- package/dist/cdn/chunks/{chunk-HODE7UDG.js → chunk-YF5BWIHV.js} +1 -1
- package/dist/cdn/chunks/create-document-capture-OLKNUVTU-Q3AGV6QB.js +1 -0
- package/dist/cdn/chunks/create-portrait-capture-5VGYZUOK-N3333DJC.js +1 -0
- package/dist/cdn/chunks/{detector-scanic-F3Y5X3DF-FGVR4NEM.js → detector-scanic-YCDNLCGV-FH6NWNXC.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-JIKJWCFG-MMCEL43X.js → document-capture-view-GZX5JJ7N-PRYTX37D.js} +1 -1
- package/dist/cdn/chunks/{eid-view-IW2ZP2NG-EB5SCHBD.js → eid-view-ERVRHLLD-ONTAYXU7.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-VDTMZ4R5-Y5QHQDIB.js → email-otp-view-B7UQ5CHL-GWHWAR75.js} +1 -1
- package/dist/cdn/chunks/flow-views-IGQ5MYS2-3UXKITDZ.js +1 -0
- package/dist/cdn/chunks/icao-gate-T3BTOKFJ-BWMLKL7A.js +1 -0
- package/dist/cdn/chunks/icao-tuning-4ETMF53W-FRBTB5R7.js +1 -0
- package/dist/cdn/chunks/{landmarker-3BBP3RBY-DDXMOLGK.js → landmarker-KB7LVXAU-F7BQTP3H.js} +1 -1
- package/dist/cdn/chunks/mrz-band-VYHOTDHY-VEZ2J5IL.js +1 -0
- package/dist/cdn/chunks/overlay-de-5KYN4JFO-I4ESJMAS.js +1 -0
- package/dist/cdn/chunks/overlay-es-6CAERCCN-SPFAX3SD.js +1 -0
- package/dist/cdn/chunks/overlay-pt-UBGXJ3C3-MWW4QOSN.js +1 -0
- package/dist/cdn/chunks/plan-runner-VKPRZ3AD-VYRGIMQG.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-LWESDZPM-SEOHMLJQ.js → portrait-capture-view-TMHG2UX2-N44IPYHU.js} +1 -1
- package/dist/cdn/chunks/portrait-review-view-XUWQ5LIN-M5WOPF2E.js +1 -0
- package/dist/cdn/chunks/{print-4WOMNRBE-DNXJ7ERA.js → print-SEWS3VHQ-HWJTHADG.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunk-4QKQAQKO.js +1 -0
- package/dist/{chunk-UT2KIR2K.js → chunk-6LR6LY2U.js} +1 -1
- package/dist/chunk-GRQ3QAMU.js +33 -0
- package/dist/{chunk-KU4DZ3OQ.js → chunk-GTN3SYJJ.js} +1 -1
- package/dist/{chunk-W2UTL5PI.js → chunk-IFHBX74I.js} +1 -1
- package/dist/{chunk-X5K27NXI.js → chunk-INKK6CKB.js} +1 -1
- package/dist/{chunk-JQ3ANVKN.js → chunk-IQ7FLSNW.js} +1 -1
- package/dist/{chunk-X5WMOOH2.js → chunk-KXJRO6VZ.js} +1 -1
- package/dist/{chunk-OSBGOI4W.js → chunk-LHD2PSUM.js} +1 -1
- package/dist/{chunk-4QI2LTJD.js → chunk-LREBBPJW.js} +1 -1
- package/dist/{chunk-WWGJDMZQ.js → chunk-OQUTKFRP.js} +1 -1
- package/dist/{chunk-HSQWGTF7.js → chunk-S6JGFCOP.js} +1 -1
- package/dist/{chunk-JJNFGW3A.js → chunk-SBJNQYEL.js} +1 -1
- package/dist/{chunk-SEE6MST7.js → chunk-YZ6YGLNN.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-JIKJWCFG-OWMTF5A3.js → document-capture-view-GZX5JJ7N-ZW55IE6H.js} +1 -1
- package/dist/{eid-view-IW2ZP2NG-SKEYTRTX.js → eid-view-ERVRHLLD-NLA6CQL7.js} +1 -1
- package/dist/{email-otp-view-VDTMZ4R5-EO7T6SL4.js → email-otp-view-B7UQ5CHL-67LKMWBY.js} +1 -1
- package/dist/flow-views-IGQ5MYS2-DVYTE4D2.js +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-5KYN4JFO-MYA62T4Z.js +1 -0
- package/dist/overlay-es-6CAERCCN-QPH54AX7.js +1 -0
- package/dist/overlay-pt-UBGXJ3C3-VG6FOOCX.js +1 -0
- package/dist/{portrait-capture-view-LWESDZPM-XZOM6LXG.js → portrait-capture-view-TMHG2UX2-4DHDNWRH.js} +1 -1
- package/dist/portrait-review-view-XUWQ5LIN-7GZ3GF2B.js +1 -0
- package/dist/styles.css +5 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-3KIFGAEK.js +0 -1
- package/dist/cdn/chunks/chunk-562ANROG.js +0 -1
- package/dist/cdn/chunks/chunk-YEPHU5PX.js +0 -1
- package/dist/cdn/chunks/chunk-ZKEOHGBY.js +0 -33
- package/dist/cdn/chunks/create-document-capture-LNX6NFSK-A4LP25Y5.js +0 -1
- package/dist/cdn/chunks/create-portrait-capture-VRZZOMJS-I4FBRNBP.js +0 -1
- package/dist/cdn/chunks/flow-views-N4FMOYIR-FDN6ATHN.js +0 -1
- package/dist/cdn/chunks/icao-gate-SO6YJ7RV-MPW6W3QN.js +0 -1
- package/dist/cdn/chunks/icao-tuning-DCZCMCEQ-ZQSK7ZOV.js +0 -1
- package/dist/cdn/chunks/mrz-band-DCXFWDBD-OPMO6HYS.js +0 -1
- package/dist/cdn/chunks/overlay-de-F7GCMCGJ-FBTP3BSM.js +0 -1
- package/dist/cdn/chunks/overlay-es-HIO7CIKS-GDHVHUQW.js +0 -1
- package/dist/cdn/chunks/overlay-pt-YC4HRHKL-J3TGRZRW.js +0 -1
- package/dist/cdn/chunks/plan-runner-DIRERYBF-FANNXQNO.js +0 -1
- package/dist/cdn/chunks/portrait-review-view-FU3QSO4K-DZHDIMQX.js +0 -1
- package/dist/cdn/chunks/turnstile-N4K4U2AI-SLP55XAA.js +0 -1
- package/dist/chunk-43YHL2WG.js +0 -1
- package/dist/chunk-73JRPFCO.js +0 -33
- package/dist/flow-views-N4FMOYIR-J54ADNRO.js +0 -1
- package/dist/overlay-de-F7GCMCGJ-7OI7SGX4.js +0 -1
- package/dist/overlay-es-HIO7CIKS-LXC2SFGY.js +0 -1
- package/dist/overlay-pt-YC4HRHKL-2QCRICEV.js +0 -1
- package/dist/portrait-review-view-FU3QSO4K-AGWEX2EQ.js +0 -1
- /package/dist/cdn/chunks/{chunk-SK6UAYX2.js → chunk-2FETDQV5.js} +0 -0
- /package/dist/cdn/chunks/{chunk-RK4HVNRS.js → chunk-5QL6W6FW.js} +0 -0
- /package/dist/cdn/chunks/{chunk-CMS5FVGM.js → chunk-FAQCPBKF.js} +0 -0
- /package/dist/cdn/chunks/{chunk-HDJ6JFXX.js → chunk-IO7MUUC6.js} +0 -0
- /package/dist/cdn/chunks/{chunk-RRLXNT33.js → chunk-JS2IXPNL.js} +0 -0
- /package/dist/cdn/chunks/{chunk-ET7NCKUV.js → chunk-KHSYTJ46.js} +0 -0
- /package/dist/cdn/chunks/{chunk-CMDITVXF.js → chunk-KVTY4E6J.js} +0 -0
- /package/dist/cdn/chunks/{chunk-7HJH5Q4M.js → chunk-L22GFJQV.js} +0 -0
- /package/dist/cdn/chunks/{chunk-FAIDO3QL.js → chunk-L244IUB3.js} +0 -0
- /package/dist/cdn/chunks/{chunk-UZWMCNZI.js → chunk-P7K7ELYZ.js} +0 -0
- /package/dist/cdn/chunks/{chunk-JOZCJGRV.js → chunk-YVQ6LFN4.js} +0 -0
- /package/dist/cdn/chunks/{clip-inspect-HZ7N2YOP-DCDXB76T.js → clip-inspect-DLJXVKV6-TNHTD4LV.js} +0 -0
- /package/dist/cdn/chunks/{keyframe-rank-R4NPQGN3-VRURE6OQ.js → keyframe-rank-YAJLYJYF-WCA6RPMD.js} +0 -0
- /package/dist/cdn/chunks/{scanic-ml-stub-XPNKT2N3-YSXFN7KY.js → scanic-ml-stub-KW7IZHUT-XLERBDWM.js} +0 -0
- /package/dist/cdn/chunks/{segmenter-3CVPTZMM-WGI6XGWN.js → segmenter-USLNBX65-HFEEUGXG.js} +0 -0
- /package/dist/cdn/chunks/{upload-file-C4MFKLT3-DXCNEDXP.js → upload-file-UYXOHCRG-MBYCMRP2.js} +0 -0
- /package/dist/{chunk-TPIBYY2S.js → chunk-N2DNXUEA.js} +0 -0
- /package/dist/{chunk-RPLVIGTS.js → chunk-SSU37LFQ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-SBJNQYEL.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{b,c as t,v as s,w as i,y as l}from"./chunk-
|
|
1
|
+
import{b,c as t,v as s,w as i,y as l}from"./chunk-SBJNQYEL.js";import{a as o,c as k,i as r}from"./chunk-SSU37LFQ.js";var a=k(b(),1);function x({title:n,lead:d,cameraLabel:c,uploadLabel:m,notice:p,testId:e,onCamera:h,onUpload:u,onPhone:f=!1}){return(0,a.jsxs)("section",{className:"sekyro-step","data-testid":e,children:[(0,a.jsx)(i,{title:n,lead:d}),p,(0,a.jsxs)(l,{children:[(0,a.jsxs)(t,{full:!0,onClick:h,"data-testid":`${e}-camera`,children:[(0,a.jsx)(s,{name:f?"smartphone":"camera"}),c]}),(0,a.jsx)(t,{full:!0,kind:"ghost",onClick:u,"data-testid":`${e}-upload`,children:m})]})]})}o(x,"k");r(x,"PhotoSourceView");export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-6LR6LY2U.js";import{K as b,a as k,b as y,c as x}from"./chunk-SBJNQYEL.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-IGQ5MYS2-DVYTE4D2.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{a as j}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-IFHBX74I.js";import{d as U}from"./chunk-INKK6CKB.js";import{K as k,L as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-SBJNQYEL.js";import{a as s,c as N,i as n}from"./chunk-SSU37LFQ.js";var f=N(A(),1),e=N(V(),1);var D={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."},y={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."},G={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pr,d as hr}from"./chunk-OSBGOI4W.js";import{b as gr,c as kt}from"./chunk-KU4DZ3OQ.js";import{a as kr}from"./chunk-SEE6MST7.js";import{c as bt}from"./chunk-43YHL2WG.js";import{a as cr,b as ur,c as dr,d as Re}from"./chunk-HSQWGTF7.js";import{F as mr,K as yr,L as vr,a as F,b as de,c as X,m as ar,n as Je,p as ir,q as Xe,r as or,s as lr,t as gt,u as se,v as Ae,w as et,y as fr}from"./chunk-JJNFGW3A.js";import{a as i,c as E,i as s}from"./chunk-RPLVIGTS.js";var _r=E(F(),1),v=E(de(),1),ee=E(de(),1),ye=E(F(),1),q=E(de(),1),_=E(F(),1),y=E(F(),1),st=E(F(),1),fe=E(de(),1),Hr=E(F(),1),Y=E(F(),1),it=E(F(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1),ot=E(F(),1),pe=E(F(),1),Q=E(F(),1),M=E(F(),1),me=E(F(),1),Te=E(F(),1),Nt=E(de(),1),k=E(de(),1);import{subscribeCameraPermission as Un}from"@sekyro/web";import{getLivenessAssetsStatus as jn,preloadLivenessAssets as Tn,subscribeLivenessAssets as Pn}from"@sekyro/web";import{createLivenessCapture as qn}from"@sekyro/web";function ie({className:e,children:t}){return(0,v.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})}i(ie,"te");s(ie,"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 Cr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.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"})]})}i(Cr,"cn");s(Cr,"SunIcon");function wr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(wr,"ln");s(wr,"FaceUncoveredIcon");function Sr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Sr,"un");s(Sr,"PhoneEyeLevelIcon");function xr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.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,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(xr,"dn");s(xr,"LookStraightIcon");function Nr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Nr,"pn");s(Nr,"CameraCheckIcon");function Mr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.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"})]})}i(Mr,"fn");s(Mr,"CameraAskIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(Lr,"mn");s(Lr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Rr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Rr,"yn");s(Rr,"CheckIcon");function Ar(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Ar,"gn");s(Ar,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Sn={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Cr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(wr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Sr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(xr,{}),"icon")}};function Er({tips:e}){let t=Re(),n=(0,_r.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Sn[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Er,"vn");s(Er,"TipList");var xn=220;function Ir({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=gt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let L=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},xn))},"choose");return(0,q.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,q.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,q.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,q.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,q.jsx)(se,{tone:"danger",children:(0,q.jsx)("span",{children:a})}):null,u==="buttons"?(0,q.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,q.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,q.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,q.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>L(p.id),"onClick"),children:[p.glyph!==void 0?(0,q.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,q.jsxs)("span",{className:"sekyro-card__body",children:[(0,q.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,q.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,q.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Ir,"kn");s(Ir,"ChoiceScreen");var Ur=["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"];function nt(e){return e!==null&&Ur.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var Nn=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&&Nn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Mn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Ln={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function jr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(jr,"wr");s(jr,"speechAvailable");function Ct(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(Ct,"bn");s(Ct,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=Ct(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>Ct(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Tr(e){if(!jr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Tr,"Mn");s(Tr,"speechUsable");function Pr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Pr,"wn");s(Pr,"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}`}}i($e,"Ke");s($e,"clipIdentity");function wt(e){e.pause(),e.removeAttribute("src"),e.load()}i(wt,"Sn");s(wt,"release");function Br(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,L)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,L!==void 0&&(C.onend=C.onerror=L),p.speak(C);return}}L?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let L=$e(N);if(o.has(L))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(L,p)}},"warmClips");return{say(d){let N=d.url!==null?$e(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let L=n,p=d.onEnd,j=p!==void 0?()=>{L===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{L===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:L}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Mn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(L??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&wt(e),e=null;for(let d of o.values())wt(d);o.clear()}}}i(Br,"Ln");s(Br,"createVoicePlayer");var Rn="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}}i(qr,"xn");s(qr,"readVoicePreference");function Or(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Or,"In");s(Or,"writeVoicePreference");var Ve="capture.tips.summary",An=typeof window<"u"?_.useLayoutEffect:_.useEffect,En=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of Ur){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Vr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Rn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),L=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=Br()),C.current),[]),O=Ln[e],H=a.speechFallback,f=H===void 0||H===!0?!0:H===!1?!1:H.includes(e),D=a.clips??t??En,oe=(0,_.useRef)(!1),le=(0,_.useRef)(D);An(()=>{le.current=D,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let R=qr(o);R!==null&&(S.current=R,u(R))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Pr(()=>j(R=>R+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let R=f&&Tr(O);w(tt(D,e).length>0||R),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(D,Ve,e)!==null||R?"default":"none")},[r,D,c,e,f,O,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let R=tt(D,e);R.length>0&&A().prefetch(R)},[r,l,D,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(R=>{r||(oe.current=!0,A().unlock({lang:O,speech:f,...R?{prefetch:tt(le.current,e)}:{}}))},[r,A,O,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{L.current=!1,N(!1)},[]),B=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{L.current&&B()},[B]),he=(0,_.useCallback)((R,xe)=>{if(r)return;if(L.current){B();return}let ge=A();ge.stop(),L.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:R,lang:O,speech:f,onEnd:G})},[r,B,A,e,O,f,G]),K=(0,_.useCallback)(R=>{r||(R?V(!0):B(),o!==null&&Or(o,R),S.current=R,u(R))},[r,V,B,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((R,xe)=>{if(r||!l)return;L.current&&G();let ge=je(le.current,R,e);A().say({url:ge,text:xe,lang:O,speech:f})},[r,l,e,A,O,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:B,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,B,x,d,he,ve])}i(Vr,"ht");s(Vr,"useVoiceGuidance");function $r(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i($r,"vt");s($r,"useSpeakGuidance");function at(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"}}i(at,"Pn");s(at,"retryCoachingOf");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","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 Fr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Re(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.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(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Fr,"An");s(Fr,"CapturedPanel");function Rt(){try{return!1}catch{return!1}}i(Rt,"tt");s(Rt,"isDevBuild");var In=(0,Hr.createContext)(null);function Dr({state:e}){let t=Re(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Nr,{}):e==="denied"?(0,we.jsx)(Lr,{}):(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}`)})]})}i(Dr,"Kn");s(Dr,"PermissionRow");function Gr({voice:e}){let t=Re();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:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{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)(Rr,{className:"sekyro-switch__check"}):null})})]})}i(Gr,"Un");s(Gr,"VoiceSwitch");function Kr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Re(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),L=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=L.current;if(L.current=e,f===e)return;let D=p.current;e!=="loading"&&(p.current=!1),zr(I.current)&&(e==="failed"?N.current?.focus():D&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,O=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),H;return e==="failed"?H=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):H=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:O,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ar,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Er,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Dr,{state:n}),(0,U.jsx)(Gr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),H,(0,U.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"):""})]})}i(Kr,"Gn");s(Kr,"PreCaptureScreen");function zr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(zr,"Or");s(zr,"focusIsOurs");function Zr(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>Un(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(Zr,"Fn");s(Zr,"useCameraStatus");function Qr(e){return At(e,"mobileRequired")}i(Qr,"qn");s(Qr,"useMobileRequired");function Wr(e){return At(e,"returning").required}i(Wr,"Dn");s(Wr,"useReturning");function At(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(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(At,"jn");s(At,"useFlag");function Yr(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,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,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}}i(Yr,"$n");s(Yr,"useCaptureMode");function Jr(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}i(Jr,"zn");s(Jr,"useBusy");var Bn=s(()=>"idle","serverSnapshot");function St(e){return Tn(e!==void 0?{assetBaseUrl:e}:{})}i(St,"Wn");s(St,"preload");function Xr(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>Pn(h,e),[e]),()=>jn(e),Bn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{St(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{St(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(Xr,"Qn");s(Xr,"useLivenessAssets");var br={progress:0,hint:null,faceDetected:!1};function en(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Rt()&&(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,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(br),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,L]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[O,H]=(0,M.useState)(null),[f,D]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),B=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},$=r!==void 0?r.liveness(ce):qn(ce);o.current=$;let Ne=s(()=>V($.facingMode??null),"readFacing");Ne();let He=[$.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),H(null),D(null),h(br),d(!1),x(!1),L(null),A(null),B.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),L(null),B.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),$.on("gate",b=>{let ke=B.current;B.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),$.on("frozen",({previewDataUrl:b})=>L(b)),$.on("profile",({animations:b})=>j(b==="reduced")),$.on("ramp",({colour:b})=>A(b)),$.on("captured",b=>{H(b),le(null),te.current.onCaptured?.(b)}),$.on("error",b=>{D(b);let ke=r?.reportCaptureIssue;ke!==void 0&&kt(Ee=>ke.call(r,Ee),gr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of He)b?.();o.current=null,$.destroy()}},[r,t,n]);let R=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let $=await ce.setCaptureMode(J).catch(()=>!1)===!0;return $&&V(ce.facingMode??null),$},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:O,error:f,result:oe,facingMode:c,start:R,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(en,"Xn");s(en,"useLivenessHandle");var On=new Set(["national_number"]);function xt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>On.has(n));return t.length>0?{...e,options:t}:null}i(xt,"er");s(xt,"pending");function tn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(xt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(xt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(tn,"tr");s(tn,"useMethodChoice");var Vn=["ar","fr","en"];function rn(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}}i(rn,"oo");s(rn,"isClipUrl");function nn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Vn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!rn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(nn,"so");s(nn,"toVoiceClipMap");function sn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?nn(t):null,[t]);return e===void 0?null:r}i(sn,"nr");s(sn,"useServerVoiceClips");function an({voice:e}){let t=Re();return(0,Nt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Nt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(an,"or");s(an,"VoiceChip");var $n=new Set(["abandoned","not_opened","cancelled","superseded"]),Fn=800;function on(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}i(on,"uo");s(on,"isDefaultTips");function ln(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}i(ln,"po");s(ln,"carriesActivation");function cn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(cn,"fo");s(cn,"isNoticeObject");var Hn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function un(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(un,"yo");s(un,"isCapturing");function dn(e){return e==="captured"||e==="uploading"||e==="checking"}i(dn,"go");s(dn,"isPostCapture");function Dn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:L,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let O=ur(t),H=(0,y.useMemo)(()=>cr(t,r),[t,r,O]),f=(0,y.useMemo)(()=>g=>H[g]??"",[H]),D=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(In),c=en({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:L,onError:p,onStateChange:j}),V=Xr(C,c.state==="idle"&&c.error===null),T=tn(e),G=T.choice!==null,B=Qr(e),ve=Wr(e),he=Jr(e),K=Zr(),z=Yr(e),te=z.session==="choice",R=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=sn(xe?e:void 0),P=Vr({locale:t,defaultClips:ge,options:I}),J=R?"environment":"user",ce=z.settled,$=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),He=(0,y.useRef)(P.unlock);He.current=P.unlock,(0,y.useEffect)(()=>{let g=$.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let Oe of ne)g.removeEventListener(Oe,Le,!0)},"disarm");function Le(Oe){if(Ne.current){Ce();return}ln(Oe)&&(Ne.current=!0,Ce(),He.current())}i(Le,"Re"),s(Le,"onGesture");for(let Oe of ne)g.addEventListener(Oe,Le,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,It=!G&&!B.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),Ut=It&&T.settled&&B.settled&&ce,fn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,jt=It&&Pe&&!Ee.current,ct=(fn||jt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ut||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ut,Pe,V.gate,ke]);let mn=Pe&&!G&&!B.required&&!(jt&&V.gate==="ready"),[Tt,Pt]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Pt(!1);return}let g=!0;return Bt().then(ne=>{g&&Pt(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Ot}=z,Ie=R?"self":"assisted",yn=(0,y.useCallback)(async()=>{await qt(Ie)&&Ot(Ie)},[qt,Ot,Ie]),Vt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Vt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Vt]);let De=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(De!==null)return()=>URL.revokeObjectURL(De)},[De]);let $t=c.frozenPreview??De,Ue=e!==void 0,Z=un(c.state),be=dn(c.state),Ge=Z||be,re=c.result,Ft=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ht=Tt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{yn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Be=be||ut,Dt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":ar(Ze),[vn,Gt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Gt(Qe);return}if(!Z)return;let g=setTimeout(()=>Gt(Qe),Fn);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",Kt=R&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?vn:null,pt=dt?x:Me===null?"":f(Me);$r(P,Me,pt,Z);let zt=(0,y.useRef)(d);zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let qe=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Zt=ht!==void 0,Qt=I===void 0,Wt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Zt||!Qt||Wt.current||!Rt()||(Wt.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."))},[Zt,Qt]);let gn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,qe):P.supported?()=>(0,k.jsx)(an,{voice:qe}):void 0,{summary:ft,summaryPlaying:Yt,toggleSummary:Jt,stopSummary:Xt}=P,We=w!==void 0&&w!=="",er=We?w:f("capture.tips.summary"),tr=We?ft!=="none":ft==="partner"||ft==="default"&&on(h),kn=(0,y.useMemo)(()=>tr?{playing:Yt,toggle:s(()=>Jt(er,{clip:!We}),"toggle"),stop:Xt}:void 0,[tr,Yt,Jt,er,Xt,We]),bn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:qe}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,qe]),_n=cn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=Ft&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=Ft&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Le=or(t,ne);if(Le!==null)return f(Le.key).replace("{time}",Le.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),rr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&$n.has(_e.reason)?f("errors.session_expired"):null),Cn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,nr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Hn.has(Ye)||kt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,nr)})},[W,Ye,nr,e]);let sr=gt(),wn=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(dr,{value:f,children:(0,k.jsxs)("div",{ref:$,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:D,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,B.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(ir(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Cn?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,rr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:rr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Be&&Ue?f("capture.checking"):pt,coached:dt&&!(Be&&Ue),note:Be?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):Kt),settled:Be&&Ue,progress:c.gate.progress,phase:Dt,still:Be?$t:null,live:Ge,modeSwitch:Ht,...Tt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(pr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Dt,draining:c.draining,stillUrl:$t,showChecking:Ue,operatorText:Kt,voicePrompt:gn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(hr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ht})}),wn&&T.choice!==null?(0,k.jsx)(Ir,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,mn?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,_n,a?.intro!==void 0?a.intro(b,bn):(0,k.jsx)(Kr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:qe,tips:h??_t,summary:kn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Fr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?lr(H,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Dn,"_i");s(Dn,"LivenessCapture");var Et=E(F(),1),lt=E(F(),1),m=E(de(),1);import{isInAppBrowser as Jn}from"@sekyro/web/client";var vs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Gn(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}}i(Gn,"Y");s(Gn,"identityLabel");function Kn(e,t){let[n,r]=(0,Et.useState)(!1),[a,o]=(0,Et.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(kr(u,e.strings))),t?.(u)})},"run")}}i(Kn,"q");s(Kn,"useChoiceAction");function pn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(pn,"O");s(pn,"FaceMark");var zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Zn(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}}i(Zn,"te");s(Zn,"faceIntroRetryOf");var Qn={"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 Wn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=bt(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:Fe[w].tips,I=(0,lt.useContext)(mr)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(pn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(hn,{retry:u,title:Fe[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Qn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(fr,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Wn,"ne");s(Wn,"FaceIntro");var Yn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function hn({retry:e,title:t}){let n=bt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Yn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(yr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(hn,"T");s(hn,"RetryNotice");function Xn(e){return Jn(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(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`}i(es,"ce");s(es,"androidBrowserIntent");export{Ir as a,Rt as b,In as c,Yr as d,Dn as e,vs as f,Gn as g,Kn as h,Zn as i,Wn as j,Xn as k,es as l};
|
|
1
|
+
import{b as pr,d as hr}from"./chunk-LHD2PSUM.js";import{b as gr,c as kt}from"./chunk-GTN3SYJJ.js";import{a as kr}from"./chunk-YZ6YGLNN.js";import{c as bt}from"./chunk-4QKQAQKO.js";import{a as cr,b as ur,c as dr,d as Re}from"./chunk-S6JGFCOP.js";import{F as mr,K as yr,L as vr,a as F,b as de,c as X,m as ar,n as Je,p as ir,q as Xe,r as or,s as lr,t as gt,u as se,v as Ae,w as et,y as fr}from"./chunk-SBJNQYEL.js";import{a as i,c as E,i as s}from"./chunk-SSU37LFQ.js";var _r=E(F(),1),v=E(de(),1),ee=E(de(),1),ye=E(F(),1),q=E(de(),1),_=E(F(),1),y=E(F(),1),st=E(F(),1),fe=E(de(),1),Hr=E(F(),1),Y=E(F(),1),it=E(F(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1),ot=E(F(),1),pe=E(F(),1),Q=E(F(),1),M=E(F(),1),me=E(F(),1),Te=E(F(),1),Nt=E(de(),1),k=E(de(),1);import{subscribeCameraPermission as Un}from"@sekyro/web";import{getLivenessAssetsStatus as jn,preloadLivenessAssets as Tn,subscribeLivenessAssets as Pn}from"@sekyro/web";import{createLivenessCapture as qn}from"@sekyro/web";function ie({className:e,children:t}){return(0,v.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})}i(ie,"te");s(ie,"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 Cr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.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"})]})}i(Cr,"cn");s(Cr,"SunIcon");function wr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}i(wr,"ln");s(wr,"FaceUncoveredIcon");function Sr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}i(Sr,"un");s(Sr,"PhoneEyeLevelIcon");function xr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.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,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}i(xr,"dn");s(xr,"LookStraightIcon");function Nr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}i(Nr,"pn");s(Nr,"CameraCheckIcon");function Mr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.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"})]})}i(Mr,"fn");s(Mr,"CameraAskIcon");function Lr(e){return(0,v.jsxs)(ie,{...e,children:[(0,v.jsx)("path",{d:Mt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}i(Lr,"mn");s(Lr,"CameraBlockedIcon");function rt({off:e,className:t}){return(0,v.jsxs)(ie,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}i(rt,"Ve");s(rt,"SpeakerIcon");function Rr(e){return(0,v.jsx)(ie,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}i(Rr,"yn");s(Rr,"CheckIcon");function Ar(e){return(0,v.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}i(Ar,"gn");s(Ar,"SpinnerIcon");var _t=["light","uncover","eyeLevel","straight"],Sn={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Cr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(wr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Sr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(xr,{}),"icon")}};function Er({tips:e}){let t=Re(),n=(0,_r.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Sn[r]:void 0,o=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},o)})})]})}i(Er,"vn");s(Er,"TipList");var xn=220;function Ir({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=gt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let L=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},xn))},"choose");return(0,q.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,q.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,q.jsx)("h2",{id:w,ref:o?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,q.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,q.jsx)(se,{tone:"danger",children:(0,q.jsx)("span",{children:a})}):null,u==="buttons"?(0,q.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,q.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:i(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,q.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,q.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:i(()=>L(p.id),"onClick"),children:[p.glyph!==void 0?(0,q.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,q.jsxs)("span",{className:"sekyro-card__body",children:[(0,q.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,q.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,q.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.id))})]})}i(Ir,"kn");s(Ir,"ChoiceScreen");var Ur=["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"];function nt(e){return e!==null&&Ur.includes(e)}i(nt,"he");s(nt,"isVoiceKey");var Nn=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&&Nn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}i(je,"Me");s(je,"resolveClip");var Mn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Ln={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}i(ae,"ne");s(ae,"synth");function jr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}i(jr,"wr");s(jr,"speechAvailable");function Ct(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}i(Ct,"bn");s(Ct,"baseLang");function Lt(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=Ct(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>Ct(a.lang)===r)}i(Lt,"Vn");s(Lt,"pickVoice");function Tr(e){if(!jr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||Lt(t,e)!==void 0}i(Tr,"Mn");s(Tr,"speechUsable");function Pr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}i(Pr,"wn");s(Pr,"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}`}}i($e,"Ke");s($e,"clipIdentity");function wt(e){e.pause(),e.removeAttribute("src"),e.load()}i(wt,"Sn");s(wt,"release");function Br(){let e=null,t=null,n=0,r=null,a=[],o=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,L)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=Lt(a,N);if(a.length===0||j!==void 0){p.cancel();let C=new SpeechSynthesisUtterance(d);C.lang=N,j!==void 0&&(C.voice=j),C.rate=.95,L!==void 0&&(C.onend=C.onerror=L),p.speak(C);return}}L?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let L=$e(N);if(o.has(L))continue;let p=new Audio;p.preload="auto",p.src=N,o.set(L,p)}},"warmClips");return{say(d){let N=d.url!==null?$e(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let L=n,p=d.onEnd,j=p!==void 0?()=>{L===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let C=h();C.pause(),C.muted=!1,C.src=d.url,C.currentTime=0,C.onended=j??null,C.play()?.catch(A=>{L===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:L}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(Mn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let C=ae();if(N&&C!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,C.speak(A)}I(L??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&wt(e),e=null;for(let d of o.values())wt(d);o.clear()}}}i(Br,"Ln");s(Br,"createVoicePlayer");var Rn="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}}i(qr,"xn");s(qr,"readVoicePreference");function Or(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}i(Or,"In");s(Or,"writeVoicePreference");var Ve="capture.tips.summary",An=typeof window<"u"?_.useLayoutEffect:_.useEffect,En=Object.freeze({});function tt(e,t){let n=new Set,r=[];for(let a of Ur){let o=a===Ve?null:je(e,a,t);o===null||n.has($e(o))||(n.add($e(o)),r.push(o))}return r}i(tt,"gt");s(tt,"resolvedClipUrls");function Vr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?Rn:a.storageKey,[l,u]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(l),[h,w]=(0,_.useState)(!1),[x,I]=(0,_.useState)("none"),[d,N]=(0,_.useState)(!1),L=(0,_.useRef)(!1),[p,j]=(0,_.useState)(0),C=(0,_.useRef)(null),A=(0,_.useCallback)(()=>(C.current??(C.current=Br()),C.current),[]),O=Ln[e],H=a.speechFallback,f=H===void 0||H===!0?!0:H===!1?!1:H.includes(e),D=a.clips??t??En,oe=(0,_.useRef)(!1),le=(0,_.useRef)(D);An(()=>{le.current=D,S.current=l}),(0,_.useEffect)(()=>{if(r||o===null)return;let R=qr(o);R!==null&&(S.current=R,u(R))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!f))return Pr(()=>j(R=>R+1))},[r,f]);let c=a.clips;(0,_.useEffect)(()=>{if(r)return;let R=f&&Tr(O);w(tt(D,e).length>0||R),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(D,Ve,e)!==null||R?"default":"none")},[r,D,c,e,f,O,p]),(0,_.useEffect)(()=>{if(r||!l||!oe.current)return;let R=tt(D,e);R.length>0&&A().prefetch(R)},[r,l,D,e,A]),(0,_.useEffect)(()=>()=>{C.current?.dispose(),C.current=null,oe.current=!1},[]);let V=(0,_.useCallback)(R=>{r||(oe.current=!0,A().unlock({lang:O,speech:f,...R?{prefetch:tt(le.current,e)}:{}}))},[r,A,O,f,e]),T=(0,_.useCallback)(()=>V(S.current),[V]),G=(0,_.useCallback)(()=>{L.current=!1,N(!1)},[]),B=(0,_.useCallback)(()=>{G(),C.current?.stop()},[G]),ve=(0,_.useCallback)(()=>{L.current&&B()},[B]),he=(0,_.useCallback)((R,xe)=>{if(r)return;if(L.current){B();return}let ge=A();ge.stop(),L.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:R,lang:O,speech:f,onEnd:G})},[r,B,A,e,O,f,G]),K=(0,_.useCallback)(R=>{r||(R?V(!0):B(),o!==null&&Or(o,R),S.current=R,u(R))},[r,V,B,o]),z=(0,_.useCallback)(()=>K(!S.current),[K]),te=(0,_.useCallback)((R,xe)=>{if(r||!l)return;L.current&&G();let ge=je(le.current,R,e);A().say({url:ge,text:xe,lang:O,speech:f})},[r,l,e,A,O,f,G]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:K,toggle:z,unlock:T,speakKey:te,stop:B,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,K,z,T,te,B,x,d,he,ve])}i(Vr,"ht");s(Vr,"useVoiceGuidance");function $r(e,t,n,r){let{speakKey:a,stop:o,enabled:l}=e,u=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!l){u.current&&o(),u.current=!1;return}u.current=!0,nt(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,o])}i($r,"vt");s($r,"useSpeakGuidance");function at(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"}}i(at,"Pn");s(at,"retryCoachingOf");var Fe={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","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 Fr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Re(),l=(0,st.useRef)(null);return(0,st.useEffect)(()=>{r&&l.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(u=>(0,fe.jsx)("li",{children:o(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}i(Fr,"An");s(Fr,"CapturedPanel");function Rt(){try{return!1}catch{return!1}}i(Rt,"tt");s(Rt,"isDevBuild");var In=(0,Hr.createContext)(null);function Dr({state:e}){let t=Re(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Nr,{}):e==="denied"?(0,we.jsx)(Lr,{}):(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}`)})]})}i(Dr,"Kn");s(Dr,"PermissionRow");function Gr({voice:e}){let t=Re();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:i(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(rt,{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)(Rr,{className:"sekyro-switch__check"}):null})})]})}i(Gr,"Un");s(Gr,"VoiceSwitch");function Kr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Re(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),L=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=L.current;if(L.current=e,f===e)return;let D=p.current;e!=="loading"&&(p.current=!1),zr(I.current)&&(e==="failed"?N.current?.focus():D&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),C=e==="loading",A=C||S,O=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),H;return e==="failed"?H=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):H=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":C?"true":void 0,onClick:O,children:C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ar,{}),w("capture.preparing.title")]}):u??w("capture.start")}),C?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,U.jsx)(Er,{tips:o}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(rt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Dr,{state:n}),(0,U.jsx)(Gr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),H,(0,U.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"):""})]})}i(Kr,"Gn");s(Kr,"PreCaptureScreen");function zr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}i(zr,"Or");s(zr,"focusIsOurs");function Zr(){let[e,t]=(0,ot.useState)({state:"unknown",settled:!1});return(0,ot.useEffect)(()=>Un(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}i(Zr,"Fn");s(Zr,"useCameraStatus");function Qr(e){return At(e,"mobileRequired")}i(Qr,"qn");s(Qr,"useMobileRequired");function Wr(e){return At(e,"returning").required}i(Wr,"Dn");s(Wr,"useReturning");function At(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(l=>{o&&r({required:l===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}i(At,"jn");s(At,"useFlag");function Yr(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,l=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(l=>({...l,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}}i(Yr,"$n");s(Yr,"useCaptureMode");function Jr(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}i(Jr,"zn");s(Jr,"useBusy");var Bn=s(()=>"idle","serverSnapshot");function St(e){return Tn(e!==void 0?{assetBaseUrl:e}:{})}i(St,"Wn");s(St,"preload");function Xr(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>Pn(h,e),[e]),()=>jn(e),Bn),[r,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{St(e).then(h=>{o.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(o.current=!0,l(),()=>{o.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{St(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}i(Xr,"Qn");s(Xr,"useLivenessAssets");var br={progress:0,hint:null,faceDetected:!1};function en(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Rt()&&(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,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(br),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,L]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[C,A]=(0,M.useState)(null),[O,H]=(0,M.useState)(null),[f,D]=(0,M.useState)(null),[oe,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[T,G]=(0,M.useState)(!1),B=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[K,z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},$=r!==void 0?r.liveness(ce):qn(ce);o.current=$;let Ne=s(()=>V($.facingMode??null),"readFacing");Ne();let He=[$.on("state",b=>{b==="mode_switch"?G(!0):b!=="starting"&&b!=="gating"&&G(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,z(Math.max(0,he.current))),H(null),D(null),h(br),d(!1),x(!1),L(null),A(null),B.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),L(null),B.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),$.on("gate",b=>{let ke=B.current;B.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),$.on("frozen",({previewDataUrl:b})=>L(b)),$.on("profile",({animations:b})=>j(b==="reduced")),$.on("ramp",({colour:b})=>A(b)),$.on("captured",b=>{H(b),le(null),te.current.onCaptured?.(b)}),$.on("error",b=>{D(b);let ke=r?.reportCaptureIssue;ke!==void 0&&kt(Ee=>ke.call(r,Ee),gr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of He)b?.();o.current=null,$.destroy()}},[r,t,n]);let R=(0,M.useCallback)(()=>{o.current?.start()},[]),xe=(0,M.useCallback)(()=>{o.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=o.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let $=await ce.setCaptureMode(J).catch(()=>!1)===!0;return $&&V(ce.facingMode??null),$},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:C,artifacts:O,error:f,result:oe,facingMode:c,start:R,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:T,attempt:K}}i(en,"Xn");s(en,"useLivenessHandle");var On=new Set(["national_number"]);function xt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>On.has(n));return t.length>0?{...e,options:t}:null}i(xt,"er");s(xt,"pending");function tn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(xt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(xt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:o,failed:u,select:h}}i(tn,"tr");s(tn,"useMethodChoice");var Vn=["ar","fr","en"];function rn(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}}i(rn,"oo");s(rn,"isClipUrl");function nn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Vn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,l]of Object.entries(a))!nt(o)||!rn(l)||((n[r]??(n[r]={}))[o]=l)}return Object.keys(n).length>0?n:null}i(nn,"so");s(nn,"toVoiceClipMap");function sn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let l=e.on("view",u=>o(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?nn(t):null,[t]);return e===void 0?null:r}i(sn,"nr");s(sn,"useServerVoiceClips");function an({voice:e}){let t=Re();return(0,Nt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:i(()=>e.toggle(),"onClick"),children:(0,Nt.jsx)(rt,{off:!e.enabled,className:"sekyro-icon"})})}i(an,"or");s(an,"VoiceChip");var $n=new Set(["abandoned","not_opened","cancelled","superseded"]),Fn=800;function on(e){return e===void 0||e!==!1&&e.length===_t.length&&_t.every(t=>e.includes(t))}i(on,"uo");s(on,"isDefaultTips");function ln(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}i(ln,"po");s(ln,"carriesActivation");function cn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}i(cn,"fo");s(cn,"isNoticeObject");var Hn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function un(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}i(un,"yo");s(un,"isCapturing");function dn(e){return e==="captured"||e==="uploading"||e==="checking"}i(dn,"go");s(dn,"isPostCapture");function Dn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:L,onError:p,onStateChange:j,assetBaseUrl:C,className:A}){let O=ur(t),H=(0,y.useMemo)(()=>cr(t,r),[t,r,O]),f=(0,y.useMemo)(()=>g=>H[g]??"",[H]),D=n??(t==="ar"?"rtl":"ltr"),oe=(0,y.useRef)(null),le=(0,y.useContext)(In),c=en({verification:e,videoRef:oe,assetBaseUrl:C,onCaptured:N,onResult:L,onError:p,onStateChange:j}),V=Xr(C,c.state==="idle"&&c.error===null),T=tn(e),G=T.choice!==null,B=Qr(e),ve=Wr(e),he=Jr(e),K=Zr(),z=Yr(e),te=z.session==="choice",R=z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=sn(xe?e:void 0),P=Vr({locale:t,defaultClips:ge,options:I}),J=R?"environment":"user",ce=z.settled,$=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),He=(0,y.useRef)(P.unlock);He.current=P.unlock,(0,y.useEffect)(()=>{let g=$.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let Oe of ne)g.removeEventListener(Oe,Le,!0)},"disarm");function Le(Oe){if(Ne.current){Ce();return}ln(Oe)&&(Ne.current=!0,Ce(),He.current())}i(Le,"Re"),s(Le,"onGesture");for(let Oe of ne)g.addEventListener(Oe,Le,{capture:!0,passive:!0});return Ce},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,It=!G&&!B.required&&(o===!0||o==="when-permitted"&&K.permission==="granted"),Ut=It&&T.settled&&B.settled&&ce,fn=o==="when-permitted"&&!K.permissionSettled&&!Ee.current,jt=It&&Pe&&!Ee.current,ct=(fn||jt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ut||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ut,Pe,V.gate,ke]);let mn=Pe&&!G&&!B.required&&!(jt&&V.gate==="ready"),[Tt,Pt]=(0,y.useState)(!1),{canSwitchCaptureMode:Bt,setCaptureMode:qt}=c;(0,y.useEffect)(()=>{if(!z.settled||!te){Pt(!1);return}let g=!0;return Bt().then(ne=>{g&&Pt(ne)}),()=>{g=!1}},[z.settled,te,Bt]);let{choose:Ot}=z,Ie=R?"self":"assisted",yn=(0,y.useCallback)(async()=>{await qt(Ie)&&Ot(Ie)},[qt,Ot,Ie]),Vt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=oe.current?.style;Vt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Vt]);let De=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if(De!==null)return()=>URL.revokeObjectURL(De)},[De]);let $t=c.frozenPreview??De,Ue=e!==void 0,Z=un(c.state),be=dn(c.state),Ge=Z||be,re=c.result,Ft=c.state==="done"&&re!==null,ut=c.state==="recording"&&c.frozenPreview!==null,Ke=le!==null,Ht=Tt&&Z&&!ut?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{yn()},"onSwitch")}:null,ze=c.modeRestarted&&Z?f("capture.modeSwitch.restarted"):null,Be=be||ut,Dt=be?"checking":ut?"frozen":c.state==="recording"?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Ze=Z?c.gate.hint:null,Qe=c.state==="starting"?"capture.preparing.title":Ze===null?null:Ze==="center"&&!c.gate.faceDetected?"fcv3.no_face":ar(Ze),[vn,Gt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Qe!=="fcv3.no_face"){Gt(Qe);return}if(!Z)return;let g=setTimeout(()=>Gt(Qe),Fn);return()=>clearTimeout(g)},[Qe,Z]);let dt=Z&&typeof x=="string"&&x!=="",Kt=R&&Z?f("capture.assisted.stage"):null,Me=Z&&!dt?vn:null,pt=dt?x:Me===null?"":f(Me);$r(P,Me,pt,Z);let zt=(0,y.useRef)(d);zt.current=d,(0,y.useEffect)(()=>{if(nt(Me))try{zt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let qe=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ht=a?.voicePrompt,Zt=ht!==void 0,Qt=I===void 0,Wt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Zt||!Qt||Wt.current||!Rt()||(Wt.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."))},[Zt,Qt]);let gn=ht!==void 0?(g,ne,Ce)=>ht(g,ne,Ce,qe):P.supported?()=>(0,k.jsx)(an,{voice:qe}):void 0,{summary:ft,summaryPlaying:Yt,toggleSummary:Jt,stopSummary:Xt}=P,We=w!==void 0&&w!=="",er=We?w:f("capture.tips.summary"),tr=We?ft!=="none":ft==="partner"||ft==="default"&&on(h),kn=(0,y.useMemo)(()=>tr?{playing:Yt,toggle:s(()=>Jt(er,{clip:!We}),"toggle"),stop:Xt}:void 0,[tr,Yt,Jt,er,Xt,We]),bn=(0,y.useMemo)(()=>({assets:ct,retryAssets:V.retry,permission:K.permission,permissionSettled:K.permissionSettled,captureMode:z.mode,facing:J,voice:qe}),[ct,V.retry,K.permission,K.permissionSettled,z.mode,J,qe]),_n=cn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=Ft&&re.status==="unavailable"&&!G&&re.reasonCode!=="portrait_required"?re:null,_e=Ft&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,mt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Le=or(t,ne);if(Le!==null)return f(Le.key).replace("{time}",Le.time)}let Ce=Xe(g);return Ce===null?null:f(Ce)},"reasonText"),yt=s(g=>{let ne=g.retakeHint===void 0?null:Je(g.retakeHint);return ne===null?mt(g.reasonCode):f(ne)},"retryText"),rr=_e===null?null:mt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&$n.has(_e.reason)?f("errors.session_expired"):null),Cn=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Ye=W?.reasonCode,nr=c.attempt;(0,y.useEffect)(()=>{W===null||Ye===void 0||e?.reportCaptureIssue===void 0||Hn.has(Ye)||kt(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Ye,attempt:Math.min(1e3,nr)})},[W,Ye,nr,e]);let sr=gt(),wn=G&&T.auto===null&&!Z&&!be&&c.error===null,vt=(0,y.useCallback)(async g=>{await T.select(g)&&c.state==="done"&&c.retry()},[T.select,c.state,c.retry]);return(0,y.useEffect)(()=>{T.auto!==null&&!T.busy&&!Z&&!be&&vt(T.auto)},[T.auto,T.busy,Z,be,vt]),(0,k.jsx)(dr,{value:f,children:(0,k.jsxs)("div",{ref:$,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:D,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&yt(ue)!==null&&!(Ke&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:yt(ue)})}):null,ze!==null&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:ze})}):null,he&&be&&!Ke?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,B.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(ir(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:mt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Cn?(0,k.jsx)(X,{ref:sr,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,rr!==null&&_e!==null?(0,k.jsx)(se,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:rr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ke?le({videoRef:oe,guidance:Be&&Ue?f("capture.checking"):pt,coached:dt&&!(Be&&Ue),note:Be?Ue?f(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?yt(ue):Kt),settled:Be&&Ue,progress:c.gate.progress,phase:Dt,still:Be?$t:null,live:Ge,modeSwitch:Ht,...Tt?{status:ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(pr,{videoRef:oe,guidanceText:pt,guidanceHint:Ze,guidanceKey:Me,progress:c.gate.progress,phase:Dt,draining:c.draining,stillUrl:$t,showChecking:Ue,operatorText:Kt,voicePrompt:gn,overlay:i(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(hr,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Ht})}),wn&&T.choice!==null?(0,k.jsx)(Ir,{title:f("method.title"),description:f("method.description"),options:T.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:T.busy,error:T.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:i(g=>{vt(g)},"onChoose")}):null,mn?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,_n,a?.intro!==void 0?a.intro(b,bn):(0,k.jsx)(Kr,{assets:ct,onRetryAssets:V.retry,permission:K.permission,captureMode:z.mode,voice:qe,tips:h??_t,summary:kn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Fr,{showCoaching:ue!==null,coaching:at(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?lr(H,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}i(Dn,"_i");s(Dn,"LivenessCapture");var Et=E(F(),1),lt=E(F(),1),m=E(de(),1);import{isInAppBrowser as Jn}from"@sekyro/web/client";var vs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Gn(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}}i(Gn,"Y");s(Gn,"identityLabel");function Kn(e,t){let[n,r]=(0,Et.useState)(!1),[a,o]=(0,Et.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),o(null),l().then(()=>r(!1),u=>{r(!1),o(e.t(kr(u,e.strings))),t?.(u)})},"run")}}i(Kn,"q");s(Kn,"useChoiceAction");function pn(){let e=`sekyro-face-light-${(0,lt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(pn,"O");s(pn,"FaceMark");var zn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Zn(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}}i(Zn,"te");s(Zn,"faceIntroRetryOf");var Qn={"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 Wn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:l,retry:u}){let S=bt(),{t:h}=S,w=u===void 0?"face":at(u.reason),x=w==="face"?null:Fe[w].tips,I=(0,lt.useContext)(mr)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(pn,{}),t.captureMode==="assisted"?(0,m.jsx)(et,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):o?(0,m.jsx)(et,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(et,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(hn,{retry:u,title:Fe[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Qn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:zn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(fr,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("capture.start")]})})]})}i(Wn,"ne");s(Wn,"FaceIntro");var Yn=new Set(["match_inconclusive","no_face_source","below_threshold"]);function hn({retry:e,title:t}){let n=bt(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":Yn.has(e.reason)?"capture.retryMatch.message":Xe(e.reason);return(0,m.jsxs)(yr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.jsx)("span",{children:vr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}i(hn,"T");s(hn,"RetryNotice");function Xn(e){return Jn(e)}i(Xn,"se");s(Xn,"isInAppBrowser");function es(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`}i(es,"ce");s(es,"androidBrowserIntent");export{Ir as a,Rt as b,In as c,Yr as d,Dn as e,vs as f,Gn as g,Kn as h,Zn as i,Wn as j,Xn as k,es as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as H}from"./chunk-HSQWGTF7.js";import{a as T,b as C,c as D}from"./chunk-JJNFGW3A.js";import{a as s,b as L,c as N,i as u}from"./chunk-RPLVIGTS.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-S6JGFCOP.js";import{a as T,b as C,c as D}from"./chunk-SBJNQYEL.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{d as U}from"./chunk-
|
|
1
|
+
import{d as U}from"./chunk-LHD2PSUM.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-SBJNQYEL.js";import{a as N,c as R,i as d}from"./chunk-SSU37LFQ.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b}from"./chunk-
|
|
1
|
+
import{a as v,b}from"./chunk-SBJNQYEL.js";import{a,c as p,i as d}from"./chunk-SSU37LFQ.js";var r=p(v(),1),o=p(b(),1),m=p(v(),1);import{normalizeNni as C}from"@sekyro/web";function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[y,f]=(0,r.useState)(!1),[h,k]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&k(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let N=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${y&&u===N?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(C(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
|
|
@@ -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-SBJNQYEL.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};
|