@apolitical/component-library 4.5.0 → 4.5.1

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/index.js CHANGED
@@ -32,7 +32,7 @@ Check the top-level render call using <`+le+">.")}return ae}}function Oo(j,ae){{
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"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_fieldWrapper_characterLimit_info:"You can enter up 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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",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"},Ih={...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>"},$h={...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"},Lh={...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>"},zh=Object.freeze(Object.defineProperty({__proto__:null,en:er,es:Ih,fr:$h,pt:Lh},Symbol.toStringTag,{value:"Module"})),Wa=(e,t=er)=>e in t,_t=(e,t,n,r,a={})=>{let i="";return Wa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},qh=(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},ca=(e,t)=>D.Children.map(e,n=>Object.is(n,null)?n:D.cloneElement(n,{...t})),Rc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Wh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Mc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(_r);if(!a)return e;for(const s of a){const o=s.replace(_r,(d,h)=>h),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 d=l;if(d.startsWith(ss))try{const h=d.replace(ss,"");u.id=h,await r({id:h}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Wh(e,u,t):s)}return e},Ic=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Hh=e=>new URLSearchParams(window.location.search).get(e),Lo=(e="")=>e.replace(/\s+/g,"").length>0,us=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 Ae=({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:d=!1,children:h=!1,...p})=>{const g=Xn(typeof t=="object"),{showTooltip:f,tooltipProps:C}=$s(!!u);if(typeof t=="object"&&typeof g=="number"){const w=Object.assign({},t),E=Bc(Object.keys(w));t=Ac(g,E,w)}!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 x={...p,className:G(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:w=>{(!a||a[0]==="#")&&s&&(w.preventDefault(),w.stopPropagation()),s&&s(w)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const _=D.createElement(i,x,h||(d?c.jsx(Me,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...C,children:[c.jsx(kn,{isOpen:f,children:u}),_]}):_},tr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ae,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ae,{...s})},o)});return D.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const Vt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},zo={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"}},Uh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?zo[e]:zo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Vh=({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},ui=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Vh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const nr=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=Uh(e),g=ui({format:"avif",query:s,range:p,url:o}),f=ui({format:"webp",query:s,range:p,url:o}),C=ui({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:C,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Kh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(nr,{image:{...e},className:"image"})}),_n=({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),c.jsx("a",{href:e,className:G("gtm-trackable",r),...l,children:t})}return n?D.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const $c=D.forwardRef(({className:e="",children:t},n)=>{const r=D.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Ha=({parent:e=document.body,children:t})=>typeof document=="object"?yc.createPortal(t,e):null;const Zh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Me,{children:c.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const Yh=({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 c.jsx(Ae,{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 Gh=({items:e,className:t="",...n})=>c.jsx("ul",{className:G("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),qo=300,Wo="ease-in-out";class Qh{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:qo,easing:Wo}),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:qo,easing:Wo}),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 Ua=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=D.useRef(null);return D.useEffect(()=>{let s;return r&&(s=new Qh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Ho={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Jh=e=>{let t=e;return Object.keys(Ho).includes(e)&&(t=Ho[e]),`url(${Ut}icons/${t}.svg)`};const Uo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Lc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Jh(t)}:{},s=Wa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:G("content-type-label text-small",e in Uo?Uo[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(${Ut}icons/${t}.svg)`}:{};return c.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const on=({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 h=Object.assign({},n.breakpoints),p=Bc(Object.keys(h));a=Ac(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Rt,{variant:"subtle",className:G("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Nt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ae,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ls=({children:e,...t})=>c.jsx("p",{...t,children:e}),zc={q:ls,blockquote:ls};for(let e=1;e<=6;e++)zc[`h${e}`]={component:ls,props:{className:"title"}};const qc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Nt,{options:{wrapper:D.Fragment,forceBlock:!0,overrides:zc},children:r}):c.jsx("p",{children:r})]});const Wc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=D.useRef(null);e||(e=Date.now().toString());const[u,d]=D.useState(""),[h,p]=D.useState("closed");D.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",m),()=>{f.removeEventListener("transitionend",m)}},[]),D.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"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_fieldWrapper_characterLimit_info:"You can enter up 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_insights:"Insights",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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",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"},Ih={...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>"},$h={...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"},Lh={...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>"},zh=Object.freeze(Object.defineProperty({__proto__:null,en:er,es:Ih,fr:$h,pt:Lh},Symbol.toStringTag,{value:"Module"})),Wa=(e,t=er)=>e in t,_t=(e,t,n,r,a={})=>{let i="";return Wa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},qh=(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},ca=(e,t)=>D.Children.map(e,n=>Object.is(n,null)?n:D.cloneElement(n,{...t})),Rc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Wh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Mc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(_r);if(!a)return e;for(const s of a){const o=s.replace(_r,(d,h)=>h),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 d=l;if(d.startsWith(ss))try{const h=d.replace(ss,"");u.id=h,await r({id:h}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Wh(e,u,t):s)}return e},Ic=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Hh=e=>new URLSearchParams(window.location.search).get(e),Lo=(e="")=>e.replace(/\s+/g,"").length>0,us=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 Ae=({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:d=!1,children:h=!1,...p})=>{const g=Xn(typeof t=="object"),{showTooltip:f,tooltipProps:C}=$s(!!u);if(typeof t=="object"&&typeof g=="number"){const w=Object.assign({},t),E=Bc(Object.keys(w));t=Ac(g,E,w)}!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 x={...p,className:G(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:w=>{(!a||a[0]==="#")&&s&&(w.preventDefault(),w.stopPropagation()),s&&s(w)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const _=D.createElement(i,x,h||(d?c.jsx(Me,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...C,children:[c.jsx(kn,{isOpen:f,children:u}),_]}):_},tr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ae,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ae,{...s})},o)});return D.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const Vt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},zo={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"}},Uh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?zo[e]:zo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Vh=({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},ui=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Vh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const nr=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=Uh(e),g=ui({format:"avif",query:s,range:p,url:o}),f=ui({format:"webp",query:s,range:p,url:o}),C=ui({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:C,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Kh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(nr,{image:{...e},className:"image"})}),_n=({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),c.jsx("a",{href:e,className:G("gtm-trackable",r),...l,children:t})}return n?D.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const $c=D.forwardRef(({className:e="",children:t},n)=>{const r=D.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Ha=({parent:e=document.body,children:t})=>typeof document=="object"?yc.createPortal(t,e):null;const Zh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Me,{children:c.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const Yh=({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 c.jsx(Ae,{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 Gh=({items:e,className:t="",...n})=>c.jsx("ul",{className:G("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),qo=300,Wo="ease-in-out";class Qh{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:qo,easing:Wo}),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:qo,easing:Wo}),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 Ua=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=D.useRef(null);return D.useEffect(()=>{let s;return r&&(s=new Qh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Ho={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Jh=e=>{let t=e;return Object.keys(Ho).includes(e)&&(t=Ho[e]),`url(${Ut}icons/${t}.svg)`};const Uo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Lc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Jh(t)}:{},s=Wa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:G("content-type-label text-small",e in Uo?Uo[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(${Ut}icons/${t}.svg)`}:{};return c.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const on=({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 h=Object.assign({},n.breakpoints),p=Bc(Object.keys(h));a=Ac(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Rt,{variant:"subtle",className:G("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Nt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ae,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ls=({children:e,...t})=>c.jsx("p",{...t,children:e}),zc={q:ls,blockquote:ls};for(let e=1;e<=6;e++)zc[`h${e}`]={component:ls,props:{className:"title"}};const qc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Nt,{options:{wrapper:D.Fragment,forceBlock:!0,overrides:zc},children:r}):c.jsx("p",{children:r})]});const Wc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=D.useRef(null);e||(e=Date.now().toString());const[u,d]=D.useState(""),[h,p]=D.useState("closed");D.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",m),()=>{f.removeEventListener("transitionend",m)}},[]),D.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
36
36
  `);d(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
37
37
  `))},[a]),D.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const m=({propertyName:f})=>{f==="max-height"&&p(C=>C==="opening"?"open":C==="closing"?"closed":C)};if(!a)return null;const g=["opening","open"].includes(h);return c.jsxs(Rt,{variant:"subtle",className:G("hide-show-text-box",t),children:[c.jsxs("div",{ref:l,id:e,className:G("content",h),children:[c.jsx(Nt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),c.jsx("p",{className:"cta",children:c.jsx(Ae,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"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 Xh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return D.createElement(e,{className:G("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:D.Fragment,forceInline:!0},h={"--icon":`url(${Ut}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(D.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Nt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Nt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Nt,{options:d,children:l.text}):l.text},u)})})},nt=()=>D.Fragment,em=({children:e})=>c.jsx(Rt,{variant:"secondary",children:e}),tm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),nm=["span","strong","h1","h2","h3","h4","h5","h6","p"],rm=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(D.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of D.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&D.isValidElement(s)){const o=s.type;if(nm.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 c.jsx(Ua,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},am=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Rt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},im=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"),c.jsxs(c.Fragment,{children:[c.jsx(Me,{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}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:`content-after-iframe-${n}`})]})},Vo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},sm=({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 D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&D.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"||Vo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!D.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Vo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ae,{variant:"primary",size:"medium",...n,children:r})})):c.jsx("a",{...n,children:r})},cs=({children:e,...t})=>c.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const om={default:{a:sm,CollapsibleSection:Ua,TextBox:Rt,CaseStudy:em,style:nt,details:rm,div:am,iframe:im,center:tm},"text-only":{h1:nt,h2:nt,h3:nt,h4:nt,h5:nt,h6:nt,style:nt,details:nt,div:nt,TextBox:nt,CollapsibleSection:nt,CaseStudy:nt,blockquote:nt,iframe:nt,button:nt}},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:D.Fragment,forceBlock:!0};let o=om[r];return t.overrides&&(o={...o,...t.overrides}),c.jsx("div",{className:G("markdown-text",e,{"highlight-titles":i}),children:c.jsx(Nt,{options:{...s,...t,overrides:o},children:n})})};const Hc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:G("page-heading",a),children:[c.jsxs("div",{className:G("content",{"has-max-width":e}),style:i,children:[t&&t.text&&D.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&D.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(${Ut}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=$s(!!a),d=c.jsx("span",{...u,className:G("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?c.jsxs("span",{className:"pill-wrapper",children:[c.jsx(kn,{isOpen:l,children:a}),d]}):d};const Br=({element:e="p",children:t=null,className:n="",...r})=>D.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const um=({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,d={"--progress":`${t}%`};return c.jsx("span",{className:G(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:D.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},zs=D.memo(um);const li="loadingBlock_",lm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${li}loading`})},75:{text:r.formatMessage({id:`${li}almostDone`})},100:{text:r.formatMessage({id:`${li}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(${Ut}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Rt,{className:G("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(zs,{progress:e})]})},cm=D.memo(lm);const Et=({element:e="div",className:t="",...n})=>c.jsx(qa,{element:e,className:G("loading-placeholder",t),...n});const ds={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"]},Uc=(e,t)=>e in ds?c.jsx("div",{className:e,children:ds[e].map((n,r)=>Uc(n,r))},t):c.jsx(Et,{className:e},t),qs=({layout:e="overview-page",...t})=>c.jsx("div",{className:G("loading-state",e),...t,children:ds[e].map((n,r)=>Uc(n,r))}),Vc=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):""},Wr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],dm=e=>{const t=Math.ceil(26/Wr.length),n=Vc(e).toLowerCase();if(n==="")return Wr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Wr.length;a++)if(r<=t*(a+1))return Wr[a]};const Ko=256,Zt=({className:e="",src:t="",name:n,alt:r,width:a=Ko,height:i=Ko,...s})=>{const[o,l]=D.useState(!1),u=D.useRef(null),d=r??n;D.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,f=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=f*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=dm(n),m.fillRect(0,0,g,f),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Vc(n),g/2,f/1.6)},[n]);let h=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:G("profile-picture",e,{error:o}),...s,children:h?c.jsx("img",{src:t,alt:d,onError:()=>{l(!0)},width:a,height:i}):c.jsx("canvas",{ref:u})})},Va=e=>e==="apolitical"?{image:`${Ut}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ut}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},fm=({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 rr=({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:d="medium"}=r,h=Va(t);h.name||(h.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=h;let{url:g}=h;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const f=fm(h),C=n&&n.createdAt?os(n.createdAt):!1,v=n&&n.createdAt?Ls(n.createdAt):"";return D.createElement(e,{className:G("member text-medium",d,o),...a,children:c.jsxs(_n,{href:g,gtmType:s,gtmContext:i,onClick:x=>{x==null||x.stopPropagation()},children:[c.jsx(Zt,{name:p,src:m,alt:l}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{children:[p,n&&c.jsxs("span",{className:"additional-content",children:[n.createdAt&&C&&c.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${C.path}`},{number:C.number})}),n.didEdit&&c.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),f&&c.jsx("small",{className:G({"text-medium":d==="large"}),children:f})]})]})})};const Zo={small:24,medium:48},Ws=({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="",...d})=>{const h=ue.useIntl();return!n||n.length===0?null:D.createElement(e,{...d,className:G("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:C="",image:v=""}=Va(p);if(s)return c.jsx(Et,{element:"li",className:"contributor"},m);g=c.jsx(Zt,{name:C,src:v,width:Zo[a||"medium"],height:Zo[a||"medium"]})}else if(m===o){const C=(t||n.length)-o;g=c.jsxs("small",{className:G({"large-number":C>99}),children:["+",qh(C,0)]}),f="number-left"}return g?c.jsx("li",{className:G("contributor",f),children:g},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Un(n[0].name||"",20):l||null})]})})},Kc=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&c.jsx(wh.ReactQueryDevtools,{initialIsOpen:!1})]})};var hm=D.createContext({client:la});function mm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=D.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(la.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),la.init(r,a)),la)},[n,r]);return D.createElement(hm.Provider,{value:{client:i}},t)}const Zc=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(mm,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e}),Yc=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...zh[r],...n||{}};return c.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},Hs=D.createContext({}),da={en:"English",es:"Español",fr:"Français",pt:"Português"},It=D.createContext({isLoading:!0});function Ka(){return D.useContext(It)}const Gc=({children:e,user:t})=>c.jsx(It.Provider,{value:t,children:e}),Us=D.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Qc=()=>D.useContext(Us),Jc=({children:e})=>{const[t,n]=D.useState([]);D.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=D.useCallback(i=>{n(s=>[...s,i])},[]),a=D.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(Us.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},pm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=D.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=D.useState(s),u=d=>{localStorage.setItem("language",d),l(d)};return D.useEffect(()=>{e().then(d=>{i({...d,isLoading:!1}),Rc(5e3)}).catch(d=>{d.message===jc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),c.jsx(Hs.Provider,{value:{language:o,updateLanguage:u},children:c.jsx(Yc,{locale:o,messages:n==null?void 0:n.messages,children:c.jsx(Ms.CookiesProvider,{children:c.jsx(Gc,{user:a,children:c.jsx(Jc,{children:c.jsx(Kc,{showDevTools:r,children:c.jsx(Zc,{user:a,children:t})})})})})})})};const lr="joinCommunityButton",Vs=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=D.useContext(It),l=o&&typeof o.id=="string",u=r||!l,[d,h]=D.useState(e),[p,m]=D.useState(e?"joined":"notJoined");D.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${lr}_leave`}),g["aria-label"]=s.formatMessage({id:`${lr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ae,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${lr}_closed_tooltip`}):"",onClick:async C=>{if(u)return;C.currentTarget.blur(),m(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${lr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const x=d?i:a;typeof x=="function"&&setTimeout(async()=>{await x()},500),h(!d)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${lr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ci="communityDetails_",gm=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,d=a||i.length,h=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,m=t||n,g=!n&&!t;return c.jsxs("div",{className:G("community-details",e),children:[m&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ci}members`}),c.jsx("span",{className:"count",children:d})]}),!p&&c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${ci}viewAll`})})})]}),c.jsx(Ws,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(Vs,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(Ae,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ci}invite`})})]})};const vm=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:G("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(_n,{href:s?void 0:i,...l,children:Un(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const bm=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=D.useState(t?["all"]:[]),u=(d,h)=>{let p=[];o.includes(d)?p=o.filter(m=>m!==d):d==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),d]:p=[d],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return c.jsx("ul",{className:G("filters",a),children:s.map(({id:d,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),c.jsx("li",{children:c.jsx("button",{className:G(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,m)},...g,children:h})},d)})})},ym=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const Hr="languageSwitcher_",Dm=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:d=()=>{}}=D.useContext(Hs),[h,p]=D.useState(e);if(D.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(C=>C&&C.post_name))return null;const g=Object.keys(r),f=h!==e;return c.jsxs("div",{className:G("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${Hr}label`})}),c.jsx("ul",{children:g.map(C=>{var _;if(!da[C])return null;const v=(_=r[C])==null?void 0:_.post_name;let x={className:C};if(h===C)x["aria-label"]=u.formatMessage({id:`${Hr}selected`},{language:da[C]});else{const w=ym(C,v,i);x={...x,href:typeof w=="string"?w:w.url,onClick:E=>{p(C),d(C),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(C,typeof w=="string"?w:w.urlForRouter))}}}return c.jsx("li",{children:c.jsx(_n,{...x,fallbackElement:"span",children:da[C]})},C)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${Hr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${Hr}disclaimer`},{email:Rn.support,link:C=>{const v=`mailto:${C}`;return c.jsx("a",{href:v,children:C})}})})]})};const di=ue.createIntl({locale:"en",messages:er}),Mr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:di.formatMessage({id:"loadMore_button"}),endOfFeed:di.formatMessage({id:"loadMore_endOfFeed"}),error:di.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=D.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:G("load-more",l),children:!d&&e?c.jsx(Ae,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Ks=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:c.jsx(Me,{children:c.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let Ur=!1;const Xc=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=D.useRef(null),[s,o]=D.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return D.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),D.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},g)=>{const f={...m,onClick:C=>{o(!1),typeof d=="function"&&d(C)},onFocus:()=>{Ur&&(clearTimeout(Ur),Ur=!1)},onBlur:()=>{Ur=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ae,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Cm=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const xm=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],ed=({activeLink:e})=>{const t=ue.useIntl(),n=D.useContext(It),r=n&&typeof n.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[xm.map(({key:a,href:i})=>{const s=Cm(i,e),o={};return s&&(o["aria-current"]="page"),c.jsx("li",{className:G(a,{active:s}),children:c.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&c.jsx("li",{className:"profile","data-testid":"profile-link",children:c.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[c.jsx(Zt,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),c.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},cr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,wm=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${cr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${cr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${cr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
38
38
 
@@ -131,7 +131,7 @@ ${u}
131
131
  `:""}`;case o[Y.paragraph]:return`${u}
132
132
 
133
133
  `;case o[Y.hr]:return`---
134
- `;default:return u}}function Nn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Hl(t)}`;if(r.length===e.length)return a;const i=t+r+Hl(t);return e.replace(n,i)}const Hl=e=>e.split("").reverse().join(""),RC=e=>e.map(t=>_f(t)).join("").trim();const MC=()=>{const e=An(),{dispatch:t,mentionPopover:n,id:r}=D.useContext(Gt),{show:a,selectedUser:i,possibleUsers:s}=n,o=lf(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:c.jsx(Ha,{children:c.jsx($c,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:c.jsx("ul",{children:s.map(({userId:l,user:u},d)=>c.jsx(rr,{element:"li",className:G({selected:d===i}),member:{id:l,...u,link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation();const p={...n,selectedUser:d};t([{type:"mentionPopover",value:p}]),kf(e,p,t,r)}}},l))})})})},Do=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=An(),{id:u,tabbableOption:d,setFocus:h,openTooltip:p,dispatch:m}=D.useContext(Gt),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const C=[{type:"openTooltip",value:null}];l.selection&&C.push({type:"lastAnchor",value:l.selection.anchor}),m(C)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var C,v,x,_;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const w=f.currentTarget.closest("li");let E=w==null?void 0:w.nextElementSibling;if(f.key==="ArrowLeft"){const W=w==null?void 0:w.previousElementSibling;W?E=W:E=(C=w==null?void 0:w.parentElement)==null?void 0:C.lastElementChild}else E||(E=(v=w==null?void 0:w.parentElement)==null?void 0:v.firstElementChild);const T=E==null?void 0:E.className.split(" ")[0];T&&(h(T),(x=E==null?void 0:E.querySelector("button"))==null||x.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(_=S==null?void 0:S.previousElementSibling)==null||_.focus();break}}},children:[c.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(kn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ul=[Y.ol,Y.ul],Bf=(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},IC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Y.blockquote});return!!t},Af=(e,t,n)=>{try{const r=IC(e),a=Bf(e,t),i=Ul.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Ul.includes(u.type)},split:!0});const o={type:a?Y.paragraph:i?Y.li:t};if(J.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:d,match:p=>{const m=p;return!b.isEditor(p)&&ce.isElement(p)&&m.type===Y.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:Y.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},$C=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=An(),i=Bf(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{Af(a,e,r),n(i?null:e)}})},wr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Y.link}});return!!t},LC=(e,t,n,r)=>{e.selection&&Co(e,t,n,r)},zC=(e,t,n,r)=>{const{selection:a}=e;if(a&&Z.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Y.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),yo(n)}}else Co(e,t,n,r)},Co=(e,t,n,r=a=>{console.error(a)})=>{try{wr(e)&&Ff(e);const{selection:a}=e,i=a&&Z.isCollapsed(a),s={type:Y.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),yo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Ff=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Y.link}})};let Ii=null;const qC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=D.useContext(Gt),o=An(),l=r1(o),u=(l==null?void 0:l.text)||jC(o),[d,h]=D.useState(wr(o)),p=lf(o,"link-editor",`${n}-link`),m=D.useRef(null);D.useEffect(()=>{var x;!d&&r&&((x=m.current)==null||x.focus())},[d]),D.useEffect(()=>{Ii&&clearTimeout(Ii),Ii=setTimeout(()=>{h(wr(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(x=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${x}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:x}),x){case"open":_.href=(l==null?void 0:l.full)||"",_.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Me,{children:e.formatMessage({id:`${t}${x}_text`})})]});break;case"edit":_.onClick=()=>{h(!1)};break;case"remove":_.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];wr(o)&&(Ff(o),w.push({type:"lastAnchor",value:null})),i(w)};break}return _}),C=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&C.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});let v=document.body;if(a!==!1){const x=document.getElementById(`${a}-overlay`);x&&(v=x)}return c.jsx(Ha,{parent:v,children:c.jsx(kn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var x;return(x=m.current)==null?void 0:x.focus()})}},children:d?c.jsx(tr,{wrappers:g,buttons:f}):c.jsx(Bn,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async x=>{setTimeout(()=>{const _=[{type:"showLinkEditor",value:!1}];if(x.url){const{full:w}=Ic(x.url);l!=null&&l.full?zC(o,w,n,s):LC(o,w,n,s),_.push({type:"lastAnchor",value:null})}i(_)})}},fields:C,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},WC=()=>{const e=An(),{setFocus:t,dispatch:n}=D.useContext(Gt),[r,a]=D.useState(!1);return D.useEffect(()=>{a(wr(e))},[e.selection]),c.jsx(Do,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},HC=e=>[Y.bold,Y.italic,Y.strikethrough].includes(e),Tf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Sf=(e,t,n)=>{try{Tf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},UC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=An(),i=Tf(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{Sf(a,e,r),n(i?null:e)}})},Fa=[Y.bold,Y.italic,Y.strikethrough],VC=[Y.ol,Y.ul,Y.blockquote];const KC=({...e})=>{const t=ue.useIntl(),{id:n}=D.useContext(Gt);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Fa.map((r,a)=>c.jsx(UC,{format:r,hasDivider:a===Fa.length-1},r)),c.jsx(WC,{}),VC.map((r,a)=>c.jsx($C,{format:r,hasDivider:a===1},r))]})]}),c.jsx(qC,{})]})};var ZC=JC,YC=/^(?:\w+:)?\/\/(\S+)$/,GC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,QC=/^[^\s\.]+\.\S{2,}$/;function JC(e){if(typeof e!="string")return!1;var t=e.match(YC);if(!t)return!1;var n=t[1];return n?!!(GC.test(n)||QC.test(n)):!1}const XC=En(ZC),ex=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Y.link].includes(s.type)||a(i)},e.insertText=i=>{i&&XC(i)?Co(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},tx=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Y.mention?!0:n(i),e.isVoid=i=>i.type===Y.mention?!0:r(i),e.markableVoid=i=>i.type===Y.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},nx=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Y.link&&oe.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const jf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),d=Mh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,onChange:m=()=>{},reportError:g=H=>{console.error(H)}}=i||{},f=[{type:Y.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const C={editorKey:null,originalValue:t||"",initialValue:t?null:f,tabbableOption:Fa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[v,x]=D.useReducer(Rr,C),{editorKey:_,originalValue:w,initialValue:E,stringValue:T,lastAnchor:S,lastKey:W,hasInteracted:O,hasLoaded:q,mentionPopover:I}=v,k=H=>{const y=H||Fa[0];H&&x([{type:"tabbableOption",value:y}])},A=`rte-${e}`,P=D.useCallback(H=>c.jsx(t1,{...H}),[]),$=D.useCallback(H=>c.jsx(n1,{...H}),[]),R=D.useMemo(()=>ex(tx(nx(qv(Xy(Lv())),g),g),A,g),[]);D.useEffect(()=>{if(!t)return;_r.lastIndex=0;const H=t.match(_r);!H||H.length>1||H[0].length!==t.length||O||x([{type:"originalValue",value:t}])},[t]);const U=H=>{if(!R||H!==A)return;const y=b.end(R,[]);J.select(R,y),X.focus(R)};D.useEffect(()=>{const H=y=>{var B;const z=y,ee=((B=z==null?void 0:z.detail)==null?void 0:B.id)||null;ee&&U(ee)};return window.addEventListener("focusEditor",H),()=>{window.removeEventListener("focusEditor",H)}},[]),D.useEffect(()=>{if(R.children.length>0&&!q){if(x([{type:"hasLoaded",value:!0}]),!s)return;U(A)}},[R.children.length,E]),D.useEffect(()=>{w&&(async()=>{let y=gn(w);y.includes("<")&&(y=new xa().turndown(y)),o&&o.mentions&&(y=await Mc({text:y,template:`[${Bs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),SC(y,z=>{x([{type:"initialValue",value:z},{type:"editorKey",value:w.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:zl(R)}])},150)})})()},[w]),D.useEffect(()=>{t!==""||!R||as(w,t)&&!O||(b.withoutNormalizing(R,()=>{J.delete(R,{at:{anchor:b.start(R,[]),focus:b.end(R,[])}}),J.deselect(R),R.children.length!==0&&J.unwrapNodes(R,{at:[0]}),J.insertNodes(R,f,{at:[0]})}),x([{type:"initialValue",value:f},{type:"lastAnchor",value:null}]))},[t]);const se=Ec(()=>{PC(R,I.show,p,x)},100);return E?c.jsx("div",{id:A,className:"rich-text-editor",children:c.jsxs(Gt.Provider,{value:{...v,id:A,isInOverlay:h,setFocus:k,dispatch:x,reportError:g},children:[c.jsxs(Qy,{editor:R,initialValue:E,onChange:H=>{if(R.operations.some(z=>z.type!=="set_selection")){const z=RC(H);m(z),x([{type:"stringValue",value:zl(R)}]),O||x([{type:"hasInteracted",value:!0}]),se(),d&&console.log({serialized:z,json:H})}},...l,children:[c.jsx(qy,{className:"input",renderElement:P,renderLeaf:$,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:H=>{if(H.key==="Enter"){I.show&&(H.preventDefault(),H.stopPropagation(),kf(R,I,x,A));const{selection:y}=R;if(y){const z=Z.isCollapsed(y),[ee,B]=b.node(R,y,{depth:1});let F=ee,L=F.type;const M=F.children[0];if(M&&[Y.ol,Y.ul].includes(M.type)&&(F=M,L=M.type),F&&ce.isElement(F)&&L!==Y.paragraph){if(L===Y.blockquote&&!H.shiftKey){H.stopPropagation(),H.preventDefault(),J.insertNodes(R,f);return}if(z){const[V]=b.parent(R,y,{edge:"end"}),te=V.type;if(W==="Enter"&&te===Y.li&&[Y.ul,Y.ol].includes(L)){H.stopPropagation(),H.preventDefault(),J.insertNodes(R,f,{at:N.next(B)}),J.select(R,b.end(R,N.next(B)));return}}}}}else if(H.key==="Escape"){if(I.show){H.preventDefault(),H.stopPropagation(),x([{type:"mentionPopover",value:{...I,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(H.key)&&I.show){H.preventDefault(),H.stopPropagation();const{selectedUser:y,possibleUsers:z}=I;let ee=H.key==="ArrowUp"?y-1:y+1;ee<0&&(ee=z.length-1),ee>=z.length&&(ee=0),x([{type:"mentionPopover",value:{...I,selectedUser:ee}}])}x([{type:"lastKey",value:H.key}]),OC(H,R,x,g)},onBlur:()=>{R.selection&&x([{type:"lastAnchor",value:R.selection.anchor}])},onFocus:()=>{if(S){if(!N.isPath(S.path)||!oe.has(R,S.path))return;const H=oe.get(R,S.path);let y=0;if(fe.isText(H)?y=H.text.length:H.children&&(y=H.children.length),S.offset>y)return;try{J.select(R,{anchor:S,focus:S})}catch(z){const ee=z.message;g(`Error focusing editor: ${ee}`)}}}}),c.jsx(KC,{}),p?c.jsx(MC,{}):null]},_),c.jsx(Zs,{id:`character-limit-${e}`,limit:r,valueLength:Za(T)})]})}):null};const rx=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=D.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);D.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function ax({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=D.useState(!1),[l,u]=D.useState(!1),d=D.useRef(null),h=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(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(Zt,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&c.jsx("p",{className:"error text-small",children:c.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:h,hidden:!0,"data-testid":"file-input"}),c.jsx(Ae,{onClick:()=>d.current&&d.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:c.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Of=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Bn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{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 Pf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,h]=D.useState([]),[p,m]=D.useState(!0),[g,f]=D.useState(u),{formatMessage:C}=ue.useIntl(),v=async w=>{w.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(E){f("ERROR"),o(E)}},x=w=>{w.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},_=w=>{w.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:C({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",C({id:"inviteForm_error"})]})}),c.jsx(Vt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"secondary",onClick:x,children:C({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ae,{onClick:_,children:C({id:"inviteForm_ctaDone"})})]}):c.jsx(Ae,{onClick:x,children:C({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Eh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:C({id:"inviteForm_email_placeholder"}),emails:d,onChange:w=>{h(w),m(!w.length)},autoFocus:!1,getLabel:(w,E,T)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:w}),c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(E),m(!d.length)},className:"remove-email-button",screenreaderText:C({id:"overlay_close"})})]},E)})]}),c.jsx(Vt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ae,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ba=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},ix=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=D.useState(null),[i,s]=D.useState(!1),[o,l]=D.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!us(m[Dt.NEW_PASSWORD]).isValid,h=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ba(["required",d]),functions:{onChange:m=>l(us(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ba(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ba(["required"])}),i&&h.push({component:ud,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:h,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 c.jsxs(c.Fragment,{children:[c.jsx(Bn,{...p}),r&&c.jsx(on,{variant:"error",text:r})]})};const Nf=({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=D.useRef(null);Vn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Vl=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 d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},sx=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"]}},ox=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=sx(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}])},ux=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(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:()=>h(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"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Vl({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:rd,props:{email:d.email,type:d.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:()=>h(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:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.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=>c.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=>c.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=>c.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(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Vl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const lx=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const cx={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},dx=({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:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,C]=D.useReducer(Rr,cx),{validFields:v,emailDetails:x,shouldManuallyApprove:_,shouldDisableButton:w,showSuccessMessage:E,showError:T}=f,[S,W]=Ms.useCookies(["signup-this-session","functional-cookie-consent"]),O={form:D.createRef(),name:D.createRef(),email:D.createRef(),jobTitle:D.createRef(),organisation:D.createRef(),tc:D.createRef(),hiddenValidation:D.createRef()};D.useEffect(()=>{_===!0&&O.jobTitle.current&&O.jobTitle.current.focus()},[_]),D.useEffect(()=>{S["signup-this-session"]&&C([{type:"showSuccessMessage",value:!0}])},[S]),D.useEffect(()=>{E&&S["functional-cookie-consent"]&&W("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const q=D.useMemo(()=>ux({placeholders:n,labels:t,shouldShow:g,functions:r,refs:O,state:f,dispatch:C,dataToSubmit:s,intl:l}),[s,r,l,O,g,f]),I=w?!0:_?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?c.jsx(lx,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ue.FormattedMessage,{id:"signup_title"})}),T&&c.jsx(on,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Bn,{className:"signup-form",formRef:O.form,id:"sign-up-form",fields:q,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 ox({refs:O,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:C,state:f})},onCatch:k=>{r.handleError(k),C([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:O.hiddenValidation})]})};const cn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const fx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(cn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[D.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(tr,{buttons:r})]})})};function Rf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const hx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return c.jsxs("div",{className:G("edit-section-placeholder",{"has-icon":!!e}),style:Pc(e),children:[c.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&c.jsx(Ae,{href:r,variant:"secondary",size:"small",onClick:()=>Rf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},mx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=D.useState(!1),d=typeof r=="string"||!!n,h=()=>u(!1);return c.jsxs("section",{className:G("edit-section",t),children:[n&&c.jsx(ir,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:c.jsx(Bn,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:h}})}),c.jsxs("div",{className:"edit-section-header",children:[c.jsx("h2",{className:"edit-section-header-title",children:a}),d&&c.jsx(Ae,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Rf({href:r,setShowModal:u}),children:"Edit"})]}),e||c.jsx(hx,{...s,href:r,setShowModal:u,showEditButton:d}),o&&c.jsx(Vt,{})]})};const px=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&D.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let $i;const Li="contactFooter_",gx=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=D.useRef(null),[r,a]=D.useState(0),[i,s]=D.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout($i),$i=setTimeout(()=>{o(),s(!1)},500))};return D.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout($i),window.removeEventListener("resize",l)}),[]),c.jsx(cn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ue.FormattedMessage,{id:`${Li}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ue.FormattedMessage,{id:`${Li}text`})}),c.jsx(_n,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ue.FormattedMessage,{id:`${Li}email`})})]}),c.jsx(Of,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},vx=({activeLink:e,...t})=>c.jsx(cn,{children:c.jsx(td,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(ed,{activeLink:e}),c.jsx(Hc,{...t})]})})});const zi="cookieBanner_",qi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Wi=new Date(Date.now()+12*30*24*60*60*1e3),Mf=()=>{const e=ue.useIntl(),[t,n,r]=Ms.useCookies(qi),[a,i]=D.useState(!t["apol-cookie-banner"]),s=()=>{qi.forEach(d=>{n(d,!0,{path:"/",expires:Wi,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Wi}),qi.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Wi});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${zi}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${zi}title`})}),c.jsx("p",{children:e.formatMessage({id:`${zi}text`})}),c.jsx(tr,{buttons:u})]})},Wt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Rn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Rn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Rn.support,gtmType:"concierge-email-click"},business:{email:Rn.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const qn="footer_",Ta="SiteFooter",Kl=({group:e})=>{const t=Wt[e].order||[];let n=!1;return"text"in Wt[e]&&(n=Wt[e].text),c.jsxs(D.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Wt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":i,...s,children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(D.Fragment,{children:[c.jsx("dt",{children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},xo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(qa,{element:"hr"}),c.jsx(Ks,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Kl,{group:e}),Object.keys(Wt[e]).includes("child")&&c.jsx(Kl,{group:Wt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Wt.social.order)&&Wt.social.order.map(e=>{const t=Wt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ue.FormattedMessage,{id:`${qn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ue.FormattedMessage,{id:`${qn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ie={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Ie.handlerCalled[e]&&i-Ie.handlerCalled[e]<500)return;Ie.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Dc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Ie.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case gt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=Ie.findFirstChild(u.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=Ie.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ie.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ie.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ie.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ie.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ie.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Nr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Sa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=Dc(Nr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let _=o.gtmType||`${e}-click`;if(_.includes(".")){const w=_.split("."),E=w[w.length-2];_=`${E==="topics"?`${E}-`:""}${w[w.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let C={},v={},x={};if(f&&(C={...C,"aria-current":"page"}),m){const _=o.menuId||e,w={onClick:E=>Ie.events.onClick(E,{id:_,callback:a,isOpen:r[_]}),onFocus:()=>Ie.events.onFocus({id:_}),onBlur:()=>Ie.events.onBlur({id:_,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:_,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:_,callback:a})};v={...w,id:_===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(x={...w,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ie.events.onClick(E,{id:_,callback:a,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...C,children:[p?D.createElement(d?Ae:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...x,children:[s.formatMessage({id:h}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(_=>{if(!o[_])return null;const w={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[_].order?c.jsxs("li",{className:G({[o[_].className]:o[_].className}),children:[s.formatMessage({id:`${h}_${_}`}),c.jsx("ul",{children:o[_].order.map(E=>c.jsx(Sa,{id:`${e}.${_}.${E}`,...w},E))})]},_):c.jsx(Sa,{id:`${e}.${_}`,...w},_)})})]},e)};const bx={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const wo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=D.useContext(It),r=Xn(!0,!0),a=n&&typeof n.id=="string",i=D.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=D.useReducer(Rr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=D.useRef(s);D.useEffect(()=>{h.current=s},[s]),_c({scrollPosition:bx[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,x,_=!1)=>{Ie.handleMenus({id:v,value:x,menus:h.current.menus,dispatch:o,forceHandle:_})},m=D.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{h.current.menus[x]&&p(x,!1,!0)})};D.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",g)}},[]),Vn(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Vn(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Nf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),C=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Nr.order.map(v=>c.jsx(Sa,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Ks,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[C,f]}):c.jsxs(c.Fragment,{children:[f,C]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Ie.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(Zt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Nr.buttons.order.map(v=>c.jsx(Sa,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const yx=()=>{const e=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(wo,{}),c.jsx("div",{id:"content",children:c.jsx(on,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(xo,{})]})},If=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=wc(),[f,C]=D.useState(""),v=T=>{const{detail:{message:S}}=T;C(S)};D.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const x=ca(e,{locale:o}),_=ca(t,{locale:o}),w=ca(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),h!=="default"&&(E[h]=!0),p!=="default"&&(E[p]=!0),c.jsx(kh.ErrorBoundary,{onError:r,fallback:c.jsx(yx,{}),children:c.jsxs(D.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,E,{"has-footer":u}),children:[c.jsx(wo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[_&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":m==="large"}),children:_}),D.createElement(d==="bold"?Fo:"div",{id:"content",children:x,className:G({"large-modal":m==="large"})})]}),w&&c.jsx("div",{className:"additional-content appended",children:w}),u&&c.jsx(xo,{}),c.jsx(Mf,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Zl={default:"tags_",headerTopics:"header_topics_topics_"},Hi={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},Dx={getTagDetails:e=>{if(e.includes("topic_")){if(e=Hi.topic[e.replace("topic_","")],e){const t=Nr.topics.topics[e].href;return t?{id:e,href:t,text:`${Zl.headerTopics}${e}`}:null}return null}return Hi[e]?(e=Hi[e],{id:e,text:`${Zl.default}${e}`}):null}};const Cx=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Dx.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const xx=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:c.jsxs("div",{className:G("members-list",s),children:[c.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),c.jsx("span",{className:"count",children:t})]}),c.jsx("ul",{children:e.map((l,u)=>c.jsxs("li",{children:[c.jsx(rr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&c.jsx(mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&c.jsx(Mr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const wx=D.lazy(()=>Promise.resolve().then(()=>bE)),$f=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),i=D.useContext(It)||"community",s=Va(i);s.name||(s.name=r.formatMessage({id:`member_${typeof i=="string"?i:"community"}`}));const{modal:o=!1}=e||{},[l,u]=D.useState(o||Hh("showPost")==="true"||!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(!0)},"data-testid":"discussion-form-card",children:[c.jsx(Zt,{name:s.name,src:s.image,alt:""}),c.jsx("span",{className:"input",children:r.formatMessage({id:"discussionFormCard_placeholder"})})]}),c.jsx(Ha,{children:c.jsx(wx,{showModal:l,onClose:()=>{u(!1)},form:t,className:"in-portal"})})]})},Ex=D.lazy(()=>Promise.resolve().then(()=>Ax)),Eo=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(on,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Vs,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,h={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx($f,{form:h}):c.jsx(Ex,{...h})},kx={showForm:!1},ni=D.createContext(kx),Lf=({children:e})=>{const[t,n]=D.useState({showForm:!1});return c.jsx(ni.Provider,{value:{...t,updateConversation:n},children:e})},_x=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?c.jsx("small",{children:_t(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},Bx=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:_t(a.formatMessage,`${t}label_action`,r,"action")})};let ra=null;const Je="discussion_form_",$r=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:h="DiscussionForm"})=>{var be,he,Ee;const p=ue.useIntl(),m=D.useContext(It),[g,f]=D.useState(""),{isLoading:C=!1,isInWrapper:v=!1,isInOverlay:x=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:E=!1,isPrepopulated:T=!1,showTitle:S=!1,showGuidelines:W=!0,showDivider:O=!1,showSuccessMessage:q=!0}=r||{},{create:I=()=>{},handleSaveEdit:k=()=>{},handleCancel:A=()=>{},callback:P=()=>{},listMembers:$=()=>Promise.resolve([]),props:R={create:{projectNames:["questions-answers"]}}}=u,[U,se]=D.useState({title:E&&E.text||"",body:w&&w.text||T&&T.text||""}),[H,y]=D.useState(o.error||!1),[z,ee]=D.useState(!1);if(D.useEffect(()=>{l&&!w&&T&&T!==U.body&&se({...U,body:T.text||""})},[T]),C)return c.jsx(Et,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const B=ke=>{se({...U,body:ke});let De;!m||!m.id?De=_t(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&ke.length>=i&&(De=`${Je}error_tooLong`):De=_t(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),De?y(De):H&&y(!1)};let F=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const ke=((be=t.slugs)==null?void 0:be.reply)||((he=t.slugs)==null?void 0:he.answer)||((Ee=t.slugs)==null?void 0:Ee.question)||"";ke&&(F=`${F}-${ke.slice(-15)}`)}e&&(F=`${e}-${F}`);const L=async()=>{if(!m||!m.id||!n||te)return;ra&&clearTimeout(ra),ee("submitting");const ke=window.location.pathname;try{let De;switch(t.type){case"post":De=await I({title:U.title,content:U.body});break;case"question":De=await I({title:U.body,authorId:m&&m.id,...R==null?void 0:R.create});break;case"response":De=await I({questionSlug:t.slugs.question},{body:U.body,authorId:m&&m.id,contentPath:ke});break;case"reply":De=await I({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:U.body,authorId:m&&m.id,contentPath:ke});break;default:break}await Rh(1e3),P&&await P(De),ra=setTimeout(()=>{se({title:"",body:""}),ee("submitted"),f(_t(p.formatMessage,`${Je}success`,t.type,"action"));const je=new Event("discussionFormSubmitted");document.dispatchEvent(je),M()},500)}catch(De){const je=De;let Le=`${Je}error`;je!=null&&je.message.includes("entry already exists")&&(Le=_t(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),je!=null&&je.message.includes("429")?Le=_t(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):je!=null&&je.message.includes("400")&&(Le=`${Je}error`),y(Le),M()}},M=()=>{ra=setTimeout(()=>{y(!1),ee(!1),f("")},5e3)},V=!U.title||!Lo(U.title),ne=!U.body||!Lo(U.body);let te=ne;E&&(te=V&&ne);const re=z==="submitting",de=[{component:Bx,props:{formID:F,intlPath:Je,showLabel:E!==!1,type:t.type}},{component:jf,props:{id:`${F}-input`,value:z==="submitting"&&!H?"":U.body,placeholder:a||_t(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:x},functions:{onChange:B,listMembers:$},data:d,autoFocus:w!==!1||_&&!E,"aria-invalid":!!H,"aria-errormessage":"error-message"}},{component:_x,props:{intlPath:Je,showGuidelines:W,type:t.type,gtmContext:h}}];O&&de.push({component:Vt}),E&&de.unshift({id:"title",type:"text",value:E.text,limit:250,autoFocus:_,label:p.formatMessage({id:`${Je}titleField_label`}),functions:{onChange:ke=>{se({...U,title:ke})}},validation:[{condition:()=>te,error:p.formatMessage({id:`${Je}titleField_error`})}]});let Q=!m||!m.id||!n||te||re;return w&&(E?Q=Q||U.body===w.text&&U.title===E.text:Q=Q||U.body===w.text),c.jsxs(c.Fragment,{children:[c.jsxs(Bn,{id:F,className:G("discussion-card discussion-form",{"no-styling":v&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!re||o.cancel},functions:{onSuccess:async()=>{if(w){ee("submitting"),k(U);return}await L()},onCancel:A},fields:de,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`${w?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:Q,overwriteSubmittingText:!0,text:!re&&!w&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${re?w?"saving":"posting":w?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!U.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:h,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!w&&["question"].includes(t.type)&&c.jsx("h2",{children:_t(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(rr,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click"})]}),z==="submitted"&&q&&c.jsx(Br,{className:"success","data-testid":"success",children:_t(p.formatMessage,`${Je}success`,t.type,"action")}),H&&c.jsx(Br,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof H=="string"?H.includes(" ")?H:p.formatMessage({id:H},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):H}),g&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Ax=Object.freeze(Object.defineProperty({__proto__:null,default:$r},Symbol.toStringTag,{value:"Module"})),Fx=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Tx=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const ja=({icon:e,className:t="",...n})=>c.jsx(Ae,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Er=!1;const Ui=()=>{Er!==!1&&(clearTimeout(Er),Er=!1)},Vi=5;let Ki=null;const zf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=D.useReducer(Rr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:C,tabbableLink:v}=h;D.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const x=D.useMemo(()=>Tx(n,Vi),[n]),_=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Er)return Ui(),!1;if(Ui(),f||!s)return!1;Er=setTimeout(w,350)},w=async()=>{if(Ui(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const W=Fx(i.slugs);g?await l(W):await o({...W,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},E=()=>{Ki=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{Ki&&clearTimeout(Ki)};return D.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},c.jsxs(c.Fragment,{children:[c.jsx(ja,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:_,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>E,onClick:S=>{var O;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const W=(O=S.currentTarget.nextSibling)==null?void 0:O.childNodes[0];if(W){const q=W.querySelector("li:first-child a");q&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{q.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),E())},"aria-expanded":C,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(kn,{id:`likes-tooltip-${i.slug}`,isOpen:C,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[x.map((S,W)=>{if(typeof S=="string"||!S.name)return null;const O={};return v!==W&&(O.tabIndex=-1),c.jsx("li",{"data-index":W,children:c.jsx(_n,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:q=>q==null?void 0:q.stopPropagation(),onFocus:()=>T(),onKeyDown:q=>{var $,R,U,se;if(!q||!["ArrowUp","ArrowDown"].includes(q.key||""))return;q.stopPropagation(),q.preventDefault();const I=q.key==="ArrowUp"?"up":"down",k=($=q.currentTarget)==null?void 0:$.parentElement;let A=k==null?void 0:k.nextElementSibling;if(I==="up"){const H=k==null?void 0:k.previousElementSibling;H?A=H:(A=(R=k==null?void 0:k.parentElement)==null?void 0:R.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(U=k==null?void 0:k.parentElement)==null?void 0:U.firstElementChild);if(!A)return;const P=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:P}]),(se=A==null?void 0:A.querySelector("a"))==null||se.focus()},...O,children:S.name})},S.id||window.btoa(S.name))}),t>Vi&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Vi})})]})})]})]}))},Yl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Zi=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Sx=280,jx=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Un(e,Sx):e;a=a.trim();const i=`<br>
134
+ `;default:return u}}function Nn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Hl(t)}`;if(r.length===e.length)return a;const i=t+r+Hl(t);return e.replace(n,i)}const Hl=e=>e.split("").reverse().join(""),RC=e=>e.map(t=>_f(t)).join("").trim();const MC=()=>{const e=An(),{dispatch:t,mentionPopover:n,id:r}=D.useContext(Gt),{show:a,selectedUser:i,possibleUsers:s}=n,o=lf(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:c.jsx(Ha,{children:c.jsx($c,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:c.jsx("ul",{children:s.map(({userId:l,user:u},d)=>c.jsx(rr,{element:"li",className:G({selected:d===i}),member:{id:l,...u,link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation();const p={...n,selectedUser:d};t([{type:"mentionPopover",value:p}]),kf(e,p,t,r)}}},l))})})})},Do=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=An(),{id:u,tabbableOption:d,setFocus:h,openTooltip:p,dispatch:m}=D.useContext(Gt),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const C=[{type:"openTooltip",value:null}];l.selection&&C.push({type:"lastAnchor",value:l.selection.anchor}),m(C)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var C,v,x,_;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const w=f.currentTarget.closest("li");let E=w==null?void 0:w.nextElementSibling;if(f.key==="ArrowLeft"){const W=w==null?void 0:w.previousElementSibling;W?E=W:E=(C=w==null?void 0:w.parentElement)==null?void 0:C.lastElementChild}else E||(E=(v=w==null?void 0:w.parentElement)==null?void 0:v.firstElementChild);const T=E==null?void 0:E.className.split(" ")[0];T&&(h(T),(x=E==null?void 0:E.querySelector("button"))==null||x.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(_=S==null?void 0:S.previousElementSibling)==null||_.focus();break}}},children:[c.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(kn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ul=[Y.ol,Y.ul],Bf=(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},IC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Y.blockquote});return!!t},Af=(e,t,n)=>{try{const r=IC(e),a=Bf(e,t),i=Ul.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Ul.includes(u.type)},split:!0});const o={type:a?Y.paragraph:i?Y.li:t};if(J.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:d,match:p=>{const m=p;return!b.isEditor(p)&&ce.isElement(p)&&m.type===Y.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:Y.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},$C=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=An(),i=Bf(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{Af(a,e,r),n(i?null:e)}})},wr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Y.link}});return!!t},LC=(e,t,n,r)=>{e.selection&&Co(e,t,n,r)},zC=(e,t,n,r)=>{const{selection:a}=e;if(a&&Z.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Y.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),yo(n)}}else Co(e,t,n,r)},Co=(e,t,n,r=a=>{console.error(a)})=>{try{wr(e)&&Ff(e);const{selection:a}=e,i=a&&Z.isCollapsed(a),s={type:Y.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),yo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Ff=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Y.link}})};let Ii=null;const qC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=D.useContext(Gt),o=An(),l=r1(o),u=(l==null?void 0:l.text)||jC(o),[d,h]=D.useState(wr(o)),p=lf(o,"link-editor",`${n}-link`),m=D.useRef(null);D.useEffect(()=>{var x;!d&&r&&((x=m.current)==null||x.focus())},[d]),D.useEffect(()=>{Ii&&clearTimeout(Ii),Ii=setTimeout(()=>{h(wr(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(x=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${x}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:x}),x){case"open":_.href=(l==null?void 0:l.full)||"",_.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Me,{children:e.formatMessage({id:`${t}${x}_text`})})]});break;case"edit":_.onClick=()=>{h(!1)};break;case"remove":_.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];wr(o)&&(Ff(o),w.push({type:"lastAnchor",value:null})),i(w)};break}return _}),C=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&C.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});let v=document.body;if(a!==!1){const x=document.getElementById(`${a}-overlay`);x&&(v=x)}return c.jsx(Ha,{parent:v,children:c.jsx(kn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var x;return(x=m.current)==null?void 0:x.focus()})}},children:d?c.jsx(tr,{wrappers:g,buttons:f}):c.jsx(Bn,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async x=>{setTimeout(()=>{const _=[{type:"showLinkEditor",value:!1}];if(x.url){const{full:w}=Ic(x.url);l!=null&&l.full?zC(o,w,n,s):LC(o,w,n,s),_.push({type:"lastAnchor",value:null})}i(_)})}},fields:C,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},WC=()=>{const e=An(),{setFocus:t,dispatch:n}=D.useContext(Gt),[r,a]=D.useState(!1);return D.useEffect(()=>{a(wr(e))},[e.selection]),c.jsx(Do,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},HC=e=>[Y.bold,Y.italic,Y.strikethrough].includes(e),Tf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Sf=(e,t,n)=>{try{Tf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},UC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=An(),i=Tf(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{Sf(a,e,r),n(i?null:e)}})},Fa=[Y.bold,Y.italic,Y.strikethrough],VC=[Y.ol,Y.ul,Y.blockquote];const KC=({...e})=>{const t=ue.useIntl(),{id:n}=D.useContext(Gt);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Fa.map((r,a)=>c.jsx(UC,{format:r,hasDivider:a===Fa.length-1},r)),c.jsx(WC,{}),VC.map((r,a)=>c.jsx($C,{format:r,hasDivider:a===1},r))]})]}),c.jsx(qC,{})]})};var ZC=JC,YC=/^(?:\w+:)?\/\/(\S+)$/,GC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,QC=/^[^\s\.]+\.\S{2,}$/;function JC(e){if(typeof e!="string")return!1;var t=e.match(YC);if(!t)return!1;var n=t[1];return n?!!(GC.test(n)||QC.test(n)):!1}const XC=En(ZC),ex=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Y.link].includes(s.type)||a(i)},e.insertText=i=>{i&&XC(i)?Co(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},tx=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Y.mention?!0:n(i),e.isVoid=i=>i.type===Y.mention?!0:r(i),e.markableVoid=i=>i.type===Y.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},nx=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Y.link&&oe.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const jf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),d=Mh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,onChange:m=()=>{},reportError:g=H=>{console.error(H)}}=i||{},f=[{type:Y.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const C={editorKey:null,originalValue:t||"",initialValue:t?null:f,tabbableOption:Fa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[v,x]=D.useReducer(Rr,C),{editorKey:_,originalValue:w,initialValue:E,stringValue:T,lastAnchor:S,lastKey:W,hasInteracted:O,hasLoaded:q,mentionPopover:I}=v,k=H=>{const y=H||Fa[0];H&&x([{type:"tabbableOption",value:y}])},A=`rte-${e}`,P=D.useCallback(H=>c.jsx(t1,{...H}),[]),$=D.useCallback(H=>c.jsx(n1,{...H}),[]),R=D.useMemo(()=>ex(tx(nx(qv(Xy(Lv())),g),g),A,g),[]);D.useEffect(()=>{if(!t)return;_r.lastIndex=0;const H=t.match(_r);!H||H.length>1||H[0].length!==t.length||O||x([{type:"originalValue",value:t}])},[t]);const U=H=>{if(!R||H!==A)return;const y=b.end(R,[]);J.select(R,y),X.focus(R)};D.useEffect(()=>{const H=y=>{var B;const z=y,ee=((B=z==null?void 0:z.detail)==null?void 0:B.id)||null;ee&&U(ee)};return window.addEventListener("focusEditor",H),()=>{window.removeEventListener("focusEditor",H)}},[]),D.useEffect(()=>{if(R.children.length>0&&!q){if(x([{type:"hasLoaded",value:!0}]),!s)return;U(A)}},[R.children.length,E]),D.useEffect(()=>{w&&(async()=>{let y=gn(w);y.includes("<")&&(y=new xa().turndown(y)),o&&o.mentions&&(y=await Mc({text:y,template:`[${Bs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),SC(y,z=>{x([{type:"initialValue",value:z},{type:"editorKey",value:w.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:zl(R)}])},150)})})()},[w]),D.useEffect(()=>{t!==""||!R||as(w,t)&&!O||(b.withoutNormalizing(R,()=>{J.delete(R,{at:{anchor:b.start(R,[]),focus:b.end(R,[])}}),J.deselect(R),R.children.length!==0&&J.unwrapNodes(R,{at:[0]}),J.insertNodes(R,f,{at:[0]})}),x([{type:"initialValue",value:f},{type:"lastAnchor",value:null}]))},[t]);const se=Ec(()=>{PC(R,I.show,p,x)},100);return E?c.jsx("div",{id:A,className:"rich-text-editor",children:c.jsxs(Gt.Provider,{value:{...v,id:A,isInOverlay:h,setFocus:k,dispatch:x,reportError:g},children:[c.jsxs(Qy,{editor:R,initialValue:E,onChange:H=>{if(R.operations.some(z=>z.type!=="set_selection")){const z=RC(H);m(z),x([{type:"stringValue",value:zl(R)}]),O||x([{type:"hasInteracted",value:!0}]),se(),d&&console.log({serialized:z,json:H})}},...l,children:[c.jsx(qy,{className:"input",renderElement:P,renderLeaf:$,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:H=>{if(H.key==="Enter"){I.show&&(H.preventDefault(),H.stopPropagation(),kf(R,I,x,A));const{selection:y}=R;if(y){const z=Z.isCollapsed(y),[ee,B]=b.node(R,y,{depth:1});let F=ee,L=F.type;const M=F.children[0];if(M&&[Y.ol,Y.ul].includes(M.type)&&(F=M,L=M.type),F&&ce.isElement(F)&&L!==Y.paragraph){if(L===Y.blockquote&&!H.shiftKey){H.stopPropagation(),H.preventDefault(),J.insertNodes(R,f);return}if(z){const[V]=b.parent(R,y,{edge:"end"}),te=V.type;if(W==="Enter"&&te===Y.li&&[Y.ul,Y.ol].includes(L)){H.stopPropagation(),H.preventDefault(),J.insertNodes(R,f,{at:N.next(B)}),J.select(R,b.end(R,N.next(B)));return}}}}}else if(H.key==="Escape"){if(I.show){H.preventDefault(),H.stopPropagation(),x([{type:"mentionPopover",value:{...I,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(H.key)&&I.show){H.preventDefault(),H.stopPropagation();const{selectedUser:y,possibleUsers:z}=I;let ee=H.key==="ArrowUp"?y-1:y+1;ee<0&&(ee=z.length-1),ee>=z.length&&(ee=0),x([{type:"mentionPopover",value:{...I,selectedUser:ee}}])}x([{type:"lastKey",value:H.key}]),OC(H,R,x,g)},onBlur:()=>{R.selection&&x([{type:"lastAnchor",value:R.selection.anchor}])},onFocus:()=>{if(S){if(!N.isPath(S.path)||!oe.has(R,S.path))return;const H=oe.get(R,S.path);let y=0;if(fe.isText(H)?y=H.text.length:H.children&&(y=H.children.length),S.offset>y)return;try{J.select(R,{anchor:S,focus:S})}catch(z){const ee=z.message;g(`Error focusing editor: ${ee}`)}}}}),c.jsx(KC,{}),p?c.jsx(MC,{}):null]},_),c.jsx(Zs,{id:`character-limit-${e}`,limit:r,valueLength:Za(T)})]})}):null};const rx=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=D.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);D.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function ax({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=D.useState(!1),[l,u]=D.useState(!1),d=D.useRef(null),h=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(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(Zt,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&c.jsx("p",{className:"error text-small",children:c.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:h,hidden:!0,"data-testid":"file-input"}),c.jsx(Ae,{onClick:()=>d.current&&d.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:c.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Of=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Bn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{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 Pf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,h]=D.useState([]),[p,m]=D.useState(!0),[g,f]=D.useState(u),{formatMessage:C}=ue.useIntl(),v=async w=>{w.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(E){f("ERROR"),o(E)}},x=w=>{w.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},_=w=>{w.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:C({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",C({id:"inviteForm_error"})]})}),c.jsx(Vt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ae,{variant:"secondary",onClick:x,children:C({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ae,{onClick:_,children:C({id:"inviteForm_ctaDone"})})]}):c.jsx(Ae,{onClick:x,children:C({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Eh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:C({id:"inviteForm_email_placeholder"}),emails:d,onChange:w=>{h(w),m(!w.length)},autoFocus:!1,getLabel:(w,E,T)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:w}),c.jsx(Ae,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(E),m(!d.length)},className:"remove-email-button",screenreaderText:C({id:"overlay_close"})})]},E)})]}),c.jsx(Vt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ae,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ba=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},ix=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=D.useState(null),[i,s]=D.useState(!1),[o,l]=D.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!us(m[Dt.NEW_PASSWORD]).isValid,h=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ba(["required",d]),functions:{onChange:m=>l(us(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ba(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ba(["required"])}),i&&h.push({component:ud,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:h,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 c.jsxs(c.Fragment,{children:[c.jsx(Bn,{...p}),r&&c.jsx(on,{variant:"error",text:r})]})};const Nf=({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=D.useRef(null);Vn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Vl=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 d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},sx=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"]}},ox=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=sx(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}])},ux=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(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:()=>h(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"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Vl({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:rd,props:{email:d.email,type:d.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:()=>h(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:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.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=>c.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=>c.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=>c.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(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Vl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const lx=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const cx={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},dx=({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:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,C]=D.useReducer(Rr,cx),{validFields:v,emailDetails:x,shouldManuallyApprove:_,shouldDisableButton:w,showSuccessMessage:E,showError:T}=f,[S,W]=Ms.useCookies(["signup-this-session","functional-cookie-consent"]),O={form:D.createRef(),name:D.createRef(),email:D.createRef(),jobTitle:D.createRef(),organisation:D.createRef(),tc:D.createRef(),hiddenValidation:D.createRef()};D.useEffect(()=>{_===!0&&O.jobTitle.current&&O.jobTitle.current.focus()},[_]),D.useEffect(()=>{S["signup-this-session"]&&C([{type:"showSuccessMessage",value:!0}])},[S]),D.useEffect(()=>{E&&S["functional-cookie-consent"]&&W("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const q=D.useMemo(()=>ux({placeholders:n,labels:t,shouldShow:g,functions:r,refs:O,state:f,dispatch:C,dataToSubmit:s,intl:l}),[s,r,l,O,g,f]),I=w?!0:_?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?c.jsx(lx,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ue.FormattedMessage,{id:"signup_title"})}),T&&c.jsx(on,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Bn,{className:"signup-form",formRef:O.form,id:"sign-up-form",fields:q,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 ox({refs:O,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:C,state:f})},onCatch:k=>{r.handleError(k),C([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:O.hiddenValidation})]})};const cn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const fx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(cn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[D.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(tr,{buttons:r})]})})};function Rf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const hx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return c.jsxs("div",{className:G("edit-section-placeholder",{"has-icon":!!e}),style:Pc(e),children:[c.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&c.jsx(Ae,{href:r,variant:"secondary",size:"small",onClick:()=>Rf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},mx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=D.useState(!1),d=typeof r=="string"||!!n,h=()=>u(!1);return c.jsxs("section",{className:G("edit-section",t),children:[n&&c.jsx(ir,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:c.jsx(Bn,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:h}})}),c.jsxs("div",{className:"edit-section-header",children:[c.jsx("h2",{className:"edit-section-header-title",children:a}),d&&c.jsx(Ae,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Rf({href:r,setShowModal:u}),children:"Edit"})]}),e||c.jsx(hx,{...s,href:r,setShowModal:u,showEditButton:d}),o&&c.jsx(Vt,{})]})};const px=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&D.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let $i;const Li="contactFooter_",gx=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=D.useRef(null),[r,a]=D.useState(0),[i,s]=D.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout($i),$i=setTimeout(()=>{o(),s(!1)},500))};return D.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout($i),window.removeEventListener("resize",l)}),[]),c.jsx(cn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ue.FormattedMessage,{id:`${Li}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ue.FormattedMessage,{id:`${Li}text`})}),c.jsx(_n,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ue.FormattedMessage,{id:`${Li}email`})})]}),c.jsx(Of,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},vx=({activeLink:e,...t})=>c.jsx(cn,{children:c.jsx(td,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(ed,{activeLink:e}),c.jsx(Hc,{...t})]})})});const zi="cookieBanner_",qi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Wi=new Date(Date.now()+12*30*24*60*60*1e3),Mf=()=>{const e=ue.useIntl(),[t,n,r]=Ms.useCookies(qi),[a,i]=D.useState(!t["apol-cookie-banner"]),s=()=>{qi.forEach(d=>{n(d,!0,{path:"/",expires:Wi,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Wi}),qi.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Wi});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${zi}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${zi}title`})}),c.jsx("p",{children:e.formatMessage({id:`${zi}text`})}),c.jsx(tr,{buttons:u})]})},Wt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Rn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Rn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Rn.support,gtmType:"concierge-email-click"},business:{email:Rn.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const qn="footer_",Ta="SiteFooter",Kl=({group:e})=>{const t=Wt[e].order||[];let n=!1;return"text"in Wt[e]&&(n=Wt[e].text),c.jsxs(D.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Wt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":i,...s,children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(D.Fragment,{children:[c.jsx("dt",{children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},xo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(qa,{element:"hr"}),c.jsx(Ks,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Kl,{group:e}),Object.keys(Wt[e]).includes("child")&&c.jsx(Kl,{group:Wt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Wt.social.order)&&Wt.social.order.map(e=>{const t=Wt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ue.FormattedMessage,{id:`${qn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ue.FormattedMessage,{id:`${qn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ie={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Ie.handlerCalled[e]&&i-Ie.handlerCalled[e]<500)return;Ie.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Dc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Ie.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case gt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=Ie.findFirstChild(u.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=Ie.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ie.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ie.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ie.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ie.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ie.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Nr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Sa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=Dc(Nr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let _=o.gtmType||`${e}-click`;if(_.includes(".")){const w=_.split("."),E=w[w.length-2];_=`${E==="topics"?`${E}-`:""}${w[w.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let C={},v={},x={};if(f&&(C={...C,"aria-current":"page"}),m){const _=o.menuId||e,w={onClick:E=>Ie.events.onClick(E,{id:_,callback:a,isOpen:r[_]}),onFocus:()=>Ie.events.onFocus({id:_}),onBlur:()=>Ie.events.onBlur({id:_,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:_,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:_,callback:a})};v={...w,id:_===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(x={...w,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Ie.events.onClick(E,{id:_,callback:a,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...C,children:[p?D.createElement(d?Ae:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...x,children:[s.formatMessage({id:h}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(_=>{if(!o[_])return null;const w={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[_].order?c.jsxs("li",{className:G({[o[_].className]:o[_].className}),children:[s.formatMessage({id:`${h}_${_}`}),c.jsx("ul",{children:o[_].order.map(E=>c.jsx(Sa,{id:`${e}.${_}.${E}`,...w},E))})]},_):c.jsx(Sa,{id:`${e}.${_}`,...w},_)})})]},e)};const bx={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const wo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=D.useContext(It),r=Xn(!0,!0),a=n&&typeof n.id=="string",i=D.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=D.useReducer(Rr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=D.useRef(s);D.useEffect(()=>{h.current=s},[s]),_c({scrollPosition:bx[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,x,_=!1)=>{Ie.handleMenus({id:v,value:x,menus:h.current.menus,dispatch:o,forceHandle:_})},m=D.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{h.current.menus[x]&&p(x,!1,!0)})};D.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",g)}},[]),Vn(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Vn(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Nf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),C=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Nr.order.map(v=>c.jsx(Sa,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Ks,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[C,f]}):c.jsxs(c.Fragment,{children:[f,C]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Ie.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(Zt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Nr.buttons.order.map(v=>c.jsx(Sa,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const yx=()=>{const e=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(wo,{}),c.jsx("div",{id:"content",children:c.jsx(on,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(xo,{})]})},If=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=wc(),[f,C]=D.useState(""),v=T=>{const{detail:{message:S}}=T;C(S)};D.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const x=ca(e,{locale:o}),_=ca(t,{locale:o}),w=ca(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),h!=="default"&&(E[h]=!0),p!=="default"&&(E[p]=!0),c.jsx(kh.ErrorBoundary,{onError:r,fallback:c.jsx(yx,{}),children:c.jsxs(D.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,E,{"has-footer":u}),children:[c.jsx(wo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[_&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":m==="large"}),children:_}),D.createElement(d==="bold"?Fo:"div",{id:"content",children:x,className:G({"large-modal":m==="large"})})]}),w&&c.jsx("div",{className:"additional-content appended",children:w}),u&&c.jsx(xo,{}),c.jsx(Mf,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Zl={default:"tags_",headerTopics:"header_topics_topics_"},Hi={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},Dx={getTagDetails:e=>{if(e.includes("topic_")){if(e=Hi.topic[e.replace("topic_","")],e){const t=Nr.topics.topics[e].href;return t?{id:e,href:t,text:`${Zl.headerTopics}${e}`}:null}return null}return Hi[e]?(e=Hi[e],{id:e,text:`${Zl.default}${e}`}):null}};const Cx=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Dx.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const xx=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:c.jsxs("div",{className:G("members-list",s),children:[c.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),c.jsx("span",{className:"count",children:t})]}),c.jsx("ul",{children:e.map((l,u)=>c.jsxs("li",{children:[c.jsx(rr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&c.jsx(mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&c.jsx(Mr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const wx=D.lazy(()=>Promise.resolve().then(()=>bE)),$f=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),i=D.useContext(It)||"community",s=Va(i);s.name||(s.name=r.formatMessage({id:`member_${typeof i=="string"?i:"community"}`}));const{modal:o=!1}=e||{},[l,u]=D.useState(o||Hh("showPost")==="true"||!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(!0)},"data-testid":"discussion-form-card",children:[c.jsx(Zt,{name:s.name,src:s.image,alt:""}),c.jsx("span",{className:"input",children:r.formatMessage({id:"discussionFormCard_placeholder"})})]}),c.jsx(Ha,{children:c.jsx(wx,{showModal:l,onClose:()=>{u(!1)},form:t,className:"in-portal"})})]})},Ex=D.lazy(()=>Promise.resolve().then(()=>Ax)),Eo=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(on,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Vs,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,h={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx($f,{form:h}):c.jsx(Ex,{...h})},kx={showForm:!1},ni=D.createContext(kx),Lf=({children:e})=>{const[t,n]=D.useState({showForm:!1});return c.jsx(ni.Provider,{value:{...t,updateConversation:n},children:e})},_x=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?c.jsx("small",{children:_t(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},Bx=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:_t(a.formatMessage,`${t}label_action`,r,"action")})};let ra=null;const Je="discussion_form_",$r=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:h="DiscussionForm"})=>{var be,he,Ee;const p=ue.useIntl(),m=D.useContext(It),[g,f]=D.useState(""),{isLoading:C=!1,isInWrapper:v=!1,isInOverlay:x=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:E=!1,isPrepopulated:T=!1,showTitle:S=!1,showGuidelines:W=!0,showDivider:O=!1,showSuccessMessage:q=!0}=r||{},{create:I=()=>{},handleSaveEdit:k=()=>{},handleCancel:A=()=>{},callback:P=()=>{},listMembers:$=()=>Promise.resolve([]),props:R={create:{projectNames:["questions-answers"]}}}=u,[U,se]=D.useState({title:E&&E.text||"",body:w&&w.text||T&&T.text||""}),[H,y]=D.useState(o.error||!1),[z,ee]=D.useState(!1);if(D.useEffect(()=>{l&&!w&&T&&T!==U.body&&se({...U,body:T.text||""})},[T]),C)return c.jsx(Et,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const B=ke=>{se({...U,body:ke});let De;!m||!m.id?De=_t(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&ke.length>=i&&(De=`${Je}error_tooLong`):De=_t(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),De?y(De):H&&y(!1)};let F=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const ke=((be=t.slugs)==null?void 0:be.reply)||((he=t.slugs)==null?void 0:he.answer)||((Ee=t.slugs)==null?void 0:Ee.question)||"";ke&&(F=`${F}-${ke.slice(-15)}`)}e&&(F=`${e}-${F}`);const L=async()=>{if(!m||!m.id||!n||te)return;ra&&clearTimeout(ra),ee("submitting");const ke=window.location.pathname;try{let De;switch(t.type){case"post":De=await I({title:U.title,content:U.body});break;case"question":De=await I({title:U.body,authorId:m&&m.id,...R==null?void 0:R.create});break;case"response":De=await I({questionSlug:t.slugs.question},{body:U.body,authorId:m&&m.id,contentPath:ke});break;case"reply":De=await I({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:U.body,authorId:m&&m.id,contentPath:ke});break;default:break}await Rh(1e3),P&&await P(De),ra=setTimeout(()=>{se({title:"",body:""}),ee("submitted"),f(_t(p.formatMessage,`${Je}success`,t.type,"action"));const je=new Event("discussionFormSubmitted");document.dispatchEvent(je),M()},500)}catch(De){const je=De;let Le=`${Je}error`;je!=null&&je.message.includes("entry already exists")&&(Le=_t(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),je!=null&&je.message.includes("429")?Le=_t(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):je!=null&&je.message.includes("400")&&(Le=`${Je}error`),y(Le),M()}},M=()=>{ra=setTimeout(()=>{y(!1),ee(!1),f("")},5e3)},V=!U.title||!Lo(U.title),ne=!U.body||!Lo(U.body);let te=ne;E&&(te=V&&ne);const re=z==="submitting",de=[{component:Bx,props:{formID:F,intlPath:Je,showLabel:E!==!1,type:t.type}},{component:jf,props:{id:`${F}-input`,value:z==="submitting"&&!H?"":U.body,placeholder:a||_t(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:x},functions:{onChange:B,listMembers:$},data:d,autoFocus:w!==!1||_&&!E,"aria-invalid":!!H,"aria-errormessage":"error-message"}},{component:_x,props:{intlPath:Je,showGuidelines:W,type:t.type,gtmContext:h}}];O&&de.push({component:Vt}),E&&de.unshift({id:"title",type:"text",value:E.text,limit:250,autoFocus:_,label:p.formatMessage({id:`${Je}titleField_label`}),functions:{onChange:ke=>{se({...U,title:ke})}},validation:[{condition:()=>te,error:p.formatMessage({id:`${Je}titleField_error`})}]});let Q=!m||!m.id||!n||te||re;return w&&(E?Q=Q||U.body===w.text&&U.title===E.text:Q=Q||U.body===w.text),c.jsxs(c.Fragment,{children:[c.jsxs(Bn,{id:F,className:G("discussion-card discussion-form",{"no-styling":v&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!re||o.cancel},functions:{onSuccess:async()=>{if(w){ee("submitting"),k(U);return}await L()},onCancel:A},fields:de,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`${w?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:Q,overwriteSubmittingText:!0,text:!re&&!w&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${re?w?"saving":"posting":w?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!U.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:h,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!w&&["question"].includes(t.type)&&c.jsx("h2",{children:_t(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(rr,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click"})]}),z==="submitted"&&q&&c.jsx(Br,{className:"success","data-testid":"success",children:_t(p.formatMessage,`${Je}success`,t.type,"action")}),H&&c.jsx(Br,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof H=="string"?H.includes(" ")?H:p.formatMessage({id:H},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):H}),g&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Ax=Object.freeze(Object.defineProperty({__proto__:null,default:$r},Symbol.toStringTag,{value:"Module"})),Fx=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Tx=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const ja=({icon:e,className:t="",...n})=>c.jsx(Ae,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Er=!1;const Ui=()=>{Er!==!1&&(clearTimeout(Er),Er=!1)},Vi=5;let Ki=null;const zf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=D.useReducer(Rr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:C,tabbableLink:v}=h;D.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const x=D.useMemo(()=>Tx(n,Vi),[n]),_=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Er)return Ui(),!1;if(Ui(),f||!s)return!1;Er=setTimeout(w,350)},w=async()=>{if(Ui(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const W=Fx(i.slugs);g?await l(W):await o({...W,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},E=()=>{Ki=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{Ki&&clearTimeout(Ki)};return D.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},c.jsxs(c.Fragment,{children:[c.jsx(ja,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:_,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>E,onClick:S=>{var O;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const W=(O=S.currentTarget.nextSibling)==null?void 0:O.childNodes[0];if(W){const q=W.querySelector("li:first-child a");q&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{q.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),E())},"aria-expanded":C,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(kn,{id:`likes-tooltip-${i.slug}`,isOpen:C,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[x.map((S,W)=>{if(typeof S=="string"||!S.name)return null;const O={};return v!==W&&(O.tabIndex=-1),c.jsx("li",{"data-index":W,children:c.jsx(_n,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:q=>q==null?void 0:q.stopPropagation(),onFocus:()=>T(),onKeyDown:q=>{var $,R,U,se;if(!q||!["ArrowUp","ArrowDown"].includes(q.key||""))return;q.stopPropagation(),q.preventDefault();const I=q.key==="ArrowUp"?"up":"down",k=($=q.currentTarget)==null?void 0:$.parentElement;let A=k==null?void 0:k.nextElementSibling;if(I==="up"){const H=k==null?void 0:k.previousElementSibling;H?A=H:(A=(R=k==null?void 0:k.parentElement)==null?void 0:R.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(U=k==null?void 0:k.parentElement)==null?void 0:U.firstElementChild);if(!A)return;const P=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:P}]),(se=A==null?void 0:A.querySelector("a"))==null||se.focus()},...O,children:S.name})},S.id||window.btoa(S.name))}),t>Vi&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Vi})})]})})]})]}))},Yl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Zi=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Sx=280,jx=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Un(e,Sx):e;a=a.trim();const i=`<br>
135
135
 
136
136
  `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Mc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Ox=3e3,Px=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ue.useIntl(),[r,a]=D.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(kn,{className:G("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),c.jsx(ja,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Ox)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},qt="discussion_",Nx=195,Lr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:s,links:o={},className:l,gtmContext:u="DiscussionAnswer",children:d,isTruncated:h=!1,styling:{showShareLinkButton:p=!1}={},setFocus:m=!1,isCommunity:g=!1})=>{var Ee,ke,De,je,Le,Ue,Qe,Se;const f=ue.useIntl(),C=D.useContext(It),v=D.useContext(ni),{createContent:x=async()=>{},deleteContent:_=async()=>{},updateContent:w=async()=>{}}=s.content||{},{createLike:E=()=>{},deleteLike:T=()=>{}}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:W=()=>Promise.resolve([])}=s.mentions||{},{author:O,canLike:q,createdAt:I,id:k,likes:A=0,userLiked:P,comments:$=0,mentions:R}=t,U=C&&C.id&&typeof O!="string"&&O.id&&O.id===C.id||!1,se=typeof q=="boolean"?q:!0,H=U&&(!t.createdAt||Ph(t.createdAt,10,"seconds")),y=D.useRef(null),[z,ee]=D.useState({title:t&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[B,F]=D.useState(!1),[L,M]=D.useState(H?"highlighted":"default"),[V,ne]=D.useState("");D.useEffect(()=>{const pe=y.current;if(!(!pe||L==="default"))return document.addEventListener("discussionFormSubmitted",te),pe.addEventListener("transitionend",re),()=>{document.removeEventListener("discussionFormSubmitted",te),pe.removeEventListener("transitionend",re)}},[]),D.useEffect(()=>{ee({...z,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),D.useEffect(()=>{(async()=>{const we=await jx(z.body,h,R,W);ee({...z,postBody:we})})()},[z.body,R]);const te=()=>{setTimeout(()=>{M("fading")},1e3)},re=({propertyName:pe})=>{pe==="background-color"&&M(we=>(we==="default"&&(document.removeEventListener("discussionFormSubmitted",te),y.current&&y.current.removeEventListener("transitionend",re)),we==="fading"?"default":we))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||z.postBody===""&&t.title==="")return c.jsx(Et,{className:"discussion-card"});const de=async({title:pe,body:we})=>{pe||(pe=""),we||(we=""),ne("");try{if(!as(pe,z.title)||!as(we,z.body)){const K=t.type==="question"?{title:we}:{title:pe,body:we};await w(Yl(t.slugs),K)}ee({...z,title:pe,body:we,isEditing:!1,didEdit:!0})}catch{ne(`${qt}form_error`)}},Q=()=>{if(v&&v.updateConversation){const pe={showForm:!0},we=t.author;we&&we.id&&(g&&(pe.prepopulateForm=`@{{${we.id}}}`),pe.mentionData={id:we.id,name:we.name}),v.updateConversation(pe)}setTimeout(()=>{var me,ge,_e;const we=`reply-form-${(t.type==="answer"?t.slug:((me=t.slugs)==null?void 0:me.reply)||((ge=t.slugs)==null?void 0:ge.answer)||((_e=t.slugs)==null?void 0:_e.question)||"").toLowerCase().slice(-15)}`,K=document.getElementById(we),ie=document.getElementById(`${we}-input`);ie&&ie.focus(),K&&K.scrollIntoView({behavior:"smooth"})},0)},be=async()=>{F(!1);try{await _(Yl(t.slugs))}catch{ne("delete-error")}},he=[{text:f.formatMessage({id:`${qt}moreMenu_report`}),onClick:pe=>{pe.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(f.formatMessage({id:`${qt}report_subject`}))}&body=${encodeURI(f.formatMessage({id:`${qt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&U&&he.push({text:f.formatMessage({id:`${qt}moreMenu_edit`}),onClick:()=>ee({...z,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:f.formatMessage({id:`${qt}moreMenu_delete`}),onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),F(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...lh(`delete-${t.slug}-modal`,B)}),m&&((Ee=y==null?void 0:y.current)==null||Ee.focus(),(ke=y==null?void 0:y.current)==null||ke.scrollIntoView({behavior:"smooth"})),D.createElement(e,{className:G("discussion-post",l,{[L]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!z.isEditing}),ref:y,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:pe=>{!o.post||z.isEditing||(pe.preventDefault(),pe.stopPropagation(),window.location.href=o.post)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:k||t.slug,className:G("discussion-card",t.type,{editing:z.isEditing,"has-link":o.post&&!z.isEditing}),children:[!z.isEditing&&c.jsx(rr,{member:O,additionalContent:{createdAt:I,didEdit:z.didEdit},className:typeof O!="string"&&O.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),z.isEditing?c.jsx($r,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,hasTitleField:z.title!==""?{text:z.title}:!1,isEditing:{text:z.body},isPrepopulated:!1},isCommunity:g,maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?f.formatMessage({id:V},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:x,handleSaveEdit:de,handleCancel:()=>{ne(""),ee({...z,isEditing:!1})},listMembers:W},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?c.jsxs("a",{href:o.post,children:[(z==null?void 0:z.title)&&c.jsx("p",{className:"content-title",children:z==null?void 0:z.title}),z.postBody.length>Nx?c.jsx(Wc,{text:z.postBody,markdownOptions:{overrides:{a:cs,blockquote:{component:Zi}}}}):c.jsx(Kn,{options:{overrides:{a:cs,blockquote:{component:Zi}}},children:z.postBody})]}):c.jsxs(c.Fragment,{children:[(z==null?void 0:z.title)&&c.jsx("p",{className:"content-title",children:z==null?void 0:z.title}),c.jsx(Kn,{options:{wrapper:t.type==="question"?"h1":D.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Zi}}},children:z.postBody})]}),!z.isEditing&&!(i!=null&&i.actionBar)&&c.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&c.jsx(zf,{element:"li",likes:A,isShort:!1,userLiked:P,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:E,deleteLike:T}}),!i.comments&&(["question","post"].includes(t.type)||o.comments)&&c.jsx("li",{children:c.jsx(ja,{onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof S=="function"&&S()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:f.formatMessage({id:`${qt}comments_screenReader`},{count:$}),children:f.formatMessage({id:`${qt}comments`},{count:$})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(ja,{styling:{muted:!0},onClick:Q,icon:{icon:"speech-bubble_square"},children:f.formatMessage({id:`${qt}reply`})})}),p&&c.jsx(Px,{url:(De=t.slugs)!=null&&De.reply?`${window.location.origin}${(je=t.slugs)==null?void 0:je.question}/${(Le=t.slugs)==null?void 0:Le.answer}#${(Ue=t.slugs)==null?void 0:Ue.reply}`:`${window.location.origin}${(Qe=t.slugs)==null?void 0:Qe.question}/${(Se=t.slugs)==null?void 0:Se.answer}`,gtm:{context:u,event:`copy-link-${t.type}-click`}}),c.jsx(Xc,{element:"li",id:`more-${t.slug}`,options:he})]})]}),d,c.jsx(ir,{id:`delete-${t.slug}-modal`,isOpen:B,functions:{onOpen:()=>{},onClose:()=>F(!1)},forceShow:{error:V==="delete-error"?f.formatMessage({id:"discussion_delete_error"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:f.formatMessage({id:"discussion_delete_title"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>F(!1),children:f.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:be,children:f.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:pe=>c.jsx("p",{children:pe}),action:f.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Yi="discussion_responses_",qf=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ue.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Yi}title`},{action:r.formatMessage({id:`${Yi}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:_t(r.formatMessage,`${Yi}empty`,e,e)})]})};const Wf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=D.useContext(ni),o=ca(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Mr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx($r,{...r})]})},Rx="post",Mx="reply",Hf="00000000-0000-0000-0000-000000000000";function ko({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function _o({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function Ix(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function $x(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Uf(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function Lx({title:e,content:t}){return{title:e,content:t,id:Hf,time:new Date().toISOString(),verb:Rx}}function Gl({activity:e,user:t}){return{...e,actor:Uf(t),...Ix()}}function Oa({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Vf({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function zx({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Hf,kind:Mx,parent:t||""}}function Ql({reply:e,user:t}){const n=Uf(t);return{...e,user_id:n.id,user:n,...$x()}}function Jl({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function qx({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Kf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Xl,Gi=0;const Zf=()=>{D.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Xl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Gi=0;return}Gi++,!(Gi>10)&&(Xl=setTimeout(()=>{e(t)},50))}},Qn=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),sn=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Yf=Object.freeze({actor:`SU:${Qn.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Wx=Object.freeze({actor:`SU:${sn.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Hx=Object.freeze({actor:`SU:${Qn.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),Ux=Object.freeze({actor:`SU:${sn.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Yf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:sn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:sn.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:sn.id,user:{id:sn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Yf.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Wx.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:sn.id,user:{id:sn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Hx.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ux.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Vx({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Gl({activity:Lx(o),user:i});return ec(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Gl({activity:o,user:i});r.setQueryData(a,ec(d,u,!0)),setTimeout(()=>{Kf(d.id)},0)}});return s}function Kx({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Pa(a,s);return o&&(o.content=i),s}),onError:n});return r}function Zx({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ka(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:ko(u),mutate:_o(u)},user:l,...u},h=Vx({...d,mutationFn:e}),p=Kx({...d,mutationFn:t}),m=Yx({...d,mutationFn:n}),g=Qx({...d,mutationFn:a}),f=Jx({...d,mutationFn:i}),{activities:C,...v}=Gx({queryKey:s,queryFn:r});return{activities:C,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function Yx({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Pa(s,o);return l&&Oa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Pa(o,l);u&&Oa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Gx({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:ew(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Qx({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Xx(a,i)),onError:n});return r}function Jx({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Pa(i,s);return o&&Vf({activity:o,user:r}),s}),onError:n});return a}function ec(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Pa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Xx(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function ew(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const tw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:d,hasNextPage:h,isLoading:p,mutations:{create:m,edit:g,remove:f,like:C,unlike:v}}=Zx({queryKey:[e,t,"activities"],queryFns:r}),[x,_]=D.useState(null),w=()=>{_(l.length),d()};return Zf(),u?c.jsx(on,{variant:"error",text:u.message}):c.jsxs("section",{children:[c.jsx(Eo,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:m,listMembers:a.listMembers},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((E,T)=>{var U,se,H,y,z,ee,B,F;const{id:S,own_reactions:W,latest_reactions:O,reaction_counts:q,mentioned_users:I}=E,k=(((U=O==null?void 0:O.like)==null?void 0:U.length)||0)>0,A=(((se=W==null?void 0:W.like)==null?void 0:se.length)||0)>0,P=A?W==null?void 0:W.like[0].id:"",$=k?(H=O==null?void 0:O.like)==null?void 0:H.map(L=>{var M,V,ne;return{id:(M=L==null?void 0:L.user)==null?void 0:M.id,name:(ne=(V=L==null?void 0:L.user)==null?void 0:V.data)==null?void 0:ne.name}}):!1,R=E==null?void 0:E.actor;return c.jsx(D.Fragment,{children:c.jsx(Lr,{content:{type:"post",title:E==null?void 0:E.title,body:E==null?void 0:E.content,canLike:n,createdAt:(E==null?void 0:E.time)||"",slugs:{question:`${e}/${t}`,answer:S},slug:S,author:{id:R==null?void 0:R.id,name:(y=R==null?void 0:R.data)==null?void 0:y.name,organization:(z=R==null?void 0:R.data)==null?void 0:z.organization,jobTitle:(ee=R==null?void 0:R.data)==null?void 0:ee.jobTitle,location:(B=R==null?void 0:R.data)==null?void 0:B.location,image:{thumbnail:((F=R==null?void 0:R.data)==null?void 0:F.thumbnail)||void 0}},userLiked:A,likes:(q==null?void 0:q.like)||0,comments:(q==null?void 0:q.reply)||0,peopleWhoLiked:$,mentions:I},links:{post:`${e}/${t}/${S}`,comments:`${e}/${t}/${S}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:S}),updateContent:(L,{body:M})=>g({activityId:S,content:M})},likes:{createLike:()=>C({activityId:S}),deleteLike:()=>v({activityId:S,reactionId:P})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:T===x})},S)}),!p&&c.jsx(Mr,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},nw={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function rw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ql({reply:zx(o),user:i});return tc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Ql({reply:o,user:i});r.setQueryData(a,tc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Kf(d.id)},0)}});return s}function aw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Gf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ka(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:ko(u),mutate:_o(u)},user:l,...u},h=rw({...d,mutationFn:e}),p=aw({...d,mutationFn:t}),m=iw({...d,mutationFn:n}),g=ow({...d,mutationFn:a}),f=uw({...d,mutationFn:i}),{replies:C,...v}=sw({queryKey:s,queryFn:r});return{replies:C,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function iw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Na(s,o);return l&&Jl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Na(o,l);u&&Jl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function sw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=hw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function ow({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>fw(a,i)),onError:n});return r}function uw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Na(i,s);return o&&qx({reply:o,user:r}),s}),onError:n});return a}function lw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function cw(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function dw(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function tc(e,t,n){return t?n!=null&&n.append?cw(e,t,n):dw(e,t,n):lw(e)}function Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function fw(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function hw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const mw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:C},user:v}=Gf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:w=>i.list({...w,reactionId:r})}});Is([h]);const[x,_]=D.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ae,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>_(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&c.jsx(Wf,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(w,{body:E})=>p({activityId:n,replyId:r,content:E}),listMembers:i.listMembers},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(w=>{var se,H,y,z,ee,B,F,L,M,V,ne,te;const{id:E,own_children:T,latest_children:S,children_counts:W,data:{mentioned_users:O}}=w,I=(((se=T==null?void 0:T.like)==null?void 0:se.length)||0)>0?(H=T==null?void 0:T.like)==null?void 0:H.find(re=>{var de;return((de=re==null?void 0:re.user)==null?void 0:de.id)===(v==null?void 0:v.id)}):!1,k=I?I==null?void 0:I.id:"",A=!!I,$=(((y=S==null?void 0:S.like)==null?void 0:y.length)||0)>0?(z=S==null?void 0:S.like)==null?void 0:z.map(re=>{var de,Q,be;return{id:(de=re==null?void 0:re.user)==null?void 0:de.id,name:(be=(Q=re==null?void 0:re.user)==null?void 0:Q.data)==null?void 0:be.name}}):!1,R=w==null?void 0:w.user,U=typeof w.data.content=="string"?(ee=w==null?void 0:w.data)==null?void 0:ee.content:((F=(B=w==null?void 0:w.data)==null?void 0:B.content)==null?void 0:F.text)||"";return c.jsx(Lr,{isCommunity:!0,content:{id:E,type:"reply",body:U,canLike:a,createdAt:w==null?void 0:w.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:w==null?void 0:w.parent},slug:"",author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:(M=R.data)==null?void 0:M.organization,jobTitle:(V=R.data)==null?void 0:V.jobTitle,location:(ne=R.data)==null?void 0:ne.location,image:{thumbnail:((te=R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:A,likes:(W==null?void 0:W.like)||0,peopleWhoLiked:$,mentions:O},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:E}),updateContent:(re,{body:de})=>m({replyId:E,content:de})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>C({replyId:E,reactionId:k})},comments:{},mentions:{listMembers:i.listMembers}},styling:{showShareLinkButton:!0}},E)}):null})]})};const Qf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:g,edit:f,like:C,remove:v,unlike:x},user:_}=Gf({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{T(u.length),h()},[E,T]=D.useState(null);return Is([m]),Zf(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(qf,{type:"comment",responses:d,isLoading:m}),c.jsx(Eo,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:W})=>g({activityId:n,content:W}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map((S,W)=>{var ee,B,F,L,M,V,ne,te,re,de,Q,be;const{id:O,own_children:q,latest_children:I,children_counts:k,data:{mentioned_users:A}}=S,$=(((ee=q==null?void 0:q.like)==null?void 0:ee.length)||0)>0?(B=q==null?void 0:q.like)==null?void 0:B.find(he=>{var Ee;return((Ee=he==null?void 0:he.user)==null?void 0:Ee.id)===(_==null?void 0:_.id)}):!1,R=$?$==null?void 0:$.id:"",U=!!$,H=(((F=I==null?void 0:I.like)==null?void 0:F.length)||0)>0?(L=I==null?void 0:I.like)==null?void 0:L.map(he=>{var Ee,ke,De;return{id:(Ee=he==null?void 0:he.user)==null?void 0:Ee.id,name:(De=(ke=he==null?void 0:he.user)==null?void 0:ke.data)==null?void 0:De.name}}):!1,y=S==null?void 0:S.user,z=typeof S.data.content=="string"?(M=S==null?void 0:S.data)==null?void 0:M.content:((ne=(V=S==null?void 0:S.data)==null?void 0:V.content)==null?void 0:ne.text)||"";return c.jsx(Lf,{children:c.jsx(Lr,{isCommunity:!0,content:{id:O,type:"reply",body:z,canLike:r,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:O},slug:O,author:{id:y==null?void 0:y.id,name:(te=y.data)==null?void 0:te.name,organization:(re=y.data)==null?void 0:re.organization,jobTitle:(de=y.data)==null?void 0:de.jobTitle,location:(Q=y.data)==null?void 0:Q.location,image:{thumbnail:((be=y.data)==null?void 0:be.thumbnail)||void 0}},userLiked:U,likes:(k==null?void 0:k.like)||0,peopleWhoLiked:H,mentions:A},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:O}),updateContent:(he,{body:Ee})=>f({replyId:O,content:Ee})},likes:{createLike:()=>C({replyId:O}),deleteLike:()=>x({replyId:O,reactionId:R})},comments:{},mentions:i},children:c.jsx(mw,{basePath:e,parentId:t,activityId:n,replyId:O,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:W===E},O)},O)}),!m&&c.jsx(Mr,{hasNextPage:p,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function pw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function gw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function vw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ke.useQueryClient(),s=Ka(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:ko(o),mutate:_o(o)},user:s,...o},u=pw({...l,mutationFn:t}),d=bw({...l,mutationFn:n}),h=yw({...l,mutationFn:r}),{activity:p,...m}=gw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:d,unlike:h},user:s,...m}}function bw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Oa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Oa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function yw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Vf({activity:s,user:r}),s)),onError:n});return a}const Dw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var O,q,I,k,A,P,$,R,U,se;const d=ue.useIntl(),{activity:h,error:p,isLoading:m,mutations:{edit:g,like:f,unlike:C}}=vw({queryFns:i,queryKey:[e,t,n]});if(m)return c.jsx(Et,{style:{height:"400px"}});if(p||!h)return c.jsx(on,{variant:"error",text:d.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x,mentioned_users:_}=h,w=(((O=x==null?void 0:x.like)==null?void 0:O.length)||0)>0,E=(((q=v==null?void 0:v.like)==null?void 0:q.length)||0)>0,T=E?v==null?void 0:v.like[0].id:"",S=w?(I=x==null?void 0:x.like)==null?void 0:I.map(H=>{var y,z,ee;return{id:(y=H==null?void 0:H.user)==null?void 0:y.id,name:(ee=(z=H==null?void 0:H.user)==null?void 0:z.data)==null?void 0:ee.name}}):!1,W=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Lr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:W.id,name:(k=W.data)==null?void 0:k.name,organization:(A=W.data)==null?void 0:A.organization,jobTitle:(P=W.data)==null?void 0:P.jobTitle,location:($=W.data)==null?void 0:$.location,image:{thumbnail:((R=W.data)==null?void 0:R.thumbnail)||void 0}},userLiked:E,likes:((U=h==null?void 0:h.reaction_counts)==null?void 0:U.like)||0,comments:((se=h==null?void 0:h.reaction_counts)==null?void 0:se.reply)||0,peopleWhoLiked:S,mentions:_},originalAuthorId:W==null?void 0:W.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{title:y,body:z})=>g({title:y,content:z})},likes:{createLike:()=>f({activityId:n}),deleteLike:()=>C({activityId:n,reactionId:T})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),c.jsx(Qf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})};var Ps={exports:{}},aa={exports:{}},Ne={};/** @license React v16.13.1
137
137
  * react-is.production.min.js