@apolitical/component-library 4.4.0-SW.1 → 4.4.1-4581.10
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/form/types/signup-form/signup-form.d.ts +9 -4
- package/index.js +2 -2
- package/index.mjs +2 -3
- package/package.json +1 -1
|
@@ -5,6 +5,10 @@ export interface IShouldShowProps {
|
|
|
5
5
|
logInButton?: boolean;
|
|
6
6
|
successMessage?: boolean;
|
|
7
7
|
}
|
|
8
|
+
export interface IOnSuccessProps {
|
|
9
|
+
jobTitle: string;
|
|
10
|
+
organization: string;
|
|
11
|
+
}
|
|
8
12
|
interface ISignupForm {
|
|
9
13
|
className?: string;
|
|
10
14
|
labels?: {
|
|
@@ -14,18 +18,19 @@ interface ISignupForm {
|
|
|
14
18
|
expectation?: string;
|
|
15
19
|
};
|
|
16
20
|
functions: {
|
|
17
|
-
validateEmail: () => Promise<any>;
|
|
21
|
+
validateEmail: (email: string) => Promise<any>;
|
|
18
22
|
createAccount: (arg: any) => Promise<any>;
|
|
19
|
-
onSuccess?: () => void;
|
|
23
|
+
onSuccess?: (arg?: IOnSuccessProps) => void;
|
|
24
|
+
onCatch?: (arg?: string) => void;
|
|
20
25
|
handleError: (error: string) => void;
|
|
21
26
|
/** Callback function to resend verification code (used when user already signed up but not verified) */
|
|
22
|
-
resendVerificationCode: () =>
|
|
27
|
+
resendVerificationCode: (email: string) => Promise<unknown>;
|
|
23
28
|
};
|
|
24
29
|
shouldShow: IShouldShowProps;
|
|
25
30
|
dataToSubmit: {
|
|
26
31
|
[key: string]: string;
|
|
27
32
|
};
|
|
28
|
-
submitButton
|
|
33
|
+
submitButton?: string;
|
|
29
34
|
}
|
|
30
35
|
declare const SignupForm: ({ className, labels, placeholders, functions, shouldShow: shouldShowProps, submitButton, dataToSubmit, ...props }: ISignupForm) => import("react/jsx-runtime").JSX.Element;
|
|
31
36
|
export default SignupForm;
|
package/index.js
CHANGED
|
@@ -34,7 +34,7 @@ Please explain why you're reporting this post. Reasons could include: inappropri
|
|
|
34
34
|
|
|
35
35
|
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Nh={...er,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Rh={...er,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Mh={...er,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:er,es:Nh,fr:Rh,pt:Mh},Symbol.toStringTag,{value:"Module"})),qa=(e,t=er)=>e in t,_t=(e,t,n,r,a={})=>{let i="";return qa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},la=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Nc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Lh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Rc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(kr);if(!a)return e;for(const s of a){const o=s.replace(kr,(c,f)=>f),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const c=l;if(c.startsWith(rs))try{const f=c.replace(rs,"");u.id=f,await r({id:f}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lh(e,u,t):s)}return e},Mc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},zh=(e="")=>e.replace(/\s+/g,"").length>0,is=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const _e=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:f=!1,...p})=>{const g=Xn(typeof t=="object"),{showTooltip:h,tooltipProps:D}=Rs(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),x=_c(Object.keys(_));t=Bc(g,x,_)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const E={...p,className:Y(e,o,v,{"no-text":!f,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",E.href=a);const k=C.createElement(i,E,f||(c?d.jsx(Re,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...D,children:[d.jsx(kn,{isOpen:h,children:u}),k]}):k},_n=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(_e,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(_e,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const nn=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},$o={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},qh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?$o[e]:$o.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Wh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},si=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Wh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const tr=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:p,sizes:m}=qh(e),g=si({format:"avif",query:s,range:p,url:o}),h=si({format:"webp",query:s,range:p,url:o}),D=si({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:h,sizes:m,"data-testid":"source"}),d.jsx("img",{srcSet:D,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Hh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(tr,{image:{...e},className:"image"})}),Bn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Ic=C.forwardRef(({className:e="",children:t},n)=>{const r=C.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?vc.createPortal(e,document.body):null;const Uh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Re,{children:d.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const Vh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(_e,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Kh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Lo=300,zo="ease-in-out";class Zh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Lo,easing:zo}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Lo,easing:zo}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const Wa=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Zh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},qo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Yh=e=>{let t=e;return Object.keys(qo).includes(e)&&(t=qo[e]),`url(${Ht}icons/${t}.svg)`};const Wo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},$c=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Yh(t)}:{},s=qa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Wo?Wo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Rt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const sn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Xn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),p=_c(Object.keys(f));a=Bc(s,p,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Rt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Nt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(_e,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ss=({children:e,...t})=>d.jsx("p",{...t,children:e}),Lc={q:ss,blockquote:ss};for(let e=1;e<=6;e++)Lc[`h${e}`]={component:ss,props:{className:"title"}};const zc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Nt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Lc},children:r}):d.jsx("p",{children:r})]});const qc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,p]=C.useState("closed");C.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",m),()=>{h.removeEventListener("transitionend",m)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
|
|
36
36
|
`);c(h.length<3?`${a.substring(0,400)}...`:h.slice(0,3).join(`
|
|
37
|
-
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const m=({propertyName:h})=>{h==="max-height"&&p(D=>D==="opening"?"open":D==="closing"?"closed":D)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(Rt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[d.jsx(Nt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Nt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Nt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Nt,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,Qh=({children:e})=>d.jsx(Rt,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],em=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Xh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Wa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Rt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},nm=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Re,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Ho=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Ho(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Ho(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},os=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const am={default:{a:rm,CollapsibleSection:Wa,TextBox:Rt,CaseStudy:Qh,style:tt,details:em,div:tm,iframe:nm,center:Jh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Kn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=am[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Nt,{options:{...s,...t,overrides:o},children:n})})};const Wc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const mn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Rs(!!a),c=d.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(kn,{isOpen:l,children:a}),c]}):c};const _r=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const im=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Re,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=C.memo(im);const oi="loadingBlock_",sm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${oi}loading`})},75:{text:r.formatMessage({id:`${oi}almostDone`})},100:{text:r.formatMessage({id:`${oi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Rt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx($s,{progress:e})]})},om=C.memo(sm);const Et=({element:e="div",className:t="",...n})=>d.jsx(za,{element:e,className:Y("loading-placeholder",t),...n});const us={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Hc=(e,t)=>e in us?d.jsx("div",{className:e,children:us[e].map((n,r)=>Hc(n,r))},t):d.jsx(Et,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:us[e].map((n,r)=>Hc(n,r))}),Uc=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},qr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],um=e=>{const t=Math.ceil(26/qr.length),n=Uc(e).toLowerCase();if(n==="")return qr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<qr.length;a++)if(r<=t*(a+1))return qr[a]};const Uo=256,on=({className:e="",src:t="",name:n,alt:r,width:a=Uo,height:i=Uo,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null),c=r??n;C.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,h=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=h*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=um(n),m.fillRect(0,0,g,h),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Uc(n),g/2,h/1.6)},[n]);let f=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(f=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:f?d.jsx("img",{src:t,alt:c,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Un(l,r)),l};const nr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:c="medium"}=r,f=zs(t);f.name||(f.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=f;let{url:g}=f;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const h=lm(f),D=n&&n.createdAt?as(n.createdAt):!1,v=n&&n.createdAt?Ms(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",c,o),...a,children:d.jsxs(Bn,{href:g,gtmType:s,gtmContext:i,onClick:E=>{E==null||E.stopPropagation()},children:[d.jsx(on,{name:p,src:m,alt:l}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[p,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&D&&d.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${D.path}`},{number:D.number})}),n.didEdit&&d.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),h&&d.jsx("small",{className:Y({"text-medium":c==="large"}),children:h})]})]})})};const Vo={small:24,medium:48},qs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,m)=>{let g,h="";if(m<o){const{name:D="",image:v=""}=zs(p);if(s)return d.jsx(Et,{element:"li",className:"contributor"},m);g=d.jsx(on,{name:D,src:v,width:Vo[a||"medium"],height:Vo[a||"medium"]})}else if(m===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":D>99}),children:["+",$h(D,0)]}),h="number-left"}return g?d.jsx("li",{className:Y("contributor",h),children:g},m):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Un(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Y("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},Ha=e=>(e==null?void 0:e.toString().length)||0,Vc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{Ha(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Wr="emailHelperTextBox_",Kc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${Wr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(m=>{m.preventDefault(),m.stopPropagation();const g=h=>{s({path:`${Wr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Wr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let m=Wr,g="default",h={},D={};switch(e){case"gov":m+="autoApproved",g="success";break;case"nonGov":m+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":m+="pendingApproval",g="error",D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":m+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":m+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:m+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:m,type:g,link:h,mail:D})},[e]);const c={};return["link","mail"].forEach(m=>{c[m]=Object.keys(i[m]).length?g=>d.jsx("a",{...i[m],children:g}):g=>g}),d.jsx(zc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(Et,{element:"span"}),d.jsx(Et,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:m=>d.jsx("strong",{children:m}),em:m=>d.jsx("em",{children:m}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Mn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:p=>{const m=p.target;a.onChange(m.value)}})};const Sn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},cm=500,dm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:D}=ue.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const _=setTimeout(()=>{g||f(x=>({...x,debouncedInput:l}))},cm);return()=>{clearTimeout(_)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const x=await o(c)||[];h(F=>({...F,predictions:x}))}catch(x){console.error("Error fetching predictions:",x),h(F=>({...F,predictions:[]}))}})():h(_=>({..._,predictions:[]}))},[c,g]),C.useEffect(()=>{m>=0&&p[m]&&f(_=>({..._,displayInput:p[m].description}))},[m,p]);const v=_=>{[Sn.DOWN,Sn.UP,Sn.ENTER].includes(_.key)&&(_.preventDefault(),_.key===Sn.DOWN&&m<p.length-1?h(x=>({...x,activePredictionIndex:m+1})):_.key===Sn.UP&&m>0?h(x=>({...x,activePredictionIndex:m-1})):_.key===Sn.ENTER&&m>-1&&(s(p[m].description),f(x=>({...x,input:p[m].description})),h(x=>({...x,predictions:[],isPredictionSelected:!0}))))},E=_=>{s(_.target.value),f(x=>({...x,input:_.target.value,displayInput:_.target.value})),h(x=>({...x,activePredictionIndex:-1,isPredictionSelected:!1}))},k=_=>{s(_.description),f(x=>({...x,input:_.description,displayInput:_.description})),h(x=>({...x,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((_,x)=>d.jsx("li",{onClick:()=>k(_),onMouseEnter:()=>h(F=>({...F,activePredictionIndex:x})),className:Y("predictions-list-item",{active:x===m}),children:_.description},x))})]})};const Zc=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const p=ue.useIntl(),{onChange:m,...g}=r,h=()=>{t||m(c?null:l)},D=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const E=v.target;E.nodeName.toLowerCase()==="a"||E.parentNode&&E.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),h())},className:Y("checkbox-wrapper",e),...f,...g},D)};const fm=C.memo(function({direction:t="down"}){return d.jsx(za,{className:Y("rotating-chevron",`direction-${t}`)})});const hm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[f,p]=C.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[h,D]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(S=>S.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{D(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:k,..._}=a,x=S=>{if(o){let z=[];h!=null&&h.includes(S.id)?z=h.filter(N=>N!==S.id):z=[...h,S.id],D([...z]),E&&E([...z])}else D([S]),E&&E(S.id),p(!1)},F=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];D(z),E&&E(z)}else D([]),E&&E([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${h.length}`:v.label,d.jsx(fm,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);x(z)},hidden:!f,..._,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(h==null?void 0:h.includes(S))||(h==null?void 0:h.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),x(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(_e,{variant:"secondary",onClick:()=>{k&&k(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const mm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const p=ue.useIntl(),m=i?c:[],g=c;return d.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:D=!1,value:v=h,disabled:E=!1})=>{const k=`${r}_${h}`,_=()=>{if(E)return;let x;if(i){const F=m==null?void 0:m.indexOf(v);Array.isArray(m)&&F>=0?(x=m,x.splice(F,1)):(!m||m.length===0?x=[]:x=m,x.push(v))}else x=g===v?void 0:v;t.onChange(x)};return d.jsx(Zc,{element:"li",id:k,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:_},intlPath:n,label:D||p.formatMessage({id:n?`${n}_${h}`:h}),disabled:E},k)})})};const pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var p;l(!o),c(o?"password":"text"),(p=s.current)==null||p.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Mn,{inputRef:s,type:u,...r})]})};const jn={text:{component:Mn},email:{component:Mn},url:{component:Mn},textarea:{component:Mn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Zc},checkboxes:{component:mm,props:{multiSelect:!0}},select:{component:hm},password:{component:pm},autocomplete:{component:dm}},gm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const p=ue.useIntl(),m=l&&l.some(({condition:x})=>x==="required"),g=Ha(u),h=o&&jn[o]&&jn[o].component?jn[o].component:Mn,D={};o&&["checkboxes"].includes(o)?D.element="span":D.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:gn(a),value:u};if(i>0){const x=Vc(i,a.onChange);v={...v,...x},x.functions&&typeof x.functions=="object"&&(v.functions={...v.functions,...x.functions})}o&&jn[o]&&jn[o].props&&(v={...v,...jn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const E=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),k=({...x})=>r?C.createElement(x.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...x},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...v,label:E,className:Y("field-wrapper",n)}),d.jsx(k,{as:"p"})]});const _=x=>C.createElement(x.element||"label",{...x,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(_,{...D,children:[E,m&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...v}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(k,{})]})},vm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?gn(e.errors):{},i=e.values?gn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=gn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:h=!1}=p.validation[m];let D=!1;if(typeof g=="function"){const v=g(i);v&&(D=h||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(D){o({type:"addError",payload:{key:p.id,value:D}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ui=null;const rr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:f=()=>{},onCatch:p=()=>{},onFailure:m=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:D,...v}=s,E=40,{shouldShowCancelButton:k=!1,shouldReset:_=!0,showRequiredLabels:x=!0,showSuccessMessage:F=!1}=l||{},S=ue.useIntl(),z={};t.length&&t.forEach(y=>{const H=y.id||y.name;H&&(z[H]=y.value||"")});const[N,$]=C.useReducer(vm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:I,isSubmitting:w,formSubmitted:A,values:T}=N;C.useEffect(()=>{_&&A&&(ui=setTimeout(()=>{$({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[A]),C.useEffect(()=>()=>{ui&&clearTimeout(ui)},[]),C.useEffect(()=>{const y=H=>{$({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",y),()=>{document.removeEventListener("dropdownMultiSelectSubmit",y)}},[]);const M=C.useRef(null),R=a||M;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const W=()=>{if(!w){if($({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&$({type:"submitForm",payload:{fields:t,dispatch:$,intl:S}});return}$({type:"submitForm",payload:{fields:t,dispatch:$,onSuccess:async y=>{try{await c(y),$({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(H){p(H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(y,H)=>{m(y,H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},G=[{...v,icon:A?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:y=>{var B;if(y.preventDefault(),y.stopPropagation(),w)return;let H=0;if((B=R==null?void 0:R.current)!=null&&B.id){const j=document.getElementById(R.current.id);j&&(H=j.getBoundingClientRect().top+window.scrollY)}const te=document.getElementById("header");te&&(H=H-te.offsetHeight-E),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),W()},disabled:w||A||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||A?S.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return k&&G.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||A,onClick:f,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Y("form",n),ref:R},d.jsxs(d.Fragment,{children:[I!=null&&I.general?d.jsx(sn,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!_||!w&&!A||h)&&t.map((y,H)=>{const{id:te=y.name||H,component:B,functions:j={onChange:()=>{}},submitOnEnter:q=!1}=y;if(B)return d.jsx(B,{...y.props||{}},`component-${te}-${H}`);const L=T?T[te]:"",U={...j,onChange:ne=>{$({type:"updateValue",payload:{key:te,value:ne}}),j.onChange(ne&&ne.toString(),$)}};return q&&(U.onKeyDown=ne=>{ne.key==="Enter"&&(ne.stopPropagation(),ne.preventDefault(),W()),j.onKeyDown&&j.onKeyDown(ne)}),d.jsx(gm,{intlPath:i,...y,showRequiredLabels:x,value:L,error:I==null?void 0:I[te],functions:U},te)}),D?null:(w||A)&&h?h:d.jsx(_n,{className:Y("cta",{center:w||A,submitted:A}),buttons:G})]})),F&&A&&d.jsx(_r,{className:"success",children:typeof F=="string"?F:S.formatMessage({id:"form_success"})})]})};const Hr="passwordRules_",Yc="isMoreThanEightCharacters",Gc="includesNumberAndSymbol",Qc="includesLowerAndUppercase",bm={[Yc]:"8Characters",[Gc]:"numberSymbol",[Qc]:"lowercaseUppercase"},ym=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Hr}intro`})}),d.jsx("ul",{children:[Yc,Gc,Qc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Re,{children:[n.formatMessage({id:`${Hr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Hr}rule_${bm[r]}`})}),!e[r]&&d.jsxs(Re,{element:"strong",children:[" ",n.formatMessage({id:`${Hr}notMet`})]})]},`rule-${r}`))})]})},Jc=C.memo(ym);const Dm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(E=>({...E,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(E=>({...E,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(Et,{className:"rating-placeholder"});const{id:f,rating:p,disabled:m}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},D=async v=>{if(!(!f||m))try{u(E=>({...E,rating:v,disabled:!0})),await r({id:f,value:v})}catch(E){u(k=>({...k,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:h[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const E=v+1;return d.jsx("li",{className:Y({selected:p&&E<=p}),children:d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||E>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:E,total:t})}${E===1||E===t?` - ${h[E===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),D(E)},disabled:m})},`rating-${E}`)})})]})};function Cm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function ls(e,t){return Array(t+1).join(e)}function xm(e){return e.replace(/^\n*/,"")}function wm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
37
|
+
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const m=({propertyName:h})=>{h==="max-height"&&p(D=>D==="opening"?"open":D==="closing"?"closed":D)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(Rt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[d.jsx(Nt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Nt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Nt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Nt,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,Qh=({children:e})=>d.jsx(Rt,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],em=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Xh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Wa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Rt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},nm=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Re,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Ho=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Ho(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Ho(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},os=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const am={default:{a:rm,CollapsibleSection:Wa,TextBox:Rt,CaseStudy:Qh,style:tt,details:em,div:tm,iframe:nm,center:Jh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Kn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=am[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Nt,{options:{...s,...t,overrides:o},children:n})})};const Wc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const mn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Rs(!!a),c=d.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(kn,{isOpen:l,children:a}),c]}):c};const _r=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const im=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Re,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=C.memo(im);const oi="loadingBlock_",sm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${oi}loading`})},75:{text:r.formatMessage({id:`${oi}almostDone`})},100:{text:r.formatMessage({id:`${oi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Rt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx($s,{progress:e})]})},om=C.memo(sm);const Et=({element:e="div",className:t="",...n})=>d.jsx(za,{element:e,className:Y("loading-placeholder",t),...n});const us={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Hc=(e,t)=>e in us?d.jsx("div",{className:e,children:us[e].map((n,r)=>Hc(n,r))},t):d.jsx(Et,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:us[e].map((n,r)=>Hc(n,r))}),Uc=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},qr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],um=e=>{const t=Math.ceil(26/qr.length),n=Uc(e).toLowerCase();if(n==="")return qr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<qr.length;a++)if(r<=t*(a+1))return qr[a]};const Uo=256,on=({className:e="",src:t="",name:n,alt:r,width:a=Uo,height:i=Uo,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null),c=r??n;C.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,h=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=h*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=um(n),m.fillRect(0,0,g,h),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Uc(n),g/2,h/1.6)},[n]);let f=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(f=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:f?d.jsx("img",{src:t,alt:c,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Un(l,r)),l};const nr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:c="medium"}=r,f=zs(t);f.name||(f.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=f;let{url:g}=f;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const h=lm(f),D=n&&n.createdAt?as(n.createdAt):!1,v=n&&n.createdAt?Ms(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",c,o),...a,children:d.jsxs(Bn,{href:g,gtmType:s,gtmContext:i,onClick:E=>{E==null||E.stopPropagation()},children:[d.jsx(on,{name:p,src:m,alt:l}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[p,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&D&&d.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${D.path}`},{number:D.number})}),n.didEdit&&d.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),h&&d.jsx("small",{className:Y({"text-medium":c==="large"}),children:h})]})]})})};const Vo={small:24,medium:48},qs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,m)=>{let g,h="";if(m<o){const{name:D="",image:v=""}=zs(p);if(s)return d.jsx(Et,{element:"li",className:"contributor"},m);g=d.jsx(on,{name:D,src:v,width:Vo[a||"medium"],height:Vo[a||"medium"]})}else if(m===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":D>99}),children:["+",$h(D,0)]}),h="number-left"}return g?d.jsx("li",{className:Y("contributor",h),children:g},m):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Un(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Y("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},Ha=e=>(e==null?void 0:e.toString().length)||0,Vc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{Ha(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Wr="emailHelperTextBox_",Kc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${Wr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(m=>{m.preventDefault(),m.stopPropagation();const g=h=>{s({path:`${Wr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Wr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let m=Wr,g="default",h={},D={};switch(e){case"gov":m+="autoApproved",g="success";break;case"nonGov":m+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":m+="pendingApproval",g="error",D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":m+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":m+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:m+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:m,type:g,link:h,mail:D})},[e]);const c={};return["link","mail"].forEach(m=>{c[m]=Object.keys(i[m]).length?g=>d.jsx("a",{...i[m],children:g}):g=>g}),d.jsx(zc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(Et,{element:"span"}),d.jsx(Et,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:m=>d.jsx("strong",{children:m}),em:m=>d.jsx("em",{children:m}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Mn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:p=>{const m=p.target;a.onChange(m.value)}})};const Sn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},cm=500,dm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:D}=ue.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const _=setTimeout(()=>{g||f(x=>({...x,debouncedInput:l}))},cm);return()=>{clearTimeout(_)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const x=await o(c)||[];h(F=>({...F,predictions:x}))}catch(x){console.error("Error fetching predictions:",x),h(F=>({...F,predictions:[]}))}})():h(_=>({..._,predictions:[]}))},[c,g]),C.useEffect(()=>{m>=0&&p[m]&&f(_=>({..._,displayInput:p[m].description}))},[m,p]);const v=_=>{[Sn.DOWN,Sn.UP,Sn.ENTER].includes(_.key)&&(_.preventDefault(),_.key===Sn.DOWN&&m<p.length-1?h(x=>({...x,activePredictionIndex:m+1})):_.key===Sn.UP&&m>0?h(x=>({...x,activePredictionIndex:m-1})):_.key===Sn.ENTER&&m>-1&&(s(p[m].description),f(x=>({...x,input:p[m].description})),h(x=>({...x,predictions:[],isPredictionSelected:!0}))))},E=_=>{s(_.target.value),f(x=>({...x,input:_.target.value,displayInput:_.target.value})),h(x=>({...x,activePredictionIndex:-1,isPredictionSelected:!1}))},k=_=>{s(_.description),f(x=>({...x,input:_.description,displayInput:_.description})),h(x=>({...x,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((_,x)=>d.jsx("li",{onClick:()=>k(_),onMouseEnter:()=>h(F=>({...F,activePredictionIndex:x})),className:Y("predictions-list-item",{active:x===m}),children:_.description},x))})]})};const Zc=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const p=ue.useIntl(),{onChange:m,...g}=r,h=()=>{t||m(c?null:l)},D=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const E=v.target;E.nodeName.toLowerCase()==="a"||E.parentNode&&E.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),h())},className:Y("checkbox-wrapper",e),...f,...g},D)};const fm=C.memo(function({direction:t="down"}){return d.jsx(za,{className:Y("rotating-chevron",`direction-${t}`)})});const hm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[f,p]=C.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[h,D]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(S=>S.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{D(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:k,..._}=a,x=S=>{if(o){let z=[];h!=null&&h.includes(S.id)?z=h.filter(N=>N!==S.id):z=[...h,S.id],D([...z]),E&&E([...z])}else D([S]),E&&E(S.id),p(!1)},F=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];D(z),E&&E(z)}else D([]),E&&E([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${h.length}`:v.label,d.jsx(fm,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);x(z)},hidden:!f,..._,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(h==null?void 0:h.includes(S))||(h==null?void 0:h.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),x(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(_e,{variant:"secondary",onClick:()=>{k&&k(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const mm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const p=ue.useIntl(),m=i?c:[],g=c;return d.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:D=!1,value:v=h,disabled:E=!1})=>{const k=`${r}_${h}`,_=()=>{if(E)return;let x;if(i){const F=m==null?void 0:m.indexOf(v);Array.isArray(m)&&F>=0?(x=m,x.splice(F,1)):(!m||m.length===0?x=[]:x=m,x.push(v))}else x=g===v?void 0:v;t.onChange(x)};return d.jsx(Zc,{element:"li",id:k,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:_},intlPath:n,label:D||p.formatMessage({id:n?`${n}_${h}`:h}),disabled:E},k)})})};const pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var p;l(!o),c(o?"password":"text"),(p=s.current)==null||p.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Mn,{inputRef:s,type:u,...r})]})};const jn={text:{component:Mn},email:{component:Mn},url:{component:Mn},textarea:{component:Mn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Zc},checkboxes:{component:mm,props:{multiSelect:!0}},select:{component:hm},password:{component:pm},autocomplete:{component:dm}},gm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const p=ue.useIntl(),m=l&&l.some(({condition:x})=>x==="required"),g=Ha(u),h=o&&jn[o]&&jn[o].component?jn[o].component:Mn,D={};o&&["checkboxes"].includes(o)?D.element="span":D.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:gn(a),value:u};if(i>0){const x=Vc(i,a.onChange);v={...v,...x},x.functions&&typeof x.functions=="object"&&(v.functions={...v.functions,...x.functions})}o&&jn[o]&&jn[o].props&&(v={...v,...jn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const E=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),k=({...x})=>r?C.createElement(x.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...x},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...v,label:E,className:Y("field-wrapper",n)}),d.jsx(k,{as:"p"})]});const _=x=>C.createElement(x.element||"label",{...x,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(_,{...D,children:[E,m&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...v}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(k,{})]})},vm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?gn(e.errors):{},i=e.values?gn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=gn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:h=!1}=p.validation[m];let D=!1;if(typeof g=="function"){const v=g(i);v&&(D=h||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(D){o({type:"addError",payload:{key:p.id,value:D}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ui=null;const rr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:f=()=>{},onCatch:p=()=>{},onFailure:m=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:D,...v}=s,E=40,{shouldShowCancelButton:k=!1,shouldReset:_=!0,showRequiredLabels:x=!0,showSuccessMessage:F=!1}=l||{},S=ue.useIntl(),z={};t.length&&t.forEach(y=>{const H=y.id||y.name;H&&(z[H]=y.value||"")});const[N,$]=C.useReducer(vm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:I,isSubmitting:w,formSubmitted:A,values:T}=N;C.useEffect(()=>{_&&A&&(ui=setTimeout(()=>{$({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[A]),C.useEffect(()=>()=>{ui&&clearTimeout(ui)},[]),C.useEffect(()=>{const y=H=>{$({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",y),()=>{document.removeEventListener("dropdownMultiSelectSubmit",y)}},[]);const M=C.useRef(null),R=a||M;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const W=()=>{if(!w){if($({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&$({type:"submitForm",payload:{fields:t,dispatch:$,intl:S}});return}$({type:"submitForm",payload:{fields:t,dispatch:$,onSuccess:async y=>{try{await c(y),$({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(H){p(H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(y,H)=>{m(y,H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},G=[{...v,icon:A?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:y=>{var B;if(y.preventDefault(),y.stopPropagation(),w)return;let H=0;if((B=R==null?void 0:R.current)!=null&&B.id){const j=document.getElementById(R.current.id);j&&(H=j.getBoundingClientRect().top+window.scrollY)}const te=document.getElementById("header");te&&(H=H-te.offsetHeight-E),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),W()},disabled:w||A||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||A?S.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return k&&G.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||A,onClick:f,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Y("form",n),ref:R},d.jsxs(d.Fragment,{children:[I!=null&&I.general?d.jsx(sn,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!_||!w&&!A||h)&&t.map((y,H)=>{const{id:te=y.name||H,component:B,functions:j={onChange:()=>{}},submitOnEnter:q=!1}=y;if(B)return d.jsx(B,{...y.props||{}},`component-${te}-${H}`);const L=(T==null?void 0:T[te])||"",U={...j,onChange:ne=>{$({type:"updateValue",payload:{key:te,value:ne}}),j.onChange(ne&&ne.toString(),$)}};return q&&(U.onKeyDown=ne=>{ne.key==="Enter"&&(ne.stopPropagation(),ne.preventDefault(),W()),j.onKeyDown&&j.onKeyDown(ne)}),d.jsx(gm,{intlPath:i,...y,showRequiredLabels:x,value:L,error:I==null?void 0:I[te],functions:U},te)}),D?null:(w||A)&&h?h:d.jsx(_n,{className:Y("cta",{center:w||A,submitted:A}),buttons:G})]})),F&&A&&d.jsx(_r,{className:"success",children:typeof F=="string"?F:S.formatMessage({id:"form_success"})})]})};const Hr="passwordRules_",Yc="isMoreThanEightCharacters",Gc="includesNumberAndSymbol",Qc="includesLowerAndUppercase",bm={[Yc]:"8Characters",[Gc]:"numberSymbol",[Qc]:"lowercaseUppercase"},ym=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Hr}intro`})}),d.jsx("ul",{children:[Yc,Gc,Qc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Re,{children:[n.formatMessage({id:`${Hr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Hr}rule_${bm[r]}`})}),!e[r]&&d.jsxs(Re,{element:"strong",children:[" ",n.formatMessage({id:`${Hr}notMet`})]})]},`rule-${r}`))})]})},Jc=C.memo(ym);const Dm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(E=>({...E,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(E=>({...E,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(Et,{className:"rating-placeholder"});const{id:f,rating:p,disabled:m}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},D=async v=>{if(!(!f||m))try{u(E=>({...E,rating:v,disabled:!0})),await r({id:f,value:v})}catch(E){u(k=>({...k,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:h[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const E=v+1;return d.jsx("li",{className:Y({selected:p&&E<=p}),children:d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||E>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:E,total:t})}${E===1||E===t?` - ${h[E===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),D(E)},disabled:m})},`rating-${E}`)})})]})};function Cm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function ls(e,t){return Array(t+1).join(e)}function xm(e){return e.replace(/^\n*/,"")}function wm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
38
|
`;)t--;return e.substring(0,t)}var Em=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Hs(e){return Us(e,Em)}var Xc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function ed(e){return Us(e,Xc)}function km(e){return nd(e,Xc)}var td=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function _m(e){return Us(e,td)}function Bm(e){return nd(e,td)}function Us(e,t){return t.indexOf(e.nodeName)>=0}function nd(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var nt={};nt.paragraph={filter:"p",replacement:function(e){return`
|
|
39
39
|
|
|
40
40
|
`+e+`
|
|
@@ -129,7 +129,7 @@ ${u}
|
|
|
129
129
|
`:""}`;case o[Z.paragraph]:return`${u}
|
|
130
130
|
|
|
131
131
|
`;case o[Z.hr]:return`---
|
|
132
|
-
`;default:return u}}function Nn(e,t){const n=e.trim(),r=n,a=`${t}${r}${ql(t)}`;if(r.length===e.length)return a;const i=t+r+ql(t);return e.replace(n,i)}const ql=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>gf(t)).join("").trim();const yC=()=>{const e=An(),{dispatch:t,mentionPopover:n,id:r}=C.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Jd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Ic,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(nr,{element:"li",className:Y({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:f=>{f.preventDefault(),f.stopPropagation();const p={...n,selectedUser:c};t([{type:"mentionPopover",value:p}]),pf(e,p,t,r)}}},l))})})})},po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=An(),{id:u,tabbableOption:c,setFocus:f,openTooltip:p,dispatch:m}=C.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),m(D)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var D,v,E,k;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const _=h.currentTarget.closest("li");let x=_==null?void 0:_.nextElementSibling;if(h.key==="ArrowLeft"){const z=_==null?void 0:_.previousElementSibling;z?x=z:x=(D=_==null?void 0:_.parentElement)==null?void 0:D.lastElementChild}else x||(x=(v=_==null?void 0:_.parentElement)==null?void 0:v.firstElementChild);const F=x==null?void 0:x.className.split(" ")[0];F&&(f(F),(E=x==null?void 0:x.querySelector("button"))==null||E.focus());break;default:const S=h.currentTarget.closest("fieldset");if(S){(k=S==null?void 0:S.previousElementSibling)==null||k.focus();break}}},children:[d.jsx(Re,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(kn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Wl=[Z.ol,Z.ul],vf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},bf=(e,t,n)=>{try{const r=DC(e),a=vf(e,t),i=Wl.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Wl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:p=>{const m=p;return!b.isEditor(p)&&ce.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&Q.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=An(),i=vf(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{bf(a,e,r),n(i?null:e)}})},xr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&go(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),mo(n)}}else go(e,t,n,r)},go=(e,t,n,r=a=>{console.error(a)})=>{try{xr(e)&&yf(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),mo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},yf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Pi=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Kt),s=An(),o=$y(s),l=(o==null?void 0:o.text)||mC(s),[u,c]=C.useState(xr(s)),f=Jd(s,"link-editor",`${n}-link`),p=C.useRef(null);C.useEffect(()=>{var D;!u&&r&&((D=p.current)==null||D.focus())},[u]),C.useEffect(()=>{Pi&&clearTimeout(Pi),Pi=setTimeout(()=>{c(xr(s))},500)},[s.selection]);const m=[],g=["open","edit","remove"].map(D=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:o==null?void 0:o.pretty})};switch(m.push({className:D}),D){case"open":v.href=(o==null?void 0:o.full)||"",v.onClick=E=>{E.preventDefault(),E.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Re,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":v.onClick=()=>{c(!1)};break;case"remove":v.onClick=()=>{const E=[{type:"showLinkEditor",value:!1}];xr(s)&&(yf(s),E.push({type:"lastAnchor",value:null})),a(E)};break}return v}),h=[{id:"url",type:"url",inputRef:p,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&h.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(kn,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=p.current)==null?void 0:D.focus()})}},children:u?d.jsx(_n,{wrappers:m,buttons:g}):d.jsx(rr,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(()=>{const v=[{type:"showLinkEditor",value:!1}];if(D.url){const{full:E}=Mc(D.url);o!=null&&o.full?wC(s,E,n,i):xC(s,E,n,i),v.push({type:"lastAnchor",value:null})}a(v)})}},fields:h,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=An(),{setFocus:t,dispatch:n}=C.useContext(Kt),[r,a]=C.useState(!1);return C.useEffect(()=>{a(xr(e))},[e.selection]),d.jsx(po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Df=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Cf=(e,t,n)=>{try{Df(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=An(),i=Df(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{Cf(a,e,r),n(i?null:e)}})},Aa=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=C.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Re,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Aa.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===Aa.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const NC=En(TC),RC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&NC(i)?go(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const xf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{listMembers:c,onChange:f=()=>{},reportError:p=R=>{console.error(R)}}=a||{},m=[{type:Z.paragraph,children:[{text:""}]}],g={editorKey:null,originalValue:t||"",initialValue:t?null:m,tabbableOption:Aa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[h,D]=C.useReducer(Nr,g),{editorKey:v,originalValue:E,initialValue:k,stringValue:_,lastAnchor:x,lastKey:F,hasInteracted:S,hasLoaded:z,mentionPopover:N}=h,$=R=>{const W=R||Aa[0];R&&D([{type:"tabbableOption",value:W}])},I=`rte-${e}`,w=C.useCallback(R=>d.jsx(My,{...R}),[]),A=C.useCallback(R=>d.jsx(Iy,{...R}),[]),T=C.useMemo(()=>RC(MC(IC(Ev(Ny(xv())),p),p),I,p),[]);C.useEffect(()=>{if(!t)return;kr.lastIndex=0;const R=t.match(kr);!R||R.length>1||R[0].length!==t.length||S||D([{type:"originalValue",value:t}])},[t]),C.useEffect(()=>{E&&(async()=>{let W=gn(E);W.includes("<")&&(W=new Ca().turndown(W)),s&&s.mentions&&(W=await Rc({text:W,template:`[${Es}{{name}}]({{id}})`,mentions:s.mentions,listMembers:c||(()=>Promise.resolve([]))})),hC(W,X=>{D([{type:"initialValue",value:X},{type:"editorKey",value:E.toString()}]),setTimeout(()=>{D([{type:"stringValue",value:$l(T)}])},150)})})()},[E]),C.useEffect(()=>{if(T.children.length>0&&!z){if(D([{type:"hasLoaded",value:!0}]),!i)return;const R=b.end(T,[]);Q.select(T,R),J.focus(T)}},[T.children.length,k]),C.useEffect(()=>{t!==""||!T||bc(E,t)&&!S||(b.withoutNormalizing(T,()=>{Q.delete(T,{at:{anchor:b.start(T,[]),focus:b.end(T,[])}}),Q.deselect(T),T.children.length!==0&&Q.unwrapNodes(T,{at:[0]}),Q.insertNodes(T,m,{at:[0]})}),D([{type:"initialValue",value:m},{type:"lastAnchor",value:null}]))},[t]);const M=wc(()=>{gC(T,N.show,c,D)},100);return k?d.jsx("div",{id:I,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...h,id:I,setFocus:$,dispatch:D,reportError:p},children:[d.jsxs(Oy,{editor:T,initialValue:k,onChange:R=>{if(T.operations.some(X=>X.type!=="set_selection")){const X=bC(R);f(X),D([{type:"stringValue",value:$l(T)}]),S||D([{type:"hasInteracted",value:!0}]),M(),u&&console.log({serialized:X,json:R})}},...o,children:[d.jsx(Ey,{className:"input",renderElement:w,renderLeaf:A,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:R=>{if(R.key==="Enter"){N.show&&(R.preventDefault(),R.stopPropagation(),pf(T,N,D,I));const{selection:W}=T;if(W){const X=V.isCollapsed(W),[G,y]=b.node(T,W,{depth:1});let H=G,te=H.type;const B=H.children[0];if(B&&[Z.ol,Z.ul].includes(B.type)&&(H=B,te=B.type),H&&ce.isElement(H)&&te!==Z.paragraph){if(te===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),Q.insertNodes(T,m);return}if(X){const[j]=b.parent(T,W,{edge:"end"}),L=j.type;if(F==="Enter"&&L===Z.li&&[Z.ul,Z.ol].includes(te)){R.stopPropagation(),R.preventDefault(),Q.insertNodes(T,m,{at:P.next(y)}),Q.select(T,b.end(T,P.next(y)));return}}}}}else if(R.key==="Escape"){if(N.show){R.preventDefault(),R.stopPropagation(),D([{type:"mentionPopover",value:{...N,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&N.show){R.preventDefault(),R.stopPropagation();const{selectedUser:W,possibleUsers:X}=N;let G=R.key==="ArrowUp"?W-1:W+1;G<0&&(G=X.length-1),G>=X.length&&(G=0),D([{type:"mentionPopover",value:{...N,selectedUser:G}}])}D([{type:"lastKey",value:R.key}]),pC(R,T,D,p)},onBlur:()=>{T.selection&&D([{type:"lastAnchor",value:T.selection.anchor}])},onFocus:()=>{if(x){if(!P.isPath(x.path)||!oe.has(T,x.path))return;const R=oe.get(T,x.path);let W=0;if(de.isText(R)?W=R.text.length:R.children&&(W=R.children.length),x.offset>W)return;try{Q.select(T,{anchor:x,focus:x})}catch(X){const G=X.message;p(`Error focusing editor: ${G}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]},v),d.jsx(Ws,{limit:r,valueLength:Ha(_)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(on,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(_e,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const wf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(rr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[p,m]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:D}=ue.useIntl(),v=async _=>{_.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(x){h("ERROR"),o(x)}},E=_=>{_.preventDefault(),h("NOT_SUBMITTED"),m(!0),f([])},k=_=>{_.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:D({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",D({id:"inviteForm_error"})]})}),d.jsx(nn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"secondary",onClick:E,children:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(_e,{onClick:k,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(_e,{onClick:E,children:D({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:_=>{f(_),m(!_.length)},autoFocus:!1,getLabel:(_,x,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:_}),d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(x),m(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},x)})]}),d.jsx(nn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ga=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!is(m[Dt.NEW_PASSWORD]).isValid,f=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ga(["required",c]),functions:{onChange:m=>l(is(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ga(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ga(["required"])}),i&&f.push({component:Jc,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:f,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(rr,{...p}),r&&d.jsx(sn,{variant:"error",text:r})]})};const kf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Vn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Re,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Re,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Re,{children:l.formatMessage({id:"search_cta"})})})]})})})},Hl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},qC=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},WC=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Hl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Kc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>d.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>d.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Hl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const UC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:c,url:f,logInButton:p,successMessage:m},[h,D]=C.useReducer(Nr,VC),{validFields:v,emailDetails:E,shouldManuallyApprove:k,shouldDisableButton:_,showSuccessMessage:x,showError:F}=h,[S,z]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{k===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[k]),C.useEffect(()=>{S["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{x&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const $=C.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:h,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,N,g,h]),I=_?!0:k?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&x?d.jsx(UC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(sn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(rr,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:I?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await WC({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:h})},onCatch:w=>{r.handleError(w),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};var Ss={exports:{}},ea={exports:{}},Oe={};/** @license React v16.13.1
|
|
132
|
+
`;default:return u}}function Nn(e,t){const n=e.trim(),r=n,a=`${t}${r}${ql(t)}`;if(r.length===e.length)return a;const i=t+r+ql(t);return e.replace(n,i)}const ql=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>gf(t)).join("").trim();const yC=()=>{const e=An(),{dispatch:t,mentionPopover:n,id:r}=C.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Jd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Ic,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(nr,{element:"li",className:Y({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:f=>{f.preventDefault(),f.stopPropagation();const p={...n,selectedUser:c};t([{type:"mentionPopover",value:p}]),pf(e,p,t,r)}}},l))})})})},po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=An(),{id:u,tabbableOption:c,setFocus:f,openTooltip:p,dispatch:m}=C.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),m(D)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var D,v,E,k;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const _=h.currentTarget.closest("li");let x=_==null?void 0:_.nextElementSibling;if(h.key==="ArrowLeft"){const z=_==null?void 0:_.previousElementSibling;z?x=z:x=(D=_==null?void 0:_.parentElement)==null?void 0:D.lastElementChild}else x||(x=(v=_==null?void 0:_.parentElement)==null?void 0:v.firstElementChild);const F=x==null?void 0:x.className.split(" ")[0];F&&(f(F),(E=x==null?void 0:x.querySelector("button"))==null||E.focus());break;default:const S=h.currentTarget.closest("fieldset");if(S){(k=S==null?void 0:S.previousElementSibling)==null||k.focus();break}}},children:[d.jsx(Re,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(kn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Wl=[Z.ol,Z.ul],vf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},bf=(e,t,n)=>{try{const r=DC(e),a=vf(e,t),i=Wl.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Wl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:p=>{const m=p;return!b.isEditor(p)&&ce.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&Q.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=An(),i=vf(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{bf(a,e,r),n(i?null:e)}})},xr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&go(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),mo(n)}}else go(e,t,n,r)},go=(e,t,n,r=a=>{console.error(a)})=>{try{xr(e)&&yf(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),mo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},yf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Pi=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Kt),s=An(),o=$y(s),l=(o==null?void 0:o.text)||mC(s),[u,c]=C.useState(xr(s)),f=Jd(s,"link-editor",`${n}-link`),p=C.useRef(null);C.useEffect(()=>{var D;!u&&r&&((D=p.current)==null||D.focus())},[u]),C.useEffect(()=>{Pi&&clearTimeout(Pi),Pi=setTimeout(()=>{c(xr(s))},500)},[s.selection]);const m=[],g=["open","edit","remove"].map(D=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:o==null?void 0:o.pretty})};switch(m.push({className:D}),D){case"open":v.href=(o==null?void 0:o.full)||"",v.onClick=E=>{E.preventDefault(),E.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Re,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":v.onClick=()=>{c(!1)};break;case"remove":v.onClick=()=>{const E=[{type:"showLinkEditor",value:!1}];xr(s)&&(yf(s),E.push({type:"lastAnchor",value:null})),a(E)};break}return v}),h=[{id:"url",type:"url",inputRef:p,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&h.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(kn,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=p.current)==null?void 0:D.focus()})}},children:u?d.jsx(_n,{wrappers:m,buttons:g}):d.jsx(rr,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(()=>{const v=[{type:"showLinkEditor",value:!1}];if(D.url){const{full:E}=Mc(D.url);o!=null&&o.full?wC(s,E,n,i):xC(s,E,n,i),v.push({type:"lastAnchor",value:null})}a(v)})}},fields:h,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=An(),{setFocus:t,dispatch:n}=C.useContext(Kt),[r,a]=C.useState(!1);return C.useEffect(()=>{a(xr(e))},[e.selection]),d.jsx(po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Df=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Cf=(e,t,n)=>{try{Df(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=An(),i=Df(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{Cf(a,e,r),n(i?null:e)}})},Aa=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=C.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Re,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Aa.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===Aa.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const NC=En(TC),RC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&NC(i)?go(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const xf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{listMembers:c,onChange:f=()=>{},reportError:p=R=>{console.error(R)}}=a||{},m=[{type:Z.paragraph,children:[{text:""}]}],g={editorKey:null,originalValue:t||"",initialValue:t?null:m,tabbableOption:Aa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[h,D]=C.useReducer(Nr,g),{editorKey:v,originalValue:E,initialValue:k,stringValue:_,lastAnchor:x,lastKey:F,hasInteracted:S,hasLoaded:z,mentionPopover:N}=h,$=R=>{const W=R||Aa[0];R&&D([{type:"tabbableOption",value:W}])},I=`rte-${e}`,w=C.useCallback(R=>d.jsx(My,{...R}),[]),A=C.useCallback(R=>d.jsx(Iy,{...R}),[]),T=C.useMemo(()=>RC(MC(IC(Ev(Ny(xv())),p),p),I,p),[]);C.useEffect(()=>{if(!t)return;kr.lastIndex=0;const R=t.match(kr);!R||R.length>1||R[0].length!==t.length||S||D([{type:"originalValue",value:t}])},[t]),C.useEffect(()=>{E&&(async()=>{let W=gn(E);W.includes("<")&&(W=new Ca().turndown(W)),s&&s.mentions&&(W=await Rc({text:W,template:`[${Es}{{name}}]({{id}})`,mentions:s.mentions,listMembers:c||(()=>Promise.resolve([]))})),hC(W,X=>{D([{type:"initialValue",value:X},{type:"editorKey",value:E.toString()}]),setTimeout(()=>{D([{type:"stringValue",value:$l(T)}])},150)})})()},[E]),C.useEffect(()=>{if(T.children.length>0&&!z){if(D([{type:"hasLoaded",value:!0}]),!i)return;const R=b.end(T,[]);Q.select(T,R),J.focus(T)}},[T.children.length,k]),C.useEffect(()=>{t!==""||!T||bc(E,t)&&!S||(b.withoutNormalizing(T,()=>{Q.delete(T,{at:{anchor:b.start(T,[]),focus:b.end(T,[])}}),Q.deselect(T),T.children.length!==0&&Q.unwrapNodes(T,{at:[0]}),Q.insertNodes(T,m,{at:[0]})}),D([{type:"initialValue",value:m},{type:"lastAnchor",value:null}]))},[t]);const M=wc(()=>{gC(T,N.show,c,D)},100);return k?d.jsx("div",{id:I,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...h,id:I,setFocus:$,dispatch:D,reportError:p},children:[d.jsxs(Oy,{editor:T,initialValue:k,onChange:R=>{if(T.operations.some(X=>X.type!=="set_selection")){const X=bC(R);f(X),D([{type:"stringValue",value:$l(T)}]),S||D([{type:"hasInteracted",value:!0}]),M(),u&&console.log({serialized:X,json:R})}},...o,children:[d.jsx(Ey,{className:"input",renderElement:w,renderLeaf:A,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:R=>{if(R.key==="Enter"){N.show&&(R.preventDefault(),R.stopPropagation(),pf(T,N,D,I));const{selection:W}=T;if(W){const X=V.isCollapsed(W),[G,y]=b.node(T,W,{depth:1});let H=G,te=H.type;const B=H.children[0];if(B&&[Z.ol,Z.ul].includes(B.type)&&(H=B,te=B.type),H&&ce.isElement(H)&&te!==Z.paragraph){if(te===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),Q.insertNodes(T,m);return}if(X){const[j]=b.parent(T,W,{edge:"end"}),L=j.type;if(F==="Enter"&&L===Z.li&&[Z.ul,Z.ol].includes(te)){R.stopPropagation(),R.preventDefault(),Q.insertNodes(T,m,{at:P.next(y)}),Q.select(T,b.end(T,P.next(y)));return}}}}}else if(R.key==="Escape"){if(N.show){R.preventDefault(),R.stopPropagation(),D([{type:"mentionPopover",value:{...N,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&N.show){R.preventDefault(),R.stopPropagation();const{selectedUser:W,possibleUsers:X}=N;let G=R.key==="ArrowUp"?W-1:W+1;G<0&&(G=X.length-1),G>=X.length&&(G=0),D([{type:"mentionPopover",value:{...N,selectedUser:G}}])}D([{type:"lastKey",value:R.key}]),pC(R,T,D,p)},onBlur:()=>{T.selection&&D([{type:"lastAnchor",value:T.selection.anchor}])},onFocus:()=>{if(x){if(!P.isPath(x.path)||!oe.has(T,x.path))return;const R=oe.get(T,x.path);let W=0;if(de.isText(R)?W=R.text.length:R.children&&(W=R.children.length),x.offset>W)return;try{Q.select(T,{anchor:x,focus:x})}catch(X){const G=X.message;p(`Error focusing editor: ${G}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]},v),d.jsx(Ws,{limit:r,valueLength:Ha(_)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(on,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(_e,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const wf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(rr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[p,m]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:D}=ue.useIntl(),v=async _=>{_.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(x){h("ERROR"),o(x)}},E=_=>{_.preventDefault(),h("NOT_SUBMITTED"),m(!0),f([])},k=_=>{_.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:D({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",D({id:"inviteForm_error"})]})}),d.jsx(nn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"secondary",onClick:E,children:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(_e,{onClick:k,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(_e,{onClick:E,children:D({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:_=>{f(_),m(!_.length)},autoFocus:!1,getLabel:(_,x,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:_}),d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(x),m(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},x)})]}),d.jsx(nn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ga=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!is(m[Dt.NEW_PASSWORD]).isValid,f=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ga(["required",c]),functions:{onChange:m=>l(is(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ga(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ga(["required"])}),i&&f.push({component:Jc,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:f,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(rr,{...p}),r&&d.jsx(sn,{variant:"error",text:r})]})};const kf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Vn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Re,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Re,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Re,{children:l.formatMessage({id:"search_cta"})})})]})})})},Hl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},qC=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},WC=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Hl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Kc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>d.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>d.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Hl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const UC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:c,url:f,logInButton:p,successMessage:m},[h,D]=C.useReducer(Nr,VC),{validFields:v,emailDetails:E,shouldManuallyApprove:k,shouldDisableButton:_,showSuccessMessage:x,showError:F}=h,[S,z]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{k===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[k]),C.useEffect(()=>{S["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{x&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const $=C.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:h,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,N,g,h]),I=_?!0:k?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&x?d.jsx(UC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(sn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(rr,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:I?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await WC({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:h})},onCatch:w=>{r.handleError(w),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};var Ss={exports:{}},ea={exports:{}},Oe={};/** @license React v16.13.1
|
|
133
133
|
* react-is.production.min.js
|
|
134
134
|
*
|
|
135
135
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/index.mjs
CHANGED
|
@@ -3724,7 +3724,7 @@ const zr = ({
|
|
|
3724
3724
|
} = y;
|
|
3725
3725
|
if (k)
|
|
3726
3726
|
return /* @__PURE__ */ d.jsx(k, { ...y.props || {} }, `component-${ee}-${W}`);
|
|
3727
|
-
const I = F ? F[ee]
|
|
3727
|
+
const I = (F == null ? void 0 : F[ee]) || "", H = {
|
|
3728
3728
|
...S,
|
|
3729
3729
|
onChange: (te) => {
|
|
3730
3730
|
$({ type: "updateValue", payload: { key: ee, value: te } }), S.onChange(te && te.toString(), $);
|
|
@@ -18355,8 +18355,7 @@ const Mx = {
|
|
|
18355
18355
|
createAccount: () => Promise.resolve(),
|
|
18356
18356
|
handleError: () => {
|
|
18357
18357
|
},
|
|
18358
|
-
resendVerificationCode: () =>
|
|
18359
|
-
}
|
|
18358
|
+
resendVerificationCode: () => Promise.resolve()
|
|
18360
18359
|
},
|
|
18361
18360
|
shouldShow: a = {},
|
|
18362
18361
|
submitButton: i,
|