@apolitical/component-library 5.1.3-RR.1 → 5.1.4

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.
@@ -33,7 +33,7 @@ export namespace IMAGE_ASPECTS {
33
33
  let sizes_3: string;
34
34
  export { sizes_3 as sizes };
35
35
  }
36
- namespace fallback {
36
+ namespace highlightSection {
37
37
  let range_4: {
38
38
  height: number;
39
39
  width: number;
@@ -51,6 +51,15 @@ export namespace IMAGE_ASPECTS {
51
51
  let sizes_5: string;
52
52
  export { sizes_5 as sizes };
53
53
  }
54
+ namespace fallback {
55
+ let range_6: {
56
+ height: number;
57
+ width: number;
58
+ }[];
59
+ export { range_6 as range };
60
+ let sizes_6: string;
61
+ export { sizes_6 as sizes };
62
+ }
54
63
  }
55
64
  export function buildSourceParameters({ aspect: customAspect, range: customRange, sizes: customSizes, }: {
56
65
  aspect: any;
package/index.js CHANGED
@@ -32,7 +32,7 @@ Check the top-level render call using <`+de+">.")}return se}}function Qo(P,se){{
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...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",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:"Share a question, insight, or announcement with the community",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_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",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",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",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 email addresses 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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",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, data and AI",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 email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",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",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",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",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"},um={...sr,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>"},lm={...sr,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"},cm={...sr,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>"},dm=Object.freeze(Object.defineProperty({__proto__:null,en:sr,es:um,fr:lm,pt:cm},Symbol.toStringTag,{value:"Module"})),Xa=(e,t=sr)=>e in t,St=(e,t,n,r,a={})=>{let i="";return Xa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},fm=(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)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Jc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},hm=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},mm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Sr).replace(/{{id}}/g,Sr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Xc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(jr);if(!a)return e;for(const s of a){const o=s.replace(jr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(vs))try{const h=d.replace(vs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:g}=p;u.name=g||m||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?mm(e,u,t):s)}return e},ed=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},td=e=>new URLSearchParams(window.location.search).get(e),au=(e="")=>e.replace(/\s+/g,"").length>0,ys=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 Ee=({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=Pn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Js(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),w=Uc(Object.keys(_));t=Hc(g,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:V(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const k=y.createElement(i,x,h||(d?c.jsx(Ne,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Mn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),k]}):k},or=({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(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const Ut=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},iu={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"}},pm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?iu[e]:iu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gm=({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},bi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${gm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ur=({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}=pm(e),g=bi({format:"avif",query:s,range:p,url:o}),f=bi({format:"webp",query:s,range:p,url:o}),b=bi({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:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ur,{image:{...e},className:"image"})}),fn=({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:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const nd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),Ur=({parent:e=document.body,children:t})=>typeof document=="object"?Nc.createPortal(t,e):null,bm=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"}));const ym=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ne,{children:c.jsx(ie.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:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Dm=({elementId:e,offset:t=20})=>{const n=ie.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(Ee,{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 Cm=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("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))}),su=300,ou="ease-in-out";class xm{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:su,easing:ou}),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:su,easing:ou}),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 ei=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ie.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new xm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},uu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},wm=e=>{let t=e;return Object.keys(uu).includes(e)&&(t=uu[e]),`url(${Wt}icons/${t}.svg)`};const lu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},rd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ie.useIntl(),i=t?{"--custom-icon":wm(t)}:{},s=Xa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in lu?lu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Pt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Wt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const hn=({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=Pn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Uc(Object.keys(h));a=Hc(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Pt,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(qt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ds=({children:e,...t})=>c.jsx("p",{...t,children:e}),ad={q:Ds,blockquote:Ds};for(let e=1;e<=6;e++)ad[`h${e}`]={component:Ds,props:{className:"title"}};const id=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(qt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:ad},children:r}):c.jsx("p",{children:r})]});const sd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ie.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",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:"Share a question, insight, or announcement with the community",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_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",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",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",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 email addresses 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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",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, data and AI",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 email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",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",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",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",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"},um={...sr,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>"},lm={...sr,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"},cm={...sr,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>"},dm=Object.freeze(Object.defineProperty({__proto__:null,en:sr,es:um,fr:lm,pt:cm},Symbol.toStringTag,{value:"Module"})),Xa=(e,t=sr)=>e in t,St=(e,t,n,r,a={})=>{let i="";return Xa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},fm=(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)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Jc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},hm=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},mm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Sr).replace(/{{id}}/g,Sr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Xc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(jr);if(!a)return e;for(const s of a){const o=s.replace(jr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(vs))try{const h=d.replace(vs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:g}=p;u.name=g||m||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?mm(e,u,t):s)}return e},ed=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},td=e=>new URLSearchParams(window.location.search).get(e),au=(e="")=>e.replace(/\s+/g,"").length>0,ys=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 Ee=({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=Pn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Js(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),w=Uc(Object.keys(_));t=Hc(g,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:V(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const k=y.createElement(i,x,h||(d?c.jsx(Ne,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Mn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),k]}):k},or=({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(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const Ut=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},iu={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"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},pm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?iu[e]:iu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gm=({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},bi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${gm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ur=({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}=pm(e),g=bi({format:"avif",query:s,range:p,url:o}),f=bi({format:"webp",query:s,range:p,url:o}),b=bi({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:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ur,{image:{...e},className:"image"})}),fn=({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:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const nd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),Ur=({parent:e=document.body,children:t})=>typeof document=="object"?Nc.createPortal(t,e):null,bm=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"}));const ym=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ne,{children:c.jsx(ie.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:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Dm=({elementId:e,offset:t=20})=>{const n=ie.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(Ee,{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 Cm=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("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))}),su=300,ou="ease-in-out";class xm{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:su,easing:ou}),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:su,easing:ou}),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 ei=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ie.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new xm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},uu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},wm=e=>{let t=e;return Object.keys(uu).includes(e)&&(t=uu[e]),`url(${Wt}icons/${t}.svg)`};const lu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},rd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ie.useIntl(),i=t?{"--custom-icon":wm(t)}:{},s=Xa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in lu?lu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Pt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Wt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const hn=({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=Pn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Uc(Object.keys(h));a=Hc(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Pt,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(qt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ds=({children:e,...t})=>c.jsx("p",{...t,children:e}),ad={q:Ds,blockquote:Ds};for(let e=1;e<=6;e++)ad[`h${e}`]={component:Ds,props:{className:"title"}};const id=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(qt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:ad},children:r}):c.jsx("p",{children:r})]});const sd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ie.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
36
  `);h(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
37
  `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const g=({propertyName:b})=>{b==="max-height"&&m(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(p);return c.jsxs(Pt,{variant:"subtle",className:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(qt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Em=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:V("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:y.Fragment,forceInline:!0},h={"--icon":`url(${Wt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(qt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(qt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(qt,{options:d,children:l.text}):l.text},u)})})},at=()=>y.Fragment,_m=({children:e})=>c.jsx(Pt,{variant:"secondary",children:e}),km=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Fm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Bm=({children:e})=>{const t=ie.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Fm.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(ei,{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(Pt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Pt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Pt,{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})},_t=({children:e})=>c.jsx(c.Fragment,{children:e}),Tm=e=>{const t=ie.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},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:i,tabIndex:0})]})},cu=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})=>{const n=ie.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||cu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&cu(a)==="button"&&(i=!0);else break}const s=`@${Sr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Cs=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const jm={default:{a:Sm,CollapsibleSection:ei,TextBox:Pt,CaseStudy:_m,style:at,details:Bm,div:Am,iframe:Tm,center:km},"text-only":{h1:at,h2:at,h3:at,h4:at,h5:at,h6:at,style:at,details:at,div:at,TextBox:at,CollapsibleSection:at,CaseStudy:at,blockquote:at,iframe:at,button:at}},Fn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=jm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:V("markdown-text",t,{"highlight-titles":s}),children:c.jsx(qt,{options:{...o,...n,overrides:l},children:r})})};const od=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",a),children:[c.jsxs("div",{className:V("content",{"has-max-width":e}),style:i,children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Gt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Wt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=Js(!!a),h=y.createElement(s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...o});return a?c.jsxs("span",{className:"pill-wrapper",children:[h,c.jsx(Mn,{isOpen:u,accessibility:{readToScreenreadersWhenClosed:!0},children:a})]}):h};const Or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t);const Om=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ie.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:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Ne,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},eo=y.memo(Om);const yi="loadingBlock_",Pm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${yi}loading`})},75:{text:r.formatMessage({id:`${yi}almostDone`})},100:{text:r.formatMessage({id:`${yi}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(${Wt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Pt,{className:V("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(eo,{progress:e})]})},Mm=y.memo(Pm);const At=({element:e="div",className:t="",...n})=>c.jsx(Ja,{element:e,className:V("loading-placeholder",t),...n});const xs={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"]},ud=(e,t)=>e in xs?c.jsx("div",{className:e,children:xs[e].map((n,r)=>ud(n,r))},t):c.jsx(At,{className:e},t),to=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:xs[e].map((n,r)=>ud(n,r))}),ld=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):""},Jr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Nm=e=>{const t=Math.ceil(26/Jr.length),n=ld(e).toLowerCase();if(n==="")return Jr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Jr.length;a++)if(r<=t*(a+1))return Jr[a]};const du=256,mn=({className:e="",src:t="",name:n,alt:r,width:a=du,height:i=du,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const g=m.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Nm(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ld(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},no=y.createContext({badges:[],isLoading:!0});function cd(){return y.useContext(no)}const dd=({children:e,badges:t})=>c.jsx(no.Provider,{value:t,children:e}),fd=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Vh.ReactQueryDevtools,{initialIsOpen:!1})]})};var hd=y.createContext({client:Da});function Im(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.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&&(Da.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Da.init(r,a)),Da)},[n,r]);return y.createElement(hd.Provider,{value:{client:i}},t)}var Rm=function(){var e=y.useContext(hd).client;return e};function $m(e){var t=Rm(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const md=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Im,{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});var ro=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(ro||{});const pd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...dm[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:a,children:e})},ao=y.createContext({}),xa={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ti(){return y.useContext(it)}const gd=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),io=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),vd=()=>y.useContext(io),bd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(io.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Lm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),Jc(5e3)}).catch(p=>{p.message===Yc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(ao.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(pd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Gs.CookiesProvider,{children:c.jsx(gd,{user:a,updateDetails:i,children:c.jsx(dd,{badges:s,children:c.jsx(bd,{children:c.jsx(fd,{showDevTools:r,children:c.jsx(md,{user:a,children:t})})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const ni=e=>e==="apolitical"?{image:`${Wt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Wt}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,badges:e.badges},zm=({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=Xn(l,r)),l};const qm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Wm=({slug:e})=>{const{badges:t}=cd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Gt,{className:V("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&qm[a],element:"li",tooltip:s,children:r})};const Um=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Wm,{slug:s},o))}))})},Hm=y.lazy(()=>Promise.resolve().then(()=>bm)),Vm=y.lazy(()=>Promise.resolve().then(()=>i_));let Xr=null;const Qt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{const h=ie.useIntl(),{profile:p,...m}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:v=!1}=a,x=y.useContext(it),k=p&&x&&typeof x.id=="string",[_,w]=y.useState(!1),F=ni(t);F.name||(F.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:S,image:q}=F;let{url:N}=F;typeof t=="object"&&t.link!==void 0&&(t.link===!1?N=void 0:N=t.link);const z=zm(F),I=r&&r.createdAt?bs(r.createdAt):!1,A=r&&r.createdAt?Xs(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",g,f,l,{"has-profile-link":k}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(fn,{href:N,gtmType:o,gtmContext:s,onClick:E=>{if(E==null||E.preventDefault(),E==null||E.stopPropagation(),!N)return;Xr&&clearTimeout(Xr),Xr=setTimeout(()=>{window.location.href=N},150);const j=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:N,timeout:Xr}});document.dispatchEvent(j)},children:[c.jsx(mn,{name:S,src:q,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":v}),"data-testid":"member-name",children:[c.jsx("span",{children:S}),(u==null?void 0:u.showBadges)&&(F==null?void 0:F.badges)&&c.jsx(Um,{userBadges:F.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":v}),children:[r.createdAt&&I&&c.jsx("span",{className:"date",title:A,"aria-label":A,"data-testid":"date",children:h.formatMessage({id:`dates_${I.path}`},{number:I.number})}),r.customMessage&&c.jsx("span",{children:r.customMessage}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),z&&!v&&c.jsx("small",{className:V({"text-medium":g==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[F.role,F.organisation?` — ${F.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:F.country})]})})]})]}),z&&p&&k?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:E=>{E.preventDefault(),E.stopPropagation(),w(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(Hm,{children:c.jsx(Vm,{form:p,showModal:_,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{w(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Km=Object.freeze(Object.defineProperty({__proto__:null,default:Qt},Symbol.toStringTag,{value:"Module"}));const fu={small:24,medium:48},so=({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=ie.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("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:b="",image:v=""}=ni(p);if(s)return c.jsx(At,{element:"li",className:"contributor"},m);g=c.jsx(mn,{name:b,src:v,width:fu[a||"medium"],height:fu[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",fm(b,0)]}),f="number-left"}return g?c.jsx("li",{className:V("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]}`}):Xn(n[0].name||"",20):l||null})]})})};const oo=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:V("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var ws={exports:{}},ea={exports:{}},Pe={};/** @license React v16.13.1
38
38
  * react-is.production.min.js
@@ -162,4 +162,4 @@ ${m}${h?"1.":"-"} ${u}${p?`
162
162
 
163
163
  `}),ee=B.turndown(ee)}o&&o.mentions&&(ee=await Xc({text:ee,template:`[${zs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),lw(ee,B=>{_([{type:"initialValue",value:B},{type:"editorKey",value:F.toString()}]),setTimeout(()=>{_([{type:"stringValue",value:Cc(G)}])},150)})})()},[F]),y.useEffect(()=>{t!==""||!G||ps(F,t)&&!I||(D.withoutNormalizing(G,()=>{J.delete(G,{at:{anchor:D.start(G,[]),focus:D.end(G,[])}}),J.deselect(G),G.children.length!==0&&J.unwrapNodes(G,{at:[0]}),J.insertNodes(G,v,{at:[0]})}),_([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=zc(()=>{hw({editor:G,isShowing:E.show,numberOfUsers:E.numberOfUsers,listMembers:p,dispatch:_})},100);return S?c.jsx("div",{id:R,className:"rich-text-editor",children:c.jsxs(nn.Provider,{value:{...k,id:R,isInOverlay:h,setFocus:j,dispatch:_,onMention:f,reportError:b},children:[c.jsxs(BD,{editor:G,initialValue:S,onChange:L=>{if(G.operations.some(B=>B.type!=="set_selection")){const B=pw(L);g(B),_([{type:"stringValue",value:Cc(G)}]),I||_([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:B,json:L})}},...l,children:[c.jsx(yD,{className:"input",renderElement:W,renderLeaf:H,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:L=>{if(L.key==="Enter"){E.show&&(L.preventDefault(),L.stopPropagation(),rh(G,E,_,R));const{selection:ee}=G;if(ee){const B=K.isCollapsed(ee),[T,O]=D.node(G,ee,{depth:1});let $=T,U=$.type;const re=$.children[0];if(re&&[Z.ol,Z.ul].includes(re.type)&&($=re,U=re.type),$&&fe.isElement($)&&U!==Z.paragraph){if(U===Z.blockquote&&!L.shiftKey){L.stopPropagation(),L.preventDefault(),J.insertNodes(G,v);return}if(B){const[X,ae]=D.parent(G,ee,{edge:"end"}),Q=X.type;if([Z.ul,Z.ol].includes(U))if(L.stopPropagation(),L.preventDefault(),Q===Z.li&&z==="Enter"){X.children.length===1&&"text"in X.children[0]&&X.children[0].text===""&&J.removeNodes(G,{at:ae}),J.insertNodes(G,v,{at:M.next(O)}),J.select(G,D.end(G,M.next(O)));return}else{const[ve,pe]=cw(G,Z.li),_e={type:Z.li,children:[{text:""}]};J.insertNodes(G,_e,{at:M.next(pe)}),J.select(G,D.end(G,M.next(pe)))}}}}}else if(L.key==="Escape"){if(E.show){L.preventDefault(),L.stopPropagation(),_([{type:"mentionPopover",value:{...E,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(L.key)&&E.show){L.preventDefault(),L.stopPropagation();const{selectedUser:ee,possibleUsers:B}=E;let T=L.key==="ArrowUp"?ee-1:ee+1;T<0&&(T=B.length-1),T>=B.length+1&&(T=0),_([{type:"mentionPopover",value:{...E,selectedUser:T}}])}_([{type:"lastKey",value:L.key}]),fw(L,G,_,b)},onBlur:()=>{G.selection&&_([{type:"lastAnchor",value:G.selection.anchor}])},onFocus:()=>{if(N){if(!M.isPath(N.path)||!ue.has(G,N.path))return;const L=ue.get(G,N.path);let ee=0;if(me.isText(L)?ee=L.text.length:L.children&&(ee=L.children.length),N.offset>ee)return;try{J.select(G,{anchor:N,focus:N})}catch(B){const T=B.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(kw,{}),p?c.jsx(gw,{onFallbackClick:m}):null]},w),c.jsx(ho,{id:`character-limit-${e}`,limit:r,valueLength:ri(q)})]})}):c.jsx(c.Fragment,{})};const Nw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:V("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:V("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 fh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ie.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,g]=y.useState(!1),f=y.useRef(null),b=async _=>{p(!0),g(!1);try{const w=_.target.files&&_.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const F=await a({fileObject:w,userId:t}),S={thumbnail:F.thumbnailURL,full:F.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:x=o.formatMessage({id:`${l}cta_change`}),uploading:k=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(mn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?k:u?x:v})]})}const hh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(en,{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 mh=({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]=y.useState([]),[p,m]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=ie.useIntl(),v=async _=>{_.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},x=_=>{_.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},k=_=>{_.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:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(Ut,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:x,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:k,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:x,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:V("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(Kh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:_=>{h(_),m(!_.length)},autoFocus:!1,getLabel:(_,w,F)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:_}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(w),m(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(Ut,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ee,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Ta=e=>e.map(t=>({condition:t})),Et={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Iw=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Et.NEW_PASSWORD]!==m[Et.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!ys(m[Et.NEW_PASSWORD]).isValid,h=[{"data-testid":Et.NEW_PASSWORD,id:Et.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ta(["required",d]),functions:{onChange:m=>l(ys(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Et.CONFIRMED_PASSWORD,id:Et.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ta(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Et.CURRENT_PASSWORD,id:Et.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ta(["required"])}),i&&h.push({component:Ld,props:{matchingRules:o}});const p={id:Et.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(Et.NEW_PASSWORD)||g.includes(Et.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(en,{...p}),r&&c.jsx(hn,{variant:"error",text:r})]})};const ph=({hooks:e,functions:t,meta:n={},gtm:r})=>{var _,w;const a=ie.useIntl(),i="profileForm_",s=y.useContext(it),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:h,onSuccess:p=async F=>{},onCancel:m=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:x="ProfileForm",event:k="profile-form-submit-click"}=r||{};return c.jsx(en,{id:"profile-details-form",fields:[{component:fh,props:{userName:s.name,userId:s.id,src:o,uploadImage:h,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((_=s.location)==null?void 0:_.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:F})=>F&&!u?!1:!b(F),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:Ut}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:x,event:k},functions:{onSuccess:async F=>{try{const S={...F,image:o||null,location:u?await f(F==null?void 0:F.location):s.location};s.updateDetails&&s.updateDetails(q=>({...q,...S})),await p(S)}catch{g()}},onCancel:m,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const gh=({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=ie.useIntl(),u=y.useRef(null);er(()=>{!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:V("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(Ne,{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(Ne,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ne,{children:l.formatMessage({id:"search_cta"})})})]})})})},kc=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}])},Rw=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"]}},$w=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=Rw(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}])},Lw=({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:()=>{kc({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:Md,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"&&kc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const zw=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const qw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Ww=({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=ie.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,b]=y.useReducer(Wr,qw),{validFields:v,emailDetails:x,shouldManuallyApprove:k,shouldDisableButton:_,showSuccessMessage:w,showError:F}=f,[S,q]=Gs.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{k===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[k]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const z=y.useMemo(()=>Lw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),I=_?!0:k?!Object.values(v).every(A=>A===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&w?c.jsx(zw,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),F&&c.jsx(hn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(en,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:z,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:"/api/next-ui/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 $w({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const bn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Uw=({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(bn,{className:V("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(or,{buttons:r})]})})};const Zs="editSection_";function vh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Hw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(Pt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Zs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>vh({href:r,setShowModal:i}),children:n||s({id:`${Zs}placeholder_cta`})})})]})},Vw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ie.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:V("edit-section",t),children:[g&&c.jsx(pn,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:V("edit-section-modal"),children:b||(n?c.jsx(en,{...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 v=>{var x,k;(x=n==null?void 0:n.functions)!=null&&x.onSuccess&&await((k=n==null?void 0:n.functions)==null?void 0:k.onSuccess(v)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:V("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>vh({href:a,setShowModal:p}),children:d({id:`${Zs}edit`})})]}),e||c.jsx(Hw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(Ut,{})]})};const Kw=({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:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:V("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:V({"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 ts;const ns="contactFooter_",Zw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ts),ts=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ts),window.removeEventListener("resize",l)}),[]),c.jsx(bn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${ns}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(ie.FormattedMessage,{id:`${ns}text`})}),c.jsx(fn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${ns}email`})})]}),c.jsx(hh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Yw=({activeLink:e,profile:t,...n})=>c.jsx(bn,{children:c.jsx(Od,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(jd,{activeLink:e,profile:t}),c.jsx(od,{...n})]})})});const rs="cookieBanner_",as=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],is=new Date(Date.now()+12*30*24*60*60*1e3),bh=()=>{const e=ie.useIntl(),[t,n,r]=Gs.useCookies(as),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{as.forEach(d=>{n(d,!0,{path:"/",expires:is,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:is}),as.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:is});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:`${rs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${rs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${rs}text`})}),c.jsx(or,{buttons:u})]})},Zt={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:Un["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Un["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:Un.support,gtmType:"concierge-email-click"},business:{email:Un.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 Gn="footer_",Ha="SiteFooter",Fc=({group:e})=>{const t=Zt[e].order||[];let n=!1;return"text"in Zt[e]&&(n=Zt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${Gn}${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}=Zt[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":Ha,"data-gtm-event-type":i,...s,children:c.jsx(ie.FormattedMessage,{id:`${Gn}${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(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}${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":Ha,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Lo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ja,{element:"hr"}),c.jsx(fo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ha,"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(Fc,{group:e}),Object.keys(Zt[e]).includes("child")&&c.jsx(Fc,{group:Zt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Zt.social.order)&&Zt.social.order.map(e=>{const t=Zt.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":Ha,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${Gn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}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===yt.ACCOUNT&&t===!1&&n[yt.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 yt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case yt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case yt.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=Ic(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 yt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ie.findFirstChild(u.children,"id",yt.SITE);s=Ie.findFirstChild(d.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case yt.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)}}},qr={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:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Va=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ie.useIntl(),o=Ic(qr,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 k=o.gtmType||`${e}-click`;if(k.includes(".")){const _=k.split("."),w=_[_.length-2];k=`${w==="topics"?`${w}-`:""}${_[_.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":k,"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 b={},v={},x={};if(f&&(b={...b,"aria-current":"page"}),m){const k=o.menuId||e,_={onClick:w=>Ie.events.onClick(w,{id:k,callback:a,isOpen:r[k]}),onFocus:()=>Ie.events.onFocus({id:k}),onBlur:()=>Ie.events.onBlur({id:k,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:k,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:k,callback:a})};v={..._,id:k===yt.SITE?yt.SITE:yt.ACCOUNT},n&&(g&&(x={..._,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Ie.events.onClick(w,{id:k,callback:a,isOpen:r[k]})},"aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),v={...v,hidden:k in r?!r[k]:!0}),g||(v={...v})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...x,children:[s.formatMessage({id:h}),c.jsx(Ne,{children:s.formatMessage({id:`header_menu_${r[yt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(k=>{if(!o[k])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[k].order?c.jsxs("li",{className:V({[o[k].className]:o[k].className}),children:[s.formatMessage({id:`${h}_${k}`}),c.jsx("ul",{children:o[k].order.map(w=>c.jsx(Va,{id:`${e}.${k}.${w}`,..._},w))})]},k):c.jsx(Va,{id:`${e}.${k}`,..._},k)})})]},e)};const Gw={height:67,height_desktop:83};var yt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(yt||{});const zo=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=y.useContext(it),r=Pn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Wr,{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=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),Wc({scrollPosition:Gw[`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,k=!1)=>{Ie.handleMenus({id:v,value:x,menus:h.current.menus,dispatch:o,forceHandle:k})},m=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{h.current.menus[x]&&p(x,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",g)}},[]),er(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),er(()=>{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(Ne,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(gh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=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(Ne,{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:qr.order.map(v=>c.jsx(Va,{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:V({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ne,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(fo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),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(Ne,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(mn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:qr.buttons.order.map(v=>c.jsx(Va,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Qw=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(zo,{}),c.jsx("div",{id:"content",children:c.jsx(hn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Lo,{})]})},yh=({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=Lc(),[f,b]=y.useState(""),v=F=>{const{detail:{message:S}}=F;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const x=Ca(e,{locale:o}),k=Ca(t,{locale:o}),_=Ca(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),h!=="default"&&(w[h]=!0),p!=="default"&&(w[p]=!0),c.jsx(Zh.ErrorBoundary,{onError:r,fallback:c.jsx(Qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,w,{"has-footer":u}),children:[c.jsx(zo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":m==="large"}),children:k}),y.createElement(d==="bold"?oo:"div",{id:"content",children:x,className:V({"large-modal":m==="large"})})]}),_&&c.jsx("div",{className:"additional-content appended",children:_}),u&&c.jsx(Lo,{}),c.jsx(bh,{})]}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Bc={default:"tags_",headerTopics:"header_topics_topics_"},ss={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"},Jw={getTagDetails:e=>{if(e.includes("topic_")){if(e=ss.topic[e.replace("topic_","")],e){const t=qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Bc.headerTopics}${e}`}:null}return null}return ss[e]?(e=ss[e],{id:e,text:`${Bc.default}${e}`}):null}};const Xw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Jw.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("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)})})};var dt=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(dt||{});const eE=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",className:u=""})=>{const d=ie.useIntl(),h="membersList",p=y.useContext(it),[m,g]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:V("members-list",u),children:[c.jsxs("h1",{children:[d.formatMessage({id:h}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(Qt,{member:p,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),c.jsx(fn,{href:"/profiles/me",className:"text-small",onClick:f=>{f==null||f.preventDefault(),f==null||f.stopPropagation(),g(!0)},children:d.formatMessage({id:`${h}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((f,b)=>c.jsxs("li",{children:[c.jsx(Qt,{member:f,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),f.isAdmin&&c.jsx(Gt,{children:d.formatMessage({id:`${h}_admin`})})]},b))]}),a&&c.jsx(Hr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(fi,{form:s,showModal:m,content:{title:d.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{g(!1)}}}):c.jsx(c.Fragment,{})]})},tE={showForm:!1},di=y.createContext(tE),Dh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(di.Provider,{value:{...t,updateConversation:n},children:e})},Ys=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Kr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},nE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ie.useIntl();return t?c.jsx("small",{children:St(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,{})},rE=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ie.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(Ne,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:St(a.formatMessage,`${t}label_action`,r,"action")})};let ga=null;const Je="discussion_form_",Zr=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Se,We,Ue;const m=ie.useIntl(),g=y.useContext(it),[f,b]=y.useState(""),{isLoading:v=!1,isInWrapper:x=!1,isInOverlay:k=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:F=!1,isPrepopulated:S=!1,showTitle:q=!1,showGuidelines:N=!0,showDivider:z=!1,showSuccessMessage:I=!0}=a||{},{onChange:A=()=>{},create:E=()=>{},handleSaveEdit:j=()=>{},handleCancel:R=()=>{},callback:W=()=>{},onMention:H=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:ne=()=>{},props:C={create:{projectNames:["questions-answers"]}}}=d,[L,ee]=y.useState({title:F&&F.text||"",body:w&&w.text||S&&S.text||""}),[B,T]=y.useState(l.error||!1),[O,$]=y.useState(!1);if(y.useEffect(()=>{u&&!w&&S&&S!==L.body&&ee({...L,body:S.text||""})},[S]),v)return c.jsx(At,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const U=Be=>{ee({...L,body:Be}),A({body:Be});let Te;!g||!g.id?Te=St(m.formatMessage,`${Je}error_loggedOut`,n.type,"action"):r?s>0&&Be.length>=s&&(Te=`${Je}error_tooLong`):Te=St(m.formatMessage,`${Je}error_noPermission`,n.type,"action"),Te?T(Te):B&&T(!1)};let re=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const Be=((Se=n.slugs)==null?void 0:Se.reply)||((We=n.slugs)==null?void 0:We.answer)||((Ue=n.slugs)==null?void 0:Ue.question)||"";Be&&(re=`${re}-${Be.slice(-15)}`)}e&&(re=`${e}-${re}`);const X=async()=>{if(!g||!g.id||!r||ve)return;ga&&clearTimeout(ga),$("submitting");const Be=window.location.pathname;try{let Te;switch(n.type){case"post":Te=await E({title:L.title,content:L.body});break;case"question":Te=await E({title:L.body,authorId:g&&g.id,...C==null?void 0:C.create});break;case"response":Te=await E({questionSlug:n.slugs.question},{body:L.body,authorId:g&&g.id,contentPath:Be});break;case"reply":Te=await E({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:L.body,authorId:g&&g.id,contentPath:Be});break;default:break}await sm(1e3),W&&await W(Te),ga=setTimeout(()=>{ee({title:"",body:""}),$("submitted"),b(St(m.formatMessage,`${Je}success`,n.type,"action"));const De=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(De),ae()},500)}catch(Te){const De=Te;let Re=`${Je}error`;De!=null&&De.message.includes("entry already exists")&&(Re=St(m.formatMessage,`${Je}error_alreadyExists`,n.type,"action")),De!=null&&De.message.includes("429")?Re=St(m.formatMessage,`${Je}error_tooMany`,n.type,"action"):De!=null&&De.message.includes("400")&&(Re=`${Je}error`),T(Re),ae()}},ae=()=>{ga=setTimeout(()=>{T(!1),$(!1),b("")},5e3)},he=!L.title||!au(L.title),Q=!L.body||!au(L.body);let ve=Q;F&&(ve=he&&Q);const pe=O==="submitting",_e=[{component:rE,props:{formID:re,intlPath:Je,showLabel:F!==!1,type:n.type}},{component:dh,props:{id:`${re}-input`,value:O==="submitting"&&!B?"":L.body,placeholder:i||St(m.formatMessage,`${Je}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:U,onMention:H,listMembers:G,clickMentionFallback:ne},data:h,autoFocus:w!==!1||_&&!F,"aria-invalid":!!B,"aria-errormessage":"error-message"}},{component:nE,props:{intlPath:Je,showGuidelines:N,type:n.type,gtmContext:p}}];z&&_e.push({component:Ut}),F&&_e.unshift({id:"title",type:"text",value:F.text,limit:250,autoFocus:_,label:m.formatMessage({id:`${Je}titleField_label`}),placeholder:m.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{ee({...L,title:Be}),A({title:Be})}},validation:[{condition:()=>ve,error:m.formatMessage({id:`${Je}titleField_error`})}]});let Fe=!g||!g.id||!r||ve||pe;return w&&(F?Fe=Fe||L.body===w.text&&L.title===F.text:Fe=Fe||L.body===w.text),c.jsxs(c.Fragment,{children:[c.jsxs(en,{id:re,className:V("discussion-card discussion-form",{"no-styling":x&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!pe||l.cancel},functions:{onSuccess:async()=>{if(w){$("submitting"),j(L);return}await X()},onCancel:R},fields:_e,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`${w?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Fe,text:{default:!w&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Je}${w?"save":"post"}`}),submitting:m.formatMessage({id:`${Je}${w?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Je}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[q&&!w&&["question"].includes(n.type)&&c.jsx("h2",{children:St(m.formatMessage,`${Je}title`,n.type,"action")}),c.jsx(Qt,{member:g?{...g,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})]}),O==="submitted"&&I&&c.jsx(Or,{className:"success","data-testid":"success",children:St(m.formatMessage,`${Je}success`,n.type,"action")}),B&&c.jsx(Or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof B=="string"?B.includes(" ")?B:m.formatMessage({id:B},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):B}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,children:f})]})},aE=Object.freeze(Object.defineProperty({__proto__:null,default:Zr},Symbol.toStringTag,{value:"Module"})),iE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),sE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ka=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:V("discussion-button",t),variant:"tertiary",icon:e,...n});let Tr=!1;const os=()=>{Tr!==!1&&(clearTimeout(Tr),Tr=!1)},us=5;let ls=null;const Ch=({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=ie.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=y.useReducer(Wr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=h;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const x=y.useMemo(()=>sE(n,us),[n]),k=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Tr)return os(),!1;if(os(),f||!s)return!1;Tr=setTimeout(_,350)},_=async()=>{if(os(),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 q=iE(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{ls=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},F=()=>{ls&&clearTimeout(ls)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ka,{className:V("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:k,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(Ne,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>w,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),F(),p([{type:"showLikers",value:!0}]);const q=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(q){const z=q.querySelector("li:first-child a");z&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{z.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ne,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Mn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[x.map((S,q)=>{if(typeof S=="string")return null;const N={};return v!==q&&(N.tabIndex=-1),c.jsx("li",{"data-index":q,children:c.jsx(fn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:z=>z==null?void 0:z.stopPropagation(),onFocus:()=>F(),onKeyDown:z=>{var R,W,H,G;if(!z||!["ArrowUp","ArrowDown"].includes(z.key||""))return;z.stopPropagation(),z.preventDefault();const I=z.key==="ArrowUp"?"up":"down",A=(R=z.currentTarget)==null?void 0:R.parentElement;let E=A==null?void 0:A.nextElementSibling;if(I==="up"){const ne=A==null?void 0:A.previousElementSibling;ne?E=ne:(E=(W=A==null?void 0:A.parentElement)==null?void 0:W.lastElementChild,(E==null?void 0:E.getAttribute("data-index"))==="-1"&&(E=E==null?void 0:E.previousElementSibling))}else(!E||(E==null?void 0:E.getAttribute("data-index"))==="-1")&&(E=(H=A==null?void 0:A.parentElement)==null?void 0:H.firstElementChild);if(!E)return;const j=(E==null?void 0:E.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(G=E==null?void 0:E.querySelector("a"))==null||G.focus()},...N,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>us&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-us})})]})})]})]}))},cs=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})},oE=280,qo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Xn(e,typeof t=="number"?t:oE):e;a=a.trim();const i=`<br>
164
164
 
165
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Xc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const uE=3e3,lE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Ka,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},uE)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Mn,{className:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},It="discussion_",cE=195;let va=null;const Yr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,styling:{showShareLinkButton:m=!1,showMoreMenuButton:g=!0}={},setFocus:f=!1,isCommunity:b=!1,badges:v})=>{var Ue,Be,Te,De,Re,ze,Y,oe;const x=ie.useIntl(),k=y.useContext(it),_=y.useContext(di),{createContent:w=async()=>{},deleteContent:F=async()=>{},updateContent:S=async()=>{}}=o.content||{},{createLike:q=()=>{},deleteLike:N=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:I=()=>Promise.resolve([]),clickMentionFallback:A=()=>{}}=o.mentions||{},{author:E,canLike:j,createdAt:R,id:W,likes:H=0,userLiked:G,comments:ne=0,mentions:C}=t,L=k&&k.id&&typeof E!="string"&&E.id&&E.id===k.id||!1,ee=typeof j=="boolean"?j:!0,B=L&&(!t.createdAt||am(t.createdAt,10,"seconds")),T=y.useRef(null),[O,$]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",memberCustomMessage:(t==null?void 0:t.memberCustomMessage)||""}),[U,re]=y.useState(!1),[X,ae]=y.useState(B?"highlighted":"default"),[he,Q]=y.useState("");y.useEffect(()=>{const le=T.current;if(!(!le||X==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.addEventListener("transitionend",pe),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.removeEventListener("transitionend",pe)}},[]),y.useEffect(()=>{$({...O,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const ce=await qo(O.body,p,C,I);$({...O,postBody:ce})})()},[O.body,C]);const ve=()=>{setTimeout(()=>{ae("fading")},1e3)},pe=({propertyName:le})=>{le==="background-color"&&ae(ce=>(ce==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),T.current&&T.current.removeEventListener("transitionend",pe)),ce==="fading"?"default":ce))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||O.postBody===""&&t.title==="")return c.jsx(At,{className:"discussion-card"});const _e=async({title:le,body:ce})=>{le||(le=""),ce||(ce=""),Q("");try{if(!ps(le,O.title)||!ps(ce,O.body)){const Ce=t.type==="question"?{title:ce}:{title:le,body:ce};await S(Ys(t.slugs),Ce)}$({...O,title:le,body:ce,isEditing:!1,didEdit:!0})}catch{Q(`${It}form_error`)}},Fe=()=>{if(_&&_.updateConversation){const le={showForm:!0},ce=t.author;ce&&ce.id&&(b&&(le.prepopulateForm=`@{{${ce.id}}}`),le.mentionData={id:ce.id,name:ce.name}),_.updateConversation(le)}setTimeout(()=>{var Ye,rt,xt;const ce=`reply-form-${(t.type==="answer"?t.slug:((Ye=t.slugs)==null?void 0:Ye.reply)||((rt=t.slugs)==null?void 0:rt.answer)||((xt=t.slugs)==null?void 0:xt.question)||"").toLowerCase().slice(-15)}`,Ce=document.getElementById(ce),Ze=document.getElementById(`${ce}-input`);Ze&&Ze.focus(),Ce&&Ce.scrollIntoView({behavior:"smooth"})},0)},Se=async()=>{re(!1);try{await F(Ys(t.slugs))}catch{Q("delete-error")}},We=[{text:x.formatMessage({id:`${It}moreMenu_report`}),onClick:le=>{le.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(x.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(x.formatMessage({id:`${It}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&&L&&We.push({text:x.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>$({...O,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:x.formatMessage({id:`${It}moreMenu_delete`}),onClick:le=>{le.preventDefault(),le.stopPropagation(),re(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Td(`delete-${t.slug}-modal`,U)}),r&&o.pins&&We.push({text:x.formatMessage({id:`${It}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),f&&((Ue=T==null?void 0:T.current)==null||Ue.focus(),(Be=T==null?void 0:T.current)==null||Be.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[X]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!O.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:T,tabIndex:f?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:le=>{if(!l.post||O.isEditing)return;le.preventDefault(),le.stopPropagation(),va&&clearTimeout(va),va=setTimeout(()=>{window.location.href=l.post},150);const ce=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:va}});document.dispatchEvent(ce)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:O.isEditing,"has-link":l.post&&!O.isEditing}),children:[!O.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Qt,{member:E,additionalContent:{createdAt:R,didEdit:O.didEdit,customMessage:O.memberCustomMessage},className:typeof E!="string"&&E.id===i?"highlighted":"",styling:{additionalContentNewLine:!!O.memberCustomMessage},gtmContext:d,gtmType:"profile-click",badges:v}),t.pinned&&c.jsx(Gt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ne,{children:"Pinned Post"})})]}),O.isEditing?c.jsx(Zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:O.title!==""?{text:O.title}:!1,isEditing:{text:O.body},isPrepopulated:!1},isCommunity:b,maxLength:t.type==="question"?250:5e4,forceShow:{error:he!==""&&he!=="delete-error"?x.formatMessage({id:he},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:_e,handleCancel:()=>{Q(""),$({...O,isEditing:!1})},listMembers:I,clickMentionFallback:A},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),O.postBody.length>cE?c.jsx(sd,{text:O.postBody,markdownOptions:{overrides:{a:Cs,blockquote:{component:cs}}}}):c.jsx(Fn,{options:{overrides:{a:Cs,blockquote:{component:cs}}},children:O.postBody})]}):c.jsxs(c.Fragment,{children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),c.jsx(Fn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:cs}}},children:O.postBody})]}),!O.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:V("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(Ch,{element:"li",likes:H,isShort:!1,userLiked:G,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ee,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:q,deleteLike:N}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ka,{onClick:le=>{le.preventDefault(),le.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:x.formatMessage({id:`${It}comments_screenReader`},{count:ne}),children:x.formatMessage({id:`${It}comments`},{count:ne})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ka,{styling:{muted:!0},onClick:Fe,icon:{icon:"speech-bubble_square"},children:x.formatMessage({id:`${It}reply`})})}),m&&c.jsx(lE,{url:(Te=t.slugs)!=null&&Te.reply?`${window.location.origin}${(De=t.slugs)==null?void 0:De.question}/${(Re=t.slugs)==null?void 0:Re.answer}#${(ze=t.slugs)==null?void 0:ze.reply}`:`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(oe=t.slugs)==null?void 0:oe.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),g&&c.jsx(Sd,{element:"li",id:`more-${t.slug}`,options:We})]})]}),h,c.jsx(pn,{id:`delete-${t.slug}-modal`,isOpen:U,functions:{onOpen:()=>{},onClose:()=>re(!1)},forceShow:{error:he==="delete-error"?x.formatMessage({id:"discussion_delete_error"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:x.formatMessage({id:"discussion_delete_title"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>re(!1),children:x.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Se,children:x.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:le=>c.jsx("p",{children:le}),action:x.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const dE=y.lazy(()=>Promise.resolve().then(()=>r_)),fE=65,xh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=ni(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||td("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await qo(p.title||p.body||"",fE,p.mentions);m(x=>({...x,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const _=x.target.closest("a");v=_&&_.getAttribute("href")}h(x=>({...x,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(mn,{name:l.name,src:l.image,alt:""}),c.jsx(Fn,{className:V("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:_t,blockquote:_t,br:_t,em:_t,li:_t,ol:_t,p:_t,s:_t,span:_t,strong:_t,ul:_t}},children:f})]}),c.jsxs(Ur,{children:[c.jsx(dE,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(pn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},hE=y.lazy(()=>Promise.resolve().then(()=>aE)),Wo=({isCard:e=!1,form:t,parentId:n,membershipRequiredToPost:{isMember:r,required:a,join:i,leave:s,notMemberStateText:o}})=>{if(a&&!r)return c.jsx(hn,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(co,{isShort:!0,functions:{join:i,leave:s}})}});const{content:l,functions:u,meta:d,...h}=t,p={content:{type:(l==null?void 0:l.type)||"reply",slugs:(l==null?void 0:l.slugs)||{}},functions:{...u,create:(u==null?void 0:u.create)||(()=>{})},parentId:n,meta:{...d,isEditing:(d==null?void 0:d.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...h,id:`add-post-${h.id||""}`};return e?c.jsx(xh,{form:p}):c.jsx(hE,{...p})},Uo=({form:e})=>{const t=y.useContext(it),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{hm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(fi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ds="discussion_responses_",wh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ds}title`},{action:r.formatMessage({id:`${ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:St(r.formatMessage,`${ds}empty`,e,e)})]})};const Eh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(di),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:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Hr,{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(Zr,{...r})]})},mE="post",pE="reply",_h="00000000-0000-0000-0000-000000000000";function Ho({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Vo({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 gE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function kh(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 bE({title:e,content:t}){return{title:e,content:t,id:_h,time:new Date().toISOString(),verb:mE}}function Ac({activity:e,user:t}){return{...e,actor:kh(t),...gE()}}function Za({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 Fh({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 Ya({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Bh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function yE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:_h,kind:pE,parent:t||""}}function Tc({reply:e,user:t}){const n=kh(t);return{...e,user_id:n.id,user:n,...vE()}}function Sc({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 DE({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 Ah=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let jc,fs=0;const Th=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(jc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),fs=0;return}fs++,!(fs>10)&&(jc=setTimeout(()=>{e(t)},50))}},ir=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}),Ht=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}),Ko=Object.freeze({actor:`SU:${ir.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"}),CE=Object.freeze({actor:`SU:${Ht.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"}),xE=Object.freeze({actor:`SU:${ir.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"}),wE=Object.freeze({actor:`SU:${Ht.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:Ko.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Ko.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ko.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:CE.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xE.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function EE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ac({activity:bE(o),user:i});return Oc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ac({activity:o,user:i});r.setQueryData(a,Oc(d,u,!0)),setTimeout(()=>{Ah(d.id,"activity")},0)}});return s}function _E({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=jn(a,s);return o&&(o.content=i),s}),onError:n});return r}function kE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),h=ti(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:Ho(p),mutate:Vo(p)},user:h,...p},g=EE({...m,mutationFn:e}),f=_E({...m,mutationFn:t}),b=FE({...m,mutationFn:n}),v=TE({...m,mutationFn:a}),x=SE({...m,mutationFn:i}),k=AE({...m,mutationFn:s}),_=jE({...m,mutationFn:o}),{activities:w,...F}=BE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:x,pin:k,unpin:_},user:h,...F}}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Za({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Za({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function BE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:PE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Ya({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Ya({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>OE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Fh({activity:o,user:r}),s}),onError:n});return a}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Bh({activity:o,user:r}),s}),onError:n});return a}function Oc(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 jn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function OE(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 PE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const ME=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=$m(ro.COMMUNITY_RANKING),d=ie.useIntl(),[h,p]=y.useState("community_feed_live"),[m,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:x,isLoading:k,mutations:{create:_,edit:w,remove:F,like:S,unlike:q,pin:N,unpin:z}}=kE({queryKey:[e,t,"activities",h],queryFns:a,rankingMethod:h});y.useEffect(()=>{u&&g(m.concat(u))},[u]);const[I,A]=y.useState(null),E=()=>{A(f.length),v()};return Th(),b?c.jsx(hn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Wo,{isCard:!0,parentId:t,form:{content:{type:"post",slugs:{}},functions:{create:_,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(en,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:m.map(({id:j,label:R})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${R}`})})),initialValue:h,functions:{onChange:j=>{p(j);const R=m.find(H=>H.id===j);if(!R)return;const W=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"community_sortSuccess"},{order:d.formatMessage({id:`activitiesFeed_rankingMethod_${R.label}`})})}});document.dispatchEvent(W)}},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,R)=>{var $,U,re;const{id:W,own_reactions:H,latest_reactions:G,reaction_counts:ne,mentioned_users:C,total_replies:L}=j,ee=((($=G==null?void 0:G.like)==null?void 0:$.length)||0)>0,B=(((U=H==null?void 0:H.like)==null?void 0:U.length)||0)>0,T=B?H==null?void 0:H.like[0].id:"",O=ee?(re=G==null?void 0:G.like)==null?void 0:re.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Yr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:Kr(j==null?void 0:j.actor),userLiked:B,likes:(ne==null?void 0:ne.like)||0,comments:L||0,peopleWhoLiked:O,mentions:C,pinned:(ne==null?void 0:ne.pin)&&(ne==null?void 0:ne.pin)>0||!1},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>F({activityId:W}),updateContent:(X,{body:ae})=>w({activityId:W,content:ae})},likes:{createLike:()=>S({activityId:W}),deleteLike:()=>q({activityId:W,reactionId:T})},comments:{openComments:()=>null},pins:{createPin:()=>N({activityId:W}),deletePin:()=>z({activityId:W,reactionId:G==null?void 0:G.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:R===I,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})},W)}),!k&&c.jsx(Hr,{hasNextPage:x,loadNextPage:E,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:l})]})},NE={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 IE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Tc({reply:yE(o),user:i});return Pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Tc({reply:o,user:i});r.setQueryData(a,Pc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Ah(d.id,"reply")},0)}});return s}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ga(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Sh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=IE({...d,mutationFn:e}),p=RE({...d,mutationFn:t}),m=$E({...d,mutationFn:n}),g=zE({...d,mutationFn:a}),f=qE({...d,mutationFn:i}),{replies:b,...v}=LE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function $E({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ga(s,o);return l&&Sc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ga(o,l);u&&Sc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function LE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:KE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>VE(a,i)),onError:n});return r}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ga(i,s);return o&&DE({reply:o,user:r}),s}),onError:n});return a}function WE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function UE(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 HE(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 Pc(e,t,n){return t?n!=null&&n.append?UE(e,t,n):HE(e,t,n):WE(e)}function Ga(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function VE(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 KE(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 ZE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ie.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:b},user:v}=Sh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Qs([h]);const[x,k]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&c.jsx(Eh,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var H,G,ne,C,L,ee,B;const{id:w,own_children:F,latest_children:S,children_counts:q,data:{mentioned_users:N}}=_,I=(((H=F==null?void 0:F.like)==null?void 0:H.length)||0)>0?(G=F==null?void 0:F.like)==null?void 0:G.find(T=>{var O;return((O=T==null?void 0:T.user)==null?void 0:O.id)===(v==null?void 0:v.id)}):!1,A=I?I==null?void 0:I.id:"",E=!!I,R=(((ne=S==null?void 0:S.like)==null?void 0:ne.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(T=>{var O,$,U;return{id:(O=T==null?void 0:T.user)==null?void 0:O.id,name:(U=($=T==null?void 0:T.user)==null?void 0:$.data)==null?void 0:U.name}}):!1,W=typeof _.data.content=="string"?(L=_==null?void 0:_.data)==null?void 0:L.content:((B=(ee=_==null?void 0:_.data)==null?void 0:ee.content)==null?void 0:B.text)||"";return c.jsx(Yr,{isCommunity:!0,content:{id:w,type:"reply",body:W,canLike:a,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:Kr(_==null?void 0:_.user),userLiked:E,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(T,{body:O})=>m({replyId:w,content:O})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:A})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},w)}):null})]})};const jh=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{reactions:i,mentions:s,join:o,leave:l},profile:u})=>{const d=ie.useIntl(),{replies:h,fetchNextPage:p,hasNextPage:m,isLoading:g,mutations:{create:f,edit:b,like:v,remove:x,unlike:k},user:_}=Sh({queryKey:[e,t,n,"replies"],queryFns:i}),w=()=>{S(h.length),p()},[F,S]=y.useState(null);return Qs([g]),Th(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(wh,{type:"comment",responses:r,isLoading:g}),c.jsx(Wo,{form:{content:{type:"reply",slugs:{}},functions:{create:(q,{body:N})=>f({activityId:n,content:N}),...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:d.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:o,leave:l,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),h==null?void 0:h.map((q,N)=>{var ee,B,T,O,$,U,re;const{id:z,own_children:I,latest_children:A,children_counts:E,data:{mentioned_users:j}}=q,W=(((ee=I==null?void 0:I.like)==null?void 0:ee.length)||0)>0?(B=I==null?void 0:I.like)==null?void 0:B.find(X=>{var ae;return((ae=X==null?void 0:X.user)==null?void 0:ae.id)===(_==null?void 0:_.id)}):!1,H=W?W==null?void 0:W.id:"",G=!!W,C=(((T=A==null?void 0:A.like)==null?void 0:T.length)||0)>0?(O=A==null?void 0:A.like)==null?void 0:O.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1,L=typeof q.data.content=="string"?($=q==null?void 0:q.data)==null?void 0:$.content:((re=(U=q==null?void 0:q.data)==null?void 0:U.content)==null?void 0:re.text)||"";return c.jsx(Dh,{children:c.jsx(Yr,{isCommunity:!0,content:{id:z,type:"reply",body:L,canLike:a,createdAt:q==null?void 0:q.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:z},slug:z,author:Kr(q==null?void 0:q.user),userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:z}),updateContent:(X,{body:ae})=>b({replyId:z,content:ae})},likes:{createLike:()=>v({replyId:z}),deleteLike:()=>k({replyId:z,reactionId:H})},comments:{},mentions:s},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]},children:c.jsx(ZE,{basePath:e,parentId:t,activityId:n,replyId:z,isMember:a,functions:{...i,...s}}),styling:{showShareLinkButton:!0},setFocus:N===F},z)},z)}),!g&&c.jsx(Hr,{hasNextPage:m,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:u})]})};function YE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.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 GE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function QE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=YE({...d,mutationFn:t}),p=JE({...d,mutationFn:n}),m=XE({...d,mutationFn:r}),g=e_({...d,mutationFn:a}),f=t_({...d,mutationFn:i}),{activity:b,...v}=GE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:g,unpin:f},user:l,...v}}function JE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Za({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Za({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function XE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Fh({activity:s,user:r}),s)),onError:n});return a}function e_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ya({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ya({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function t_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Bh({activity:s,user:r}),s))),onError:n});return a}const n_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:h})=>{var E,j,R,W,H,G;const p=ie.useIntl(),{activity:m,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:x,pin:k,unpin:_}}=QE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(At,{style:{height:"400px"}});if(g||!m)return c.jsx(hn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:F,mentioned_users:S}=m,q=(((E=F==null?void 0:F.like)==null?void 0:E.length)||0)>0,N=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,z=N?w==null?void 0:w.like[0].id:"",I=q?(R=F==null?void 0:F.like)==null?void 0:R.map(ne=>{var C,L,ee;return{id:(C=ne==null?void 0:ne.user)==null?void 0:C.id,name:(ee=(L=ne==null?void 0:ne.user)==null?void 0:L.data)==null?void 0:ee.name}}):!1,A=m==null?void 0:m.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Yr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:m==null?void 0:m.title,body:m==null?void 0:m.content,canLike:r,createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:Kr(A),userLiked:N,likes:((W=m==null?void 0:m.reaction_counts)==null?void 0:W.like)||0,comments:(m==null?void 0:m.total_replies)||0,peopleWhoLiked:I,mentions:S,pinned:((H=m==null?void 0:m.reaction_counts)==null?void 0:H.pin)&&((G=m==null?void 0:m.reaction_counts)==null?void 0:G.pin)>0||!1},originalAuthorId:A==null?void 0:A.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(ne,{title:C,body:L})=>b({title:C,content:L})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:z})},comments:{openComments:()=>{}},pins:{createPin:()=>k({activityId:n}),deletePin:()=>{var ne;return _({activityId:n,reactionId:(ne=F==null?void 0:F.pin)==null?void 0:ne[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},n),c.jsx(jh,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(m==null?void 0:m.total_replies)||0,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:h})]})};const Oh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(pn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(Zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const x=g||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(k=>({...k,mentions:x}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},r_=Object.freeze(Object.defineProperty({__proto__:null,default:Oh},Symbol.toStringTag,{value:"Module"}));const a_=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=ie.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(pn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:c.jsx(mh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const fi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(td("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(pn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ph,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},i_=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));const s_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(mn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(pn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Fn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const o_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),children:[c.jsx(qt,{className:"testimonial",children:n}),r?c.jsx(Qt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),u_=y.memo(o_);const l_=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Pt,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const hi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const c_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(ur,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const d_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],f_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:x}=t[b];if(x&&d_.includes(x.toLowerCase()))return;p[b]={text:v,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(bn,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?c.jsx(Fn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(x,{key:b,className:b},v)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(ur,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},h_=y.memo(f_);const m_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(bn,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const p_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Fn,{children:n}):n;return c.jsxs(bn,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ur,{image:{...r,description:""}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},g_=y.memo(p_);const v_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),b_=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&bs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Xs(d)});if(o)return c.jsx(Gt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&bs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},y_={title:66,text:3e3,secondaryText:1e3,partner:34},Qa={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},D_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=Qa[p])!=null&&f.gtmEvent&&(m=Qa[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async k=>{if(k.preventDefault(),k.stopPropagation(),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function C_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Gt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const Zo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var I,A;const u=ie.useIntl(),d=y.useContext(it),h=!!(d!=null&&d.id),p=y.useRef(null),[m,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(E=>{g({data:E,isLoading:!1})}).catch(()=>g(E=>({...E,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:b}=m;if(b||!f)return c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Qa[v])return c.jsx(At,{element:"li",className:"card-wrapper"});const{basePath:x="",className:k,length:_,gtmEvent:w}=Qa[v];let F=f.slug?`${x}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(F=f.slug);const S=E=>{F&&(E.preventDefault(),E.stopPropagation(),window.location.href=F)},q={...y_,..._};let N={className:"card"},z={};return F&&(z={href:F,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&(z.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(N={...N,tabIndex:"0"},(I=p==null?void 0:p.current)==null||I.focus(),(A=p==null?void 0:p.current)==null||A.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",k,t,{"has-link":F,"no-link":!F,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:p,children:[c.jsx(rd,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&im(f==null?void 0:f.createdAt,60)&&c.jsx(Gt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Gt,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Qc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Gt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(ur,{image:{...f.banner,description:""}})]}):k==="people"?c.jsx(mn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(so,{contributors:{data:f.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Xn(f.partner[0],q.partner)}),["title","text","secondaryText"].map(E=>{const j=f[E];if(!j)return null;const R=Vc(E),W={key:E,className:R,"data-testid":R},H={wrapper:"p",forceWrapper:!0,forceInline:!0},G=Xn(j,q[E]);return["title","text"].includes(E)&&F?(H.wrapper="a",c.jsx("p",{...W,children:c.jsx(qt,{options:H,...z,children:G})})):c.jsx(qt,{options:H,...W,children:G})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(C_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(b_,{type:k||"",data:f}),c.jsx(D_,{data:f,cta:i,link:F||"",gtmContext:s})]})})};const Ph=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Zo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),x_=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},w_=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const hs={fourCards:1024,threeCards:769,twoCards:480};let ba=null,ms=null;const E_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[x,k]=y.useState(""),_=t.length,w=Math.ceil(_/p),F=y.useRef(null),S=Pn(!0,!0,F==null?void 0:F.current);y.useEffect(()=>{let E=1;S&&(S>=hs.fourCards?E=4:S>=hs.threeCards?E=3:S>=hs.twoCards&&(E=2),E>_&&(E=_)),h(j=>({...j,cardsPerPage:E,isLoading:!1}))},[S,_]);const q=(E="next")=>{ms&&clearTimeout(ms);let j=b;if(typeof E=="string")if(E==="next")if(b<w-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=E;k(""),f(W=>({...W,currentPage:j,loadedPages:[...new Set([...v,j])]}));const R=()=>{const W=j*d.cardsPerPage,H=W+d.cardsPerPage;return t.slice(W,H).length};ms=setTimeout(()=>{k(l.formatMessage({id:`${u}ariaLive${typeof E=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof E=="string"?E:"next"}`}),slide:typeof E=="string"?1:E+1,count:R()}))},500)},N=E=>{ba=E.touches[0].clientX},z=E=>{if(ba===null)return;const j=E.touches[0].clientX,R=ba-j;R>5?q("next"):R<-5&&q("previous"),ba=null},I={"--width":`${S||0}px`,"--total-cards":_,"--cards-per-page":p,"--page":b};if(m)return c.jsx(to,{layout:`carousel${a?"-with-title":""}`});const A=(E,j)=>{var W;let R=null;return(W=E==null?void 0:E.sys)!=null&&W.id?R=`card-${E.sys.id}`:E!=null&&E.slug?R=`card-${E.slug}`:[n[j],E.contentType].includes("customCard")&&(R=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${j}`),R};return c.jsxs("section",{ref:F,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(w_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:N,onTouchMove:z,style:I,"data-testid":"carousel-list",children:t.map((E,j)=>{let R=A(E,j);return R&&x_(j,p,b,v)?c.jsx(Zo,{id:R,card:{...E,contentType:n[j]},buildCardData:r,gtmContext:s,...o},R):(R=R||`${e}-card-${j}`,c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},R))})}),w<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(w)].map((E,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:R=>{R.preventDefault(),R.stopPropagation(),q(j)},children:c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:w})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=w-1})})]}),c.jsx(Ne,{"aria-live":x===""?"off":"polite",showOnFocus:!1,children:x})]})]})},__=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(to,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Ut,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(E_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Ut,{})]},`carousel-${d}`)});const k_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(hi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(eo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Mh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Nh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=Xa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Zc(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(hi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const F_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ie.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(ei,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(hi,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:x,isIntroduction:k,optional:_,slug:w,subsectionId:F,title:S,type:q})=>{const N=a&&t||k,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:V({article:b===Dr.ARTICLE,discussion:b===Dr.DISCUSSION,quiz:b===Dr.QUIZ,completed:g&&b===Dr.ARTICLE,locked:!N}),...z,children:c.jsx(fn,{href:N?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Kc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Mh,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",c.jsx(Nh,{completionTime:f,icon:v,optional:_,type:q,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const B_=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},A_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Mc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ya="notFoundError_",T_=()=>{const e=ie.useIntl(),t=[];return Mc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ya}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(yh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(bn,{children:[c.jsx(Ph,{cards:Mc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ya}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ya}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ya}text`})})]})};exports.ASSETS_BUCKET=Wt;exports.ActivitiesFeed=ME;exports.ActivitySection=n_;exports.AddPost=Wo;exports.BadgesContext=no;exports.BadgesProvider=dd;exports.Banner=c_;exports.BannerSection=h_;exports.Breadcrumbs=Vp;exports.Buckets=Cm;exports.Button=Ee;exports.ButtonWrapper=or;exports.COURSE_CONTENT_TYPES=Dr;exports.CacheProvider=fd;exports.Card=Zo;exports.CardBlock=Ph;exports.Carousel=__;exports.CharacterLimit=ho;exports.CollapsibleSection=ei;exports.Columns=Od;exports.CommunityDetails=Hp;exports.ContactFooter=Zw;exports.ContactForm=hh;exports.ContentTypeLabel=rd;exports.Contributors=so;exports.ConversationContext=di;exports.CookieBanner=bh;exports.CourseProgression=k_;exports.CourseStructure=F_;exports.CustomContentBanner=m_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Sr;exports.Directory=s_;exports.DiscussionConversation=Dh;exports.DiscussionForm=Zr;exports.DiscussionFormCard=xh;exports.DiscussionFormModal=Oh;exports.DiscussionLikes=Ch;exports.DiscussionPost=Yr;exports.DiscussionThread=Eh;exports.Divider=Ut;exports.DownloadSection=Uw;exports.EMAILS=Un;exports.EditSection=Vw;exports.EmailHelperTextBox=Md;exports.EmptyStateBox=hn;exports.EnrichedUrl=Kp;exports.FeatureFlags=ro;exports.Filters=Zp;exports.FlagsProvider=md;exports.Footer=Lo;exports.Form=en;exports.Formatting=Z;exports.Fragment=_t;exports.FullWidthSection=bn;exports.GET_STREAM_USER_PREFIX=vs;exports.GlobalProviders=Lm;exports.Header=zo;exports.HelperTextBox=id;exports.HiddenFromScreenReaders=Ja;exports.HideShowTextBox=sd;exports.HighlightSection=g_;exports.HighlightedTextBox=Pt;exports.INVALID_TOKEN=Yc;exports.IconBulletedList=Em;exports.ImageContainer=vm;exports.IntlProvider=pd;exports.InviteForm=mh;exports.InviteModal=a_;exports.JoinButton=co;exports.LanguageContext=ao;exports.LanguageSwitcher=Gp;exports.LessonName=Mh;exports.LessonType=Nh;exports.Link=fn;exports.LoadMore=Hr;exports.LoadingBlock=Mm;exports.LoadingPlaceholder=At;exports.LoadingState=to;exports.Logo=fo;exports.LogoSection=Kw;exports.MENTION_REGEX=Gc;exports.MarkCompleteButton=B_;exports.MarkdownText=Fn;exports.MarketingBlock=v_;exports.Marks=zt;exports.Member=Qt;exports.MembersList=eE;exports.Modal=oo;exports.MoreMenu=Sd;exports.NUMBER_OF_COUNTRIES=nm;exports.NUMBER_OF_USERS=tm;exports.NavigationMenu=jd;exports.NotFoundError=T_;exports.Overlay=pn;exports.OverlayContext=io;exports.OverlayProvider=bd;exports.PageHeading=od;exports.PageLayout=yh;exports.PasswordForm=Iw;exports.PasswordRules=Ld;exports.Pill=Gt;exports.Popover=nd;exports.Portal=Ur;exports.ProfileForm=ph;exports.ProfileImageChange=fh;exports.ProfileModal=fi;exports.ProfileModalLauncher=Uo;exports.ProfilePicture=mn;exports.ProgressBar=eo;exports.ProgressTracker=ym;exports.Rating=pg;exports.RepliesFeed=jh;exports.ResponsesHeading=wh;exports.ResponsiveImage=ur;exports.ReturnToNavButton=Dm;exports.RichTextEditor=dh;exports.SearchForm=gh;exports.ShareLinks=ng;exports.SignupForm=Ww;exports.Span=Cs;exports.StatusBanner=Or;exports.TableOfContents=l_;exports.Tabs=rg;exports.Tags=Xw;exports.TestimonialBlock=u_;exports.TimeToComplete=hi;exports.Toggle=Nw;exports.Tooltip=Mn;exports.TopLevelPage=Yw;exports.UUID_V4_REGEX=jr;exports.UserContext=it;exports.UserProvider=gd;exports.VisuallyHidden=Ne;exports.addAriaProps=Td;exports.basicReducer=Wr;exports.camelCaseToDashCase=Vc;exports.checkIntlPathExists=Xa;exports.generateConditions=Ta;exports.generateCssIcon=rm;exports.getAuthorData=Kr;exports.getCharacterLimitProps=Pd;exports.getLongDate=Xs;exports.getMember=ni;exports.getPostBody=qo;exports.getShortDate=Qc;exports.getValueLength=ri;exports.headerData=qr;exports.mapGetStreamData=A_;exports.pageReady=Jc;exports.passwordValidator=ys;exports.repliesFeedMock=NE;exports.supportedLanguages=xa;exports.toCamelCase=Kc;exports.toCapitalisedCase=em;exports.toSentenceCase=Zc;exports.transformSlugs=Ys;exports.useBadges=cd;exports.useCurrentPath=Lc;exports.useEffectAfterMount=er;exports.useElementWidth=Pn;exports.useOverlay=vd;exports.useScrollListener=Wc;exports.useScrollToHash=Qs;exports.useTooltips=Js;exports.useUser=ti;
165
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Xc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const uE=3e3,lE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Ka,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},uE)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Mn,{className:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},It="discussion_",cE=195;let va=null;const Yr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,styling:{showShareLinkButton:m=!1,showMoreMenuButton:g=!0}={},setFocus:f=!1,isCommunity:b=!1,badges:v})=>{var Ue,Be,Te,De,Re,ze,Y,oe;const x=ie.useIntl(),k=y.useContext(it),_=y.useContext(di),{createContent:w=async()=>{},deleteContent:F=async()=>{},updateContent:S=async()=>{}}=o.content||{},{createLike:q=()=>{},deleteLike:N=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:I=()=>Promise.resolve([]),clickMentionFallback:A=()=>{}}=o.mentions||{},{author:E,canLike:j,createdAt:R,id:W,likes:H=0,userLiked:G,comments:ne=0,mentions:C}=t,L=k&&k.id&&typeof E!="string"&&E.id&&E.id===k.id||!1,ee=typeof j=="boolean"?j:!0,B=L&&(!t.createdAt||am(t.createdAt,10,"seconds")),T=y.useRef(null),[O,$]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",memberCustomMessage:(t==null?void 0:t.memberCustomMessage)||""}),[U,re]=y.useState(!1),[X,ae]=y.useState(B?"highlighted":"default"),[he,Q]=y.useState("");y.useEffect(()=>{const le=T.current;if(!(!le||X==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.addEventListener("transitionend",pe),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.removeEventListener("transitionend",pe)}},[]),y.useEffect(()=>{$({...O,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const ce=await qo(O.body,p,C,I);$({...O,postBody:ce})})()},[O.body,C]);const ve=()=>{setTimeout(()=>{ae("fading")},1e3)},pe=({propertyName:le})=>{le==="background-color"&&ae(ce=>(ce==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),T.current&&T.current.removeEventListener("transitionend",pe)),ce==="fading"?"default":ce))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||O.postBody===""&&t.title==="")return c.jsx(At,{className:"discussion-card"});const _e=async({title:le,body:ce})=>{le||(le=""),ce||(ce=""),Q("");try{if(!ps(le,O.title)||!ps(ce,O.body)){const Ce=t.type==="question"?{title:ce}:{title:le,body:ce};await S(Ys(t.slugs),Ce)}$({...O,title:le,body:ce,isEditing:!1,didEdit:!0})}catch{Q(`${It}form_error`)}},Fe=()=>{if(_&&_.updateConversation){const le={showForm:!0},ce=t.author;ce&&ce.id&&(b&&(le.prepopulateForm=`@{{${ce.id}}}`),le.mentionData={id:ce.id,name:ce.name}),_.updateConversation(le)}setTimeout(()=>{var Ye,rt,xt;const ce=`reply-form-${(t.type==="answer"?t.slug:((Ye=t.slugs)==null?void 0:Ye.reply)||((rt=t.slugs)==null?void 0:rt.answer)||((xt=t.slugs)==null?void 0:xt.question)||"").toLowerCase().slice(-15)}`,Ce=document.getElementById(ce),Ze=document.getElementById(`${ce}-input`);Ze&&Ze.focus(),Ce&&Ce.scrollIntoView({behavior:"smooth"})},0)},Se=async()=>{re(!1);try{await F(Ys(t.slugs))}catch{Q("delete-error")}},We=[{text:x.formatMessage({id:`${It}moreMenu_report`}),onClick:le=>{le.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(x.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(x.formatMessage({id:`${It}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&&L&&We.push({text:x.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>$({...O,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:x.formatMessage({id:`${It}moreMenu_delete`}),onClick:le=>{le.preventDefault(),le.stopPropagation(),re(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Td(`delete-${t.slug}-modal`,U)}),r&&o.pins&&We.push({text:x.formatMessage({id:`${It}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),f&&((Ue=T==null?void 0:T.current)==null||Ue.focus(),(Be=T==null?void 0:T.current)==null||Be.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[X]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!O.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:T,tabIndex:f?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:le=>{if(!l.post||O.isEditing)return;le.preventDefault(),le.stopPropagation(),va&&clearTimeout(va),va=setTimeout(()=>{window.location.href=l.post},150);const ce=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:va}});document.dispatchEvent(ce)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:O.isEditing,"has-link":l.post&&!O.isEditing}),children:[!O.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Qt,{member:E,additionalContent:{createdAt:R,didEdit:O.didEdit,customMessage:O.memberCustomMessage},className:typeof E!="string"&&E.id===i?"highlighted":"",styling:{additionalContentNewLine:!!O.memberCustomMessage},gtmContext:d,gtmType:"profile-click",badges:v}),t.pinned&&c.jsx(Gt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ne,{children:"Pinned Post"})})]}),O.isEditing?c.jsx(Zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:O.title!==""?{text:O.title}:!1,isEditing:{text:O.body},isPrepopulated:!1},isCommunity:b,maxLength:t.type==="question"?250:5e4,forceShow:{error:he!==""&&he!=="delete-error"?x.formatMessage({id:he},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:_e,handleCancel:()=>{Q(""),$({...O,isEditing:!1})},listMembers:I,clickMentionFallback:A},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),O.postBody.length>cE?c.jsx(sd,{text:O.postBody,markdownOptions:{overrides:{a:Cs,blockquote:{component:cs}}}}):c.jsx(Fn,{options:{overrides:{a:Cs,blockquote:{component:cs}}},children:O.postBody})]}):c.jsxs(c.Fragment,{children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),c.jsx(Fn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:cs}}},children:O.postBody})]}),!O.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:V("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(Ch,{element:"li",likes:H,isShort:!1,userLiked:G,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ee,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:q,deleteLike:N}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ka,{onClick:le=>{le.preventDefault(),le.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:x.formatMessage({id:`${It}comments_screenReader`},{count:ne}),children:x.formatMessage({id:`${It}comments`},{count:ne})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ka,{styling:{muted:!0},onClick:Fe,icon:{icon:"speech-bubble_square"},children:x.formatMessage({id:`${It}reply`})})}),m&&c.jsx(lE,{url:(Te=t.slugs)!=null&&Te.reply?`${window.location.origin}${(De=t.slugs)==null?void 0:De.question}/${(Re=t.slugs)==null?void 0:Re.answer}#${(ze=t.slugs)==null?void 0:ze.reply}`:`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(oe=t.slugs)==null?void 0:oe.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),g&&c.jsx(Sd,{element:"li",id:`more-${t.slug}`,options:We})]})]}),h,c.jsx(pn,{id:`delete-${t.slug}-modal`,isOpen:U,functions:{onOpen:()=>{},onClose:()=>re(!1)},forceShow:{error:he==="delete-error"?x.formatMessage({id:"discussion_delete_error"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:x.formatMessage({id:"discussion_delete_title"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>re(!1),children:x.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Se,children:x.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:le=>c.jsx("p",{children:le}),action:x.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const dE=y.lazy(()=>Promise.resolve().then(()=>r_)),fE=65,xh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=ni(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||td("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await qo(p.title||p.body||"",fE,p.mentions);m(x=>({...x,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const _=x.target.closest("a");v=_&&_.getAttribute("href")}h(x=>({...x,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(mn,{name:l.name,src:l.image,alt:""}),c.jsx(Fn,{className:V("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:_t,blockquote:_t,br:_t,em:_t,li:_t,ol:_t,p:_t,s:_t,span:_t,strong:_t,ul:_t}},children:f})]}),c.jsxs(Ur,{children:[c.jsx(dE,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(pn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},hE=y.lazy(()=>Promise.resolve().then(()=>aE)),Wo=({isCard:e=!1,form:t,parentId:n,membershipRequiredToPost:{isMember:r,required:a,join:i,leave:s,notMemberStateText:o}})=>{if(a&&!r)return c.jsx(hn,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(co,{isShort:!0,functions:{join:i,leave:s}})}});const{content:l,functions:u,meta:d,...h}=t,p={content:{type:(l==null?void 0:l.type)||"reply",slugs:(l==null?void 0:l.slugs)||{}},functions:{...u,create:(u==null?void 0:u.create)||(()=>{})},parentId:n,meta:{...d,isEditing:(d==null?void 0:d.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...h,id:`add-post-${h.id||""}`};return e?c.jsx(xh,{form:p}):c.jsx(hE,{...p})},Uo=({form:e})=>{const t=y.useContext(it),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{hm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(fi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ds="discussion_responses_",wh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ds}title`},{action:r.formatMessage({id:`${ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:St(r.formatMessage,`${ds}empty`,e,e)})]})};const Eh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(di),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:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Hr,{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(Zr,{...r})]})},mE="post",pE="reply",_h="00000000-0000-0000-0000-000000000000";function Ho({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Vo({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 gE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function kh(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 bE({title:e,content:t}){return{title:e,content:t,id:_h,time:new Date().toISOString(),verb:mE}}function Ac({activity:e,user:t}){return{...e,actor:kh(t),...gE()}}function Za({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 Fh({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 Ya({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Bh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function yE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:_h,kind:pE,parent:t||""}}function Tc({reply:e,user:t}){const n=kh(t);return{...e,user_id:n.id,user:n,...vE()}}function Sc({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 DE({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 Ah=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let jc,fs=0;const Th=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(jc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),fs=0;return}fs++,!(fs>10)&&(jc=setTimeout(()=>{e(t)},50))}},ir=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}),Ht=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}),Ko=Object.freeze({actor:`SU:${ir.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"}),CE=Object.freeze({actor:`SU:${Ht.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"}),xE=Object.freeze({actor:`SU:${ir.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"}),wE=Object.freeze({actor:`SU:${Ht.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:Ko.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Ko.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ko.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:CE.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xE.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function EE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ac({activity:bE(o),user:i});return Oc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ac({activity:o,user:i});r.setQueryData(a,Oc(d,u,!0)),setTimeout(()=>{Ah(d.id,"activity")},0)}});return s}function _E({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=jn(a,s);return o&&(o.content=i),s}),onError:n});return r}function kE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),h=ti(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:Ho(p),mutate:Vo(p)},user:h,...p},g=EE({...m,mutationFn:e}),f=_E({...m,mutationFn:t}),b=FE({...m,mutationFn:n}),v=TE({...m,mutationFn:a}),x=SE({...m,mutationFn:i}),k=AE({...m,mutationFn:s}),_=jE({...m,mutationFn:o}),{activities:w,...F}=BE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:x,pin:k,unpin:_},user:h,...F}}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Za({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Za({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function BE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:PE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Ya({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Ya({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>OE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Fh({activity:o,user:r}),s}),onError:n});return a}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Bh({activity:o,user:r}),s}),onError:n});return a}function Oc(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 jn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function OE(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 PE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const ME=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=$m(ro.COMMUNITY_RANKING),d=ie.useIntl(),[h,p]=y.useState("community_feed_live"),[m,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:x,isLoading:k,mutations:{create:_,edit:w,remove:F,like:S,unlike:q,pin:N,unpin:z}}=kE({queryKey:[e,t,"activities",h],queryFns:a,rankingMethod:h});y.useEffect(()=>{u&&g(m.concat(u))},[u]);const[I,A]=y.useState(null),E=()=>{A(f.length),v()};return Th(),b?c.jsx(hn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Wo,{isCard:!0,parentId:t,form:{content:{type:"post",slugs:{}},functions:{create:_,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(en,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:m.map(({id:j,label:R})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${R}`})})),initialValue:h,functions:{onChange:j=>{p(j);const R=m.find(H=>H.id===j);if(!R)return;const W=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"community_sortSuccess"},{order:d.formatMessage({id:`activitiesFeed_rankingMethod_${R.label}`})})}});document.dispatchEvent(W)}},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,R)=>{var $,U,re;const{id:W,own_reactions:H,latest_reactions:G,reaction_counts:ne,mentioned_users:C,total_replies:L}=j,ee=((($=G==null?void 0:G.like)==null?void 0:$.length)||0)>0,B=(((U=H==null?void 0:H.like)==null?void 0:U.length)||0)>0,T=B?H==null?void 0:H.like[0].id:"",O=ee?(re=G==null?void 0:G.like)==null?void 0:re.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Yr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:Kr(j==null?void 0:j.actor),userLiked:B,likes:(ne==null?void 0:ne.like)||0,comments:L||0,peopleWhoLiked:O,mentions:C,pinned:(ne==null?void 0:ne.pin)&&(ne==null?void 0:ne.pin)>0||!1},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>F({activityId:W}),updateContent:(X,{body:ae})=>w({activityId:W,content:ae})},likes:{createLike:()=>S({activityId:W}),deleteLike:()=>q({activityId:W,reactionId:T})},comments:{openComments:()=>null},pins:{createPin:()=>N({activityId:W}),deletePin:()=>z({activityId:W,reactionId:G==null?void 0:G.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:R===I,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})},W)}),!k&&c.jsx(Hr,{hasNextPage:x,loadNextPage:E,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:l})]})},NE={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 IE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Tc({reply:yE(o),user:i});return Pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Tc({reply:o,user:i});r.setQueryData(a,Pc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Ah(d.id,"reply")},0)}});return s}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ga(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Sh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=IE({...d,mutationFn:e}),p=RE({...d,mutationFn:t}),m=$E({...d,mutationFn:n}),g=zE({...d,mutationFn:a}),f=qE({...d,mutationFn:i}),{replies:b,...v}=LE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function $E({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ga(s,o);return l&&Sc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ga(o,l);u&&Sc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function LE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:KE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>VE(a,i)),onError:n});return r}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ga(i,s);return o&&DE({reply:o,user:r}),s}),onError:n});return a}function WE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function UE(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 HE(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 Pc(e,t,n){return t?n!=null&&n.append?UE(e,t,n):HE(e,t,n):WE(e)}function Ga(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function VE(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 KE(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 ZE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ie.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:b},user:v}=Sh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Qs([h]);const[x,k]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&c.jsx(Eh,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var H,G,ne,C,L,ee,B;const{id:w,own_children:F,latest_children:S,children_counts:q,data:{mentioned_users:N}}=_,I=(((H=F==null?void 0:F.like)==null?void 0:H.length)||0)>0?(G=F==null?void 0:F.like)==null?void 0:G.find(T=>{var O;return((O=T==null?void 0:T.user)==null?void 0:O.id)===(v==null?void 0:v.id)}):!1,A=I?I==null?void 0:I.id:"",E=!!I,R=(((ne=S==null?void 0:S.like)==null?void 0:ne.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(T=>{var O,$,U;return{id:(O=T==null?void 0:T.user)==null?void 0:O.id,name:(U=($=T==null?void 0:T.user)==null?void 0:$.data)==null?void 0:U.name}}):!1,W=typeof _.data.content=="string"?(L=_==null?void 0:_.data)==null?void 0:L.content:((B=(ee=_==null?void 0:_.data)==null?void 0:ee.content)==null?void 0:B.text)||"";return c.jsx(Yr,{isCommunity:!0,content:{id:w,type:"reply",body:W,canLike:a,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:Kr(_==null?void 0:_.user),userLiked:E,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(T,{body:O})=>m({replyId:w,content:O})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:A})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},w)}):null})]})};const jh=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{reactions:i,mentions:s,join:o,leave:l},profile:u})=>{const d=ie.useIntl(),{replies:h,fetchNextPage:p,hasNextPage:m,isLoading:g,mutations:{create:f,edit:b,like:v,remove:x,unlike:k},user:_}=Sh({queryKey:[e,t,n,"replies"],queryFns:i}),w=()=>{S(h.length),p()},[F,S]=y.useState(null);return Qs([g]),Th(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(wh,{type:"comment",responses:r,isLoading:g}),c.jsx(Wo,{form:{content:{type:"reply",slugs:{}},functions:{create:(q,{body:N})=>f({activityId:n,content:N}),...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:d.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:o,leave:l,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),h==null?void 0:h.map((q,N)=>{var ee,B,T,O,$,U,re;const{id:z,own_children:I,latest_children:A,children_counts:E,data:{mentioned_users:j}}=q,W=(((ee=I==null?void 0:I.like)==null?void 0:ee.length)||0)>0?(B=I==null?void 0:I.like)==null?void 0:B.find(X=>{var ae;return((ae=X==null?void 0:X.user)==null?void 0:ae.id)===(_==null?void 0:_.id)}):!1,H=W?W==null?void 0:W.id:"",G=!!W,C=(((T=A==null?void 0:A.like)==null?void 0:T.length)||0)>0?(O=A==null?void 0:A.like)==null?void 0:O.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1,L=typeof q.data.content=="string"?($=q==null?void 0:q.data)==null?void 0:$.content:((re=(U=q==null?void 0:q.data)==null?void 0:U.content)==null?void 0:re.text)||"";return c.jsx(Dh,{children:c.jsx(Yr,{isCommunity:!0,content:{id:z,type:"reply",body:L,canLike:a,createdAt:q==null?void 0:q.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:z},slug:z,author:Kr(q==null?void 0:q.user),userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:z}),updateContent:(X,{body:ae})=>b({replyId:z,content:ae})},likes:{createLike:()=>v({replyId:z}),deleteLike:()=>k({replyId:z,reactionId:H})},comments:{},mentions:s},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]},children:c.jsx(ZE,{basePath:e,parentId:t,activityId:n,replyId:z,isMember:a,functions:{...i,...s}}),styling:{showShareLinkButton:!0},setFocus:N===F},z)},z)}),!g&&c.jsx(Hr,{hasNextPage:m,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:u})]})};function YE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.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 GE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function QE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=YE({...d,mutationFn:t}),p=JE({...d,mutationFn:n}),m=XE({...d,mutationFn:r}),g=e_({...d,mutationFn:a}),f=t_({...d,mutationFn:i}),{activity:b,...v}=GE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:g,unpin:f},user:l,...v}}function JE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Za({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Za({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function XE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Fh({activity:s,user:r}),s)),onError:n});return a}function e_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ya({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ya({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function t_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Bh({activity:s,user:r}),s))),onError:n});return a}const n_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:h})=>{var E,j,R,W,H,G;const p=ie.useIntl(),{activity:m,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:x,pin:k,unpin:_}}=QE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(At,{style:{height:"400px"}});if(g||!m)return c.jsx(hn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:F,mentioned_users:S}=m,q=(((E=F==null?void 0:F.like)==null?void 0:E.length)||0)>0,N=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,z=N?w==null?void 0:w.like[0].id:"",I=q?(R=F==null?void 0:F.like)==null?void 0:R.map(ne=>{var C,L,ee;return{id:(C=ne==null?void 0:ne.user)==null?void 0:C.id,name:(ee=(L=ne==null?void 0:ne.user)==null?void 0:L.data)==null?void 0:ee.name}}):!1,A=m==null?void 0:m.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Yr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:m==null?void 0:m.title,body:m==null?void 0:m.content,canLike:r,createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:Kr(A),userLiked:N,likes:((W=m==null?void 0:m.reaction_counts)==null?void 0:W.like)||0,comments:(m==null?void 0:m.total_replies)||0,peopleWhoLiked:I,mentions:S,pinned:((H=m==null?void 0:m.reaction_counts)==null?void 0:H.pin)&&((G=m==null?void 0:m.reaction_counts)==null?void 0:G.pin)>0||!1},originalAuthorId:A==null?void 0:A.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(ne,{title:C,body:L})=>b({title:C,content:L})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:z})},comments:{openComments:()=>{}},pins:{createPin:()=>k({activityId:n}),deletePin:()=>{var ne;return _({activityId:n,reactionId:(ne=F==null?void 0:F.pin)==null?void 0:ne[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},n),c.jsx(jh,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(m==null?void 0:m.total_replies)||0,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:h})]})};const Oh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(pn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(Zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const x=g||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(k=>({...k,mentions:x}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},r_=Object.freeze(Object.defineProperty({__proto__:null,default:Oh},Symbol.toStringTag,{value:"Module"}));const a_=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=ie.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(pn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:c.jsx(mh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const fi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(td("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(pn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ph,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},i_=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));const s_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(mn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(pn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Fn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const o_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),children:[c.jsx(qt,{className:"testimonial",children:n}),r?c.jsx(Qt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),u_=y.memo(o_);const l_=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Pt,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const hi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const c_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(ur,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const d_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],f_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:x}=t[b];if(x&&d_.includes(x.toLowerCase()))return;p[b]={text:v,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(bn,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?c.jsx(Fn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(x,{key:b,className:b},v)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(ur,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},h_=y.memo(f_);const m_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(bn,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const p_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Fn,{children:n}):n;return c.jsxs(bn,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ur,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},g_=y.memo(p_);const v_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),b_=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&bs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Xs(d)});if(o)return c.jsx(Gt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&bs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},y_={title:66,text:3e3,secondaryText:1e3,partner:34},Qa={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},D_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=Qa[p])!=null&&f.gtmEvent&&(m=Qa[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async k=>{if(k.preventDefault(),k.stopPropagation(),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function C_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Gt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const Zo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var I,A;const u=ie.useIntl(),d=y.useContext(it),h=!!(d!=null&&d.id),p=y.useRef(null),[m,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(E=>{g({data:E,isLoading:!1})}).catch(()=>g(E=>({...E,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:b}=m;if(b||!f)return c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Qa[v])return c.jsx(At,{element:"li",className:"card-wrapper"});const{basePath:x="",className:k,length:_,gtmEvent:w}=Qa[v];let F=f.slug?`${x}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(F=f.slug);const S=E=>{F&&(E.preventDefault(),E.stopPropagation(),window.location.href=F)},q={...y_,..._};let N={className:"card"},z={};return F&&(z={href:F,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&(z.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(N={...N,tabIndex:"0"},(I=p==null?void 0:p.current)==null||I.focus(),(A=p==null?void 0:p.current)==null||A.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",k,t,{"has-link":F,"no-link":!F,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:p,children:[c.jsx(rd,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&im(f==null?void 0:f.createdAt,60)&&c.jsx(Gt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Gt,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Qc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Gt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(ur,{image:{...f.banner,description:""}})]}):k==="people"?c.jsx(mn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(so,{contributors:{data:f.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Xn(f.partner[0],q.partner)}),["title","text","secondaryText"].map(E=>{const j=f[E];if(!j)return null;const R=Vc(E),W={key:E,className:R,"data-testid":R},H={wrapper:"p",forceWrapper:!0,forceInline:!0},G=Xn(j,q[E]);return["title","text"].includes(E)&&F?(H.wrapper="a",c.jsx("p",{...W,children:c.jsx(qt,{options:H,...z,children:G})})):c.jsx(qt,{options:H,...W,children:G})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(C_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(b_,{type:k||"",data:f}),c.jsx(D_,{data:f,cta:i,link:F||"",gtmContext:s})]})})};const Ph=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Zo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),x_=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},w_=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const hs={fourCards:1024,threeCards:769,twoCards:480};let ba=null,ms=null;const E_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[x,k]=y.useState(""),_=t.length,w=Math.ceil(_/p),F=y.useRef(null),S=Pn(!0,!0,F==null?void 0:F.current);y.useEffect(()=>{let E=1;S&&(S>=hs.fourCards?E=4:S>=hs.threeCards?E=3:S>=hs.twoCards&&(E=2),E>_&&(E=_)),h(j=>({...j,cardsPerPage:E,isLoading:!1}))},[S,_]);const q=(E="next")=>{ms&&clearTimeout(ms);let j=b;if(typeof E=="string")if(E==="next")if(b<w-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=E;k(""),f(W=>({...W,currentPage:j,loadedPages:[...new Set([...v,j])]}));const R=()=>{const W=j*d.cardsPerPage,H=W+d.cardsPerPage;return t.slice(W,H).length};ms=setTimeout(()=>{k(l.formatMessage({id:`${u}ariaLive${typeof E=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof E=="string"?E:"next"}`}),slide:typeof E=="string"?1:E+1,count:R()}))},500)},N=E=>{ba=E.touches[0].clientX},z=E=>{if(ba===null)return;const j=E.touches[0].clientX,R=ba-j;R>5?q("next"):R<-5&&q("previous"),ba=null},I={"--width":`${S||0}px`,"--total-cards":_,"--cards-per-page":p,"--page":b};if(m)return c.jsx(to,{layout:`carousel${a?"-with-title":""}`});const A=(E,j)=>{var W;let R=null;return(W=E==null?void 0:E.sys)!=null&&W.id?R=`card-${E.sys.id}`:E!=null&&E.slug?R=`card-${E.slug}`:[n[j],E.contentType].includes("customCard")&&(R=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${j}`),R};return c.jsxs("section",{ref:F,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(w_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:N,onTouchMove:z,style:I,"data-testid":"carousel-list",children:t.map((E,j)=>{let R=A(E,j);return R&&x_(j,p,b,v)?c.jsx(Zo,{id:R,card:{...E,contentType:n[j]},buildCardData:r,gtmContext:s,...o},R):(R=R||`${e}-card-${j}`,c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},R))})}),w<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(w)].map((E,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:R=>{R.preventDefault(),R.stopPropagation(),q(j)},children:c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:w})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=w-1})})]}),c.jsx(Ne,{"aria-live":x===""?"off":"polite",showOnFocus:!1,children:x})]})]})},__=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(to,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Ut,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(E_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Ut,{})]},`carousel-${d}`)});const k_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(hi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(eo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Mh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Nh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=Xa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Zc(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(hi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const F_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ie.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(ei,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(hi,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:x,isIntroduction:k,optional:_,slug:w,subsectionId:F,title:S,type:q})=>{const N=a&&t||k,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:V({article:b===Dr.ARTICLE,discussion:b===Dr.DISCUSSION,quiz:b===Dr.QUIZ,completed:g&&b===Dr.ARTICLE,locked:!N}),...z,children:c.jsx(fn,{href:N?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Kc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Mh,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",c.jsx(Nh,{completionTime:f,icon:v,optional:_,type:q,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const B_=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},A_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Mc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ya="notFoundError_",T_=()=>{const e=ie.useIntl(),t=[];return Mc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ya}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(yh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(bn,{children:[c.jsx(Ph,{cards:Mc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ya}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ya}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ya}text`})})]})};exports.ASSETS_BUCKET=Wt;exports.ActivitiesFeed=ME;exports.ActivitySection=n_;exports.AddPost=Wo;exports.BadgesContext=no;exports.BadgesProvider=dd;exports.Banner=c_;exports.BannerSection=h_;exports.Breadcrumbs=Vp;exports.Buckets=Cm;exports.Button=Ee;exports.ButtonWrapper=or;exports.COURSE_CONTENT_TYPES=Dr;exports.CacheProvider=fd;exports.Card=Zo;exports.CardBlock=Ph;exports.Carousel=__;exports.CharacterLimit=ho;exports.CollapsibleSection=ei;exports.Columns=Od;exports.CommunityDetails=Hp;exports.ContactFooter=Zw;exports.ContactForm=hh;exports.ContentTypeLabel=rd;exports.Contributors=so;exports.ConversationContext=di;exports.CookieBanner=bh;exports.CourseProgression=k_;exports.CourseStructure=F_;exports.CustomContentBanner=m_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Sr;exports.Directory=s_;exports.DiscussionConversation=Dh;exports.DiscussionForm=Zr;exports.DiscussionFormCard=xh;exports.DiscussionFormModal=Oh;exports.DiscussionLikes=Ch;exports.DiscussionPost=Yr;exports.DiscussionThread=Eh;exports.Divider=Ut;exports.DownloadSection=Uw;exports.EMAILS=Un;exports.EditSection=Vw;exports.EmailHelperTextBox=Md;exports.EmptyStateBox=hn;exports.EnrichedUrl=Kp;exports.FeatureFlags=ro;exports.Filters=Zp;exports.FlagsProvider=md;exports.Footer=Lo;exports.Form=en;exports.Formatting=Z;exports.Fragment=_t;exports.FullWidthSection=bn;exports.GET_STREAM_USER_PREFIX=vs;exports.GlobalProviders=Lm;exports.Header=zo;exports.HelperTextBox=id;exports.HiddenFromScreenReaders=Ja;exports.HideShowTextBox=sd;exports.HighlightSection=g_;exports.HighlightedTextBox=Pt;exports.INVALID_TOKEN=Yc;exports.IconBulletedList=Em;exports.ImageContainer=vm;exports.IntlProvider=pd;exports.InviteForm=mh;exports.InviteModal=a_;exports.JoinButton=co;exports.LanguageContext=ao;exports.LanguageSwitcher=Gp;exports.LessonName=Mh;exports.LessonType=Nh;exports.Link=fn;exports.LoadMore=Hr;exports.LoadingBlock=Mm;exports.LoadingPlaceholder=At;exports.LoadingState=to;exports.Logo=fo;exports.LogoSection=Kw;exports.MENTION_REGEX=Gc;exports.MarkCompleteButton=B_;exports.MarkdownText=Fn;exports.MarketingBlock=v_;exports.Marks=zt;exports.Member=Qt;exports.MembersList=eE;exports.Modal=oo;exports.MoreMenu=Sd;exports.NUMBER_OF_COUNTRIES=nm;exports.NUMBER_OF_USERS=tm;exports.NavigationMenu=jd;exports.NotFoundError=T_;exports.Overlay=pn;exports.OverlayContext=io;exports.OverlayProvider=bd;exports.PageHeading=od;exports.PageLayout=yh;exports.PasswordForm=Iw;exports.PasswordRules=Ld;exports.Pill=Gt;exports.Popover=nd;exports.Portal=Ur;exports.ProfileForm=ph;exports.ProfileImageChange=fh;exports.ProfileModal=fi;exports.ProfileModalLauncher=Uo;exports.ProfilePicture=mn;exports.ProgressBar=eo;exports.ProgressTracker=ym;exports.Rating=pg;exports.RepliesFeed=jh;exports.ResponsesHeading=wh;exports.ResponsiveImage=ur;exports.ReturnToNavButton=Dm;exports.RichTextEditor=dh;exports.SearchForm=gh;exports.ShareLinks=ng;exports.SignupForm=Ww;exports.Span=Cs;exports.StatusBanner=Or;exports.TableOfContents=l_;exports.Tabs=rg;exports.Tags=Xw;exports.TestimonialBlock=u_;exports.TimeToComplete=hi;exports.Toggle=Nw;exports.Tooltip=Mn;exports.TopLevelPage=Yw;exports.UUID_V4_REGEX=jr;exports.UserContext=it;exports.UserProvider=gd;exports.VisuallyHidden=Ne;exports.addAriaProps=Td;exports.basicReducer=Wr;exports.camelCaseToDashCase=Vc;exports.checkIntlPathExists=Xa;exports.generateConditions=Ta;exports.generateCssIcon=rm;exports.getAuthorData=Kr;exports.getCharacterLimitProps=Pd;exports.getLongDate=Xs;exports.getMember=ni;exports.getPostBody=qo;exports.getShortDate=Qc;exports.getValueLength=ri;exports.headerData=qr;exports.mapGetStreamData=A_;exports.pageReady=Jc;exports.passwordValidator=ys;exports.repliesFeedMock=NE;exports.supportedLanguages=xa;exports.toCamelCase=Kc;exports.toCapitalisedCase=em;exports.toSentenceCase=Zc;exports.transformSlugs=Ys;exports.useBadges=cd;exports.useCurrentPath=Lc;exports.useEffectAfterMount=er;exports.useElementWidth=Pn;exports.useOverlay=vd;exports.useScrollListener=Wc;exports.useScrollToHash=Qs;exports.useTooltips=Js;exports.useUser=ti;
package/index.mjs CHANGED
@@ -1794,22 +1794,26 @@ const an = ({ className: e = "", maxWidth: t = !1 }) => {
1794
1794
  ],
1795
1795
  sizes: "(min-width: 1024px) 510px, 20vw"
1796
1796
  },
1797
- fallback: {
1797
+ highlightSection: {
1798
1798
  range: [
1799
1799
  {
1800
- height: 124,
1801
- width: 375
1800
+ height: 200,
1801
+ width: 674
1802
1802
  },
1803
1803
  {
1804
- height: 320,
1805
- width: 687
1804
+ height: 400,
1805
+ width: 1348
1806
1806
  },
1807
1807
  {
1808
- height: 510,
1809
- width: 990
1808
+ height: 1e3,
1809
+ width: 1e3
1810
+ },
1811
+ {
1812
+ height: 2e3,
1813
+ width: 2e3
1810
1814
  }
1811
1815
  ],
1812
- sizes: "(min-width: 1024px) 885px, 35vw"
1816
+ sizes: "(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"
1813
1817
  },
1814
1818
  thumbnail: {
1815
1819
  range: [
@@ -1827,6 +1831,23 @@ const an = ({ className: e = "", maxWidth: t = !1 }) => {
1827
1831
  }
1828
1832
  ],
1829
1833
  sizes: "(min-width: 1024px) 453px, 20vw"
1834
+ },
1835
+ fallback: {
1836
+ range: [
1837
+ {
1838
+ height: 124,
1839
+ width: 375
1840
+ },
1841
+ {
1842
+ height: 320,
1843
+ width: 687
1844
+ },
1845
+ {
1846
+ height: 510,
1847
+ width: 990
1848
+ }
1849
+ ],
1850
+ sizes: "(min-width: 1024px) 885px, 35vw"
1830
1851
  }
1831
1852
  }, Jh = ({
1832
1853
  aspect: e,
@@ -26983,7 +27004,9 @@ const JE = ({
26983
27004
  {
26984
27005
  image: {
26985
27006
  ...r,
26986
- description: ""
27007
+ description: "",
27008
+ query: "q=85",
27009
+ aspect: "highlightSection"
26987
27010
  }
26988
27011
  }
26989
27012
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "5.1.3-RR.1",
3
+ "version": "5.1.4",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {