@sekyro/elements 0.1.0-rc.27 → 0.1.0-rc.28
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 +8 -0
- package/dist/cdn/chunks/{capture-session-doc-BT2W22H5-TWRWJRRR.js → capture-session-doc-SNOZ6SKC-NQQS4M2G.js} +1 -1
- package/dist/cdn/chunks/{chunk-TV7CW7VL.js → chunk-32LRPMCN.js} +1 -1
- package/dist/cdn/chunks/{chunk-DM2IEIG4.js → chunk-34ROD75I.js} +1 -1
- package/dist/cdn/chunks/{chunk-F4Q2Q4OC.js → chunk-37BKUH3E.js} +1 -1
- package/dist/cdn/chunks/{chunk-IWZRAEUN.js → chunk-5Y7NCFTK.js} +1 -1
- package/dist/cdn/chunks/{chunk-LKG2GOWP.js → chunk-DHNLZ7K6.js} +1 -1
- package/dist/cdn/chunks/{chunk-2RVF3WJ3.js → chunk-EGC3SJDE.js} +1 -1
- package/dist/cdn/chunks/{chunk-2PCS4H3E.js → chunk-FKXVZGAM.js} +1 -1
- package/dist/cdn/chunks/{chunk-JPREVWIF.js → chunk-IB2ADNNH.js} +1 -1
- package/dist/cdn/chunks/{chunk-B737CEIX.js → chunk-IPR33E6C.js} +1 -1
- package/dist/cdn/chunks/chunk-JAO3ZUKP.js +1 -0
- package/dist/cdn/chunks/{chunk-EHVBCFRB.js → chunk-JHQIPL2L.js} +1 -1
- package/dist/cdn/chunks/{chunk-ZYXKVMFC.js → chunk-KEGAMCHW.js} +1 -1
- package/dist/cdn/chunks/{chunk-2IYNWMYV.js → chunk-KQMX2UO4.js} +1 -1
- package/dist/cdn/chunks/{chunk-5H2LBGA7.js → chunk-KU3B6BDD.js} +1 -1
- package/dist/cdn/chunks/{chunk-URRHIQLF.js → chunk-KUUROJLV.js} +2 -2
- package/dist/cdn/chunks/chunk-LL5EZHIM.js +1 -0
- package/dist/cdn/chunks/{chunk-2RXQBUDC.js → chunk-LQOBVF4U.js} +2 -2
- package/dist/cdn/chunks/{chunk-2SXFB7OS.js → chunk-N3OO3ZW5.js} +1 -1
- package/dist/cdn/chunks/{chunk-N6TFSAF3.js → chunk-QP5KJZU7.js} +1 -1
- package/dist/cdn/chunks/chunk-QTYL46IQ.js +1 -0
- package/dist/cdn/chunks/{chunk-66K4ELX6.js → chunk-R3JHFC62.js} +1 -1
- package/dist/cdn/chunks/{chunk-ATYTAIFS.js → chunk-TIVC2P6G.js} +1 -1
- package/dist/cdn/chunks/chunk-XKZZC74I.js +1 -0
- package/dist/cdn/chunks/{chunk-UYEEBLOW.js → chunk-YVMKJQDM.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-R3H5TJD5-FZDYMF5Q.js → create-document-capture-D44AR5OI-R673MW5Y.js} +1 -1
- package/dist/cdn/chunks/{detector-scanic-P2RTEQUV-A5WTP2Q7.js → detector-scanic-3VQFGZAA-NF7AFUUP.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-BXY2GVEJ-QELJLB7A.js +1 -0
- package/dist/cdn/chunks/{eid-view-5M34JRB3-JW2ZYCJG.js → eid-view-BGDCFCPD-WQ74GPTW.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-ULR3QWIN-SSLNYDY6.js → email-otp-view-SVAX2GHU-DOOWUF3B.js} +1 -1
- package/dist/cdn/chunks/{flow-views-V3OXW6PI-COAN2VQJ.js → flow-views-PX5YBDQG-CF4UQQOQ.js} +1 -1
- package/dist/cdn/chunks/{form-view-426ISA4K-AKPX7G27.js → form-view-XNCTRA7M-LOR7RGOY.js} +1 -1
- package/dist/cdn/chunks/overlay-de-WMDVOHQO-2R3CJSPX.js +1 -0
- package/dist/cdn/chunks/overlay-es-IKLVPKGJ-CJZMWE5E.js +1 -0
- package/dist/cdn/chunks/overlay-pt-CYYJMZZA-BWRUQYY5.js +1 -0
- package/dist/cdn/chunks/{plan-runner-EY7VTTUP-RLLA2EQK.js → plan-runner-WNAXF6XR-JCQX3M7K.js} +1 -1
- package/dist/cdn/chunks/{portrait-capture-view-6K6W3USJ-MT7SJLT2.js → portrait-capture-view-BOH77RPB-2LO3FLC5.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-PZQZZCYH-NEHNS5VW.js → portrait-review-view-XVQYL2UA-HG4LWY2D.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-MX5Q2XV2-S4FLPL4A.js → proof-of-address-view-GOIZKE27-PY2P7GIQ.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-GQIZ42ZI.js → chunk-54KY532D.js} +1 -1
- package/dist/{chunk-JRZE2IZT.js → chunk-6PGOITBA.js} +1 -1
- package/dist/chunk-C3VULGQL.js +1 -0
- package/dist/{chunk-CCJXGVIL.js → chunk-ECO4HDPP.js} +1 -1
- package/dist/{chunk-Z5TRMVOP.js → chunk-EWAEIT5N.js} +1 -1
- package/dist/{chunk-KN3AOAYL.js → chunk-H7QTXWQ6.js} +2 -2
- package/dist/{chunk-XDH4CTRQ.js → chunk-HRRDUK2T.js} +1 -1
- package/dist/{chunk-R57PCZSZ.js → chunk-O4E2U4XJ.js} +1 -1
- package/dist/{chunk-JPVADGVQ.js → chunk-QTOUDK6B.js} +1 -1
- package/dist/{chunk-PNC5GJ4N.js → chunk-RNT34HNE.js} +1 -1
- package/dist/{chunk-YQXEEIWM.js → chunk-SDRPWM6A.js} +1 -1
- package/dist/{chunk-C6FGUALJ.js → chunk-TE665WZ6.js} +1 -1
- package/dist/{chunk-FXWTWHNX.js → chunk-V42GSMOG.js} +1 -1
- package/dist/{chunk-G3M7C3QG.js → chunk-XOM2CZTJ.js} +1 -1
- package/dist/define.cjs +1 -1
- package/dist/define.js +1 -1
- package/dist/document-capture-view-BXY2GVEJ-UJA5U7PL.js +1 -0
- package/dist/{eid-view-5M34JRB3-QXLAE3HM.js → eid-view-BGDCFCPD-4QCJD5OL.js} +1 -1
- package/dist/{email-otp-view-ULR3QWIN-UCGDMZIL.js → email-otp-view-SVAX2GHU-VKXK7EDR.js} +1 -1
- package/dist/{flow-views-V3OXW6PI-BFMDN2IB.js → flow-views-PX5YBDQG-X2OMG5AG.js} +1 -1
- package/dist/{form-view-426ISA4K-CTBMZ6MO.js → form-view-XNCTRA7M-KKU5MXJT.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-WMDVOHQO-DVRSDGG3.js +1 -0
- package/dist/overlay-es-IKLVPKGJ-3DJ3PLYT.js +1 -0
- package/dist/overlay-pt-CYYJMZZA-PLJSYGKU.js +1 -0
- package/dist/{portrait-capture-view-6K6W3USJ-IHLY62OK.js → portrait-capture-view-BOH77RPB-PN5ML6HU.js} +1 -1
- package/dist/{portrait-review-view-PZQZZCYH-WJPV3V7H.js → portrait-review-view-XVQYL2UA-R7GFI56G.js} +1 -1
- package/dist/{proof-of-address-view-MX5Q2XV2-NADFPD37.js → proof-of-address-view-GOIZKE27-KSBLMUVS.js} +1 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-35AXFJCG.js +0 -1
- package/dist/cdn/chunks/chunk-FCQZZSGE.js +0 -1
- package/dist/cdn/chunks/chunk-IJKJJDVP.js +0 -1
- package/dist/cdn/chunks/chunk-ZEUQQLSO.js +0 -1
- package/dist/cdn/chunks/document-capture-view-RR4DTGYF-DE3CFMWM.js +0 -1
- package/dist/cdn/chunks/overlay-de-OWNOVFUK-G2EPYZKC.js +0 -1
- package/dist/cdn/chunks/overlay-es-POP2QZLC-6H5GQA7F.js +0 -1
- package/dist/cdn/chunks/overlay-pt-IKCWBDLR-4R2H3Y7Q.js +0 -1
- package/dist/chunk-RDCMAYQA.js +0 -1
- package/dist/document-capture-view-RR4DTGYF-5PXLLNJY.js +0 -1
- package/dist/overlay-de-OWNOVFUK-QY6M35JN.js +0 -1
- package/dist/overlay-es-POP2QZLC-325Q4JIU.js +0 -1
- package/dist/overlay-pt-IKCWBDLR-2YDKPIHK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as ee,b as he,c as pe,d as ye,e as be}from"./chunk-JRZE2IZT.js";import{a as Z}from"./chunk-P223YKM3.js";import{a as fe}from"./chunk-RDCMAYQA.js";import"./chunk-G3M7C3QG.js";import{K as ue,a as J,b as X,c as de,w as ce,y as me}from"./chunk-Z5TRMVOP.js";import{a as s,c as U,i as c}from"./chunk-SSU37LFQ.js";var S=U(J(),1),E=U(J(),1),f=U(X(),1),F=U(J(),1),g=U(X(),1),l=U(X(),1);import{FormAnswersError as Pe}from"@sekyro/web";import{filterRemoteOptions as Re,FORM_ANSWER_LIMITS as ve}from"@sekyro/web";var Ee={"form.title":"بضعة أسئلة","form.lead":"تطلب منك {org} الإجابة عن هذه الأسئلة.","form.optional":"اختياري","form.continue":"متابعة","form.sending":"جارٍ إرسال إجاباتك…","form.yes":"نعم","form.no":"لا","form.chooseAny":"اختر كل ما ينطبق","form.choose":"اختر","form.openLink":"يُفتح في علامة تبويب جديدة","form.consents":"موافقتك","form.remote.other":"أخرى","form.remote.otherField":"إجابتك","form.remote.filter":"ابحث في الخيارات","form.remote.noMatch":"لا يوجد خيار يطابق بحثك","form.date.day":"اليوم","form.date.month":"الشهر","form.date.year":"السنة","form.fields.full_name.label":"الاسم الكامل","form.fields.full_name.help":"اسمك واسم عائلتك كما تكتبهما عادةً","form.fields.birth_date.label":"تاريخ الميلاد","form.fields.email.label":"البريد الإلكتروني","form.fields.phone.label":"رقم الهاتف","form.fields.address.label":"العنوان","form.fields.address.help":"مكان سكنك الحالي","form.fields.country.label":"البلد","form.fields.occupation.label":"المهنة","form.address.line1":"الشارع والرقم","form.address.line2":"تفاصيل إضافية للعنوان","form.address.city":"المدينة","form.address.postcode":"الرمز البريدي","form.address.country":"البلد","form.address.addLine":"أضف سطرًا","form.phoneCountry":"رمز البلد","form.errors.summary":"راجع الإجابات المشار إليها أدناه.","form.errors.required":"أجب عن هذا السؤال للمتابعة","form.errors.choiceRequired":"اختر إجابة للمتابعة","form.errors.consentRequired":"حدّد هذا المربع للمتابعة","form.errors.tooLong":"اختصر إجابتك إلى {max} حرفًا أو أقل","form.errors.tooShort":"أدخل {min} أحرف على الأقل","form.errors.email":"أدخل عنوان بريد إلكتروني كاملًا يتضمن @ ونطاقًا","form.errors.phone":"أدخل الرقم دون رمز البلد، بالأرقام فقط","form.errors.date":"أدخل تاريخًا صحيحًا: اليوم والشهر والسنة","form.errors.datePast":"أدخل تاريخًا في الماضي","form.errors.dateFuture":"أدخل تاريخًا في المستقبل","form.errors.dateMin":"أدخل تاريخًا في {date} أو بعده","form.errors.dateMax":"أدخل تاريخًا في {date} أو قبله","form.errors.number":"أدخل عددًا بالأرقام","form.errors.numberInteger":"أدخل عددًا صحيحًا","form.errors.numberDecimals":"استخدم منزلتين عشريتين على الأكثر","form.errors.numberMin":"أدخل {min} أو أكثر","form.errors.numberMax":"أدخل {max} أو أقل","form.errors.choice":"اختر إحدى الإجابات المعروضة","form.errors.cardNumber":"لا تُدخل رقم بطاقة هنا.","form.errors.address":"أدخل الشارع والمدينة والبلد","form.errors.failed":"تعذّر إرسال إجاباتك. تحقّق من اتصالك وحاول مرة أخرى","form.remote.results.one":"خيار واحد","form.remote.results.two":"خياران","form.remote.results.few":"{count} خيارات","form.remote.results.many":"{count} خيارًا","form.remote.results.other":"{count} خيار"},H={"form.title":"A few questions","form.lead":"{org} asks you to answer these questions.","form.optional":"optional","form.continue":"Continue","form.sending":"Sending your answers…","form.yes":"Yes","form.no":"No","form.chooseAny":"Choose all that apply","form.choose":"Choose","form.openLink":"Opens in a new tab","form.consents":"Your consent","form.remote.other":"Other","form.remote.otherField":"Your answer","form.remote.filter":"Search the options","form.remote.noMatch":"No option matches your search","form.date.day":"Day","form.date.month":"Month","form.date.year":"Year","form.fields.full_name.label":"Full name","form.fields.full_name.help":"Your first and last names, as you usually write them","form.fields.birth_date.label":"Date of birth","form.fields.email.label":"Email address","form.fields.phone.label":"Phone number","form.fields.address.label":"Address","form.fields.address.help":"Where you live now","form.fields.country.label":"Country","form.fields.occupation.label":"Occupation","form.address.line1":"Street and number","form.address.line2":"More address details","form.address.city":"City or town","form.address.postcode":"Postal code","form.address.country":"Country","form.address.addLine":"Add a line","form.phoneCountry":"Country code","form.errors.summary":"Check the answers marked below.","form.errors.required":"Answer this question to continue","form.errors.choiceRequired":"Choose an answer to continue","form.errors.consentRequired":"Tick this box to continue","form.errors.tooLong":"Shorten your answer to {max} characters or fewer","form.errors.tooShort":"Enter at least {min} characters","form.errors.email":"Enter a full email address, with @ and a domain","form.errors.phone":"Enter the number without the country code, digits only","form.errors.date":"Enter a real date: day, month and year","form.errors.datePast":"Enter a date in the past","form.errors.dateFuture":"Enter a date in the future","form.errors.dateMin":"Enter a date on or after {date}","form.errors.dateMax":"Enter a date on or before {date}","form.errors.number":"Enter a number, using digits","form.errors.numberInteger":"Enter a whole number","form.errors.numberDecimals":"Use at most 2 decimals","form.errors.numberMin":"Enter {min} or more","form.errors.numberMax":"Enter {max} or less","form.errors.choice":"Choose one of the answers listed","form.errors.cardNumber":"Do not enter a card number here.","form.errors.address":"Enter the street, the city and the country","form.errors.failed":"We could not send your answers. Check your connection and try again","form.remote.results.one":"{count} option","form.remote.results.other":"{count} options"},Oe={"form.title":"Quelques questions","form.lead":"{org} vous demande de répondre à ces questions.","form.optional":"facultatif","form.continue":"Continuer","form.sending":"Envoi de vos réponses…","form.yes":"Oui","form.no":"Non","form.chooseAny":"Choisissez toutes les réponses qui s’appliquent","form.choose":"Choisir","form.openLink":"S’ouvre dans un nouvel onglet","form.consents":"Votre consentement","form.remote.other":"Autre","form.remote.otherField":"Votre réponse","form.remote.filter":"Rechercher parmi les options","form.remote.noMatch":"Aucune option ne correspond à votre recherche","form.date.day":"Jour","form.date.month":"Mois","form.date.year":"Année","form.fields.full_name.label":"Nom complet","form.fields.full_name.help":"Vos prénoms et nom, comme vous les écrivez d’habitude","form.fields.birth_date.label":"Date de naissance","form.fields.email.label":"Adresse e-mail","form.fields.phone.label":"Numéro de téléphone","form.fields.address.label":"Adresse","form.fields.address.help":"Là où vous habitez aujourd’hui","form.fields.country.label":"Pays","form.fields.occupation.label":"Profession","form.address.line1":"Rue et numéro","form.address.line2":"Complément d’adresse","form.address.city":"Ville","form.address.postcode":"Code postal","form.address.country":"Pays","form.address.addLine":"Ajouter une ligne","form.phoneCountry":"Indicatif du pays","form.errors.summary":"Vérifiez les réponses signalées ci-dessous.","form.errors.required":"Répondez à cette question pour continuer","form.errors.choiceRequired":"Choisissez une réponse pour continuer","form.errors.consentRequired":"Cochez cette case pour continuer","form.errors.tooLong":"Raccourcissez votre réponse à {max} caractères au plus","form.errors.tooShort":"Saisissez au moins {min} caractères","form.errors.email":"Saisissez une adresse e-mail complète, avec @ et un domaine","form.errors.phone":"Saisissez le numéro sans l’indicatif, en chiffres seulement","form.errors.date":"Saisissez une date réelle : jour, mois et année","form.errors.datePast":"Saisissez une date passée","form.errors.dateFuture":"Saisissez une date à venir","form.errors.dateMin":"Saisissez une date à partir du {date}","form.errors.dateMax":"Saisissez une date jusqu’au {date}","form.errors.number":"Saisissez un nombre, en chiffres","form.errors.numberInteger":"Saisissez un nombre entier","form.errors.numberDecimals":"Utilisez au plus 2 décimales","form.errors.numberMin":"Saisissez {min} ou plus","form.errors.numberMax":"Saisissez {max} ou moins","form.errors.choice":"Choisissez une des réponses proposées","form.errors.cardNumber":"N’indiquez pas de numéro de carte ici.","form.errors.address":"Indiquez la rue, la ville et le pays","form.errors.failed":"Nous n’avons pas pu envoyer vos réponses. Vérifiez votre connexion et réessayez","form.remote.results.one":"{count} option","form.remote.results.other":"{count} options"};function Y(e){return e.replace(/[٠-٩۰-۹]/g,r=>String((r.charCodeAt(0)&15)%10))}s(Y,"G");c(Y,"westernDigits");function ie(){let e=(0,E.useId)();return{control:`${e}-c`,help:`${e}-h`,error:`${e}-e`}}s(ie,"ee");c(ie,"useFieldIds");function D(e,r,o){return[r?e.help:null,o?e.error:null].filter(t=>t!==null).join(" ")||void 0}s(D,"E");c(D,"describedBy");function K({text:e,lang:r,optional:o}){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{lang:r?.lang,dir:r?.dir,children:e}),o!==null?(0,f.jsx)("span",{className:"sekyro-form-optional",children:` (${o})`}):null]})}s(K,"Z");c(K,"LabelText");function se({ids:e,help:r,helpLang:o,error:t}){return(0,f.jsxs)(f.Fragment,{children:[r!==void 0?(0,f.jsx)("span",{className:"sekyro-help",id:e.help,lang:o?.lang,dir:o?.dir,children:r}):null,t?(0,f.jsx)("span",{className:"sekyro-help is-danger",id:e.error,role:"alert",children:t}):null]})}s(se,"re");c(se,"FieldNotes");function R({ids:e,label:r,children:o,notes:t}){return(0,f.jsxs)("div",{className:"sekyro-field sekyro-form-q",children:[(0,f.jsx)("label",{className:"sekyro-label",id:`${e.control}-l`,htmlFor:e.control,children:r}),o,t]})}s(R,"T");c(R,"Field");function V({legend:e,children:r,notes:o,invalid:t,describedby:n}){return(0,f.jsxs)("fieldset",{className:`sekyro-form-q sekyro-form-group${t?" is-invalid":""}`,"aria-describedby":n,children:[(0,f.jsx)("legend",{className:"sekyro-label",children:e}),r,o]})}s(V,"V");c(V,"Group");function ke(e){let r={ArrowDown:1,ArrowUp:-1,ArrowRight:1,ArrowLeft:-1}[e.key];if(r===void 0)return;getComputedStyle(e.currentTarget).direction==="rtl"&&(e.key==="ArrowRight"||e.key==="ArrowLeft")&&(r=-r);let o=e.currentTarget.closest("fieldset"),t=o===null?[]:Array.from(o.querySelectorAll('input[type="checkbox"]')),n=t.indexOf(e.currentTarget),a=t[(n+r+t.length)%t.length];a!==void 0&&(e.preventDefault(),a.focus())}s(ke,"Ie");c(ke,"moveInGroup");function oe({name:e,type:r,options:o,value:t,onChange:n,required:a,invalid:m,describedby:k}){let q=Array.isArray(t)?t:t===null?[]:[t];return(0,f.jsx)("div",{className:"sekyro-form-choices",children:o.map(h=>{let i=q.includes(h.value);return(0,f.jsxs)("label",{className:"sekyro-form-choice",children:[(0,f.jsx)("input",{type:r,name:e,value:h.value,checked:i,required:r==="radio"?a:void 0,"aria-invalid":m||void 0,"aria-describedby":k,onKeyDown:r==="checkbox"?ke:void 0,onChange:s(()=>{n(r==="radio"?h.value:i?q.filter(y=>y!==h.value):[...q,h.value])},"onChange")}),(0,f.jsx)("span",{lang:h.lang?.lang,dir:h.lang?.dir,children:h.label})]},h.value)})})}s(oe,"oe");c(oe,"ChoiceList");function te(e){let[r,o,t]=[e.day,e.month,e.year].map(n=>Y(n).trim());if(!(r===""&&o===""&&t===""))return`${(t??"").padStart(4,"0")}-${(o??"").padStart(2,"0")}-${(r??"").padStart(2,"0")}`}s(te,"ne");c(te,"dateValue");function ne(e){let r=typeof e=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(e):null;return r===null?{day:"",month:"",year:""}:{day:String(Number(r[3])),month:String(Number(r[2])),year:r[1]}}s(ne,"te");c(ne,"dateParts");function _e(e,r,o,t=new Date().getUTCFullYear()){if(r==="")return!1;let n=Number(r);return e==="day"?!(n>=1&&n<=31):e==="month"?!(n>=1&&n<=12):r.length!==4||n<1900||n>(o?t:2100)}s(_e,"xe");c(_e,"datePartBad");function ae({ids:e,parts:r,onChange:o,labels:t,required:n,invalid:a,birthday:m,onPartBlur:k,onLeave:q}){let h=c(y=>{let _=y.target.dataset.part;_!==void 0&&k(_),y.currentTarget.contains(y.relatedTarget)||q()},"onBlur"),i=c((y,_)=>(0,f.jsxs)("div",{className:`sekyro-form-date__${y}`,children:[(0,f.jsx)("label",{className:"sekyro-help",htmlFor:`${e.control}-${y}`,children:t[y]}),(0,f.jsx)("input",{id:`${e.control}-${y}`,"data-part":y,className:"sekyro-input",type:"text",inputMode:"numeric",dir:"ltr",maxLength:_,autoComplete:m?`bday-${y}`:"off",required:n,"aria-invalid":a||void 0,"aria-describedby":D(e,!1,a),value:r[y],onChange:s(A=>o({...r,[y]:Y(A.target.value).replace(/\D/g,"")}),"onChange")})]}),"cell");return(0,f.jsxs)("div",{className:"sekyro-form-date",onBlur:h,children:[i("day",2),i("month",2),i("year",4)]})}s(ae,"se");c(ae,"DateInputs");function Ce(e){return(0,E.useMemo)(()=>{let r=[];for(let t=65;t<=90;t++)for(let n=65;n<=90;n++){let a=String.fromCharCode(t,n);ee(a)!==void 0&&a!=="AC"&&a!=="TA"&&r.push(a)}let o=new Intl.Collator(e);return r.map(t=>({code:t,name:Z(t,e)})).sort((t,n)=>o.compare(t.name,n.name))},[e])}s(Ce,"Me");c(Ce,"useCountries");function le({id:e,labelId:r,value:o,onChange:t,locale:n,placeholder:a,searchLabel:m,searchPlaceholder:k,noMatch:q,invalid:h,describedby:i}){let y=Ce(n),[_,A]=(0,E.useState)(!1),z=(0,E.useRef)(null),P=(0,E.useRef)(null),p=(0,E.useId)(),M=`${e}-v`,L=y.find(b=>b.code===o),O=c(()=>{A(!1),requestAnimationFrame(()=>z.current?.focus())},"close");return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("button",{ref:z,id:e,type:"button",className:"sekyro-input sekyro-form-country","aria-labelledby":`${r} ${M}`,"aria-expanded":_,"aria-controls":_?p:void 0,"aria-invalid":h||void 0,"aria-describedby":i,onClick:s(()=>{A(b=>!b),_||requestAnimationFrame(()=>P.current?.focus())},"onClick"),children:L!==void 0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:pe(L.code)}),(0,f.jsx)("span",{className:"sekyro-form-country__name",id:M,children:L.name})]}):(0,f.jsx)("span",{className:"sekyro-form-country__name is-empty",id:M,children:a})}),_?(0,f.jsx)("div",{id:p,className:"sekyro-form-country__list",onKeyDown:s(b=>{b.key==="Escape"&&(b.preventDefault(),O())},"onKeyDown"),children:(0,f.jsx)(he,{countries:y,label:(0,f.jsx)("span",{className:"sekyro-visually-hidden",children:m}),searchPlaceholder:k,noMatch:q,selected:o,searchRef:P,scroll:!0,onPick:s(b=>{t(b),O()},"onPick")})}):null]})}s(le,"ae");c(le,"CountryField");var T="\0other",ge,re;function Ne(e){let[r,o]=(0,F.useState)(ge);return(0,F.useEffect)(()=>{if(!e||r!==void 0)return;let t=!0;return re??(re=import("./icons-form-R366YPMB-KUTXHC7X.js").then(n=>ge=n.FORM_OPTION_ICON_PATHS)),re.then(n=>t&&o(n)).catch(()=>{}),()=>{t=!1}},[e,r]),r}s(Ne,"Te");c(Ne,"useOptionIcons");function qe({icon:e,imageUrl:r,icons:o}){let[t,n]=(0,F.useState)(!1);if(r!==void 0&&!t)return(0,g.jsx)("img",{className:"sekyro-form-card__picture",src:r,alt:"",loading:"lazy",decoding:"async",onError:s(()=>n(!0),"onError")});let a=e!==void 0?o?.[e]:void 0;return a===void 0?null:(0,g.jsx)("span",{className:"sekyro-form-card__icon","aria-hidden":"true",children:(0,g.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",strokeWidth:1.5,focusable:"false",dangerouslySetInnerHTML:{__html:a}})})}s(qe,"qe");c(qe,"OptionPicture");function xe({name:e,labelId:r,remote:o,draft:t,onChange:n,required:a,invalid:m,describedby:k,client:q,copy:h}){let[i,y]=(0,F.useState)(""),_=(0,F.useId)(),A=(0,F.useId)(),z=(0,F.useRef)(null),[P,p]=(0,F.useState)(!1),M=o.options.length>ve.remoteFilterAbove,L=(0,F.useMemo)(()=>M?Re(o.options,i):o.options,[o.options,i,M]),O=o.otherLabel??h.other,b=Ne(o.options.some(u=>u.icon!==void 0));(0,F.useEffect)(()=>{P&&(z.current?.focus(),p(!1))},[P]);let x=c(u=>{u===T?(n({pick:T,other:t.other}),p(!0)):n({pick:u,other:""})},"pick");return(0,g.jsxs)("div",{className:"sekyro-form-remote",children:[M?(0,g.jsxs)("div",{className:"sekyro-field sekyro-form-remote__filter",children:[(0,g.jsx)("label",{className:"sekyro-help",htmlFor:_,children:h.filter}),(0,g.jsx)("input",{id:_,className:"sekyro-input",type:"search",autoComplete:"off",value:i,onChange:s(u=>y(u.target.value),"onChange")}),(0,g.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:i.trim()===""?"":h.results(L.length)})]}):null,(0,g.jsxs)("div",{className:"sekyro-form-cards",role:"radiogroup","aria-labelledby":r,"aria-required":a||void 0,"aria-invalid":m||void 0,"aria-describedby":k,children:[L.map(u=>{let I=t.pick===u.value;return(0,g.jsxs)("label",{className:"sekyro-form-card","data-value":u.value,children:[(0,g.jsx)("input",{type:"radio",name:e,value:u.value,checked:I,required:a,"aria-invalid":m||void 0,onChange:s(()=>x(u.value),"onChange")}),(0,g.jsx)(qe,{icon:u.icon,imageUrl:u.imageUrl,icons:b}),(0,g.jsxs)("span",{className:"sekyro-form-card__text",lang:q.lang,children:[u.title!==void 0?(0,g.jsx)("span",{className:"sekyro-form-card__title",dir:"auto",children:u.title}):null,(0,g.jsx)("span",{className:"sekyro-form-card__label",dir:"auto",children:u.label}),u.description!==void 0?(0,g.jsx)("span",{className:"sekyro-form-card__description",dir:"auto",children:u.description}):null]})]},u.value)}),M&&L.length===0&&!o.allowOther?(0,g.jsx)("p",{className:"sekyro-help sekyro-form-remote__none",children:h.noMatch}):null,o.allowOther?(0,g.jsxs)("label",{className:"sekyro-form-card sekyro-form-card--other",children:[(0,g.jsx)("input",{type:"radio",name:e,value:T,checked:t.pick===T,required:a,"aria-invalid":m||void 0,onChange:s(()=>x(T),"onChange")}),(0,g.jsx)("span",{className:"sekyro-form-card__text",children:(0,g.jsx)("span",{className:"sekyro-form-card__label",dir:"auto",lang:o.otherLabel!==void 0?q.lang:void 0,children:O})})]}):null]}),t.pick===T?(0,g.jsxs)("div",{className:"sekyro-field sekyro-form-remote__other",children:[(0,g.jsx)("label",{className:"sekyro-help",htmlFor:A,children:o.otherLabel??h.otherField}),(0,g.jsx)("input",{id:A,ref:z,className:"sekyro-input",type:"text",autoComplete:"off",maxLength:ve.remoteOther,required:a,"aria-invalid":m||void 0,"aria-describedby":k,value:t.other,onChange:s(u=>n({pick:T,other:u.target.value}),"onChange")})]}):null]})}s(xe,"Se");c(xe,"OptionCardList");var De={en:H,fr:Oe,ar:Ee,es:H,pt:H,de:H};function we(e){let r=e.strings,o=De[e.locale];return(t,n)=>fe(r[t]??o[t]??"",n)}s(we,"Be");c(we,"formCopy");var Te=new Set(["single_choice","multiple_choice","yes_no","remote_choice"]),je=c(e=>e.kind==="field"?e.field==="country":Te.has(e.type),"isChoice");function Se(e,r,o){if(e.kind==="field")switch(e.field){case"birth_date":return ne(r);case"phone":return typeof r=="string"?r:"";case"address":{let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{};return{line1:t.lines?.[0]??"",line2:t.lines?.slice(1).join(", ")??"",city:t.city??"",postcode:t.postcode??"",country:t.country??o}}default:return typeof r=="string"?r:""}switch(e.type){case"multiple_choice":return Array.isArray(r)?r:[];case"yes_no":return typeof r=="boolean"?r:null;case"single_choice":return typeof r=="string"?r:null;case"date":return ne(r);case"number":return typeof r=="number"?String(r):"";case"remote_choice":return{pick:null,other:""};default:return typeof r=="string"?r:""}}s(Se,"Ke");c(Se,"draftOf");function Me(e,r){if(e.kind==="field")switch(e.field){case"birth_date":return te(r);case"phone":return r||void 0;case"address":{let o=r,t=[o.line1,o.line2].map(n=>n.trim()).filter(n=>n!=="");return t.length===0&&o.city.trim()===""&&o.postcode.trim()===""?void 0:{country:o.country,city:o.city.trim(),lines:t,...o.postcode.trim()!==""?{postcode:o.postcode.trim()}:{}}}case"email":return r.trim().toLowerCase()||void 0;default:return r.trim()||void 0}switch(e.type){case"multiple_choice":return r.length>0?r:void 0;case"yes_no":return typeof r=="boolean"?r:void 0;case"single_choice":return typeof r=="string"?r:void 0;case"date":return te(r);case"remote_choice":{let o=r;return o.pick===null?void 0:o.pick===T?{other:o.other.trim()}:o.pick}case"number":{let o=Y(r).replace(/[\s ]/g,"").replace(/[,٫]/g,".");if(o==="")return;let t=Number(o);return Number.isFinite(t)&&/^-?\d+(\.\d+)?$/.test(o)?t:Number.NaN}default:return r.trim()||void 0}}s(Me,"Ye");c(Me,"answerOf");function Ae(e,r,o,t){let n=c(m=>{try{return new Intl.DateTimeFormat(t,{dateStyle:"long",timeZone:"UTC"}).format(new Date(`${String(m)}T00:00:00Z`))}catch{return String(m)}},"date"),a=e.params??{};switch(e.code){case"required":return o(r!==void 0&&je(r)?"form.errors.choiceRequired":"form.errors.required");case"consent_required":return o("form.errors.consentRequired");case"too_long":return o("form.errors.tooLong",{max:Number(a.max??0)});case"too_short":return o("form.errors.tooShort",{min:Number(a.min??0)});case"email_invalid":return o("form.errors.email");case"phone_invalid":return o("form.errors.phone");case"date_invalid":return o("form.errors.date");case"date_not_past":return o("form.errors.datePast");case"date_not_future":return o("form.errors.dateFuture");case"date_too_early":return o("form.errors.dateMin",{date:n(a.date)});case"date_too_late":return o("form.errors.dateMax",{date:n(a.date)});case"number_invalid":return o("form.errors.number");case"number_not_integer":return o("form.errors.numberInteger");case"number_decimals":return o("form.errors.numberDecimals");case"number_too_small":return o("form.errors.numberMin",{min:new Intl.NumberFormat(t).format(Number(a.min??0))});case"number_too_large":return o("form.errors.numberMax",{max:new Intl.NumberFormat(t).format(Number(a.max??0))});case"address_invalid":return o("form.errors.address");case"card_number":return o("form.errors.cardNumber");default:return o("form.errors.choice")}}s(Ae,"Ue");c(Ae,"issueText");var W={full_name:200,occupation:120,email:254,short_text:120,long_text:1e3};function Fe(e,r){let o=new Intl.PluralRules(r);return{other:e("form.remote.other"),otherField:e("form.remote.otherField"),filter:e("form.remote.filter"),results:c(t=>e(`form.remote.results.${o.select(t)}`,{count:t})||e("form.remote.results.other",{count:t}),"results"),noMatch:e("form.remote.noMatch")}}s(Fe,"je");c(Fe,"remoteCopy");function Ve({step:e,i18n:r,onError:o}){let t=we(r),{form:n}=e,a={lang:n.locale,dir:e.dir},m=typeof n.prefill?.country=="string"?n.prefill.country:"",[k,q]=(0,S.useState)(()=>Object.fromEntries(n.questions.map(d=>[d.id,Se(d,n.prefill?.[d.id],m)]))),[h,i]=(0,S.useState)({}),[y,_]=(0,S.useState)([]),[A,z]=(0,S.useState)(!1),[P,p]=(0,S.useState)(!1),[M,L]=(0,S.useState)(0),O=(0,S.useRef)(null),b=(0,S.useId)();(0,S.useEffect)(()=>{M!==0&&O.current?.querySelector('[aria-invalid="true"]')?.focus()},[M]);let x=c(d=>{let N=y.find(C=>C.id===d);return N===void 0?null:Ae(N,n.questions.find(C=>C.id===d),t,r.locale)},"errorOf"),u=c((d,N)=>{q(C=>({...C,[d]:N})),_(C=>C.filter($=>$.id!==d))},"set"),I=c(()=>{let d={};for(let N of n.questions){let C=Me(N,k[N.id]??null);C!==void 0&&(d[N.id]=C)}return{answers:d,consents:Object.fromEntries(n.consents.map(N=>[N.id,h[N.id]===!0]))}},"input"),j=c(d=>{let N=e.validate(I()).filter(C=>C.id===d&&C.code!=="required");_(C=>[...C.filter($=>$.id!==d),...N])},"checkOne"),v=c(d=>{if(d.preventDefault(),A)return;let N=I(),C=e.validate(N);if(C.length>0){_(C),L($=>$+1);return}z(!0),p(!1),e.submit(N).catch($=>{o?.($);let B=($ instanceof Pe||$?.name==="FormAnswersError"?$.issues:null)?.filter(G=>n.questions.some(Q=>Q.id===G.id)||n.consents.some(Q=>Q.id===G.id))??[];B.length>0?(_(B),L(G=>G+1)):p(!0)}).finally(()=>z(!1))},"onSubmit"),w=c(d=>d?null:t("form.optional"),"optional");return(0,l.jsxs)("form",{ref:O,className:"sekyro-step sekyro-form","aria-labelledby":b,onSubmit:v,noValidate:!0,"data-testid":"sekyro-form-step",children:[(0,l.jsx)(ce,{id:b,title:n.title??t("form.title"),lead:n.intro??t("form.lead",{org:e.context.orgName}),lang:{...n.title!==void 0?{title:n.locale}:{},...n.intro!==void 0?{lead:n.locale}:{},dir:e.dir}}),P?(0,l.jsx)(ue,{tone:"danger",children:(0,l.jsx)("span",{children:t("form.errors.failed")})}):null,(0,l.jsx)("div",{className:"sekyro-form-questions",children:n.questions.map(d=>(0,l.jsx)(Le,{q:d,draft:k[d.id]??null,onChange:s(N=>u(d.id,N),"onChange"),error:x(d.id),optional:w(d.required),c:t,locale:r.locale,client:a,fallbackCountry:m,onCheck:s(()=>j(d.id),"onCheck")},d.id))}),n.consents.length>0?(0,l.jsxs)("fieldset",{className:"sekyro-form-q sekyro-form-group sekyro-form-consents",children:[(0,l.jsx)("legend",{className:"sekyro-label",children:t("form.consents")}),n.consents.map(d=>(0,l.jsx)($e,{id:d.id,text:d.text,link:d.link,required:d.required,checked:h[d.id]===!0,onChange:s(N=>{i(C=>({...C,[d.id]:N})),_(C=>C.filter($=>$.id!==d.id))},"onChange"),error:x(d.id),optional:w(d.required),openLink:t("form.openLink"),client:a},d.id))]}):null,(0,l.jsxs)(me,{children:[(0,l.jsx)(de,{type:"submit",full:!0,disabled:A,"aria-busy":A||void 0,"data-testid":"sekyro-form-continue",children:t(A?"form.sending":"form.continue")}),(0,l.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:A?t("form.sending"):""})]})]})}s(Ve,"Mr");c(Ve,"FormView");function $e({id:e,text:r,link:o,required:t,checked:n,onChange:a,error:m,optional:k,openLink:q,client:h}){let i=ie();return(0,l.jsxs)("div",{className:"sekyro-form-consent","data-consent":e,children:[(0,l.jsxs)("div",{className:"sekyro-form-choice sekyro-form-consent__row",children:[(0,l.jsx)("input",{id:i.control,type:"checkbox",checked:n,required:t,"aria-invalid":m!==null||void 0,"aria-describedby":D(i,!1,m!==null),onChange:s(y=>a(y.target.checked),"onChange")}),(0,l.jsxs)("span",{className:"sekyro-form-consent__text",children:[(0,l.jsx)("label",{htmlFor:i.control,children:(0,l.jsx)(K,{text:r,lang:h,optional:k})}),o!==void 0?(0,l.jsxs)("a",{className:"sekyro-link sekyro-form-consent__link",href:o.url,target:"_blank",rel:"noopener noreferrer",lang:h.lang,dir:h.dir,children:[o.label,(0,l.jsxs)("span",{className:"sekyro-visually-hidden",children:[" (",q,")"]})]}):null]})]}),(0,l.jsx)(se,{ids:i,error:m})]})}s($e,"We");c($e,"Consent");function Le({q:e,draft:r,onChange:o,error:t,optional:n,c:a,locale:m,client:k,fallbackCountry:q,onCheck:h}){let i=ie(),[y,_]=(0,S.useState)(()=>new Set),A=e.kind==="field"&&e.field==="birth_date",z=(A||e.kind==="custom"&&e.type==="date")&&[...y].some(v=>_e(v,Y(r[v]??""),A)),P=t??(z?a("form.errors.date"):null),p=P!==null,M=e.kind==="custom"?e:null,L=M!==null?M.help:e.kind==="field"&&(e.field==="full_name"||e.field==="address")?a(`form.fields.${e.field}.help`):void 0,O=M!==null?k:void 0,b=M!==null?(0,l.jsx)(K,{text:M.label,lang:k,optional:n}):(0,l.jsx)(K,{text:a(`form.fields.${e.kind==="field"?e.field:""}.label`),optional:n}),x=(0,l.jsx)(se,{ids:i,help:L,helpLang:O,error:P}),u=D(i,L!==void 0,p),I=c(v=>v.long===!0?(0,l.jsx)("textarea",{id:i.control,className:"sekyro-input sekyro-form-textarea",rows:4,maxLength:v.max,required:e.required,"aria-invalid":p||void 0,"aria-describedby":u,value:r,onChange:s(w=>o(w.target.value),"onChange")}):(0,l.jsx)("input",{id:i.control,className:"sekyro-input",type:v.type??"text",inputMode:v.inputMode,autoComplete:v.autoComplete??"off",dir:v.dir,maxLength:v.max,required:e.required,"aria-invalid":p||void 0,"aria-describedby":u,value:r,onChange:s(w=>o(w.target.value),"onChange")}),"text");if(e.kind==="field")switch(e.field){case"full_name":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({autoComplete:"name",max:W.full_name})});case"occupation":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({autoComplete:"organization-title",max:W.occupation})});case"email":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({type:"email",inputMode:"email",autoComplete:"email",dir:"ltr",max:W.email})});case"country":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:(0,l.jsx)(le,{id:i.control,labelId:`${i.control}-l`,value:r??"",onChange:o,locale:m,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:u})});case"phone":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:(0,l.jsx)(ze,{id:i.control,value:r,onChange:o,locale:m,c:a,fallbackCountry:q,required:e.required,invalid:p,describedby:u})});case"birth_date":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(ae,{ids:i,parts:r,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:e.required,invalid:p,birthday:!0,onPartBlur:s(v=>_(w=>new Set(w).add(v)),"onPartBlur"),onLeave:h})});case"address":{let v=r,w=c((d,N,C,$)=>(0,l.jsxs)("div",{className:"sekyro-field",children:[(0,l.jsx)("label",{className:"sekyro-help",id:`${i.control}-${d}-l`,htmlFor:`${i.control}-${d}`,children:a(N)}),d==="country"?(0,l.jsx)(le,{id:`${i.control}-${d}`,labelId:`${i.control}-${d}-l`,value:v.country,onChange:s(B=>o({...v,country:B}),"onChange"),locale:m,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:D(i,!1,p)}):(0,l.jsx)("input",{id:`${i.control}-${d}`,className:"sekyro-input",type:"text",autoComplete:C,maxLength:$,required:e.required&&d!=="line2"&&d!=="postcode","aria-invalid":p||void 0,"aria-describedby":D(i,!1,p),value:v[d],onChange:s(B=>o({...v,[d]:B.target.value}),"onChange")})]}),"part");return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsxs)("div",{className:"sekyro-form-address",children:[w("line1","form.address.line1","address-line1",120),w("line2","form.address.line2","address-line2",120),w("city","form.address.city","address-level2",80),w("postcode","form.address.postcode","postal-code",16),w("country","form.address.country","country",2)]})})}default:return null}let j=e;switch(j.type){case"short_text":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({max:W.short_text})});case"long_text":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({max:W.long_text,long:!0})});case"number":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({inputMode:"decimal",dir:"ltr",max:20})});case"date":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(ae,{ids:i,parts:r,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:e.required,invalid:p,birthday:!1,onPartBlur:s(v=>_(w=>new Set(w).add(v)),"onPartBlur"),onLeave:h})});case"yes_no":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(oe,{name:i.control,type:"radio",options:[{value:"yes",label:a("form.yes")},{value:"no",label:a("form.no")}],value:r===!0?"yes":r===!1?"no":null,onChange:s(v=>o(v==="yes"),"onChange"),required:e.required,invalid:p,describedby:D(i,!1,p)})});case"remote_choice":return j.remote===void 0?null:(0,l.jsx)(V,{legend:(0,l.jsx)("span",{id:`${i.control}-l`,children:b}),notes:x,invalid:p,describedby:u,children:(0,l.jsx)(xe,{name:i.control,labelId:`${i.control}-l`,remote:j.remote,draft:r,onChange:o,required:e.required,invalid:p,describedby:D(i,!1,p),client:k,copy:Fe(a,m)})});case"single_choice":case"multiple_choice":{let v=j.type==="multiple_choice";return(0,l.jsx)(V,{legend:b,notes:(0,l.jsxs)(l.Fragment,{children:[v?(0,l.jsx)("span",{className:"sekyro-help",children:a("form.chooseAny")}):null,x]}),invalid:p,describedby:u,children:(0,l.jsx)(oe,{name:i.control,type:v?"checkbox":"radio",options:(j.choices??[]).map(w=>({value:w.value,label:w.label,lang:k})),value:r,onChange:o,required:e.required,invalid:p,describedby:D(i,!1,p)})})}default:return null}}s(Le,"Ze");c(Le,"Question");function Ie(e,r){let o=[];for(let a=65;a<=90;a++)for(let m=65;m<=90;m++){let k=String.fromCharCode(a,m),q=ee(k);q!==void 0&&k!=="AC"&&k!=="TA"&&o.push({code:k,dial:`+${q}`})}let t=new Intl.Collator(r),n=new Map(o.map(a=>[a.code,Z(a.code,r)]));return o.sort((a,m)=>a.code===e?-1:m.code===e?1:t.compare(n.get(a.code)??"",n.get(m.code)??"")),o}s(Ie,"Je");c(Ie,"phoneCountries");function ze({id:e,value:r,onChange:o,locale:t,c:n,fallbackCountry:a,required:m,invalid:k,describedby:q}){let h=(0,S.useMemo)(()=>Ie(a||"MR",t),[a,t]),[i]=(0,S.useState)(()=>r||(h[0]?.dial??"")),y=ye({countries:h,international:!1,closed:!1,defaultPhone:i}),_=y.empty?"":y.typed??y.phone;return(0,S.useEffect)(()=>{_!==r&&o(_)},[_]),(0,l.jsx)(be,{field:y,id:e,locale:t,t:n,required:m,invalid:k,describedby:q,compact:!0})}s(ze,"Xe");c(ze,"FormPhone");export{Ve as FormView,we as formCopy};
|
|
1
|
+
"use client";import{a as ee,b as he,c as pe,d as ye,e as be}from"./chunk-6PGOITBA.js";import{a as Z}from"./chunk-P223YKM3.js";import{a as fe}from"./chunk-C3VULGQL.js";import"./chunk-XOM2CZTJ.js";import{K as ue,a as J,b as X,c as de,w as ce,y as me}from"./chunk-EWAEIT5N.js";import{a as s,c as U,i as c}from"./chunk-SSU37LFQ.js";var S=U(J(),1),E=U(J(),1),f=U(X(),1),F=U(J(),1),g=U(X(),1),l=U(X(),1);import{FormAnswersError as Pe}from"@sekyro/web";import{filterRemoteOptions as Re,FORM_ANSWER_LIMITS as ve}from"@sekyro/web";var Ee={"form.title":"بضعة أسئلة","form.lead":"تطلب منك {org} الإجابة عن هذه الأسئلة.","form.optional":"اختياري","form.continue":"متابعة","form.sending":"جارٍ إرسال إجاباتك…","form.yes":"نعم","form.no":"لا","form.chooseAny":"اختر كل ما ينطبق","form.choose":"اختر","form.openLink":"يُفتح في علامة تبويب جديدة","form.consents":"موافقتك","form.remote.other":"أخرى","form.remote.otherField":"إجابتك","form.remote.filter":"ابحث في الخيارات","form.remote.noMatch":"لا يوجد خيار يطابق بحثك","form.date.day":"اليوم","form.date.month":"الشهر","form.date.year":"السنة","form.fields.full_name.label":"الاسم الكامل","form.fields.full_name.help":"اسمك واسم عائلتك كما تكتبهما عادةً","form.fields.birth_date.label":"تاريخ الميلاد","form.fields.email.label":"البريد الإلكتروني","form.fields.phone.label":"رقم الهاتف","form.fields.address.label":"العنوان","form.fields.address.help":"مكان سكنك الحالي","form.fields.country.label":"البلد","form.fields.occupation.label":"المهنة","form.address.line1":"الشارع والرقم","form.address.line2":"تفاصيل إضافية للعنوان","form.address.city":"المدينة","form.address.postcode":"الرمز البريدي","form.address.country":"البلد","form.address.addLine":"أضف سطرًا","form.phoneCountry":"رمز البلد","form.errors.summary":"راجع الإجابات المشار إليها أدناه.","form.errors.required":"أجب عن هذا السؤال للمتابعة","form.errors.choiceRequired":"اختر إجابة للمتابعة","form.errors.consentRequired":"حدّد هذا المربع للمتابعة","form.errors.tooLong":"اختصر إجابتك إلى {max} حرفًا أو أقل","form.errors.tooShort":"أدخل {min} أحرف على الأقل","form.errors.email":"أدخل عنوان بريد إلكتروني كاملًا يتضمن @ ونطاقًا","form.errors.phone":"أدخل الرقم دون رمز البلد، بالأرقام فقط","form.errors.date":"أدخل تاريخًا صحيحًا: اليوم والشهر والسنة","form.errors.datePast":"أدخل تاريخًا في الماضي","form.errors.dateFuture":"أدخل تاريخًا في المستقبل","form.errors.dateMin":"أدخل تاريخًا في {date} أو بعده","form.errors.dateMax":"أدخل تاريخًا في {date} أو قبله","form.errors.number":"أدخل عددًا بالأرقام","form.errors.numberInteger":"أدخل عددًا صحيحًا","form.errors.numberDecimals":"استخدم منزلتين عشريتين على الأكثر","form.errors.numberMin":"أدخل {min} أو أكثر","form.errors.numberMax":"أدخل {max} أو أقل","form.errors.choice":"اختر إحدى الإجابات المعروضة","form.errors.cardNumber":"لا تُدخل رقم بطاقة هنا.","form.errors.address":"أدخل الشارع والمدينة والبلد","form.errors.failed":"تعذّر إرسال إجاباتك. تحقّق من اتصالك وحاول مرة أخرى","form.remote.results.one":"خيار واحد","form.remote.results.two":"خياران","form.remote.results.few":"{count} خيارات","form.remote.results.many":"{count} خيارًا","form.remote.results.other":"{count} خيار"},H={"form.title":"A few questions","form.lead":"{org} asks you to answer these questions.","form.optional":"optional","form.continue":"Continue","form.sending":"Sending your answers…","form.yes":"Yes","form.no":"No","form.chooseAny":"Choose all that apply","form.choose":"Choose","form.openLink":"Opens in a new tab","form.consents":"Your consent","form.remote.other":"Other","form.remote.otherField":"Your answer","form.remote.filter":"Search the options","form.remote.noMatch":"No option matches your search","form.date.day":"Day","form.date.month":"Month","form.date.year":"Year","form.fields.full_name.label":"Full name","form.fields.full_name.help":"Your first and last names, as you usually write them","form.fields.birth_date.label":"Date of birth","form.fields.email.label":"Email address","form.fields.phone.label":"Phone number","form.fields.address.label":"Address","form.fields.address.help":"Where you live now","form.fields.country.label":"Country","form.fields.occupation.label":"Occupation","form.address.line1":"Street and number","form.address.line2":"More address details","form.address.city":"City or town","form.address.postcode":"Postal code","form.address.country":"Country","form.address.addLine":"Add a line","form.phoneCountry":"Country code","form.errors.summary":"Check the answers marked below.","form.errors.required":"Answer this question to continue","form.errors.choiceRequired":"Choose an answer to continue","form.errors.consentRequired":"Tick this box to continue","form.errors.tooLong":"Shorten your answer to {max} characters or fewer","form.errors.tooShort":"Enter at least {min} characters","form.errors.email":"Enter a full email address, with @ and a domain","form.errors.phone":"Enter the number without the country code, digits only","form.errors.date":"Enter a real date: day, month and year","form.errors.datePast":"Enter a date in the past","form.errors.dateFuture":"Enter a date in the future","form.errors.dateMin":"Enter a date on or after {date}","form.errors.dateMax":"Enter a date on or before {date}","form.errors.number":"Enter a number, using digits","form.errors.numberInteger":"Enter a whole number","form.errors.numberDecimals":"Use at most 2 decimals","form.errors.numberMin":"Enter {min} or more","form.errors.numberMax":"Enter {max} or less","form.errors.choice":"Choose one of the answers listed","form.errors.cardNumber":"Do not enter a card number here.","form.errors.address":"Enter the street, the city and the country","form.errors.failed":"We could not send your answers. Check your connection and try again","form.remote.results.one":"{count} option","form.remote.results.other":"{count} options"},Oe={"form.title":"Quelques questions","form.lead":"{org} vous demande de répondre à ces questions.","form.optional":"facultatif","form.continue":"Continuer","form.sending":"Envoi de vos réponses…","form.yes":"Oui","form.no":"Non","form.chooseAny":"Choisissez toutes les réponses qui s’appliquent","form.choose":"Choisir","form.openLink":"S’ouvre dans un nouvel onglet","form.consents":"Votre consentement","form.remote.other":"Autre","form.remote.otherField":"Votre réponse","form.remote.filter":"Rechercher parmi les options","form.remote.noMatch":"Aucune option ne correspond à votre recherche","form.date.day":"Jour","form.date.month":"Mois","form.date.year":"Année","form.fields.full_name.label":"Nom complet","form.fields.full_name.help":"Vos prénoms et nom, comme vous les écrivez d’habitude","form.fields.birth_date.label":"Date de naissance","form.fields.email.label":"Adresse e-mail","form.fields.phone.label":"Numéro de téléphone","form.fields.address.label":"Adresse","form.fields.address.help":"Là où vous habitez aujourd’hui","form.fields.country.label":"Pays","form.fields.occupation.label":"Profession","form.address.line1":"Rue et numéro","form.address.line2":"Complément d’adresse","form.address.city":"Ville","form.address.postcode":"Code postal","form.address.country":"Pays","form.address.addLine":"Ajouter une ligne","form.phoneCountry":"Indicatif du pays","form.errors.summary":"Vérifiez les réponses signalées ci-dessous.","form.errors.required":"Répondez à cette question pour continuer","form.errors.choiceRequired":"Choisissez une réponse pour continuer","form.errors.consentRequired":"Cochez cette case pour continuer","form.errors.tooLong":"Raccourcissez votre réponse à {max} caractères au plus","form.errors.tooShort":"Saisissez au moins {min} caractères","form.errors.email":"Saisissez une adresse e-mail complète, avec @ et un domaine","form.errors.phone":"Saisissez le numéro sans l’indicatif, en chiffres seulement","form.errors.date":"Saisissez une date réelle : jour, mois et année","form.errors.datePast":"Saisissez une date passée","form.errors.dateFuture":"Saisissez une date à venir","form.errors.dateMin":"Saisissez une date à partir du {date}","form.errors.dateMax":"Saisissez une date jusqu’au {date}","form.errors.number":"Saisissez un nombre, en chiffres","form.errors.numberInteger":"Saisissez un nombre entier","form.errors.numberDecimals":"Utilisez au plus 2 décimales","form.errors.numberMin":"Saisissez {min} ou plus","form.errors.numberMax":"Saisissez {max} ou moins","form.errors.choice":"Choisissez une des réponses proposées","form.errors.cardNumber":"N’indiquez pas de numéro de carte ici.","form.errors.address":"Indiquez la rue, la ville et le pays","form.errors.failed":"Nous n’avons pas pu envoyer vos réponses. Vérifiez votre connexion et réessayez","form.remote.results.one":"{count} option","form.remote.results.other":"{count} options"};function Y(e){return e.replace(/[٠-٩۰-۹]/g,r=>String((r.charCodeAt(0)&15)%10))}s(Y,"G");c(Y,"westernDigits");function ie(){let e=(0,E.useId)();return{control:`${e}-c`,help:`${e}-h`,error:`${e}-e`}}s(ie,"ee");c(ie,"useFieldIds");function D(e,r,o){return[r?e.help:null,o?e.error:null].filter(t=>t!==null).join(" ")||void 0}s(D,"E");c(D,"describedBy");function K({text:e,lang:r,optional:o}){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{lang:r?.lang,dir:r?.dir,children:e}),o!==null?(0,f.jsx)("span",{className:"sekyro-form-optional",children:` (${o})`}):null]})}s(K,"Z");c(K,"LabelText");function se({ids:e,help:r,helpLang:o,error:t}){return(0,f.jsxs)(f.Fragment,{children:[r!==void 0?(0,f.jsx)("span",{className:"sekyro-help",id:e.help,lang:o?.lang,dir:o?.dir,children:r}):null,t?(0,f.jsx)("span",{className:"sekyro-help is-danger",id:e.error,role:"alert",children:t}):null]})}s(se,"re");c(se,"FieldNotes");function R({ids:e,label:r,children:o,notes:t}){return(0,f.jsxs)("div",{className:"sekyro-field sekyro-form-q",children:[(0,f.jsx)("label",{className:"sekyro-label",id:`${e.control}-l`,htmlFor:e.control,children:r}),o,t]})}s(R,"T");c(R,"Field");function V({legend:e,children:r,notes:o,invalid:t,describedby:n}){return(0,f.jsxs)("fieldset",{className:`sekyro-form-q sekyro-form-group${t?" is-invalid":""}`,"aria-describedby":n,children:[(0,f.jsx)("legend",{className:"sekyro-label",children:e}),r,o]})}s(V,"V");c(V,"Group");function ke(e){let r={ArrowDown:1,ArrowUp:-1,ArrowRight:1,ArrowLeft:-1}[e.key];if(r===void 0)return;getComputedStyle(e.currentTarget).direction==="rtl"&&(e.key==="ArrowRight"||e.key==="ArrowLeft")&&(r=-r);let o=e.currentTarget.closest("fieldset"),t=o===null?[]:Array.from(o.querySelectorAll('input[type="checkbox"]')),n=t.indexOf(e.currentTarget),a=t[(n+r+t.length)%t.length];a!==void 0&&(e.preventDefault(),a.focus())}s(ke,"Ie");c(ke,"moveInGroup");function oe({name:e,type:r,options:o,value:t,onChange:n,required:a,invalid:m,describedby:k}){let q=Array.isArray(t)?t:t===null?[]:[t];return(0,f.jsx)("div",{className:"sekyro-form-choices",children:o.map(h=>{let i=q.includes(h.value);return(0,f.jsxs)("label",{className:"sekyro-form-choice",children:[(0,f.jsx)("input",{type:r,name:e,value:h.value,checked:i,required:r==="radio"?a:void 0,"aria-invalid":m||void 0,"aria-describedby":k,onKeyDown:r==="checkbox"?ke:void 0,onChange:s(()=>{n(r==="radio"?h.value:i?q.filter(y=>y!==h.value):[...q,h.value])},"onChange")}),(0,f.jsx)("span",{lang:h.lang?.lang,dir:h.lang?.dir,children:h.label})]},h.value)})})}s(oe,"oe");c(oe,"ChoiceList");function te(e){let[r,o,t]=[e.day,e.month,e.year].map(n=>Y(n).trim());if(!(r===""&&o===""&&t===""))return`${(t??"").padStart(4,"0")}-${(o??"").padStart(2,"0")}-${(r??"").padStart(2,"0")}`}s(te,"ne");c(te,"dateValue");function ne(e){let r=typeof e=="string"?/^(\d{4})-(\d{2})-(\d{2})$/.exec(e):null;return r===null?{day:"",month:"",year:""}:{day:String(Number(r[3])),month:String(Number(r[2])),year:r[1]}}s(ne,"te");c(ne,"dateParts");function _e(e,r,o,t=new Date().getUTCFullYear()){if(r==="")return!1;let n=Number(r);return e==="day"?!(n>=1&&n<=31):e==="month"?!(n>=1&&n<=12):r.length!==4||n<1900||n>(o?t:2100)}s(_e,"xe");c(_e,"datePartBad");function ae({ids:e,parts:r,onChange:o,labels:t,required:n,invalid:a,birthday:m,onPartBlur:k,onLeave:q}){let h=c(y=>{let _=y.target.dataset.part;_!==void 0&&k(_),y.currentTarget.contains(y.relatedTarget)||q()},"onBlur"),i=c((y,_)=>(0,f.jsxs)("div",{className:`sekyro-form-date__${y}`,children:[(0,f.jsx)("label",{className:"sekyro-help",htmlFor:`${e.control}-${y}`,children:t[y]}),(0,f.jsx)("input",{id:`${e.control}-${y}`,"data-part":y,className:"sekyro-input",type:"text",inputMode:"numeric",dir:"ltr",maxLength:_,autoComplete:m?`bday-${y}`:"off",required:n,"aria-invalid":a||void 0,"aria-describedby":D(e,!1,a),value:r[y],onChange:s(A=>o({...r,[y]:Y(A.target.value).replace(/\D/g,"")}),"onChange")})]}),"cell");return(0,f.jsxs)("div",{className:"sekyro-form-date",onBlur:h,children:[i("day",2),i("month",2),i("year",4)]})}s(ae,"se");c(ae,"DateInputs");function Ce(e){return(0,E.useMemo)(()=>{let r=[];for(let t=65;t<=90;t++)for(let n=65;n<=90;n++){let a=String.fromCharCode(t,n);ee(a)!==void 0&&a!=="AC"&&a!=="TA"&&r.push(a)}let o=new Intl.Collator(e);return r.map(t=>({code:t,name:Z(t,e)})).sort((t,n)=>o.compare(t.name,n.name))},[e])}s(Ce,"Me");c(Ce,"useCountries");function le({id:e,labelId:r,value:o,onChange:t,locale:n,placeholder:a,searchLabel:m,searchPlaceholder:k,noMatch:q,invalid:h,describedby:i}){let y=Ce(n),[_,A]=(0,E.useState)(!1),z=(0,E.useRef)(null),P=(0,E.useRef)(null),p=(0,E.useId)(),M=`${e}-v`,L=y.find(b=>b.code===o),O=c(()=>{A(!1),requestAnimationFrame(()=>z.current?.focus())},"close");return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("button",{ref:z,id:e,type:"button",className:"sekyro-input sekyro-form-country","aria-labelledby":`${r} ${M}`,"aria-expanded":_,"aria-controls":_?p:void 0,"aria-invalid":h||void 0,"aria-describedby":i,onClick:s(()=>{A(b=>!b),_||requestAnimationFrame(()=>P.current?.focus())},"onClick"),children:L!==void 0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:pe(L.code)}),(0,f.jsx)("span",{className:"sekyro-form-country__name",id:M,children:L.name})]}):(0,f.jsx)("span",{className:"sekyro-form-country__name is-empty",id:M,children:a})}),_?(0,f.jsx)("div",{id:p,className:"sekyro-form-country__list",onKeyDown:s(b=>{b.key==="Escape"&&(b.preventDefault(),O())},"onKeyDown"),children:(0,f.jsx)(he,{countries:y,label:(0,f.jsx)("span",{className:"sekyro-visually-hidden",children:m}),searchPlaceholder:k,noMatch:q,selected:o,searchRef:P,scroll:!0,onPick:s(b=>{t(b),O()},"onPick")})}):null]})}s(le,"ae");c(le,"CountryField");var T="\0other",ge,re;function Ne(e){let[r,o]=(0,F.useState)(ge);return(0,F.useEffect)(()=>{if(!e||r!==void 0)return;let t=!0;return re??(re=import("./icons-form-R366YPMB-KUTXHC7X.js").then(n=>ge=n.FORM_OPTION_ICON_PATHS)),re.then(n=>t&&o(n)).catch(()=>{}),()=>{t=!1}},[e,r]),r}s(Ne,"Te");c(Ne,"useOptionIcons");function qe({icon:e,imageUrl:r,icons:o}){let[t,n]=(0,F.useState)(!1);if(r!==void 0&&!t)return(0,g.jsx)("img",{className:"sekyro-form-card__picture",src:r,alt:"",loading:"lazy",decoding:"async",onError:s(()=>n(!0),"onError")});let a=e!==void 0?o?.[e]:void 0;return a===void 0?null:(0,g.jsx)("span",{className:"sekyro-form-card__icon","aria-hidden":"true",children:(0,g.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",strokeWidth:1.5,focusable:"false",dangerouslySetInnerHTML:{__html:a}})})}s(qe,"qe");c(qe,"OptionPicture");function xe({name:e,labelId:r,remote:o,draft:t,onChange:n,required:a,invalid:m,describedby:k,client:q,copy:h}){let[i,y]=(0,F.useState)(""),_=(0,F.useId)(),A=(0,F.useId)(),z=(0,F.useRef)(null),[P,p]=(0,F.useState)(!1),M=o.options.length>ve.remoteFilterAbove,L=(0,F.useMemo)(()=>M?Re(o.options,i):o.options,[o.options,i,M]),O=o.otherLabel??h.other,b=Ne(o.options.some(u=>u.icon!==void 0));(0,F.useEffect)(()=>{P&&(z.current?.focus(),p(!1))},[P]);let x=c(u=>{u===T?(n({pick:T,other:t.other}),p(!0)):n({pick:u,other:""})},"pick");return(0,g.jsxs)("div",{className:"sekyro-form-remote",children:[M?(0,g.jsxs)("div",{className:"sekyro-field sekyro-form-remote__filter",children:[(0,g.jsx)("label",{className:"sekyro-help",htmlFor:_,children:h.filter}),(0,g.jsx)("input",{id:_,className:"sekyro-input",type:"search",autoComplete:"off",value:i,onChange:s(u=>y(u.target.value),"onChange")}),(0,g.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:i.trim()===""?"":h.results(L.length)})]}):null,(0,g.jsxs)("div",{className:"sekyro-form-cards",role:"radiogroup","aria-labelledby":r,"aria-required":a||void 0,"aria-invalid":m||void 0,"aria-describedby":k,children:[L.map(u=>{let I=t.pick===u.value;return(0,g.jsxs)("label",{className:"sekyro-form-card","data-value":u.value,children:[(0,g.jsx)("input",{type:"radio",name:e,value:u.value,checked:I,required:a,"aria-invalid":m||void 0,onChange:s(()=>x(u.value),"onChange")}),(0,g.jsx)(qe,{icon:u.icon,imageUrl:u.imageUrl,icons:b}),(0,g.jsxs)("span",{className:"sekyro-form-card__text",lang:q.lang,children:[u.title!==void 0?(0,g.jsx)("span",{className:"sekyro-form-card__title",dir:"auto",children:u.title}):null,(0,g.jsx)("span",{className:"sekyro-form-card__label",dir:"auto",children:u.label}),u.description!==void 0?(0,g.jsx)("span",{className:"sekyro-form-card__description",dir:"auto",children:u.description}):null]})]},u.value)}),M&&L.length===0&&!o.allowOther?(0,g.jsx)("p",{className:"sekyro-help sekyro-form-remote__none",children:h.noMatch}):null,o.allowOther?(0,g.jsxs)("label",{className:"sekyro-form-card sekyro-form-card--other",children:[(0,g.jsx)("input",{type:"radio",name:e,value:T,checked:t.pick===T,required:a,"aria-invalid":m||void 0,onChange:s(()=>x(T),"onChange")}),(0,g.jsx)("span",{className:"sekyro-form-card__text",children:(0,g.jsx)("span",{className:"sekyro-form-card__label",dir:"auto",lang:o.otherLabel!==void 0?q.lang:void 0,children:O})})]}):null]}),t.pick===T?(0,g.jsxs)("div",{className:"sekyro-field sekyro-form-remote__other",children:[(0,g.jsx)("label",{className:"sekyro-help",htmlFor:A,children:o.otherLabel??h.otherField}),(0,g.jsx)("input",{id:A,ref:z,className:"sekyro-input",type:"text",autoComplete:"off",maxLength:ve.remoteOther,required:a,"aria-invalid":m||void 0,"aria-describedby":k,value:t.other,onChange:s(u=>n({pick:T,other:u.target.value}),"onChange")})]}):null]})}s(xe,"Se");c(xe,"OptionCardList");var De={en:H,fr:Oe,ar:Ee,es:H,pt:H,de:H};function we(e){let r=e.strings,o=De[e.locale];return(t,n)=>fe(r[t]??o[t]??"",n)}s(we,"Be");c(we,"formCopy");var Te=new Set(["single_choice","multiple_choice","yes_no","remote_choice"]),je=c(e=>e.kind==="field"?e.field==="country":Te.has(e.type),"isChoice");function Se(e,r,o){if(e.kind==="field")switch(e.field){case"birth_date":return ne(r);case"phone":return typeof r=="string"?r:"";case"address":{let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{};return{line1:t.lines?.[0]??"",line2:t.lines?.slice(1).join(", ")??"",city:t.city??"",postcode:t.postcode??"",country:t.country??o}}default:return typeof r=="string"?r:""}switch(e.type){case"multiple_choice":return Array.isArray(r)?r:[];case"yes_no":return typeof r=="boolean"?r:null;case"single_choice":return typeof r=="string"?r:null;case"date":return ne(r);case"number":return typeof r=="number"?String(r):"";case"remote_choice":return{pick:null,other:""};default:return typeof r=="string"?r:""}}s(Se,"Ke");c(Se,"draftOf");function Me(e,r){if(e.kind==="field")switch(e.field){case"birth_date":return te(r);case"phone":return r||void 0;case"address":{let o=r,t=[o.line1,o.line2].map(n=>n.trim()).filter(n=>n!=="");return t.length===0&&o.city.trim()===""&&o.postcode.trim()===""?void 0:{country:o.country,city:o.city.trim(),lines:t,...o.postcode.trim()!==""?{postcode:o.postcode.trim()}:{}}}case"email":return r.trim().toLowerCase()||void 0;default:return r.trim()||void 0}switch(e.type){case"multiple_choice":return r.length>0?r:void 0;case"yes_no":return typeof r=="boolean"?r:void 0;case"single_choice":return typeof r=="string"?r:void 0;case"date":return te(r);case"remote_choice":{let o=r;return o.pick===null?void 0:o.pick===T?{other:o.other.trim()}:o.pick}case"number":{let o=Y(r).replace(/[\s ]/g,"").replace(/[,٫]/g,".");if(o==="")return;let t=Number(o);return Number.isFinite(t)&&/^-?\d+(\.\d+)?$/.test(o)?t:Number.NaN}default:return r.trim()||void 0}}s(Me,"Ye");c(Me,"answerOf");function Ae(e,r,o,t){let n=c(m=>{try{return new Intl.DateTimeFormat(t,{dateStyle:"long",timeZone:"UTC"}).format(new Date(`${String(m)}T00:00:00Z`))}catch{return String(m)}},"date"),a=e.params??{};switch(e.code){case"required":return o(r!==void 0&&je(r)?"form.errors.choiceRequired":"form.errors.required");case"consent_required":return o("form.errors.consentRequired");case"too_long":return o("form.errors.tooLong",{max:Number(a.max??0)});case"too_short":return o("form.errors.tooShort",{min:Number(a.min??0)});case"email_invalid":return o("form.errors.email");case"phone_invalid":return o("form.errors.phone");case"date_invalid":return o("form.errors.date");case"date_not_past":return o("form.errors.datePast");case"date_not_future":return o("form.errors.dateFuture");case"date_too_early":return o("form.errors.dateMin",{date:n(a.date)});case"date_too_late":return o("form.errors.dateMax",{date:n(a.date)});case"number_invalid":return o("form.errors.number");case"number_not_integer":return o("form.errors.numberInteger");case"number_decimals":return o("form.errors.numberDecimals");case"number_too_small":return o("form.errors.numberMin",{min:new Intl.NumberFormat(t).format(Number(a.min??0))});case"number_too_large":return o("form.errors.numberMax",{max:new Intl.NumberFormat(t).format(Number(a.max??0))});case"address_invalid":return o("form.errors.address");case"card_number":return o("form.errors.cardNumber");default:return o("form.errors.choice")}}s(Ae,"Ue");c(Ae,"issueText");var W={full_name:200,occupation:120,email:254,short_text:120,long_text:1e3};function Fe(e,r){let o=new Intl.PluralRules(r);return{other:e("form.remote.other"),otherField:e("form.remote.otherField"),filter:e("form.remote.filter"),results:c(t=>e(`form.remote.results.${o.select(t)}`,{count:t})||e("form.remote.results.other",{count:t}),"results"),noMatch:e("form.remote.noMatch")}}s(Fe,"je");c(Fe,"remoteCopy");function Ve({step:e,i18n:r,onError:o}){let t=we(r),{form:n}=e,a={lang:n.locale,dir:e.dir},m=typeof n.prefill?.country=="string"?n.prefill.country:"",[k,q]=(0,S.useState)(()=>Object.fromEntries(n.questions.map(d=>[d.id,Se(d,n.prefill?.[d.id],m)]))),[h,i]=(0,S.useState)({}),[y,_]=(0,S.useState)([]),[A,z]=(0,S.useState)(!1),[P,p]=(0,S.useState)(!1),[M,L]=(0,S.useState)(0),O=(0,S.useRef)(null),b=(0,S.useId)();(0,S.useEffect)(()=>{M!==0&&O.current?.querySelector('[aria-invalid="true"]')?.focus()},[M]);let x=c(d=>{let N=y.find(C=>C.id===d);return N===void 0?null:Ae(N,n.questions.find(C=>C.id===d),t,r.locale)},"errorOf"),u=c((d,N)=>{q(C=>({...C,[d]:N})),_(C=>C.filter($=>$.id!==d))},"set"),I=c(()=>{let d={};for(let N of n.questions){let C=Me(N,k[N.id]??null);C!==void 0&&(d[N.id]=C)}return{answers:d,consents:Object.fromEntries(n.consents.map(N=>[N.id,h[N.id]===!0]))}},"input"),j=c(d=>{let N=e.validate(I()).filter(C=>C.id===d&&C.code!=="required");_(C=>[...C.filter($=>$.id!==d),...N])},"checkOne"),v=c(d=>{if(d.preventDefault(),A)return;let N=I(),C=e.validate(N);if(C.length>0){_(C),L($=>$+1);return}z(!0),p(!1),e.submit(N).catch($=>{o?.($);let B=($ instanceof Pe||$?.name==="FormAnswersError"?$.issues:null)?.filter(G=>n.questions.some(Q=>Q.id===G.id)||n.consents.some(Q=>Q.id===G.id))??[];B.length>0?(_(B),L(G=>G+1)):p(!0)}).finally(()=>z(!1))},"onSubmit"),w=c(d=>d?null:t("form.optional"),"optional");return(0,l.jsxs)("form",{ref:O,className:"sekyro-step sekyro-form","aria-labelledby":b,onSubmit:v,noValidate:!0,"data-testid":"sekyro-form-step",children:[(0,l.jsx)(ce,{id:b,title:n.title??t("form.title"),lead:n.intro??t("form.lead",{org:e.context.orgName}),lang:{...n.title!==void 0?{title:n.locale}:{},...n.intro!==void 0?{lead:n.locale}:{},dir:e.dir}}),P?(0,l.jsx)(ue,{tone:"danger",children:(0,l.jsx)("span",{children:t("form.errors.failed")})}):null,(0,l.jsx)("div",{className:"sekyro-form-questions",children:n.questions.map(d=>(0,l.jsx)(Le,{q:d,draft:k[d.id]??null,onChange:s(N=>u(d.id,N),"onChange"),error:x(d.id),optional:w(d.required),c:t,locale:r.locale,client:a,fallbackCountry:m,onCheck:s(()=>j(d.id),"onCheck")},d.id))}),n.consents.length>0?(0,l.jsxs)("fieldset",{className:"sekyro-form-q sekyro-form-group sekyro-form-consents",children:[(0,l.jsx)("legend",{className:"sekyro-label",children:t("form.consents")}),n.consents.map(d=>(0,l.jsx)($e,{id:d.id,text:d.text,link:d.link,required:d.required,checked:h[d.id]===!0,onChange:s(N=>{i(C=>({...C,[d.id]:N})),_(C=>C.filter($=>$.id!==d.id))},"onChange"),error:x(d.id),optional:w(d.required),openLink:t("form.openLink"),client:a},d.id))]}):null,(0,l.jsxs)(me,{children:[(0,l.jsx)(de,{type:"submit",full:!0,disabled:A,"aria-busy":A||void 0,"data-testid":"sekyro-form-continue",children:t(A?"form.sending":"form.continue")}),(0,l.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:A?t("form.sending"):""})]})]})}s(Ve,"Mr");c(Ve,"FormView");function $e({id:e,text:r,link:o,required:t,checked:n,onChange:a,error:m,optional:k,openLink:q,client:h}){let i=ie();return(0,l.jsxs)("div",{className:"sekyro-form-consent","data-consent":e,children:[(0,l.jsxs)("div",{className:"sekyro-form-choice sekyro-form-consent__row",children:[(0,l.jsx)("input",{id:i.control,type:"checkbox",checked:n,required:t,"aria-invalid":m!==null||void 0,"aria-describedby":D(i,!1,m!==null),onChange:s(y=>a(y.target.checked),"onChange")}),(0,l.jsxs)("span",{className:"sekyro-form-consent__text",children:[(0,l.jsx)("label",{htmlFor:i.control,children:(0,l.jsx)(K,{text:r,lang:h,optional:k})}),o!==void 0?(0,l.jsxs)("a",{className:"sekyro-link sekyro-form-consent__link",href:o.url,target:"_blank",rel:"noopener noreferrer",lang:h.lang,dir:h.dir,children:[o.label,(0,l.jsxs)("span",{className:"sekyro-visually-hidden",children:[" (",q,")"]})]}):null]})]}),(0,l.jsx)(se,{ids:i,error:m})]})}s($e,"We");c($e,"Consent");function Le({q:e,draft:r,onChange:o,error:t,optional:n,c:a,locale:m,client:k,fallbackCountry:q,onCheck:h}){let i=ie(),[y,_]=(0,S.useState)(()=>new Set),A=e.kind==="field"&&e.field==="birth_date",z=(A||e.kind==="custom"&&e.type==="date")&&[...y].some(v=>_e(v,Y(r[v]??""),A)),P=t??(z?a("form.errors.date"):null),p=P!==null,M=e.kind==="custom"?e:null,L=M!==null?M.help:e.kind==="field"&&(e.field==="full_name"||e.field==="address")?a(`form.fields.${e.field}.help`):void 0,O=M!==null?k:void 0,b=M!==null?(0,l.jsx)(K,{text:M.label,lang:k,optional:n}):(0,l.jsx)(K,{text:a(`form.fields.${e.kind==="field"?e.field:""}.label`),optional:n}),x=(0,l.jsx)(se,{ids:i,help:L,helpLang:O,error:P}),u=D(i,L!==void 0,p),I=c(v=>v.long===!0?(0,l.jsx)("textarea",{id:i.control,className:"sekyro-input sekyro-form-textarea",rows:4,maxLength:v.max,required:e.required,"aria-invalid":p||void 0,"aria-describedby":u,value:r,onChange:s(w=>o(w.target.value),"onChange")}):(0,l.jsx)("input",{id:i.control,className:"sekyro-input",type:v.type??"text",inputMode:v.inputMode,autoComplete:v.autoComplete??"off",dir:v.dir,maxLength:v.max,required:e.required,"aria-invalid":p||void 0,"aria-describedby":u,value:r,onChange:s(w=>o(w.target.value),"onChange")}),"text");if(e.kind==="field")switch(e.field){case"full_name":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({autoComplete:"name",max:W.full_name})});case"occupation":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({autoComplete:"organization-title",max:W.occupation})});case"email":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({type:"email",inputMode:"email",autoComplete:"email",dir:"ltr",max:W.email})});case"country":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:(0,l.jsx)(le,{id:i.control,labelId:`${i.control}-l`,value:r??"",onChange:o,locale:m,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:u})});case"phone":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:(0,l.jsx)(ze,{id:i.control,value:r,onChange:o,locale:m,c:a,fallbackCountry:q,required:e.required,invalid:p,describedby:u})});case"birth_date":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(ae,{ids:i,parts:r,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:e.required,invalid:p,birthday:!0,onPartBlur:s(v=>_(w=>new Set(w).add(v)),"onPartBlur"),onLeave:h})});case"address":{let v=r,w=c((d,N,C,$)=>(0,l.jsxs)("div",{className:"sekyro-field",children:[(0,l.jsx)("label",{className:"sekyro-help",id:`${i.control}-${d}-l`,htmlFor:`${i.control}-${d}`,children:a(N)}),d==="country"?(0,l.jsx)(le,{id:`${i.control}-${d}`,labelId:`${i.control}-${d}-l`,value:v.country,onChange:s(B=>o({...v,country:B}),"onChange"),locale:m,placeholder:a("form.choose"),searchLabel:a("doc.countrySearch"),searchPlaceholder:a("doc.countrySearch"),noMatch:a("doc.noCountryMatch"),invalid:p,describedby:D(i,!1,p)}):(0,l.jsx)("input",{id:`${i.control}-${d}`,className:"sekyro-input",type:"text",autoComplete:C,maxLength:$,required:e.required&&d!=="line2"&&d!=="postcode","aria-invalid":p||void 0,"aria-describedby":D(i,!1,p),value:v[d],onChange:s(B=>o({...v,[d]:B.target.value}),"onChange")})]}),"part");return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsxs)("div",{className:"sekyro-form-address",children:[w("line1","form.address.line1","address-line1",120),w("line2","form.address.line2","address-line2",120),w("city","form.address.city","address-level2",80),w("postcode","form.address.postcode","postal-code",16),w("country","form.address.country","country",2)]})})}default:return null}let j=e;switch(j.type){case"short_text":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({max:W.short_text})});case"long_text":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({max:W.long_text,long:!0})});case"number":return(0,l.jsx)(R,{ids:i,label:b,notes:x,children:I({inputMode:"decimal",dir:"ltr",max:20})});case"date":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(ae,{ids:i,parts:r,onChange:o,labels:{day:a("form.date.day"),month:a("form.date.month"),year:a("form.date.year")},required:e.required,invalid:p,birthday:!1,onPartBlur:s(v=>_(w=>new Set(w).add(v)),"onPartBlur"),onLeave:h})});case"yes_no":return(0,l.jsx)(V,{legend:b,notes:x,invalid:p,describedby:u,children:(0,l.jsx)(oe,{name:i.control,type:"radio",options:[{value:"yes",label:a("form.yes")},{value:"no",label:a("form.no")}],value:r===!0?"yes":r===!1?"no":null,onChange:s(v=>o(v==="yes"),"onChange"),required:e.required,invalid:p,describedby:D(i,!1,p)})});case"remote_choice":return j.remote===void 0?null:(0,l.jsx)(V,{legend:(0,l.jsx)("span",{id:`${i.control}-l`,children:b}),notes:x,invalid:p,describedby:u,children:(0,l.jsx)(xe,{name:i.control,labelId:`${i.control}-l`,remote:j.remote,draft:r,onChange:o,required:e.required,invalid:p,describedby:D(i,!1,p),client:k,copy:Fe(a,m)})});case"single_choice":case"multiple_choice":{let v=j.type==="multiple_choice";return(0,l.jsx)(V,{legend:b,notes:(0,l.jsxs)(l.Fragment,{children:[v?(0,l.jsx)("span",{className:"sekyro-help",children:a("form.chooseAny")}):null,x]}),invalid:p,describedby:u,children:(0,l.jsx)(oe,{name:i.control,type:v?"checkbox":"radio",options:(j.choices??[]).map(w=>({value:w.value,label:w.label,lang:k})),value:r,onChange:o,required:e.required,invalid:p,describedby:D(i,!1,p)})})}default:return null}}s(Le,"Ze");c(Le,"Question");function Ie(e,r){let o=[];for(let a=65;a<=90;a++)for(let m=65;m<=90;m++){let k=String.fromCharCode(a,m),q=ee(k);q!==void 0&&k!=="AC"&&k!=="TA"&&o.push({code:k,dial:`+${q}`})}let t=new Intl.Collator(r),n=new Map(o.map(a=>[a.code,Z(a.code,r)]));return o.sort((a,m)=>a.code===e?-1:m.code===e?1:t.compare(n.get(a.code)??"",n.get(m.code)??"")),o}s(Ie,"Je");c(Ie,"phoneCountries");function ze({id:e,value:r,onChange:o,locale:t,c:n,fallbackCountry:a,required:m,invalid:k,describedby:q}){let h=(0,S.useMemo)(()=>Ie(a||"MR",t),[a,t]),[i]=(0,S.useState)(()=>r||(h[0]?.dial??"")),y=ye({countries:h,international:!1,closed:!1,defaultPhone:i}),_=y.empty?"":y.typed??y.phone;return(0,S.useEffect)(()=>{_!==r&&o(_)},[_]),(0,l.jsx)(be,{field:y,id:e,locale:t,t:n,required:m,invalid:k,describedby:q,compact:!0})}s(ze,"Xe");c(ze,"FormPhone");export{Ve as FormView,we as formCopy};
|