@apolitical/component-library 8.3.5 → 8.3.6-dh.0
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.
|
@@ -35,7 +35,7 @@ export interface IDiscussionPostProps {
|
|
|
35
35
|
forceHide?: IForceHide;
|
|
36
36
|
/** The functions that are passed in to handle the functionality */
|
|
37
37
|
functions: {
|
|
38
|
-
content
|
|
38
|
+
content?: {
|
|
39
39
|
/** Create a new post */
|
|
40
40
|
createContent: DiscussionCreateContentFunction;
|
|
41
41
|
/** Delete the post */
|
|
@@ -43,20 +43,20 @@ export interface IDiscussionPostProps {
|
|
|
43
43
|
/** Update the post */
|
|
44
44
|
updateContent: (args1?: object, args2?: object) => void;
|
|
45
45
|
};
|
|
46
|
-
likes
|
|
46
|
+
likes?: {
|
|
47
47
|
/** Create a new like on the post */
|
|
48
48
|
createLike: DiscussionCreateLikeFunction;
|
|
49
49
|
/** Delete a like on the post */
|
|
50
50
|
deleteLike: DiscussionDeleteLikeFunction;
|
|
51
51
|
/** List the likes on the post */
|
|
52
|
-
listLikes
|
|
52
|
+
listLikes?: DiscussionListLikesFunction;
|
|
53
53
|
};
|
|
54
54
|
polls?: IPollFunctions;
|
|
55
|
-
comments
|
|
55
|
+
comments?: {
|
|
56
56
|
/** Open comments on a post */
|
|
57
57
|
openComments?: () => void;
|
|
58
58
|
};
|
|
59
|
-
form
|
|
59
|
+
form?: IDiscussionFormFns;
|
|
60
60
|
pins?: {
|
|
61
61
|
/** Pin the post */
|
|
62
62
|
createPin?: () => void;
|
|
@@ -75,6 +75,10 @@ export type IForceHide = {
|
|
|
75
75
|
comments?: boolean;
|
|
76
76
|
/** Whether to hide the likes */
|
|
77
77
|
likes?: boolean;
|
|
78
|
+
/** Whether to hide the share link button */
|
|
79
|
+
shareLink?: boolean;
|
|
80
|
+
/** Whether to hide the more menu */
|
|
81
|
+
moreMenu?: boolean;
|
|
78
82
|
};
|
|
79
83
|
export type DiscussionCreateContentFunction = (args1: void | object, args2?: object) => void;
|
|
80
84
|
export type DiscussionCreatePollFunction = (args: ITransformedPollData) => Promise<IObject>;
|
package/index.js
CHANGED
|
@@ -568,4 +568,4 @@ and limitations under the License.
|
|
|
568
568
|
.Toastify__toast-body {
|
|
569
569
|
padding: 0px;
|
|
570
570
|
}
|
|
571
|
-
`]))),yge={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};E.createContext({notificationsData:yge});function bge(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,o=a===void 0?"":a,s=e.subscriberId,l=s===void 0?"":s,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,h=e.notificationClickHandler,m=e.primaryActionClickHandler,p=e.secondaryActionClickHandler,y=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,_=e.noNotificationsComponent,T=e.loaderComponent,C=e.tabBadgeComponent,x=e.headerRightComponent,w=e.hideAvatar,I=w===void 0?!1:w,O=e.hideInbox,M=e.hideToast,R=e.theme,D=e.themeType,k=D===void 0?"light":D,B=e.pagination,H=B===void 0?!0:B,$=e.pageSize,F=e.popperPosition,ne=F===void 0?"bottom":F,J=e.showUnreadCountOnTabs,P=J===void 0?!0:J,A=e.host;c&&(l=c);var Y=E.useState(!1),L=Y[0],U=Y[1],V=E.useState(),z=V[0],j=V[1],le=E.useState({storeData:{},count:0}),Q=le[0],ie=le[1],se=E.useState(""),te=se[0],Ae=se[1],De=E.useState(!1),ve=De[0],ce=De[1];E.useEffect(function(){var Oe=new iQ(n,{pageSize:$,tenantID:i,stores:d,host:A});return j(Oe),Oe.emitter.on("sync_notif_store",function(){var Le=Oe.feed.data;ie({storeData:(Le==null?void 0:Le.stores)||{},count:(Le==null?void 0:Le.unseenCount)||0,hasNext:Le==null?void 0:Le.hasNext,initialLoading:Le==null?void 0:Le.initialLoading,activeStoreId:Le==null?void 0:Le.activeStoreId}),Ae(Le==null?void 0:Le.activeStoreId)}),Oe.emitter.on("new_notification",function(Le){gge({notificationsData:Le,toastProps:f})}),function(){Oe.emitter.all.clear()}},[]),E.useEffect(function(){L&&l&&z&&z.feed.markAllSeen()},[L,l,z]),E.useEffect(function(){if(!(!l||!z))return ie({storeData:{},count:0}),z.identifyUser(o,l),z.feed.fetchNotifications(),function(){z.resetUser()}},[l,z]);var ye=k==="dark"?rD(Qme,R):R||{};return E.createElement(tD.Provider,{value:ye},E.createElement(eD.Provider,{value:{workspaceKey:n,notificationsData:Q,setNotificationsData:ie,notificationClickHandler:h,primaryActionClickHandler:m,secondaryActionClickHandler:p,bellComponent:y,badgeComponent:v,notificationComponent:b,noNotificationsComponent:_,tabBadgeComponent:C,headerRightComponent:x,toggleInbox:U,inbox:z,loaderComponent:T,pagination:H,hideAvatar:I,activeStore:te,setActiveStore:Ae,changingActiveStore:ve,setChangingActiveStore:ce,showUnreadCountOnTabs:P,themeType:k}},!O&&E.createElement(oge,{openInbox:L,toggleInbox:U,popperPosition:ne}),!M&&E.createElement(mge,f)))}const Lt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const o=`logged${e?"In":"Out"}`;return t>=n[a][o]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===gr.ACCOUNT&&t===!1&&n[gr.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Lt.handlerCalled[e]&&a-Lt.handlerCalled[e]<500)return;Lt.handlerCalled[e]=a;let o=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(s=>{s===e||n[s]===!1||o.push({type:`menus.${s}`,value:!1})});else{let s=null;switch(e){case gr.SITE:s=document.querySelector("#header .menu-button"),s||(s=document.querySelector("#navigation .navigation-button"));break;case gr.SEARCH:s=document.querySelector("#header .toggle-search-button");break;case gr.ACCOUNT:s=document.querySelector("#header .account-button");break;default:return}s&&s.focus()}r(o)},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 i=OC(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Lt.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let o,s;switch(e){case gr.SITE:if(n){const u=Lt.findFirstChild(t.current.children,"className","has-submenu parent"),c=Lt.findFirstChild(u.children,"id",gr.SITE);o=Lt.findFirstChild(c.children,"href")}else o=Lt.findFirstChild(t.current.children,"href");break;case gr.ACCOUNT:if(s=Lt.findFirstChild(t.current.children,"className","account"),!s||!s.children)return;o=Lt.findFirstChild(s.children,"href");break;default:return}o&&(i([{type:`focusElements.${e}.${a}`,value:o.attributes.href.value}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Lt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Lt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Lt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Lt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zc={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},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:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},dh=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const o=me.useIntl(),s=OC(zc,e);if(!s||s.onlyShow&&(s.onlyShow==="logged-in"&&!t||s.onlyShow==="logged-out"&&t))return null;const l="doTrack"in s,u=a===null?l?s.doTrack:!0:a,c=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;s.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let f=!1;if(s.href){let _=s.gtmType||`${e}-click`;if(_.includes(".")){const T=_.split("."),C=T[T.length-2];_=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}f={href:s.withReturnTo?`${s.href}?returnTo=${window.location.pathname}`:s.href},u&&(f={...f,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),c&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...s.props||{}})}const h=s.order&&s.order[0]&&s[s.order[0]],m=h&&s[s.order[0]].order,p=f&&window.location.pathname===s.href;let y={},v={},b={};if(p&&(y={...y,"aria-current":"page"}),h){const _=s.menuId||e,T={onClick:C=>Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]}),onFocus:()=>Lt.events.onFocus({id:_}),onBlur:()=>Lt.events.onBlur({id:_,callback:i}),onMouseLeave:()=>Lt.events.onBlur({id:_,callback:i}),onMouseEnter:()=>Lt.events.onMouseEnter({id:_,callback:i})};v={...T,id:_===gr.SITE?gr.SITE:gr.ACCOUNT},n&&(m&&(b={...T,className:"navigation-button",onKeyPress:C=>{C.key==="Enter"&&Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),m||(v={...v})}return g.jsxs("li",{className:ee({[s.className]:s.className,"has-submenu":h,parent:m,active:p}),...y,children:[f?E.createElement(c?Ke:"a",f,o.formatMessage({id:d})):n&&s.order&&m?g.jsxs("button",{...b,children:[o.formatMessage({id:d}),g.jsx(xt,{children:o.formatMessage({id:`header_menu_${r[gr.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:d}),s.order&&g.jsx("ul",{...v,children:s.order.map(_=>{if(!s[_])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return s[_].order?g.jsxs("li",{className:ee({[s[_].className]:s[_].className}),children:[o.formatMessage({id:`${d}_${_}`}),g.jsx("ul",{children:s[_].order.map(C=>g.jsx(dh,{id:`${e}.${_}.${C}`,...T},C))})]},_):g.jsx(dh,{id:`${e}.${_}`,...T},_)})})]},e)};const Ege=({headerIsVisible:e,locale:t})=>{const n=me.useIntl();return g.jsx("div",{id:"language-unavailable-message",className:ee({visible:e}),children:g.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>g.jsx("a",{href:"/home",children:r})})})})};const q0={height:67,height_desktop:83,additional_message_height:40};var gr=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gr||{});const l5=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i,novuApplicationIdentifier:a})=>{var B,H;const o=me.useIntl(),s=E.useContext(gn),l=lo(!0,!0),u=s&&typeof s.id=="string",c=E.useMemo(()=>Lt.getIsDesktopVersion(u,l),[u,l]),d=Op("suprsend-notifications")&&i,f=(H=(B=s==null?void 0:s.externalsMetadata)==null?void 0:B.suprsend)==null?void 0:H.subscriberId,h=Op("novu-notifications")&&a,m=Op("language-switcher")&&n,[p,y]=E.useState(!1);E.useEffect(()=>{t&&m&&(s!=null&&s.id)&&(s==null?void 0:s.locale)!==vl&&y(!0)},[t,m,s]);const[v,b]=E.useReducer(Pl,{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:_,menus:T,focusElements:C}=v,x=E.useRef(v);E.useEffect(()=>{x.current=v},[v]),LC({scrollPosition:p?q0[`height${c.navigation?"_desktop":""}`]+q0.additional_message_height:q0[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!0,$,b)},scrollDown:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!1,$,b)}}});const w=($,F,ne=!1)=>{Lt.handleMenus({id:$,value:F,menus:x.current.menus,dispatch:b,forceHandle:ne})},I=E.useRef(null),O=$=>{$.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(F=>{x.current.menus[F]&&w(F,!1,!0)})};E.useEffect(()=>{var $;return($=document.getElementById("header"))==null||$.addEventListener("keydown",O),()=>{var F;(F=document.getElementById("header"))==null||F.removeEventListener("keydown",O)}},[]),pl(()=>{T["site-navigation"]&&Lt.autoFocus({menu:"site-navigation",navigationRef:I,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["site-navigation"]]),pl(()=>{T["account-navigation"]&&Lt.autoFocus({menu:"account-navigation",navigationRef:I,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["account-navigation"]]);const M=g.jsxs(g.Fragment,{children:[!c.search&&g.jsx("button",{className:"search toggle-search-button",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("search",!T.search)},children:g.jsx(xt,{children:o.formatMessage({id:`header_search_${T.search?"hide":"show"}`})})}),g.jsx(Nw,{id:"global-search",handleToggle:{searchIsOpen:T.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),R=g.jsx("button",{className:"earth icon language-switcher-button","aria-label":"Language switcher",onClick:$=>{$.preventDefault(),$.stopPropagation(),r?r():y(!p)},children:g.jsx(xt,{children:o.formatMessage({id:"header_language_switcher"})})}),D=[d&&f&&g.jsx("div",{id:"suprsend-notifications",children:g.jsx(bge,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:{badge:{backgroundColor:"#C34141"},header:{markAllReadText:{color:"#4F43BA"}},notification:{unseenDot:{backgroundColor:"#C34141"},container:{unreadBackgroundColor:"white",readBackgroundColor:"white",hoverBackgroundColor:"#F0F5FF",borderColor:"#D7E0EF"},headerText:{color:"#151921"},bodyText:{color:"#151921"},subtext:{color:"#404A61"},actions:[{container:{backgroundColor:"#4F43BA"}},{container:{borderColor:"#4F43BA",color:"#4F43BA",backgroundColor:"white"}}]}}})}),h&&(s==null?void 0:s.id)&&g.jsx("div",{className:"novu-notifications",children:g.jsx(xZ,{applicationIdentifier:a,subscriberId:s==null?void 0:s.id,routerPush:$=>window.location.href=$,backendUrl:"https://eu.api.novu.co",socketUrl:"https://eu.ws.novu.co",appearance:{variables:{colorBackground:"#FFFFFF",colorForeground:"#151921",colorPrimary:"#4F43BA",fontSize:"24px"},elements:{notificationPrimaryAction__button:{borderRadius:"16px"}}}})})],k=g.jsxs(g.Fragment,{children:[!c.navigation&&g.jsx("button",{className:"menu-button gtm-trackable",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("site-navigation",!T["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":T["site-navigation"],"aria-controls":"site-navigation",children:g.jsx(xt,{children:o.formatMessage({id:`header_menu_${T["site-navigation"]?"hide":"show"}`})})}),g.jsx("ul",{ref:I,id:"navigation",hidden:c.navigation||T["account-navigation"]?!1:!T["site-navigation"],"data-showing":!c.navigation&&T["account-navigation"]?"account":"default",children:zc.order.map($=>g.jsx(dh,{id:$,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":T["site-navigation"],"account-navigation":T["account-navigation"]},callback:w},$))})]});return s&&s.isLoading?null:g.jsxs(g.Fragment,{children:[g.jsxs("nav",{id:"header",className:ee({"logged-in":u,"logged-out":!u,visible:_}),children:[g.jsx(xt,{element:"a",href:"#content-of-page",children:o.formatMessage({id:"header_skip"})}),g.jsx(Xv,{variant:"monochrome"}),e?g.jsxs(g.Fragment,{children:[c.navigation?g.jsxs(g.Fragment,{children:[k,M,m&&R,D]}):g.jsxs(g.Fragment,{children:[M,m&&R,D,k]}),u?g.jsxs("button",{className:"account-button",onClick:$=>Lt.events.onClick($,{id:"account-navigation",callback:w,isOpen:T["account-navigation"]}),onMouseEnter:()=>Lt.events.onMouseEnter({id:"account-navigation",callback:w}),onMouseLeave:()=>Lt.events.onBlur({id:"account-navigation",callback:w}),"aria-haspopup":"true","aria-expanded":T["account-navigation"],"aria-controls":"account-navigation",children:[g.jsx(xt,{children:o.formatMessage({id:`header_account_${T["account-navigation"]?"hide":"show"}`})}),g.jsx(Sa,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):g.jsx("ul",{className:"sign-in-buttons",children:zc.buttons.order.map($=>g.jsx(dh,{id:`buttons.${$}`},$))})]}):m&&R]}),p&&g.jsx(Ege,{headerIsVisible:_,locale:(s==null?void 0:s.locale)||vl}),g.jsx("hr",{id:"content-of-page"}),g.jsx("div",{className:ee("overlay",{open:T["site-navigation"]||T["account-navigation"]||!c.search&&T.search})})]})};const _ge=()=>{const e=me.useIntl();return g.jsxs(g.Fragment,{children:[g.jsx(l5,{}),g.jsx("div",{id:"content",children:g.jsx(Ui,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),g.jsx(ky,{})]})},sD=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:o="",locale:s="en",suprSendWorkspaceKey:l,novuApplicationIdentifier:u})=>{const c=me.useIntl(),{navigation:d=!0,footer:f=!0}=i,{background:h="default",variant:m="default",circle:p="default",modal:y="default"}=a,v=MC(),[b,_]=E.useState(""),T=O=>{const{detail:{message:M}}=O;_(M)};E.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[v]);const C=Ed(e,{locale:s}),x=Ed(t,{locale:s}),w=Ed(n,{locale:s}),I={};return h!=="default"&&(I[h]=!0),m!=="default"&&(I[m]=!0),p!=="default"&&(I[p]=!0),g.jsx(DD.ErrorBoundary,{onError:r,fallback:g.jsx(_ge,{}),children:g.jsxs(E.Suspense,{fallback:null,children:[g.jsxs("div",{id:"wrapper",className:ee(o,I,{"has-footer":f}),"data-too-small":c.formatMessage({id:"pageLayout_browserTooSmall"}),children:[g.jsx(l5,{suprSendWorkspaceKey:l,novuApplicationIdentifier:u,showNavigation:d}),g.jsxs("main",{id:"content-wrapper",children:[x&&g.jsx("div",{className:ee("additional-content prepended",{"large-modal":y==="large"}),children:x}),E.createElement(h==="bold"?Lv:"div",{id:"content",children:C,className:ee({"large-modal":y==="large"})})]}),w&&g.jsx("div",{className:"additional-content appended",children:w}),f&&g.jsx(ky,{}),g.jsx(Pw,{})]}),b&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},AC={default:"tags_",headerTopics:"header_topics_topics_"},W0={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"},Tge={getTagDetails:e=>{if(e.includes("topic_")){if(e=W0.topic[e.replace("topic_","")],e){const t=zc.topics.topics[e].href;return t?{id:e,href:t,text:`${AC.headerTopics}${e}`}:null}return null}return W0[e]?(e=W0[e],{id:e,text:`${AC.default}${e}`}):null}};const Cge=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:o="tags"})=>{const s=me.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Tge.getTagDetails(u);c&&l.push(c)}),l.length<1?null:g.jsx("ul",{className:ee("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=s.formatMessage({id:u.text});return g.jsx("li",{children:u.href&&r?g.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":o,children:c}):c},u.id)})})};const lD=25,xge=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:o,gtmContext:s="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=me.useIntl(),h="membersList",m=E.useContext(gn),[p,y]=E.useState(!1);return e.length===0&&!c?null:g.jsxs("div",{className:ee("members-list",d),children:[u?g.jsxs("h1",{children:[f.formatMessage({id:h}),g.jsx("span",{className:"count",children:t})]}):g.jsx(g.Fragment,{}),g.jsxs("ul",{children:[r?g.jsxs("li",{children:[g.jsx(Ea,{member:m,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:n||""},{scope:Rn.Platform,area:"all"}]}}),g.jsx(co,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),y(!0)},children:f.formatMessage({id:`${h}_profile`})})]}):g.jsx(g.Fragment,{}),e.map((v,b)=>m&&v.id===m.id?g.jsx(g.Fragment,{}):g.jsxs("li",{children:[g.jsx(Ea,{member:v,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:n||""},{scope:Rn.Platform,area:"all"}]}}),v.isAdmin&&g.jsx(Fi,{children:f.formatMessage({id:`${h}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,lD))].map((v,b)=>g.jsx("li",{children:g.jsx(bh,{layout:"member"})},b)):g.jsx(g.Fragment,{})]}),i&&g.jsx(Vc,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),o?g.jsx(xp,{form:o,showModal:p,content:{title:f.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{y(!1)}}}):g.jsx(g.Fragment,{})]})},uD=xge,wge=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=me.useIntl();return t?g.jsx("small",{children:ai(i.formatMessage,`${e}explainer`,n,"action",{a:a=>g.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:a})})}):g.jsx(g.Fragment,{})},Age=({intlPath:e,type:t,...n})=>{const r=me.useIntl();return g.jsx(Af,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:ai(r.formatMessage,`${e}label_action`,t,"action")},...n})},SC=5,kC=2,Sge=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Ps=null;const nn="discussion_form_",l1=({id:e,parentId:t,content:n={type:at.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:o=0,buttons:s,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var re,ge,Ne;const f=me.useIntl(),h=E.useContext(gn),[m,p]=E.useState(n.type),[y,v]=E.useState(""),{isLoading:b=!1,isInWrapper:_=!1,isInOverlay:T=!1,isAutoFocused:C=!1,isEditing:x=!1,hasTitleField:w=!1,canBePrepopulated:I=!1,isPrepopulated:O=!1,showTitle:M=!1,showGuidelines:R=!0,showDivider:D=!1,showSuccessMessage:k=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:$=()=>{},create:F=()=>{},createPoll:ne=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:P=()=>{},callback:A=()=>{},onMention:Y=()=>{},listMembers:L=()=>Promise.resolve([]),clickMentionFallback:U=()=>{},getLinkPreview:V=()=>Promise.resolve({}),props:z={create:{projectNames:["questions-answers"]}}}=u,[j,le]=E.useState({body:x&&x.text||O&&O.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Q,ie]=E.useState(l.error||!1),se={status:!1,title:w&&w.text||"",polls:0},[te,Ae]=E.useState(se);E.useEffect(()=>{I&&!x&&O&&O!==j.body&&le(be=>({...be,body:O.text||""}))},[O]),E.useEffect(()=>{p(n.type)},[n.type]);const De=mc((be,X)=>{le(xe=>({...xe,body:be,data:{link:X}})),$({body:be});let he;!h||!h.id?he=ai(f.formatMessage,`${nn}error_loggedOut`,m,"action"):r?o>0&&be.length>=o&&(he=`${nn}error_tooLong`):he=ai(f.formatMessage,`${nn}error_noPermission`,m,"action"),he?ie(he):Q&&ie(!1)},50);let ve=`${m}-form`;if(m===at.Response||m===at.Reply){const be=((re=n.slugs)==null?void 0:re.reply)||((ge=n.slugs)==null?void 0:ge.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";be&&(ve=`${ve}-${be.slice(-15)}`)}e&&(ve=`${e}-${ve}`);const ce=async be=>{if(!h||!h.id||!r||gt)throw new Error("You do not have permission to post.");Ps&&clearTimeout(Ps),Ae(he=>({...he,status:"submitting"}));const X=window.location.pathname;try{let he;switch(m){case at.Post:he=await F({title:be.title,content:be.body,categories:be.postType,data:be.data});break;case at.Poll:he=await ne(Sge(be));break;case at.Question:he=await F({title:be.body,authorId:h&&h.id,data:be.data,...z==null?void 0:z.create});break;case at.Response:he=await F({questionSlug:n.slugs.question},{body:be.body,authorId:h&&h.id,contentPath:X,data:be.data});break;case at.Reply:he=await F({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:be.body,authorId:h&&h.id,contentPath:X,data:be.data});break;default:break}return await WD(1e3),A&&await A(he),Ps=setTimeout(()=>{le({body:"",data:{}}),p(at.Post),Ae(Ue=>({...Ue,status:"submitted"})),v(ai(f.formatMessage,`${nn}success`,m,"action"));const xe=new Event(bn.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(xe),ye()},850),he}catch(he){const xe=he;let Ue=`${nn}error`;xe!=null&&xe.message.includes("entry already exists")&&(Ue=ai(f.formatMessage,`${nn}error_alreadyExists`,m,"action")),xe!=null&&xe.message.includes("429")?Ue=ai(f.formatMessage,`${nn}error_tooMany`,m,"action"):xe!=null&&xe.message.includes("400")&&(Ue=`${nn}error`),ie(Ue),ye()}},ye=()=>{Ps=setTimeout(()=>{ie(!1),Ae(se),v("")},5e3)},Oe=mc(async be=>{const X={...j,...be};if(x){Ae(he=>({...he,status:"submitting"})),J(X);return}try{if(!await ce(X))throw Error("No response from handleSubmit")}catch{Ps&&clearTimeout(Ps)}},100);if(b)return g.jsx(Vr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Le=!j.body||!yc(j.body),ht=!te.title||!yc(te.title);let gt=!1;m!==at.Poll&&(gt=Le),w&&(gt=gt&&ht);const nt=te.status==="submitting",ot=[];m===at.Poll?ot.push({id:"poll-options",label:f.formatMessage({id:`${nn}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${nn}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:kC,maxInputs:SC,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${nn}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:be=>{var he;let X=0;be&&Array.isArray(be)&&(X=((he=be==null?void 0:be.filter(xe=>xe!==""))==null?void 0:he.length)||0),te.polls!==X&&Ae(xe=>({...xe,polls:X})),$({polls:be})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${nn}multiplePollAnswers`}),className:"text-medium"}):ot.push({component:Age,props:{formID:ve,intlPath:nn,showLabel:w!==!1,type:m}},{component:Sy,props:{id:`${ve}-input`,value:te.status==="submitting"&&!Q?"":j.body,placeholder:a||ai(f.formatMessage,`${nn}placeholder`,m,"action"),maxLength:o,meta:{isInOverlay:T},functions:{onChange:De,onChangeData:be=>{le(X=>({...X,data:be}))},onMention:Y,listMembers:L,clickMentionFallback:U,getLinkPreview:V},data:c,autoFocus:x!==!1||C&&!w,"aria-invalid":!!Q,"aria-errormessage":"error-message"}},{component:wge,props:{intlPath:nn,showGuidelines:R,type:m,gtmContext:d}}),D&&ot.push({component:di}),w&&ot.unshift({id:"title",type:"textarea",value:w.text,limit:250,label:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:be=>{Ae(X=>({...X,title:be})),$({title:be})}},validation:m===at.Poll?[{condition:"required"}]:[]}),B&&ot.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${nn}postType_label`}),options:H.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{$({postType:be}),be.includes(at.Poll)?p(at.Poll):m!==at.Post&&p(at.Post)}}});let je=!h||!h.id||!r||nt;if(m===at.Poll){const be=te.polls;je=je||ht||be<kC||be>SC}else je=je||gt,x&&(w?je=je||j.body===x.text&&te.title===w.text:je=je||j.body===x.text);return g.jsxs(g.Fragment,{children:[g.jsxs(Zi,{id:ve,className:ee("discussion-card discussion-form",{"no-styling":_&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!nt||l.cancel},functions:{onSuccess:async be=>{await Oe(be)},onCancel:P},fields:ot,intlPath:nn,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${x?"save":"submit"}-${m}-click`,"data-testid":"save-button",disabled:je,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:f.formatMessage({id:`${nn}${x?"save":"post"}`}),submitting:f.formatMessage({id:`${nn}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${m}-click`,disabled:!l.cancel&&(!h||!h.id||!j.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:f.formatMessage({id:`${nn}cancel`})},gtm:{context:d,event:`${m}-form`},"data-testid":`discussion-${m}-form`,children:[M&&!x&&m===at.Question&&g.jsx("h2",{children:ai(f.formatMessage,`${nn}title`,m,"action")}),g.jsx(Ea,{member:h?{...h,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:t||""},{scope:Rn.Platform,area:"all"}]}})]}),te.status==="submitted"&&k&&g.jsx(ml,{className:"success","data-testid":"success",children:ai(f.formatMessage,`${nn}success`,m,"action")}),Q&&g.jsx(ml,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Q=="string"?Q.includes(" ")?Q:f.formatMessage({id:Q},{action:f.formatMessage({id:`discussion_action_${m}`}),maxLength:o}):Q}),y&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:y})]})},kge=Object.freeze(Object.defineProperty({__proto__:null,default:l1},Symbol.toStringTag,{value:"Module"}));const Dge={showForm:!1},Cp=E.createContext(Dge),cD=({children:e})=>{const[t,n]=E.useState({showForm:!1});return g.jsx(Cp.Provider,{value:{...t,updateConversation:n},children:e})};function Oge({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:o}){var d;const s="discussion_",l=me.useIntl(),u=(d=i==null?void 0:i.componentProps)==null?void 0:d.member.additionalContent,c=u?u.customMessage:void 0;return g.jsxs("div",{className:"author-section",children:[g.jsx(Ea,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:c},className:ee({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!c},gtmContext:a,gtmType:"profile-click",badges:o}),i.pinned&&g.jsx(Fi,{variant:"naked",size:"xlarge",icon:"pin",children:g.jsx(xt,{children:l.formatMessage({id:`${s}pinned_post`})})})]})}const K0=({children:e,class:t,...n})=>{const r={...n,class:ee("subtle",t)};return g.jsx("blockquote",{...r,children:e})};function Nge({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?g.jsx(g.Fragment,{}):g.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?g.jsx(g.Fragment,{}):g.jsx(Fi,{size:"small",element:"li",children:n.name},n.slug))})}var fh=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(fh||{});const Ige=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,Pge=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const o=e.parentElement;if(o)for(i=n==="next"?o.firstElementChild:o.lastElementChild,a=n==="next"?0:o.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const Rge=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:o=!1,isTabbable:s=!1,functions:l})=>{var y;const[u,c]=E.useState(t.hasUserVoted);let d=0,f={};const h=(i||!o)&&!t.hasUserVoted;a&&(d=Math.round(t.numVotes/r*100)||0,f={"--vote-perc":`${d}%`});const m=v=>{v.stopPropagation(),h&&(l==null||l.createVote(t),c(!0))},p={htmlFor:t.id,className:ee({"can-vote":h}),tabIndex:s&&h?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:m,onKeyDown:v=>{var b;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),m(v),c(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const _=v.code==="ArrowUp"?"prev":"next",{nextElement:T,nextIndex:C}=Pge(v.currentTarget.parentElement,"selected",_,n);T&&((b=T.querySelector("label"))==null||b.focus(),l==null||l.setTabbableOption(C));break}}};return g.jsxs("li",{"data-testid":"poll-option",style:f,className:ee("poll-option text-small",{selected:t.hasUserVoted}),children:[g.jsx("label",{...p,children:g.jsx("span",{children:t.label})}),a&&g.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&g.jsx(Sa,{className:"author-profile-picture",name:e.name,src:(y=e==null?void 0:e.image)==null?void 0:y.thumbnail}),g.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[d,"%"]})]}),g.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const dD=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=me.useIntl(),o=E.useContext(gn),{showRemoveVote:s=!1,allowMultipleVotes:l=!1,resultsVisibility:u=fh.AfterVoting}=n||{},[c,d]=E.useState(Ige(t,l,o==null?void 0:o.id)),f=t.reduce((v,b)=>v+b.numVotes,0),h=t.filter(v=>v.hasUserVoted).length,m=t.filter(v=>v.hasUserVoted),p=E.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),y=E.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return g.jsxs("div",{className:"poll-wrapper",children:[g.jsx("p",{className:"poll-title",children:e}),g.jsxs("aside",{className:"poll-info",children:[g.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:g.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),g.jsx("p",{className:"poll-num-votes",children:g.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:f})})}),s&&g.jsx("p",{className:"poll-remove-vote",children:g.jsx(Ke,{variant:"tertiary",onClick:y,"data-testid":"remove-votes-button",disabled:h===0,children:g.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:h})})})})]}),t&&g.jsx("form",{children:g.jsx("fieldset",{children:g.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,b)=>g.jsx(Rge,{isTabbable:c===b,user:o,option:v,optionIndex:b,totalPollVotes:f,showResults:u==fh.Always||!!h,allowMultipleVotes:l,hasVotedOnPoll:!!h,functions:{createVote:p,setTabbableOption:d}},v.id))})})}),g.jsxs(xt,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:h}),!!h&&g.jsx("ul",{children:m.map(v=>g.jsx("li",{children:v.label}))})]})]})};function Fge({content:e,contentData:t,functions:n}){return g.jsx(dD,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function Mge({links:e={},contentData:t,postCutOff:n,content:r}){var i;return g.jsxs(g.Fragment,{children:[e.post?g.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?g.jsx(e3,{text:t.postBody,markdownOptions:{overrides:{a:ng,blockquote:{component:K0}}}}):g.jsx(Qo,{options:{overrides:{a:ng,blockquote:{component:K0}}},children:t.postBody})]}):g.jsxs(g.Fragment,{children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),g.jsx(Qo,{options:{wrapper:r.type===at.Question?"h1":E.Fragment,forceWrapper:r.type===at.Question,forceInline:r.type===at.Question,forceBlock:r.type!==at.Question,overrides:{blockquote:{component:K0}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?g.jsx(Qv,{data:t.data.link}):g.jsx(g.Fragment,{})]})}const ei="discussion_",Bge=195;let gd=null;const u1=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:o,functions:s,links:l={},className:u,gtmContext:c="DiscussionAnswer",children:d,isTruncated:f=!1,setFocus:h=!1,isCommunity:m=!1,badges:p,basePath:y,parentId:v,locale:b="en",disableMentions:_})=>{var je,re,ge,Ne,be,X;const T=me.useIntl(),C=E.useContext(Cp),x=E.useContext(gn),{createContent:w=async()=>{},deleteContent:I=async()=>{},updateContent:O=async()=>{}}=s.content||{},{createLike:M=()=>{},deleteLike:R=()=>{},listLikes:D=async()=>({})}=s.likes||{},{openComments:k=()=>{}}=s.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:H=()=>{}}=s.form||{},{createVote:$=()=>{},removeVote:F=()=>{},removePoll:ne=()=>{}}=s.polls||{},{author:J,createdAt:P,id:A,likes:Y=0,userLiked:L,comments:U=0,data:V}=t,z=cI(t.title,b),j=x&&x.id&&typeof J!="string"&&J.id&&J.id===x.id||!1,le=j&&(!t.createdAt||VD(t.createdAt,10,"seconds")),Q=E.useRef(null),[ie,se]=E.useState({title:t.body!==z&&z||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[te,Ae]=E.useState(!1),[De,ve]=E.useState(le?"highlighted":"default"),[ce,ye]=E.useState("");E.useEffect(()=>{const he=Q.current;if(!(!he||De==="default"))return document.addEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),he.addEventListener("transitionend",Le),()=>{document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),he.removeEventListener("transitionend",Le)}},[]),E.useEffect(()=>{se(he=>({...he,title:t&&z||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),E.useEffect(()=>{(async()=>{const xe=await Yv(ie.body,f,V==null?void 0:V.mentions,B);se(Ue=>({...Ue,postBody:xe}))})()},[ie.body,V==null?void 0:V.mentions]);const Oe=()=>{setTimeout(()=>{ve("fading")},1e3)},Le=({propertyName:he})=>{he==="background-color"&&ve(xe=>(xe==="default"&&(document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),Q.current&&Q.current.removeEventListener("transitionend",Le)),xe==="fading"?"default":xe))};if(i||!t||t.type===at.Answer&&(!t.slugs||!t.slugs.question)||ie.postBody===""&&t.title==="")return g.jsx(Vr,{className:"discussion-card"});const ht=async({title:he,body:xe,data:Ue})=>{he||(he=""),xe||(xe=""),ye("");try{if(!cf(he,ie.title)||!cf(xe,ie.body)){const kt=t.type===at.Question?{title:xe}:{title:he,body:xe,data:Ue};await O(sg(t.slugs),kt)}se(kt=>({...kt,title:he||"",body:xe||"",data:{...kt.data,...Ue},isEditing:!1,didEdit:!0}))}catch{ye(`${ei}form_error`)}},gt=()=>{if(C&&C.updateConversation){const he={showForm:!0},xe=t.author;xe&&xe.id&&!_&&(m&&(he.prepopulateForm=`@{{${xe.id}}}`),he.mentionData={id:xe.id,name:xe.name}),C.updateConversation(he)}setTimeout(()=>{var vt,St,sn;const xe=`reply-form-${(t.type===at.Answer?t.slug:((vt=t.slugs)==null?void 0:vt.reply)||((St=t.slugs)==null?void 0:St.answer)||((sn=t.slugs)==null?void 0:sn.question)||"").toLowerCase().slice(-15)}`,Ue=document.getElementById(xe),kt=document.getElementById(`${xe}-input`);kt&&kt.focus(),Ue&&Ue.scrollIntoView({behavior:"smooth"})},0)},nt=async()=>{Ae(!1);try{t.type===at.Poll?(await ne(),window.location.href=`${y}/${v}`):await I(sg(t.slugs))}catch{ye("delete-error")}},ot=[];return n&&j&&(t.type!==at.Poll&&ot.push({text:T.formatMessage({id:`${ei}moreMenu_edit`}),onClick:()=>se(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),ot.push({text:T.formatMessage({id:`${ei}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),Ae(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...D3(`delete-${t.slug}-modal`,te)})),r&&s.pins&&ot.push({text:T.formatMessage({id:`${ei}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?s.pins.deletePin:s.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),h&&((je=Q==null?void 0:Q.current)==null||je.focus(),(re=Q==null?void 0:Q.current)==null||re.scrollIntoView({behavior:"smooth"})),E.createElement(e,{className:ee("discussion-post",u,{[De]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ie.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Q,tabIndex:h?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:he=>{if(!l.post||ie.isEditing||t.type===at.Poll&&uI(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),gd&&clearTimeout(gd),gd=setTimeout(()=>{window.location.href=l.post},150);const xe=new CustomEvent(bn.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:gd}});document.dispatchEvent(xe)},children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{id:A||t.slug,className:ee("discussion-card text-medium",t.type,{editing:ie.isEditing,"has-link":l.post&&!ie.isEditing}),children:[!ie.isEditing&&g.jsx(Oge,{author:J,originalAuthorId:a,createdAt:P,contentData:{didEdit:ie.didEdit},content:t,gtmContext:c,badges:p}),ie.isEditing?g.jsx(l1,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ie.title!==""?{text:ie.title}:!1,isEditing:{text:ie.body,categories:[]},canBePrepopulated:m,isPrepopulated:!1},maxLength:t.type===at.Question?250:5e4,forceShow:{error:ce!==""&&ce!=="delete-error"?T.formatMessage({id:ce},{action:T.formatMessage({id:`${ei}action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:ht,handleCancel:()=>{ye(""),se(he=>({...he,isEditing:!1}))},listMembers:B,clickMentionFallback:H},gtmContext:`${c}Form`,data:V}):g.jsxs(g.Fragment,{children:[t.type===at.Poll?g.jsx(Fge,{content:t,contentData:ie,functions:{createVote:$,removeVote:F}}):g.jsx(Mge,{links:l,contentData:ie,postCutOff:Bge,content:t}),g.jsx(Nge,{content:t})]}),!ie.isEditing&&!(o!=null&&o.actionBar)&&g.jsx(V3,{className:t.type,gtmContext:c,contentType:t.type,likes:o!=null&&o.likes?!1:{count:Y||0,userLiked:L||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:M,deleteLike:R,listLikes:D},basePath:y,parentId:v},comments:!(o!=null&&o.comments)&&([at.Question,at.Post].includes(t.type)||l.comments)?{count:U||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof k=="function"&&k()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:gt}}:!1,shareLink:{url:`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(Ne=t.slugs)==null?void 0:Ne.answer}${(be=t.slugs)!=null&&be.reply?`#${(X=t.slugs)==null?void 0:X.reply}`:""}`},moreMenu:{options:ot,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),d,g.jsx(ka,{id:`delete-${t.slug}-modal`,isOpen:te,functions:{onOpen:()=>{},onClose:()=>Ae(!1)},forceShow:{error:ce==="delete-error"?T.formatMessage({id:"${intlPath}delete_error"},{action:T.formatMessage({id:`${ei}action_${t.type}`})}):!1},title:T.formatMessage({id:`${ei}delete_title`},{action:T.formatMessage({id:`${ei}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Ae(!1),children:T.formatMessage({id:`${ei}delete_cancel`})},{variant:"primary",className:"destructive",onClick:nt,children:T.formatMessage({id:`${ei}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:g.jsx(me.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>g.jsx("p",{children:he}),action:T.formatMessage({id:`${ei}action_${t.type}`})}})})]})})};const Lge=E.lazy(()=>Promise.resolve().then(()=>Xge)),$ge=65,fD=({forceShow:e,form:t,className:n})=>{const r=me.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",s=E.useContext(gn)||"community",l=Eh(s);l.name||(l.name=r.formatMessage({id:`member_${typeof s=="string"?s:"community"}`}));const u=lo(!0,!1),c=u?u<768:0,{modal:d=!1}=e||{},[f,h]=E.useState({form:d||YC("showPost")==="true"||!1,warning:!1}),[m,p]=E.useState({showCachedText:!1});E.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const _=await Yv(m.title||m.body||"",$ge,m.mentions);p(T=>({...T,prettifiedText:_}))})()},[m.showCachedText,m.title,m.body]);const y=b=>{if(!m.showCachedText||typeof f.warning=="string")return;let _;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),_=b.detail.link;else{const T=b;T.preventDefault(),T.stopPropagation();const x=T.target.closest("a");_=x&&x.getAttribute("href")}h(T=>({...T,warning:_||!1}))};E.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y);return}return document.addEventListener(bn.DISCUSSION_POST_CLICKED,y),document.addEventListener(bn.MEMBER_CLICKED,y),document.addEventListener("click",y),()=>{document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y)}},[m.showCachedText]),E.useEffect(()=>{const b=_=>{if(!(!m.showCachedText||f.warning!==!1))return _.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[m.showCachedText,f.warning]);let v=r.formatMessage({id:`${i}placeholder${c?"":"_long"}`});return m.showCachedText&&(m.title||m.body)&&(v=m.prettifiedText||v),g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:ee("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(_=>({..._,form:!0}))},"data-testid":"discussion-form-card",children:[g.jsx(Sa,{name:l.name,src:l.image,alt:""}),g.jsx(Qo,{className:ee("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Ir,blockquote:Ir,br:Ir,em:Ir,li:Ir,ol:Ir,p:Ir,s:Ir,span:Ir,strong:Ir,ul:Ir}},children:v})]}),g.jsxs(Ml,{children:[g.jsx(Lge,{showModal:f.form,functions:{cacheText:p,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),g.jsx(ka,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:f.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof f.warning=="string"&&(window.location.href=f.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:g.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},jge=E.lazy(()=>Promise.resolve().then(()=>kge)),u5=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:o,leave:s,notMemberStateText:l},locale:u=vl})=>{if(a&&!i)return g.jsx(Ui,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:g.jsx(Uv,{isShort:!0,functions:{join:o,leave:s}})}});const{content:c,functions:d,meta:f,...h}=t,m={content:{type:(c==null?void 0:c.type)||"reply",slugs:(c==null?void 0:c.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?g.jsx(fD,{form:m}):g.jsx(jge,{...m})},c5=({form:e})=>{const t=E.useContext(gn),n=me.useIntl(),[r,i]=E.useState(!1),a=()=>{JD(t)||i(!0)};E.useEffect(()=>(document.addEventListener(bn.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(bn.DISCUSSION_POST_ADDED,a)}));const o={};return["successMessage","title","text"].forEach(s=>{o[s]=n.formatMessage({id:`profileModalLauncher_${s}`})}),g.jsx(xp,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:o})};const G0="discussion_responses_",hD=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=me.useIntl();return t=parseInt(t),g.jsxs("div",{className:"responses-heading",children:[g.jsx("h4",{children:r.formatMessage({id:`${G0}title`},{action:r.formatMessage({id:`${G0}${e}`}),count:t})}),!n&&t===0&&g.jsx("p",{children:ai(r.formatMessage,`${G0}empty`,e,e)})]})};const pD=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=me.useIntl(),o=E.useContext(Cp),s=Ed(i,{element:"li"});if(o.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:o.prepopulateForm},o.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=o.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:o.mentionData},r.data=l,r.meta.isAutoFocused=!0}return g.jsxs("div",{className:ee("thread-wrapper",{"empty-thread":!s}),children:[!Object.is(s,null)&&g.jsx("ul",{className:"thread",children:s}),!e&&g.jsx(Vc,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&o.showForm&&g.jsx(l1,{...r})]})};function Hge(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,o;(o=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&o.length&&(t=!0)}),t}function Uge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:o}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:s})=>t(l=>(N3({activity:l,reactionId:s,user:a}),l)),onError:n,onSuccess:(s,{reactionId:l},u)=>{u&&I3({activity:u,reactionId:l,correctReactionId:s.body.id,user:a}),r.setQueryData(i,u)}});return o}function zge({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Rt.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(o=>(o&&(i!=null&&(o.content=i),a!=null&&(o.title=a)),o)),onError:n});return r}function Vge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&vf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&vf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function qge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&yf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&yf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Wge({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Rt.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function Kge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(o=>(P3({activity:o,reactionId:a}),o)),onError:n});return i}function Gge({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:o,removeVote:s},queryKey:l}){const u=Rt.useQueryClient(),c=yh(),d={queryClient:u,queryKey:l},f={mutationHandlers:{error:zv(d),mutate:Vv(d)},user:c,...d},h=zge({...f,mutationFn:t}),m=Vge({...f,mutationFn:n}),p=Yge({...f,mutationFn:r}),y=qge({...f,mutationFn:i}),v=Zge({...f,mutationFn:a}),b=Uge({...f,mutationFn:o}),_=Kge({...f,mutationFn:s}),{activity:T,...C}=Wge({queryKey:l,queryFn:e});return{activity:T,mutations:{edit:h,like:m,unlike:p,pin:y,unpin:v,createVote:b,removeVote:_},user:c,...C}}function Yge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>t(o=>(o&&R3({activity:o,user:r}),o)),onError:n});return i}function Zge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(o=>(o&&F3({activity:o,user:r}),o))),onError:n});return i}const Qge=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...o},likes:s,reactions:l,form:u,join:c,leave:d,polls:f},profile:h,categories:m,locale:p=vl,type:y=fi.Communities})=>{var L,U,V,z,j,le,Q,ie,se,te,Ae,De;const v=me.useIntl(),b={...o,...f},{activity:_,error:T,isLoading:C,mutations:{edit:x,like:w,unlike:I,pin:O,unpin:M,createVote:R,removeVote:D}}=Gge({queryFns:b,queryKey:[e,t,n]});if(C)return g.jsx(Vr,{style:{height:"400px"}});if(T||!_)return g.jsx(Ui,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:k,verb:B,latest_reactions:H,mentioned_users:$,additional_data:F}=_,ne=(((L=H==null?void 0:H.like)==null?void 0:L.length)||0)>0,J=(((U=k==null?void 0:k.like)==null?void 0:U.length)||0)>0,P=J?k==null?void 0:k.like[0].id:"",A=ne?(V=H==null?void 0:H.like)==null?void 0:V.map(ve=>{var ce,ye,Oe;return{id:(ce=ve==null?void 0:ve.user)==null?void 0:ce.id,name:(Oe=(ye=ve==null?void 0:ve.user)==null?void 0:ye.data)==null?void 0:Oe.name}}):!1,Y=_==null?void 0:_.actor;return g.jsxs("section",{className:"activity-section",children:[g.jsx(u1,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:B,title:_==null?void 0:_.title,body:y===fi.Courses?HN({content:_.content,locale:p}):_==null?void 0:_.content,categories:Zv((_==null?void 0:_.categories)||[],m||[]),createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${e}/${t}`,answer:_==null?void 0:_.id},slug:n,author:Ll(Y),userLiked:J,likes:((z=_==null?void 0:_.reaction_counts)==null?void 0:z.like)||0,comments:(_==null?void 0:_.total_replies)||0,peopleWhoLiked:A,data:{mentions:$,...F||{}},pinned:((j=_==null?void 0:_.reaction_counts)==null?void 0:j.pin)&&((le=_==null?void 0:_.reaction_counts)==null?void 0:le.pin)>0||!1,pollOptions:O3(_,p),pollSettings:{showRemoveVote:(Q=_==null?void 0:_.settings)==null?void 0:Q.show_remove_vote,allowMultipleVotes:(ie=_==null?void 0:_.settings)==null?void 0:ie.allow_multiple_votes,deadlineAt:(se=_==null?void 0:_.settings)==null?void 0:se.deadline_at,hideParticipants:(te=_==null?void 0:_.settings)==null?void 0:te.hide_participants,numberOfWinners:(Ae=_==null?void 0:_.settings)==null?void 0:Ae.number_of_winners,resultsVisibility:(De=_==null?void 0:_.settings)==null?void 0:De.results_visibility}},originalAuthorId:Y==null?void 0:Y.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ve,{title:ce,body:ye})=>x({title:ce,content:ye})},likes:{createLike:()=>w({activityId:n}),deleteLike:()=>I({activityId:n,reactionId:P}),listLikes:ve=>s.list({activityId:n,...ve})},comments:{openComments:()=>{}},pins:{createPin:()=>O({activityId:n}),deletePin:()=>{var ve;return M({activityId:n,reactionId:(ve=H==null?void 0:H.pin)==null?void 0:ve[0].id})}},polls:{createVote:({reactionId:ve})=>R({reactionId:ve}),removeVote:({reactionId:ve})=>D({reactionId:ve}),removePoll:()=>f.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:t||""},{scope:Rn.Platform,area:"all"}]},basePath:e,parentId:t},n),g.jsx(j3,{basePath:e,parentId:t,activityId:n,showReplies:B===at.Poll?Hge(_):!0,activityTotalReplies:(_==null?void 0:_.total_replies)||0,isMember:r,functions:{reactions:l,likes:s,form:u,join:c,leave:d},profile:h,type:y})]})};const mD=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=me.useIntl(),o="discussionFormModal_",{onClose:s=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:d}=n,{title:f="",body:h="",mentions:m}=r||{},p="discussion-form-modal";return g.jsx(ka,{id:p,title:a.formatMessage({id:`${o}title`}),isOpen:e,functions:{onClose:()=>{(f!==""||h!=="")&&l(y=>({...y,showCachedText:!0})),s()}},className:ee("discussion-form-modal",i),children:g.jsx(l1,{...n,data:{...u,mentions:m||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${p}-overlay`,hasTitleField:{text:f},isPrepopulated:{text:h||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${o}cta`})},functions:{...d,onChange:y=>{l(v=>({...v,...y}))},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const b=m||{};b[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l(_=>({..._,mentions:b}))},create:async y=>{s(),d.create&&await d.create(y),l({showCachedText:!1})},createPoll:async y=>{const v=()=>{s(),l({showCachedText:!1})};if(d.createPoll)try{const b=await d.createPoll(y);return new Promise(_=>(v(),_(b)))}catch{return new Promise((_,T)=>T())}else return v(),new Promise(b=>b({}))},handleSaveEdit:async y=>{s(),d.handleSaveEdit&&await d.handleSaveEdit(y),l({showCachedText:!1})}}})})},Xge=Object.freeze(Object.defineProperty({__proto__:null,default:mD},Symbol.toStringTag,{value:"Module"}));const Jge=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:o,showIcon:s,onClose:l,reportError:u=()=>{},sendInvites:c})=>{const d=me.useIntl();return i||(i=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),o||(o=d.formatMessage({id:"inviteModal_cta"})),g.jsx(ka,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:l},className:ee("invite-modal",e,{success:!!n}),children:g.jsx(kw,{title:i,label:a,messagePlaceholder:r,ctaMessage:o,onClose:l,sendInvites:c,reportError:u})})};const eve=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:o})=>{const s=me.useIntl(),[l,u]=E.useState(YC("showProfile")==="true"||e);E.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=i;return g.jsx(ka,{id:"profile-form-modal",title:t||n||s.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:ee("profile-modal",o,{success:!!t}),maxWidth:700,children:g.jsxs(g.Fragment,{children:[t&&n||r?g.jsxs("div",{className:"intro",children:[t&&n?g.jsx("h3",{children:n}):"",r?g.jsx("p",{children:r}):""]}):null,g.jsx(Dw,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async d=>{var f;try{(f=a==null?void 0:a.functions)!=null&&f.onSuccess&&await a.functions.onSuccess(d)}finally{c()}}}})]})})},xp=eve,tve=Object.freeze(Object.defineProperty({__proto__:null,default:xp},Symbol.toStringTag,{value:"Module"}));const nve=({members:e})=>{const[t,n]=E.useState(!1),r=i=>{const{fullName:a,jobTitle:o,organisation:s,photo:l}=i||{};return g.jsxs(g.Fragment,{children:[g.jsx(Sa,{name:a,src:l}),g.jsx("p",{children:a}),g.jsx("small",{className:"text-medium",children:s?`${o}, ${s}`:o})]})};return g.jsxs("div",{className:"directory-wrapper",children:[g.jsx("ul",{className:"directory",children:e.map(i=>g.jsx("li",{children:g.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),g.jsx(ka,{isOpen:t!==!1,children:t===!1?"":g.jsxs(g.Fragment,{children:[r(t),g.jsx(Qo,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const rve=({email:e,settings:t={}})=>{const{formatMessage:n}=me.useIntl(),r=E.useContext(gn),{myProfile:i,isConnected:a,cannotConnect:o}=t,[s,l]=E.useState(!1),[u,c]=E.useState(!1);return r?e&&i?g.jsx(Ke,{icon:{icon:"info-inside-circle",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_mine"}),forceTooltip:!0,className:"show-email fake-button",children:e}):o?g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_private"}),forceTooltip:!0,className:"show-email fake-button",children:n({id:"member_show_email_private"})}):a?e&&a?g.jsx(g.Fragment,{children:s?g.jsx(Ke,{icon:{icon:"copy",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},className:"show-email copy-button",tooltip:n({id:`member_show_email_tooltip${u?"_copied":""}`}),forceTooltip:!0,"data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"copy-email-click",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{c(!0),setTimeout(()=>{c(!1)},2e3)})},children:e}):g.jsx(Ke,{icon:"email",size:"small","data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"show-email-click",onClick:()=>l(!0),children:n({id:"member_show_email_show"})})}):g.jsx(g.Fragment,{}):g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):g.jsx(g.Fragment,{})};const ive=({author:e,authorCite:t,content:n,member:r,className:i=""})=>g.jsxs("blockquote",{className:ee("testimonial-block",i),children:[g.jsx(Ri,{className:"testimonial",children:n}),r?g.jsx(Ea,{member:r,styling:{size:"large"}}):g.jsxs(g.Fragment,{children:[e&&g.jsx("p",{className:ee("author",{"text-small":!i.includes("new")}),children:e}),t&&g.jsx("p",{className:ee("author-cite",{"text-small":!i.includes("new")}),children:g.jsx("cite",{children:t})})]})]}),ave=E.memo(ive);const ove=({items:e=[],selector:t="",className:n=""})=>{const r=me.useIntl(),[i,a]=E.useState(e);return E.useEffect(()=>{if(e.length)return;let o="";Array(6).fill(0).forEach((u,c)=>{o+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(o)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&g.jsxs(br,{variant:"subtle",className:ee("table-of-contents",n),children:[g.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),g.jsx("nav",{children:g.jsx("ul",{children:i.map(({id:o,text:s})=>g.jsx("li",{children:g.jsx("a",{href:`#${o}`,children:s})},o))})})]})};const wp=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=me.useIntl(),o="timeToComplete_";if(!e||typeof e!="number")return null;const s=c=>{const d=c/60,f=Math.floor(d),h=(d-f)*60,m=Math.round(h),p=`${a.formatMessage({id:`${o}hours`},{time:f})}${f>0&&m>0?", ":""}${a.formatMessage({id:`${o}minutes`},{time:m})}`;return{text:`${f>0?`${a.formatMessage({id:`${o}hours_short`},{time:f})} `:""}${m>0?a.formatMessage({id:`${o}minutes_short`},{time:m}):""}`,ariaText:p}};let{text:l,ariaText:u}=s(e);if(t){const{text:c,ariaText:d}=s(e+t);l=a.formatMessage({id:`${o}range`},{early:l,late:c}),u=a.formatMessage({id:`${o}range_aria`},{early:u,late:d})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),g.jsx("span",{className:ee("time-to-complete",i),"aria-label":u,children:l})};const sve=({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",g.jsx(uo,{...n,className:ee("banner",e),image:{...t,aspect:"banner"}})):null;const lve=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],uve=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:o={eyebrow:!1,title:!1,text:!1},cta:s,children:l})=>{var m,p;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],d={eyebrow:"small",title:"h1",text:"p"},f={};c.forEach(y=>{if(!t[y]){f[y]=!1;return}if(!o[y]){if(typeof t[y]=="object"){f[y]=t[y];const{text:v,element:b}=t[y];if(b&&lve.includes(b.toLowerCase()))return;f[y]={text:v,element:d[y]};return}f[y]={text:t[y],element:d[y]}}});const h=s&&s.text&&s.link;return h&&s.link[0]==="#"&&(s.props||(s.props={}),s.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(s.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),g.jsx(po,{className:ee("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&i==="normal"&&f.eyebrow&&f.title}),children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:v,element:b=""}=f[y];return y==="text"?g.jsx(Qo,{overrideType:"text-only",className:"text",children:v},y):E.createElement(b,{key:y,className:y},v)}return null}),l,h&&g.jsx(Ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:s.link,...s.props,className:ee({new:r==="subtle",[(m=s.props)==null?void 0:m.className]:(p=s.props)==null?void 0:p.className}),children:s.text})]}),n&&g.jsx(uo,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},cve=E.memo(uve);const dve=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),g.jsx(po,{className:ee("custom-content-banner",t,r,{"has-image":e}),style:i,children:g.jsx("div",{className:"content-slim",children:n})})};const fve=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?g.jsx(Qo,{children:n}):n;return g.jsxs(po,{className:ee("highlight-section",t),children:[r&&g.jsx("div",{className:ee("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:g.jsx(uo,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),g.jsx("div",{className:ee("highlight-container highlight-content-wrapper",{"no-image":!r}),children:g.jsx("div",{className:ee("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:g.jsx("div",{className:"content-default",children:i})})})]})},hve=E.memo(fve);const pve=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:g.jsxs("aside",{className:ee("marketing-block",e),children:[n&&g.jsx("p",{className:"title",children:n}),r&&g.jsx("p",{children:r}),t&&g.jsx(Ke,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),mve=({type:e,data:t})=>{const n=me.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:o,pill:s,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const d=i&&J0(i);return g.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&g.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(c&&!a||o)return g.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Dv(c)});if(s)return g.jsx(Fi,{variant:s==="free"?"subtle":"highlighted",className:s,"data-testid":"course-type",children:s});if(l||u){const d=u&&J0(u);return g.jsxs("ul",{className:"details",children:[l&&g.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&g.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},gve={title:66,text:3e3,secondaryText:1e3,partner:34},hh={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"}},vve=({data:e,cta:t,link:n,gtmContext:r})=>{var p,y;const i=me.useIntl(),[a,o]=E.useState({loading:!1,registered:e.registered||!1});E.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:s,startDate:l,dateHasPassed:u,pill:c,slug:d}=e,f=e.contentType;let h="";if((p=hh[f])!=null&&p.gtmEvent&&(h=hh[f].gtmEvent),l&&u)return n?g.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?g.jsx(Ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_cta_people"})}):null;const m=["communityPage","microcourse","event"];if(t&&t.onClick&&m.includes(f)&&c!=="premium"){const v=a.loading||a.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),b=async _=>{var T;if(_.preventDefault(),_.stopPropagation(),window&&((T=window.dataLayer)==null||T.push({event:"gtm.click","gtm.element":n,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":n,EventType:`${r}-${f}-register-click`,EventContext:`${r}Page-${f}: ${d}`})),!(v||!t||!t.onClick)){o(C=>({...C,loading:!0}));try{const C=await t.onClick(e);o(C==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return g.jsx("p",{className:ee("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:g.jsx(Ke,{onClick:b,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${f}: ${d}`,"data-gtm-event-type":`${r}-${f}-register-click`,"data-testid":"in-card-button",children:s||i.formatMessage({id:`card_cta_${f}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function yve({buildMemberData:e,communitySlug:t}){const n=me.useIntl(),r=E.useContext(gn),[i,a]=E.useState({count:"...",isMember:!1,memberType:""});return E.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(o=>{if(!o)return;const{membersCount:s,role:l="",pagination:u}=o;let c=0;s?c=s:u!=null&&u.total&&(c=u==null?void 0:u.total),a({count:c.toString(),isMember:!!l,memberType:l})})},[t,e]),g.jsxs("span",{className:"member-information",children:[i.isMember&&g.jsx(Fi,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),g.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const d5=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:o="Carousel",handleCardClick:s,meta:l})=>{var k,B;const u=me.useIntl(),c=E.useContext(gn),d=!!(c!=null&&c.id),{isTabbable:f=!0,setFocus:h=!1}=l||{},m=E.useRef(null),[p,y]=E.useState({data:null,isLoading:!0});E.useEffect(()=>{n(i,d).then(H=>{y({data:H,isLoading:!1})}).catch(()=>y(H=>({...H,isLoading:!1})))},[i,d,n]);const{data:v,isLoading:b}=p;if(b||!v)return g.jsx(Vr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:s});const{contentType:_}=v;if(!_||!hh[_])return g.jsx(Vr,{element:"li",className:"card-wrapper"});const{basePath:T="",className:C,length:x,gtmEvent:w}=hh[_];let I=f&&v.slug?`${T}${v.slug}`:!1;f&&v.slug&&(v.slug.slice(0,4)==="http"||v.slug.slice(0,2)==="//"||v.slug.slice(0,6)==="mailto"||v.slug.slice(0,3)==="tel")&&(I=v.slug);const O=H=>{if(I){H.preventDefault(),H.stopPropagation();const $=H.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":$,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":$,EventType:`${o}-CarouselCard`,EventContext:`${w}-click`}),window.location.href=$}},M={...gve,...x};let R={className:"card"},D={};return I&&(D={href:I,className:"gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},v.openInNewTab&&(D.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),h&&(R={...R,tabIndex:"0"},(k=m==null?void 0:m.current)==null||k.focus(),(B=m==null?void 0:m.current)==null||B.scrollIntoView({behavior:"smooth"})),g.jsx("li",{className:ee("card-wrapper text-medium",C,t,{"has-link":I,"no-link":!I,"has-image":v.banner}),"data-testid":`${_}-card`,children:g.jsxs("div",{...R,ref:m,"data-url":I,children:[g.jsx(QC,{className:"card-label",contentType:_,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),_==="communityPage"&&(v==null?void 0:v.createdAt)&&qD(v==null?void 0:v.createdAt,60)&&g.jsx(Fi,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&g.jsx(Fi,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):WC(v.startDate)}),v.banner?g.jsxs("p",{className:"img",children:[v.registered&&g.jsx(Fi,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),g.jsx(uo,{image:{...v.banner,description:""}})]}):C==="people"?g.jsx(Sa,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&g.jsx(Bv,{contributors:{data:v.contributors},styling:{size:"small",showGap:C!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(_)?u.formatMessage({id:`card_contributors_${_}`}):void 0,"data-testid":"contributors"}),v.partner&&g.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?u.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):hl(v.partner[0],M.partner)}),["title","text","secondaryText"].map(H=>{const $=v[H];if(!$)return null;const F=HC(H),ne={key:H,className:F,"data-testid":F},J={wrapper:"p",forceWrapper:!0,forceInline:!0},P=hl($,M[H]);return["title","text"].includes(H)&&I?(J.wrapper="a",g.jsx("p",{...ne,children:g.jsx(Ri,{options:J,...D,children:P})})):g.jsx(Ri,{options:J,...ne,children:P})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&g.jsx(yve,{communitySlug:i.slug||v.slug,buildMemberData:r}),g.jsx(mve,{type:C||"",data:v}),g.jsx(vve,{data:v,cta:a,link:I||"",gtmContext:o})]})})};const gD=({cards:e,cardTypes:t,className:n="",...r})=>g.jsx("ul",{className:ee("card-block",n),children:e.map((i,a)=>{const o=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return g.jsx(d5,{id:o,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},o)})}),bve=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),o=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:o}},Eve=({id:e,title:t})=>{const n=me.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:o="medium",link:s}=t;return E.createElement(i,{className:ee("title",a,o,{"highlighted-title":a==="highlighted"}),children:g.jsxs(g.Fragment,{children:[r,s&&g.jsx("a",{href:s,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 Y0={fourCards:1024,threeCards:769,twoCards:480};let vd=null,Z0=null;const _ve=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:o,...s})=>{const l=me.useIntl(),u="carousel_pagination_",[c,d]=E.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:h}=c,[m,p]=E.useState({currentPage:0,loadedPages:[0]}),{currentPage:y,loadedPages:v}=m,[b,_]=E.useState(""),T=t.length,C=Math.ceil(T/f),x=E.useRef(null),w=lo(!0,!0,x==null?void 0:x.current);E.useEffect(()=>{let k=1;w&&(w>=Y0.fourCards?k=4:w>=Y0.threeCards?k=3:w>=Y0.twoCards&&(k=2),k>T&&(k=T)),d(B=>({...B,cardsPerPage:k,isLoading:!1}))},[w,T]);const I=(k="next")=>{Z0&&clearTimeout(Z0);let B=y;if(typeof k=="string")if(k==="next")if(y<C-1)B=y+1;else return;else if(y>0)B=y-1;else return;else B=k;_(""),p($=>({...$,currentPage:B,loadedPages:[...new Set([...v,B])]}));const H=()=>{const $=B*c.cardsPerPage,F=$+c.cardsPerPage;return t.slice($,F).length};Z0=setTimeout(()=>{_(l.formatMessage({id:`${u}ariaLive${typeof k=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof k=="string"?k:"next"}`}),slide:typeof k=="string"?1:k+1,count:H()}))},500)},O=k=>{vd=k.touches[0].clientX},M=k=>{if(vd===null)return;const B=k.touches[0].clientX,H=vd-B;H>5?I("next"):H<-5&&I("previous"),vd=null},R={"--width":`${w||0}px`,"--total-cards":T,"--cards-per-page":f,"--page":y};if(h)return g.jsx(bh,{layout:`carousel${i?"-with-title":""}`});const D=(k,B)=>{var $;let H=null;return($=k==null?void 0:k.sys)!=null&&$.id?H=`card-${k.sys.id}`:k!=null&&k.slug?H=`card-${k.slug}`:[n[B],k.contentType].includes("customCard")&&(H=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${B}`),H};return g.jsxs("section",{ref:x,className:ee("carousel-wrapper",a),"data-testid":"carousel",children:[g.jsx(Eve,{id:e,title:i}),g.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:M,style:R,"data-testid":"carousel-list",children:t.map((k,B)=>{let H=D(k,B);const{inView:$,isLoaded:F}=bve(B,f,y,v);return H&&($||F)?g.jsx(d5,{id:H,card:{...k,contentType:n[B]},buildCardData:r,gtmContext:o,meta:{isTabbable:$},...s},H):(H=H||`${e}-card-${B}`,g.jsx(Vr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},H))})}),C<=1?null:g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[g.jsx("li",{className:"arrow previous",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),I("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:y<=0})}),[...Array(C)].map((k,B)=>g.jsx("li",{"data-testid":"carousel-controls-button",children:g.jsx("button",{className:ee("page-indicator",{selected:B===y}),onClick:H=>{H.preventDefault(),H.stopPropagation(),I(B)},children:g.jsx(xt,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:B+1,total:C})})})},`page-indicator-${B}`)),g.jsx("li",{className:"arrow next",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),I("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:y>=C-1})})]}),g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},Tve=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:o,cards:s,cardsTypes:l},u)=>{const c=a?window.btoa(a):`carousel-${u}`,d=u===e.length-1;return t?g.jsxs(E.Fragment,{children:[g.jsx(bh,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:g.jsx(di,{})]},`placeholder-${c}`):g.jsxs(E.Fragment,{children:[g.jsx(_ve,{cards:s,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:o},...i}),d?null:g.jsx(di,{})]},`carousel-${c}`)});const Cve=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:o,isPrivate:s,slug:l}=n;let u={};return l&&(u={onClick:d=>{l&&(d.preventDefault(),d.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),E.createElement(e,{className:ee("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ee("img",{private:s,"no-image":!i}),children:i&&g.jsx(uo,{image:i})}),g.jsxs("div",{className:"content",children:[a&&g.jsx("p",{className:"title text-medium",children:a}),o&&g.jsx("p",{className:"text text-medium",children:o})]})]})})};const xve=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:o={},className:s=""})=>{const l=me.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=o;return E.createElement(e,{className:ee("course-progression",s,{"highlight-percentage":c,"has-circle-graph":a==="circle"}),children:g.jsxs(g.Fragment,{children:[g.jsx(Mv,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}}),g.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:d=>g.jsx("strong",{children:d}),number:u})}),u<100&&i&&g.jsx(wp,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})})]})})};const vD=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>E.createElement(e,{className:ee("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yD=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const o=me.useIntl(),s=gh(`lessonType_${i}`)?o.formatMessage({id:`lessonType_${i}`}):zC(i||"");return g.jsxs("small",{className:ee("content-type",{[e]:e!=="default"}),children:[g.jsx("span",{className:ee("type",n),children:s})," ",t>0&&!r&&g.jsx(wp,{time:t})," ",a?g.jsx("span",{className:"additional",children:a}):null]})};const wve=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:o,slug:s,timeLeft:l,title:u},quizScores:c})=>{const d=me.useIntl(),f="courseStructure_",h=u.toLowerCase().includes("course conclusion");return g.jsxs(vh,{className:"course-structure",label:g.jsxs(g.Fragment,{children:[g.jsxs("small",{children:[d.formatMessage({id:`${f}section${h?"_end":""}`},{number:a})," ",!r&&o>=0&&g.jsx("span",{className:"time",children:i&&l===0?d.formatMessage({id:`${f}time_completed`}):g.jsx(wp,{time:o,appendedText:i?d.formatMessage({id:`${f}time_left`}):""})})]}),g.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[g.jsx("p",{children:n}),g.jsx("ol",{children:e&&e.length>0&&e.map(({completed:m,completionTime:p,contentType:y,icon:v,image:b,isIntroduction:_,optional:T,slug:C,subsectionId:x,title:w,type:I})=>{const O=i&&t||_,M={};return b&&(M.style={"--image":`url(${b})`}),g.jsx("li",{className:ee({article:y===Du.ARTICLE,discussion:y===Du.DISCUSSION,quiz:y===Du.QUIZ,completed:m&&y===Du.ARTICLE,locked:!O}),...M,children:g.jsx(co,{href:O?`/microcourses/en/${s}/${C}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${UC(w)}`,gtmType:"article-click",children:g.jsxs(g.Fragment,{children:[g.jsx(vD,{sectionId:a,subsectionId:x,title:w,className:"course-title"})," ",g.jsx(yD,{completionTime:p,icon:v,optional:T,type:I,children:c&&c[C]&&g.jsx("span",{className:"quiz-score",children:`${c[C]}%`})})]})})},C)})})]})};const Ave=({isComplete:e=!1,onClick:t,...n})=>{const r=me.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),g.jsx(Ke,{...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:ee("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Sve=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),DC=[{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 yd="notFoundError_",kve=()=>{const e=me.useIntl(),t=[];return DC.forEach((n,r)=>{n.title=e.formatMessage({id:`${yd}post_${r+1}`}),t.push("solutionArticle")}),g.jsxs(sD,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:g.jsxs(po,{children:[g.jsx(gD,{cards:DC,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),g.jsx(Ke,{href:"/solution-articles/",children:e.formatMessage({id:`${yd}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[g.jsx("h1",{children:e.formatMessage({id:`${yd}title`})}),g.jsx("p",{children:e.formatMessage({id:`${yd}text`})})]})};exports.ASSETS_URL=Hi;exports.ActionBar=V3;exports.ActionButton=bc;exports.ActivitiesFeed=dI;exports.ActivitySection=Qge;exports.ActivityType=Bl;exports.AddPost=u5;exports.Badge=f3;exports.BadgeScope=Rn;exports.Badges=h3;exports.BadgesContext=Nv;exports.BadgesProvider=n3;exports.Banner=sve;exports.BannerSection=cve;exports.Breadcrumbs=II;exports.Buckets=sO;exports.Button=Ke;exports.ButtonWrapper=Fl;exports.COURSE_CONTENT_TYPES=Du;exports.CacheProvider=r3;exports.Card=d5;exports.CardBlock=gD;exports.Carousel=Tve;exports.CharacterLimit=Jv;exports.Checkbox=ey;exports.CollapsibleSection=vh;exports.Columns=K3;exports.CommunityDetails=DN;exports.ConnectionCta=p3;exports.ConnectionDirectionType=Fv;exports.ConnectionStatusType=Rv;exports.ContactFooter=MU;exports.ContactForm=Sw;exports.ContentTypeLabel=QC;exports.Contributors=Bv;exports.ConversationContext=Cp;exports.CookieBanner=Pw;exports.CourseProgression=xve;exports.CourseStructure=wve;exports.CustomContentBanner=dve;exports.CustomEvents=bn;exports.DELETED_USER_ID=gc;exports.Directory=nve;exports.DiscussionContentType=at;exports.DiscussionConversation=cD;exports.DiscussionForm=l1;exports.DiscussionFormCard=fD;exports.DiscussionFormModal=mD;exports.DiscussionPost=u1;exports.DiscussionThread=pD;exports.DiscussionType=fi;exports.Divider=di;exports.DownloadSection=IU;exports.EMAILS=Us;exports.EditSection=RU;exports.EmailHelperTextBox=Y3;exports.EmptyStateBox=Ui;exports.EnrichedUrl=Qv;exports.FeatureFlags=o3;exports.Filters=q3;exports.FlagsProvider=a3;exports.Footer=ky;exports.Form=Zi;exports.Formatting=ae;exports.Fragment=Ir;exports.FullWidthSection=po;exports.GET_STREAM_USER_PREFIX=X0;exports.GlobalProviders=yO;exports.Header=l5;exports.HelperTextBox=JC;exports.HiddenFromScreenReaders=mh;exports.HideShowTextBox=e3;exports.HighlightSection=hve;exports.HighlightedTextBox=br;exports.INVALID_TOKEN=VC;exports.IconBulletedList=cO;exports.ImageContainer=rO;exports.IntlProvider=s3;exports.InviteForm=kw;exports.InviteModal=Jge;exports.JoinButton=Uv;exports.Label=Af;exports.LanguageContext=Iv;exports.LanguageSwitcher=RI;exports.LessonName=vD;exports.LessonType=yD;exports.LikesButton=L3;exports.LikesFeed=H3;exports.LikesModal=U3;exports.Link=co;exports.LoadMore=Vc;exports.LoadingBlock=m3;exports.LoadingPlaceholder=Vr;exports.LoadingState=bh;exports.Logo=Xv;exports.LogoSection=FU;exports.MEMBERS_PER_PAGE=lD;exports.MENTION_REGEX=qC;exports.MarkCompleteButton=Ave;exports.MarkdownText=Qo;exports.MarketingBlock=pve;exports.Marks=Pi;exports.Member=Ea;exports.MembersList=uD;exports.Modal=Lv;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=UD;exports.NUMBER_OF_USERS=HD;exports.NarrowCard=Cve;exports.NavigationMenu=W3;exports.NotFoundError=kve;exports.Overlay=ka;exports.OverlayContext=Pv;exports.OverlayProvider=c3;exports.PageHeading=d3;exports.PageLayout=sD;exports.Password=Z3;exports.PasswordForm=TU;exports.PasswordRules=tx;exports.Pill=Fi;exports.Poll=dD;exports.Popover=ZC;exports.Portal=Ml;exports.ProfileForm=Dw;exports.ProfileImageChange=Aw;exports.ProfileModal=xp;exports.ProfileModalLauncher=c5;exports.ProfilePicture=Sa;exports.ProgressBar=Mv;exports.ProgressTracker=aO;exports.PublishArticleForm=wU;exports.Rating=QI;exports.RepliesFeed=j3;exports.ResponsesHeading=hD;exports.ResponsiveImage=uo;exports.ResultsVisibility=fh;exports.ReturnToNavButton=oO;exports.RichTextEditor=Sy;exports.STORAGE_KEYS=kv;exports.SearchForm=Nw;exports.ShareLink=z3;exports.ShareLinks=jI;exports.ShowEmail=rve;exports.SignupForm=NU;exports.Span=ng;exports.StatusBanner=ml;exports.TableOfContents=ove;exports.Tabs=HI;exports.Tags=Cge;exports.TestimonialBlock=ave;exports.TimeToComplete=wp;exports.Toggle=EU;exports.Tooltip=os;exports.TopLevelPage=BU;exports.UUID_V4_REGEX=vc;exports.UserContext=gn;exports.UserProvider=l3;exports.VisuallyHidden=xt;exports.addAriaProps=D3;exports.basicReducer=Pl;exports.camelCaseToDashCase=HC;exports.checkIntlPathExists=gh;exports.courseDiscussionRepliesFeedMock=hI;exports.enrichPostCategories=Zv;exports.generateConditions=Dd;exports.generateCssIcon=zD;exports.getAuthorData=Ll;exports.getCharacterLimitProps=G3;exports.getLongDate=Dv;exports.getMember=Eh;exports.getPostBody=Yv;exports.getShortDate=WC;exports.getValueLength=_h;exports.headerData=zc;exports.likesResponseMock=OI;exports.mapGetStreamData=Sve;exports.pageReady=KC;exports.passwordValidator=eg;exports.repliesFeedMock=fI;exports.supportedLanguages=_d;exports.toCamelCase=UC;exports.toCapitalisedCase=jD;exports.toSentenceCase=zC;exports.transformSlugs=sg;exports.useAutoResize=FC;exports.useBadges=t3;exports.useCurrentPath=MC;exports.useEffectAfterMount=pl;exports.useElementWidth=lo;exports.useOverlay=u3;exports.useScrollListener=LC;exports.useScrollToHash=Av;exports.useTooltips=Sv;exports.useUser=yh;
|
|
571
|
+
`]))),yge={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};E.createContext({notificationsData:yge});function bge(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,o=a===void 0?"":a,s=e.subscriberId,l=s===void 0?"":s,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,h=e.notificationClickHandler,m=e.primaryActionClickHandler,p=e.secondaryActionClickHandler,y=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,_=e.noNotificationsComponent,T=e.loaderComponent,C=e.tabBadgeComponent,x=e.headerRightComponent,w=e.hideAvatar,I=w===void 0?!1:w,O=e.hideInbox,M=e.hideToast,R=e.theme,D=e.themeType,k=D===void 0?"light":D,B=e.pagination,H=B===void 0?!0:B,$=e.pageSize,F=e.popperPosition,ne=F===void 0?"bottom":F,J=e.showUnreadCountOnTabs,P=J===void 0?!0:J,A=e.host;c&&(l=c);var Y=E.useState(!1),L=Y[0],U=Y[1],V=E.useState(),z=V[0],j=V[1],le=E.useState({storeData:{},count:0}),Q=le[0],ie=le[1],se=E.useState(""),te=se[0],Ae=se[1],De=E.useState(!1),ve=De[0],ce=De[1];E.useEffect(function(){var Oe=new iQ(n,{pageSize:$,tenantID:i,stores:d,host:A});return j(Oe),Oe.emitter.on("sync_notif_store",function(){var Le=Oe.feed.data;ie({storeData:(Le==null?void 0:Le.stores)||{},count:(Le==null?void 0:Le.unseenCount)||0,hasNext:Le==null?void 0:Le.hasNext,initialLoading:Le==null?void 0:Le.initialLoading,activeStoreId:Le==null?void 0:Le.activeStoreId}),Ae(Le==null?void 0:Le.activeStoreId)}),Oe.emitter.on("new_notification",function(Le){gge({notificationsData:Le,toastProps:f})}),function(){Oe.emitter.all.clear()}},[]),E.useEffect(function(){L&&l&&z&&z.feed.markAllSeen()},[L,l,z]),E.useEffect(function(){if(!(!l||!z))return ie({storeData:{},count:0}),z.identifyUser(o,l),z.feed.fetchNotifications(),function(){z.resetUser()}},[l,z]);var ye=k==="dark"?rD(Qme,R):R||{};return E.createElement(tD.Provider,{value:ye},E.createElement(eD.Provider,{value:{workspaceKey:n,notificationsData:Q,setNotificationsData:ie,notificationClickHandler:h,primaryActionClickHandler:m,secondaryActionClickHandler:p,bellComponent:y,badgeComponent:v,notificationComponent:b,noNotificationsComponent:_,tabBadgeComponent:C,headerRightComponent:x,toggleInbox:U,inbox:z,loaderComponent:T,pagination:H,hideAvatar:I,activeStore:te,setActiveStore:Ae,changingActiveStore:ve,setChangingActiveStore:ce,showUnreadCountOnTabs:P,themeType:k}},!O&&E.createElement(oge,{openInbox:L,toggleInbox:U,popperPosition:ne}),!M&&E.createElement(mge,f)))}const Lt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const o=`logged${e?"In":"Out"}`;return t>=n[a][o]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===gr.ACCOUNT&&t===!1&&n[gr.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Lt.handlerCalled[e]&&a-Lt.handlerCalled[e]<500)return;Lt.handlerCalled[e]=a;let o=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(s=>{s===e||n[s]===!1||o.push({type:`menus.${s}`,value:!1})});else{let s=null;switch(e){case gr.SITE:s=document.querySelector("#header .menu-button"),s||(s=document.querySelector("#navigation .navigation-button"));break;case gr.SEARCH:s=document.querySelector("#header .toggle-search-button");break;case gr.ACCOUNT:s=document.querySelector("#header .account-button");break;default:return}s&&s.focus()}r(o)},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 i=OC(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Lt.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let o,s;switch(e){case gr.SITE:if(n){const u=Lt.findFirstChild(t.current.children,"className","has-submenu parent"),c=Lt.findFirstChild(u.children,"id",gr.SITE);o=Lt.findFirstChild(c.children,"href")}else o=Lt.findFirstChild(t.current.children,"href");break;case gr.ACCOUNT:if(s=Lt.findFirstChild(t.current.children,"className","account"),!s||!s.children)return;o=Lt.findFirstChild(s.children,"href");break;default:return}o&&(i([{type:`focusElements.${e}.${a}`,value:o.attributes.href.value}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Lt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Lt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Lt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Lt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zc={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},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:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},dh=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const o=me.useIntl(),s=OC(zc,e);if(!s||s.onlyShow&&(s.onlyShow==="logged-in"&&!t||s.onlyShow==="logged-out"&&t))return null;const l="doTrack"in s,u=a===null?l?s.doTrack:!0:a,c=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;s.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let f=!1;if(s.href){let _=s.gtmType||`${e}-click`;if(_.includes(".")){const T=_.split("."),C=T[T.length-2];_=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}f={href:s.withReturnTo?`${s.href}?returnTo=${window.location.pathname}`:s.href},u&&(f={...f,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),c&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...s.props||{}})}const h=s.order&&s.order[0]&&s[s.order[0]],m=h&&s[s.order[0]].order,p=f&&window.location.pathname===s.href;let y={},v={},b={};if(p&&(y={...y,"aria-current":"page"}),h){const _=s.menuId||e,T={onClick:C=>Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]}),onFocus:()=>Lt.events.onFocus({id:_}),onBlur:()=>Lt.events.onBlur({id:_,callback:i}),onMouseLeave:()=>Lt.events.onBlur({id:_,callback:i}),onMouseEnter:()=>Lt.events.onMouseEnter({id:_,callback:i})};v={...T,id:_===gr.SITE?gr.SITE:gr.ACCOUNT},n&&(m&&(b={...T,className:"navigation-button",onKeyPress:C=>{C.key==="Enter"&&Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),m||(v={...v})}return g.jsxs("li",{className:ee({[s.className]:s.className,"has-submenu":h,parent:m,active:p}),...y,children:[f?E.createElement(c?Ke:"a",f,o.formatMessage({id:d})):n&&s.order&&m?g.jsxs("button",{...b,children:[o.formatMessage({id:d}),g.jsx(xt,{children:o.formatMessage({id:`header_menu_${r[gr.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:d}),s.order&&g.jsx("ul",{...v,children:s.order.map(_=>{if(!s[_])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return s[_].order?g.jsxs("li",{className:ee({[s[_].className]:s[_].className}),children:[o.formatMessage({id:`${d}_${_}`}),g.jsx("ul",{children:s[_].order.map(C=>g.jsx(dh,{id:`${e}.${_}.${C}`,...T},C))})]},_):g.jsx(dh,{id:`${e}.${_}`,...T},_)})})]},e)};const Ege=({headerIsVisible:e,locale:t})=>{const n=me.useIntl();return g.jsx("div",{id:"language-unavailable-message",className:ee({visible:e}),children:g.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>g.jsx("a",{href:"/home",children:r})})})})};const q0={height:67,height_desktop:83,additional_message_height:40};var gr=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gr||{});const l5=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i,novuApplicationIdentifier:a})=>{var B,H;const o=me.useIntl(),s=E.useContext(gn),l=lo(!0,!0),u=s&&typeof s.id=="string",c=E.useMemo(()=>Lt.getIsDesktopVersion(u,l),[u,l]),d=Op("suprsend-notifications")&&i,f=(H=(B=s==null?void 0:s.externalsMetadata)==null?void 0:B.suprsend)==null?void 0:H.subscriberId,h=Op("novu-notifications")&&a,m=Op("language-switcher")&&n,[p,y]=E.useState(!1);E.useEffect(()=>{t&&m&&(s!=null&&s.id)&&(s==null?void 0:s.locale)!==vl&&y(!0)},[t,m,s]);const[v,b]=E.useReducer(Pl,{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:_,menus:T,focusElements:C}=v,x=E.useRef(v);E.useEffect(()=>{x.current=v},[v]),LC({scrollPosition:p?q0[`height${c.navigation?"_desktop":""}`]+q0.additional_message_height:q0[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!0,$,b)},scrollDown:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!1,$,b)}}});const w=($,F,ne=!1)=>{Lt.handleMenus({id:$,value:F,menus:x.current.menus,dispatch:b,forceHandle:ne})},I=E.useRef(null),O=$=>{$.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(F=>{x.current.menus[F]&&w(F,!1,!0)})};E.useEffect(()=>{var $;return($=document.getElementById("header"))==null||$.addEventListener("keydown",O),()=>{var F;(F=document.getElementById("header"))==null||F.removeEventListener("keydown",O)}},[]),pl(()=>{T["site-navigation"]&&Lt.autoFocus({menu:"site-navigation",navigationRef:I,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["site-navigation"]]),pl(()=>{T["account-navigation"]&&Lt.autoFocus({menu:"account-navigation",navigationRef:I,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["account-navigation"]]);const M=g.jsxs(g.Fragment,{children:[!c.search&&g.jsx("button",{className:"search toggle-search-button",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("search",!T.search)},children:g.jsx(xt,{children:o.formatMessage({id:`header_search_${T.search?"hide":"show"}`})})}),g.jsx(Nw,{id:"global-search",handleToggle:{searchIsOpen:T.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),R=g.jsx("button",{className:"earth icon language-switcher-button","aria-label":"Language switcher",onClick:$=>{$.preventDefault(),$.stopPropagation(),r?r():y(!p)},children:g.jsx(xt,{children:o.formatMessage({id:"header_language_switcher"})})}),D=[d&&f&&g.jsx("div",{id:"suprsend-notifications",children:g.jsx(bge,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:{badge:{backgroundColor:"#C34141"},header:{markAllReadText:{color:"#4F43BA"}},notification:{unseenDot:{backgroundColor:"#C34141"},container:{unreadBackgroundColor:"white",readBackgroundColor:"white",hoverBackgroundColor:"#F0F5FF",borderColor:"#D7E0EF"},headerText:{color:"#151921"},bodyText:{color:"#151921"},subtext:{color:"#404A61"},actions:[{container:{backgroundColor:"#4F43BA"}},{container:{borderColor:"#4F43BA",color:"#4F43BA",backgroundColor:"white"}}]}}})}),h&&(s==null?void 0:s.id)&&g.jsx("div",{className:"novu-notifications",children:g.jsx(xZ,{applicationIdentifier:a,subscriberId:s==null?void 0:s.id,routerPush:$=>window.location.href=$,backendUrl:"https://eu.api.novu.co",socketUrl:"https://eu.ws.novu.co",appearance:{variables:{colorBackground:"#FFFFFF",colorForeground:"#151921",colorPrimary:"#4F43BA",fontSize:"24px"},elements:{notificationPrimaryAction__button:{borderRadius:"16px"}}}})})],k=g.jsxs(g.Fragment,{children:[!c.navigation&&g.jsx("button",{className:"menu-button gtm-trackable",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("site-navigation",!T["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":T["site-navigation"],"aria-controls":"site-navigation",children:g.jsx(xt,{children:o.formatMessage({id:`header_menu_${T["site-navigation"]?"hide":"show"}`})})}),g.jsx("ul",{ref:I,id:"navigation",hidden:c.navigation||T["account-navigation"]?!1:!T["site-navigation"],"data-showing":!c.navigation&&T["account-navigation"]?"account":"default",children:zc.order.map($=>g.jsx(dh,{id:$,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":T["site-navigation"],"account-navigation":T["account-navigation"]},callback:w},$))})]});return s&&s.isLoading?null:g.jsxs(g.Fragment,{children:[g.jsxs("nav",{id:"header",className:ee({"logged-in":u,"logged-out":!u,visible:_}),children:[g.jsx(xt,{element:"a",href:"#content-of-page",children:o.formatMessage({id:"header_skip"})}),g.jsx(Xv,{variant:"monochrome"}),e?g.jsxs(g.Fragment,{children:[c.navigation?g.jsxs(g.Fragment,{children:[k,M,m&&R,D]}):g.jsxs(g.Fragment,{children:[M,m&&R,D,k]}),u?g.jsxs("button",{className:"account-button",onClick:$=>Lt.events.onClick($,{id:"account-navigation",callback:w,isOpen:T["account-navigation"]}),onMouseEnter:()=>Lt.events.onMouseEnter({id:"account-navigation",callback:w}),onMouseLeave:()=>Lt.events.onBlur({id:"account-navigation",callback:w}),"aria-haspopup":"true","aria-expanded":T["account-navigation"],"aria-controls":"account-navigation",children:[g.jsx(xt,{children:o.formatMessage({id:`header_account_${T["account-navigation"]?"hide":"show"}`})}),g.jsx(Sa,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):g.jsx("ul",{className:"sign-in-buttons",children:zc.buttons.order.map($=>g.jsx(dh,{id:`buttons.${$}`},$))})]}):m&&R]}),p&&g.jsx(Ege,{headerIsVisible:_,locale:(s==null?void 0:s.locale)||vl}),g.jsx("hr",{id:"content-of-page"}),g.jsx("div",{className:ee("overlay",{open:T["site-navigation"]||T["account-navigation"]||!c.search&&T.search})})]})};const _ge=()=>{const e=me.useIntl();return g.jsxs(g.Fragment,{children:[g.jsx(l5,{}),g.jsx("div",{id:"content",children:g.jsx(Ui,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),g.jsx(ky,{})]})},sD=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:o="",locale:s="en",suprSendWorkspaceKey:l,novuApplicationIdentifier:u})=>{const c=me.useIntl(),{navigation:d=!0,footer:f=!0}=i,{background:h="default",variant:m="default",circle:p="default",modal:y="default"}=a,v=MC(),[b,_]=E.useState(""),T=O=>{const{detail:{message:M}}=O;_(M)};E.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[v]);const C=Ed(e,{locale:s}),x=Ed(t,{locale:s}),w=Ed(n,{locale:s}),I={};return h!=="default"&&(I[h]=!0),m!=="default"&&(I[m]=!0),p!=="default"&&(I[p]=!0),g.jsx(DD.ErrorBoundary,{onError:r,fallback:g.jsx(_ge,{}),children:g.jsxs(E.Suspense,{fallback:null,children:[g.jsxs("div",{id:"wrapper",className:ee(o,I,{"has-footer":f}),"data-too-small":c.formatMessage({id:"pageLayout_browserTooSmall"}),children:[g.jsx(l5,{suprSendWorkspaceKey:l,novuApplicationIdentifier:u,showNavigation:d}),g.jsxs("main",{id:"content-wrapper",children:[x&&g.jsx("div",{className:ee("additional-content prepended",{"large-modal":y==="large"}),children:x}),E.createElement(h==="bold"?Lv:"div",{id:"content",children:C,className:ee({"large-modal":y==="large"})})]}),w&&g.jsx("div",{className:"additional-content appended",children:w}),f&&g.jsx(ky,{}),g.jsx(Pw,{})]}),b&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},AC={default:"tags_",headerTopics:"header_topics_topics_"},W0={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"},Tge={getTagDetails:e=>{if(e.includes("topic_")){if(e=W0.topic[e.replace("topic_","")],e){const t=zc.topics.topics[e].href;return t?{id:e,href:t,text:`${AC.headerTopics}${e}`}:null}return null}return W0[e]?(e=W0[e],{id:e,text:`${AC.default}${e}`}):null}};const Cge=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:o="tags"})=>{const s=me.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Tge.getTagDetails(u);c&&l.push(c)}),l.length<1?null:g.jsx("ul",{className:ee("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=s.formatMessage({id:u.text});return g.jsx("li",{children:u.href&&r?g.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":o,children:c}):c},u.id)})})};const lD=25,xge=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:o,gtmContext:s="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=me.useIntl(),h="membersList",m=E.useContext(gn),[p,y]=E.useState(!1);return e.length===0&&!c?null:g.jsxs("div",{className:ee("members-list",d),children:[u?g.jsxs("h1",{children:[f.formatMessage({id:h}),g.jsx("span",{className:"count",children:t})]}):g.jsx(g.Fragment,{}),g.jsxs("ul",{children:[r?g.jsxs("li",{children:[g.jsx(Ea,{member:m,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:n||""},{scope:Rn.Platform,area:"all"}]}}),g.jsx(co,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),y(!0)},children:f.formatMessage({id:`${h}_profile`})})]}):g.jsx(g.Fragment,{}),e.map((v,b)=>m&&v.id===m.id?g.jsx(g.Fragment,{}):g.jsxs("li",{children:[g.jsx(Ea,{member:v,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:n||""},{scope:Rn.Platform,area:"all"}]}}),v.isAdmin&&g.jsx(Fi,{children:f.formatMessage({id:`${h}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,lD))].map((v,b)=>g.jsx("li",{children:g.jsx(bh,{layout:"member"})},b)):g.jsx(g.Fragment,{})]}),i&&g.jsx(Vc,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),o?g.jsx(xp,{form:o,showModal:p,content:{title:f.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{y(!1)}}}):g.jsx(g.Fragment,{})]})},uD=xge,wge=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=me.useIntl();return t?g.jsx("small",{children:ai(i.formatMessage,`${e}explainer`,n,"action",{a:a=>g.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:a})})}):g.jsx(g.Fragment,{})},Age=({intlPath:e,type:t,...n})=>{const r=me.useIntl();return g.jsx(Af,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:ai(r.formatMessage,`${e}label_action`,t,"action")},...n})},SC=5,kC=2,Sge=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Ps=null;const nn="discussion_form_",l1=({id:e,parentId:t,content:n={type:at.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:o=0,buttons:s,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var re,ge,Ne;const f=me.useIntl(),h=E.useContext(gn),[m,p]=E.useState(n.type),[y,v]=E.useState(""),{isLoading:b=!1,isInWrapper:_=!1,isInOverlay:T=!1,isAutoFocused:C=!1,isEditing:x=!1,hasTitleField:w=!1,canBePrepopulated:I=!1,isPrepopulated:O=!1,showTitle:M=!1,showGuidelines:R=!0,showDivider:D=!1,showSuccessMessage:k=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:$=()=>{},create:F=()=>{},createPoll:ne=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:P=()=>{},callback:A=()=>{},onMention:Y=()=>{},listMembers:L=()=>Promise.resolve([]),clickMentionFallback:U=()=>{},getLinkPreview:V=()=>Promise.resolve({}),props:z={create:{projectNames:["questions-answers"]}}}=u,[j,le]=E.useState({body:x&&x.text||O&&O.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Q,ie]=E.useState(l.error||!1),se={status:!1,title:w&&w.text||"",polls:0},[te,Ae]=E.useState(se);E.useEffect(()=>{I&&!x&&O&&O!==j.body&&le(be=>({...be,body:O.text||""}))},[O]),E.useEffect(()=>{p(n.type)},[n.type]);const De=mc((be,X)=>{le(xe=>({...xe,body:be,data:{link:X}})),$({body:be});let he;!h||!h.id?he=ai(f.formatMessage,`${nn}error_loggedOut`,m,"action"):r?o>0&&be.length>=o&&(he=`${nn}error_tooLong`):he=ai(f.formatMessage,`${nn}error_noPermission`,m,"action"),he?ie(he):Q&&ie(!1)},50);let ve=`${m}-form`;if(m===at.Response||m===at.Reply){const be=((re=n.slugs)==null?void 0:re.reply)||((ge=n.slugs)==null?void 0:ge.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";be&&(ve=`${ve}-${be.slice(-15)}`)}e&&(ve=`${e}-${ve}`);const ce=async be=>{if(!h||!h.id||!r||gt)throw new Error("You do not have permission to post.");Ps&&clearTimeout(Ps),Ae(he=>({...he,status:"submitting"}));const X=window.location.pathname;try{let he;switch(m){case at.Post:he=await F({title:be.title,content:be.body,categories:be.postType,data:be.data});break;case at.Poll:he=await ne(Sge(be));break;case at.Question:he=await F({title:be.body,authorId:h&&h.id,data:be.data,...z==null?void 0:z.create});break;case at.Response:he=await F({questionSlug:n.slugs.question},{body:be.body,authorId:h&&h.id,contentPath:X,data:be.data});break;case at.Reply:he=await F({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:be.body,authorId:h&&h.id,contentPath:X,data:be.data});break;default:break}return await WD(1e3),A&&await A(he),Ps=setTimeout(()=>{le({body:"",data:{}}),p(at.Post),Ae(Ue=>({...Ue,status:"submitted"})),v(ai(f.formatMessage,`${nn}success`,m,"action"));const xe=new Event(bn.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(xe),ye()},850),he}catch(he){const xe=he;let Ue=`${nn}error`;xe!=null&&xe.message.includes("entry already exists")&&(Ue=ai(f.formatMessage,`${nn}error_alreadyExists`,m,"action")),xe!=null&&xe.message.includes("429")?Ue=ai(f.formatMessage,`${nn}error_tooMany`,m,"action"):xe!=null&&xe.message.includes("400")&&(Ue=`${nn}error`),ie(Ue),ye()}},ye=()=>{Ps=setTimeout(()=>{ie(!1),Ae(se),v("")},5e3)},Oe=mc(async be=>{const X={...j,...be};if(x){Ae(he=>({...he,status:"submitting"})),J(X);return}try{if(!await ce(X))throw Error("No response from handleSubmit")}catch{Ps&&clearTimeout(Ps)}},100);if(b)return g.jsx(Vr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Le=!j.body||!yc(j.body),ht=!te.title||!yc(te.title);let gt=!1;m!==at.Poll&&(gt=Le),w&&(gt=gt&&ht);const nt=te.status==="submitting",ot=[];m===at.Poll?ot.push({id:"poll-options",label:f.formatMessage({id:`${nn}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${nn}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:kC,maxInputs:SC,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${nn}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:be=>{var he;let X=0;be&&Array.isArray(be)&&(X=((he=be==null?void 0:be.filter(xe=>xe!==""))==null?void 0:he.length)||0),te.polls!==X&&Ae(xe=>({...xe,polls:X})),$({polls:be})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${nn}multiplePollAnswers`}),className:"text-medium"}):ot.push({component:Age,props:{formID:ve,intlPath:nn,showLabel:w!==!1,type:m}},{component:Sy,props:{id:`${ve}-input`,value:te.status==="submitting"&&!Q?"":j.body,placeholder:a||ai(f.formatMessage,`${nn}placeholder`,m,"action"),maxLength:o,meta:{isInOverlay:T},functions:{onChange:De,onChangeData:be=>{le(X=>({...X,data:be}))},onMention:Y,listMembers:L,clickMentionFallback:U,getLinkPreview:V},data:c,autoFocus:x!==!1||C&&!w,"aria-invalid":!!Q,"aria-errormessage":"error-message"}},{component:wge,props:{intlPath:nn,showGuidelines:R,type:m,gtmContext:d}}),D&&ot.push({component:di}),w&&ot.unshift({id:"title",type:"textarea",value:w.text,limit:250,label:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:be=>{Ae(X=>({...X,title:be})),$({title:be})}},validation:m===at.Poll?[{condition:"required"}]:[]}),B&&ot.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${nn}postType_label`}),options:H.map(be=>({id:be.slug,label:be.name})),validation:[{condition:"required"}],functions:{onChange:be=>{$({postType:be}),be.includes(at.Poll)?p(at.Poll):m!==at.Post&&p(at.Post)}}});let je=!h||!h.id||!r||nt;if(m===at.Poll){const be=te.polls;je=je||ht||be<kC||be>SC}else je=je||gt,x&&(w?je=je||j.body===x.text&&te.title===w.text:je=je||j.body===x.text);return g.jsxs(g.Fragment,{children:[g.jsxs(Zi,{id:ve,className:ee("discussion-card discussion-form",{"no-styling":_&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!nt||l.cancel},functions:{onSuccess:async be=>{await Oe(be)},onCancel:P},fields:ot,intlPath:nn,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${x?"save":"submit"}-${m}-click`,"data-testid":"save-button",disabled:je,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:f.formatMessage({id:`${nn}${x?"save":"post"}`}),submitting:f.formatMessage({id:`${nn}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${m}-click`,disabled:!l.cancel&&(!h||!h.id||!j.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:f.formatMessage({id:`${nn}cancel`})},gtm:{context:d,event:`${m}-form`},"data-testid":`discussion-${m}-form`,children:[M&&!x&&m===at.Question&&g.jsx("h2",{children:ai(f.formatMessage,`${nn}title`,m,"action")}),g.jsx(Ea,{member:h?{...h,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:t||""},{scope:Rn.Platform,area:"all"}]}})]}),te.status==="submitted"&&k&&g.jsx(ml,{className:"success","data-testid":"success",children:ai(f.formatMessage,`${nn}success`,m,"action")}),Q&&g.jsx(ml,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Q=="string"?Q.includes(" ")?Q:f.formatMessage({id:Q},{action:f.formatMessage({id:`discussion_action_${m}`}),maxLength:o}):Q}),y&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:y})]})},kge=Object.freeze(Object.defineProperty({__proto__:null,default:l1},Symbol.toStringTag,{value:"Module"}));const Dge={showForm:!1},Cp=E.createContext(Dge),cD=({children:e})=>{const[t,n]=E.useState({showForm:!1});return g.jsx(Cp.Provider,{value:{...t,updateConversation:n},children:e})};function Oge({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:o}){var d;const s="discussion_",l=me.useIntl(),u=(d=i==null?void 0:i.componentProps)==null?void 0:d.member.additionalContent,c=u?u.customMessage:void 0;return g.jsxs("div",{className:"author-section",children:[g.jsx(Ea,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:c},className:ee({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!c},gtmContext:a,gtmType:"profile-click",badges:o}),i.pinned&&g.jsx(Fi,{variant:"naked",size:"xlarge",icon:"pin",children:g.jsx(xt,{children:l.formatMessage({id:`${s}pinned_post`})})})]})}const K0=({children:e,class:t,...n})=>{const r={...n,class:ee("subtle",t)};return g.jsx("blockquote",{...r,children:e})};function Nge({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?g.jsx(g.Fragment,{}):g.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?g.jsx(g.Fragment,{}):g.jsx(Fi,{size:"small",element:"li",children:n.name},n.slug))})}var fh=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(fh||{});const Ige=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,Pge=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const o=e.parentElement;if(o)for(i=n==="next"?o.firstElementChild:o.lastElementChild,a=n==="next"?0:o.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const Rge=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:o=!1,isTabbable:s=!1,functions:l})=>{var y;const[u,c]=E.useState(t.hasUserVoted);let d=0,f={};const h=(i||!o)&&!t.hasUserVoted;a&&(d=Math.round(t.numVotes/r*100)||0,f={"--vote-perc":`${d}%`});const m=v=>{v.stopPropagation(),h&&(l==null||l.createVote(t),c(!0))},p={htmlFor:t.id,className:ee({"can-vote":h}),tabIndex:s&&h?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:m,onKeyDown:v=>{var b;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),m(v),c(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const _=v.code==="ArrowUp"?"prev":"next",{nextElement:T,nextIndex:C}=Pge(v.currentTarget.parentElement,"selected",_,n);T&&((b=T.querySelector("label"))==null||b.focus(),l==null||l.setTabbableOption(C));break}}};return g.jsxs("li",{"data-testid":"poll-option",style:f,className:ee("poll-option text-small",{selected:t.hasUserVoted}),children:[g.jsx("label",{...p,children:g.jsx("span",{children:t.label})}),a&&g.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&g.jsx(Sa,{className:"author-profile-picture",name:e.name,src:(y=e==null?void 0:e.image)==null?void 0:y.thumbnail}),g.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[d,"%"]})]}),g.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const dD=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=me.useIntl(),o=E.useContext(gn),{showRemoveVote:s=!1,allowMultipleVotes:l=!1,resultsVisibility:u=fh.AfterVoting}=n||{},[c,d]=E.useState(Ige(t,l,o==null?void 0:o.id)),f=t.reduce((v,b)=>v+b.numVotes,0),h=t.filter(v=>v.hasUserVoted).length,m=t.filter(v=>v.hasUserVoted),p=E.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),y=E.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return g.jsxs("div",{className:"poll-wrapper",children:[g.jsx("p",{className:"poll-title",children:e}),g.jsxs("aside",{className:"poll-info",children:[g.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:g.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),g.jsx("p",{className:"poll-num-votes",children:g.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:f})})}),s&&g.jsx("p",{className:"poll-remove-vote",children:g.jsx(Ke,{variant:"tertiary",onClick:y,"data-testid":"remove-votes-button",disabled:h===0,children:g.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:h})})})})]}),t&&g.jsx("form",{children:g.jsx("fieldset",{children:g.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,b)=>g.jsx(Rge,{isTabbable:c===b,user:o,option:v,optionIndex:b,totalPollVotes:f,showResults:u==fh.Always||!!h,allowMultipleVotes:l,hasVotedOnPoll:!!h,functions:{createVote:p,setTabbableOption:d}},v.id))})})}),g.jsxs(xt,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:h}),!!h&&g.jsx("ul",{children:m.map(v=>g.jsx("li",{children:v.label}))})]})]})};function Fge({content:e,contentData:t,functions:n}){return g.jsx(dD,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function Mge({links:e={},contentData:t,postCutOff:n,content:r}){var i;return g.jsxs(g.Fragment,{children:[e.post?g.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?g.jsx(e3,{text:t.postBody,markdownOptions:{overrides:{a:ng,blockquote:{component:K0}}}}):g.jsx(Qo,{options:{overrides:{a:ng,blockquote:{component:K0}}},children:t.postBody})]}):g.jsxs(g.Fragment,{children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),g.jsx(Qo,{options:{wrapper:r.type===at.Question?"h1":E.Fragment,forceWrapper:r.type===at.Question,forceInline:r.type===at.Question,forceBlock:r.type!==at.Question,overrides:{blockquote:{component:K0}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?g.jsx(Qv,{data:t.data.link}):g.jsx(g.Fragment,{})]})}const ei="discussion_",Bge=195;let gd=null;const u1=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:o,functions:s,links:l={},className:u,gtmContext:c="DiscussionAnswer",children:d,isTruncated:f=!1,setFocus:h=!1,isCommunity:m=!1,badges:p,basePath:y,parentId:v,locale:b="en",disableMentions:_})=>{var je,re,ge,Ne,be,X;const T=me.useIntl(),C=E.useContext(Cp),x=E.useContext(gn),{createContent:w=async()=>{},deleteContent:I=async()=>{},updateContent:O=async()=>{}}=s.content||{},{createLike:M=()=>{},deleteLike:R=()=>{},listLikes:D=async()=>({})}=s.likes||{},{openComments:k=()=>{}}=s.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:H=()=>{}}=s.form||{},{createVote:$=()=>{},removeVote:F=()=>{},removePoll:ne=()=>{}}=s.polls||{},{author:J,createdAt:P,id:A,likes:Y=0,userLiked:L,comments:U=0,data:V}=t,z=cI(t.title,b),j=x&&x.id&&typeof J!="string"&&J.id&&J.id===x.id||!1,le=j&&(!t.createdAt||VD(t.createdAt,10,"seconds")),Q=E.useRef(null),[ie,se]=E.useState({title:t.body!==z&&z||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[te,Ae]=E.useState(!1),[De,ve]=E.useState(le?"highlighted":"default"),[ce,ye]=E.useState("");E.useEffect(()=>{const he=Q.current;if(!(!he||De==="default"))return document.addEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),he.addEventListener("transitionend",Le),()=>{document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),he.removeEventListener("transitionend",Le)}},[]),E.useEffect(()=>{se(he=>({...he,title:t&&z||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),E.useEffect(()=>{(async()=>{const xe=await Yv(ie.body,f,V==null?void 0:V.mentions,B);se(Ue=>({...Ue,postBody:xe}))})()},[ie.body,V==null?void 0:V.mentions]);const Oe=()=>{setTimeout(()=>{ve("fading")},1e3)},Le=({propertyName:he})=>{he==="background-color"&&ve(xe=>(xe==="default"&&(document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,Oe),Q.current&&Q.current.removeEventListener("transitionend",Le)),xe==="fading"?"default":xe))};if(i||!t||t.type===at.Answer&&(!t.slugs||!t.slugs.question)||ie.postBody===""&&t.title==="")return g.jsx(Vr,{className:"discussion-card"});const ht=async({title:he,body:xe,data:Ue})=>{he||(he=""),xe||(xe=""),ye("");try{if(!cf(he,ie.title)||!cf(xe,ie.body)){const kt=t.type===at.Question?{title:xe}:{title:he,body:xe,data:Ue};await O(sg(t.slugs),kt)}se(kt=>({...kt,title:he||"",body:xe||"",data:{...kt.data,...Ue},isEditing:!1,didEdit:!0}))}catch{ye(`${ei}form_error`)}},gt=()=>{if(C&&C.updateConversation){const he={showForm:!0},xe=t.author;xe&&xe.id&&!_&&(m&&(he.prepopulateForm=`@{{${xe.id}}}`),he.mentionData={id:xe.id,name:xe.name}),C.updateConversation(he)}setTimeout(()=>{var vt,St,sn;const xe=`reply-form-${(t.type===at.Answer?t.slug:((vt=t.slugs)==null?void 0:vt.reply)||((St=t.slugs)==null?void 0:St.answer)||((sn=t.slugs)==null?void 0:sn.question)||"").toLowerCase().slice(-15)}`,Ue=document.getElementById(xe),kt=document.getElementById(`${xe}-input`);kt&&kt.focus(),Ue&&Ue.scrollIntoView({behavior:"smooth"})},0)},nt=async()=>{Ae(!1);try{t.type===at.Poll?(await ne(),window.location.href=`${y}/${v}`):await I(sg(t.slugs))}catch{ye("delete-error")}},ot=[];return n&&j&&(t.type!==at.Poll&&ot.push({text:T.formatMessage({id:`${ei}moreMenu_edit`}),onClick:()=>se(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),ot.push({text:T.formatMessage({id:`${ei}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),Ae(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...D3(`delete-${t.slug}-modal`,te)})),r&&s.pins&&ot.push({text:T.formatMessage({id:`${ei}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?s.pins.deletePin:s.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),h&&((je=Q==null?void 0:Q.current)==null||je.focus(),(re=Q==null?void 0:Q.current)==null||re.scrollIntoView({behavior:"smooth"})),E.createElement(e,{className:ee("discussion-post",u,{[De]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ie.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Q,tabIndex:h?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:he=>{if(!l.post||ie.isEditing||t.type===at.Poll&&uI(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),gd&&clearTimeout(gd),gd=setTimeout(()=>{window.location.href=l.post},150);const xe=new CustomEvent(bn.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:gd}});document.dispatchEvent(xe)},children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{id:A||t.slug,className:ee("discussion-card text-medium",t.type,{editing:ie.isEditing,"has-link":l.post&&!ie.isEditing}),children:[!ie.isEditing&&g.jsx(Oge,{author:J,originalAuthorId:a,createdAt:P,contentData:{didEdit:ie.didEdit},content:t,gtmContext:c,badges:p}),ie.isEditing?g.jsx(l1,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ie.title!==""?{text:ie.title}:!1,isEditing:{text:ie.body,categories:[]},canBePrepopulated:m,isPrepopulated:!1},maxLength:t.type===at.Question?250:5e4,forceShow:{error:ce!==""&&ce!=="delete-error"?T.formatMessage({id:ce},{action:T.formatMessage({id:`${ei}action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:ht,handleCancel:()=>{ye(""),se(he=>({...he,isEditing:!1}))},listMembers:B,clickMentionFallback:H},gtmContext:`${c}Form`,data:V}):g.jsxs(g.Fragment,{children:[t.type===at.Poll?g.jsx(Fge,{content:t,contentData:ie,functions:{createVote:$,removeVote:F}}):g.jsx(Mge,{links:l,contentData:ie,postCutOff:Bge,content:t}),g.jsx(Nge,{content:t})]}),!ie.isEditing&&!(o!=null&&o.actionBar)&&g.jsx(V3,{className:t.type,gtmContext:c,contentType:t.type,likes:o!=null&&o.likes?!1:{count:Y||0,userLiked:L||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:M,deleteLike:R,listLikes:D},basePath:y,parentId:v},comments:!(o!=null&&o.comments)&&([at.Question,at.Post].includes(t.type)||l.comments)?{count:U||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof k=="function"&&k()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:gt}}:!1,shareLink:!(o!=null&&o.shareLink)&&{url:`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(Ne=t.slugs)==null?void 0:Ne.answer}${(be=t.slugs)!=null&&be.reply?`#${(X=t.slugs)==null?void 0:X.reply}`:""}`},moreMenu:!(o!=null&&o.moreMenu)&&{options:ot,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),d,g.jsx(ka,{id:`delete-${t.slug}-modal`,isOpen:te,functions:{onOpen:()=>{},onClose:()=>Ae(!1)},forceShow:{error:ce==="delete-error"?T.formatMessage({id:"${intlPath}delete_error"},{action:T.formatMessage({id:`${ei}action_${t.type}`})}):!1},title:T.formatMessage({id:`${ei}delete_title`},{action:T.formatMessage({id:`${ei}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Ae(!1),children:T.formatMessage({id:`${ei}delete_cancel`})},{variant:"primary",className:"destructive",onClick:nt,children:T.formatMessage({id:`${ei}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:g.jsx(me.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>g.jsx("p",{children:he}),action:T.formatMessage({id:`${ei}action_${t.type}`})}})})]})})};const Lge=E.lazy(()=>Promise.resolve().then(()=>Xge)),$ge=65,fD=({forceShow:e,form:t,className:n})=>{const r=me.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",s=E.useContext(gn)||"community",l=Eh(s);l.name||(l.name=r.formatMessage({id:`member_${typeof s=="string"?s:"community"}`}));const u=lo(!0,!1),c=u?u<768:0,{modal:d=!1}=e||{},[f,h]=E.useState({form:d||YC("showPost")==="true"||!1,warning:!1}),[m,p]=E.useState({showCachedText:!1});E.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const _=await Yv(m.title||m.body||"",$ge,m.mentions);p(T=>({...T,prettifiedText:_}))})()},[m.showCachedText,m.title,m.body]);const y=b=>{if(!m.showCachedText||typeof f.warning=="string")return;let _;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),_=b.detail.link;else{const T=b;T.preventDefault(),T.stopPropagation();const x=T.target.closest("a");_=x&&x.getAttribute("href")}h(T=>({...T,warning:_||!1}))};E.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y);return}return document.addEventListener(bn.DISCUSSION_POST_CLICKED,y),document.addEventListener(bn.MEMBER_CLICKED,y),document.addEventListener("click",y),()=>{document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y)}},[m.showCachedText]),E.useEffect(()=>{const b=_=>{if(!(!m.showCachedText||f.warning!==!1))return _.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[m.showCachedText,f.warning]);let v=r.formatMessage({id:`${i}placeholder${c?"":"_long"}`});return m.showCachedText&&(m.title||m.body)&&(v=m.prettifiedText||v),g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:ee("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(_=>({..._,form:!0}))},"data-testid":"discussion-form-card",children:[g.jsx(Sa,{name:l.name,src:l.image,alt:""}),g.jsx(Qo,{className:ee("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Ir,blockquote:Ir,br:Ir,em:Ir,li:Ir,ol:Ir,p:Ir,s:Ir,span:Ir,strong:Ir,ul:Ir}},children:v})]}),g.jsxs(Ml,{children:[g.jsx(Lge,{showModal:f.form,functions:{cacheText:p,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),g.jsx(ka,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:f.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof f.warning=="string"&&(window.location.href=f.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:g.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},jge=E.lazy(()=>Promise.resolve().then(()=>kge)),u5=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:o,leave:s,notMemberStateText:l},locale:u=vl})=>{if(a&&!i)return g.jsx(Ui,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:g.jsx(Uv,{isShort:!0,functions:{join:o,leave:s}})}});const{content:c,functions:d,meta:f,...h}=t,m={content:{type:(c==null?void 0:c.type)||"reply",slugs:(c==null?void 0:c.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?g.jsx(fD,{form:m}):g.jsx(jge,{...m})},c5=({form:e})=>{const t=E.useContext(gn),n=me.useIntl(),[r,i]=E.useState(!1),a=()=>{JD(t)||i(!0)};E.useEffect(()=>(document.addEventListener(bn.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(bn.DISCUSSION_POST_ADDED,a)}));const o={};return["successMessage","title","text"].forEach(s=>{o[s]=n.formatMessage({id:`profileModalLauncher_${s}`})}),g.jsx(xp,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:o})};const G0="discussion_responses_",hD=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=me.useIntl();return t=parseInt(t),g.jsxs("div",{className:"responses-heading",children:[g.jsx("h4",{children:r.formatMessage({id:`${G0}title`},{action:r.formatMessage({id:`${G0}${e}`}),count:t})}),!n&&t===0&&g.jsx("p",{children:ai(r.formatMessage,`${G0}empty`,e,e)})]})};const pD=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=me.useIntl(),o=E.useContext(Cp),s=Ed(i,{element:"li"});if(o.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:o.prepopulateForm},o.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=o.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:o.mentionData},r.data=l,r.meta.isAutoFocused=!0}return g.jsxs("div",{className:ee("thread-wrapper",{"empty-thread":!s}),children:[!Object.is(s,null)&&g.jsx("ul",{className:"thread",children:s}),!e&&g.jsx(Vc,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&o.showForm&&g.jsx(l1,{...r})]})};function Hge(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,o;(o=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&o.length&&(t=!0)}),t}function Uge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:o}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:s})=>t(l=>(N3({activity:l,reactionId:s,user:a}),l)),onError:n,onSuccess:(s,{reactionId:l},u)=>{u&&I3({activity:u,reactionId:l,correctReactionId:s.body.id,user:a}),r.setQueryData(i,u)}});return o}function zge({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Rt.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(o=>(o&&(i!=null&&(o.content=i),a!=null&&(o.title=a)),o)),onError:n});return r}function Vge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&vf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&vf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function qge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&yf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&yf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Wge({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Rt.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function Kge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(o=>(P3({activity:o,reactionId:a}),o)),onError:n});return i}function Gge({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:o,removeVote:s},queryKey:l}){const u=Rt.useQueryClient(),c=yh(),d={queryClient:u,queryKey:l},f={mutationHandlers:{error:zv(d),mutate:Vv(d)},user:c,...d},h=zge({...f,mutationFn:t}),m=Vge({...f,mutationFn:n}),p=Yge({...f,mutationFn:r}),y=qge({...f,mutationFn:i}),v=Zge({...f,mutationFn:a}),b=Uge({...f,mutationFn:o}),_=Kge({...f,mutationFn:s}),{activity:T,...C}=Wge({queryKey:l,queryFn:e});return{activity:T,mutations:{edit:h,like:m,unlike:p,pin:y,unpin:v,createVote:b,removeVote:_},user:c,...C}}function Yge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>t(o=>(o&&R3({activity:o,user:r}),o)),onError:n});return i}function Zge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(o=>(o&&F3({activity:o,user:r}),o))),onError:n});return i}const Qge=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...o},likes:s,reactions:l,form:u,join:c,leave:d,polls:f},profile:h,categories:m,locale:p=vl,type:y=fi.Communities})=>{var L,U,V,z,j,le,Q,ie,se,te,Ae,De;const v=me.useIntl(),b={...o,...f},{activity:_,error:T,isLoading:C,mutations:{edit:x,like:w,unlike:I,pin:O,unpin:M,createVote:R,removeVote:D}}=Gge({queryFns:b,queryKey:[e,t,n]});if(C)return g.jsx(Vr,{style:{height:"400px"}});if(T||!_)return g.jsx(Ui,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:k,verb:B,latest_reactions:H,mentioned_users:$,additional_data:F}=_,ne=(((L=H==null?void 0:H.like)==null?void 0:L.length)||0)>0,J=(((U=k==null?void 0:k.like)==null?void 0:U.length)||0)>0,P=J?k==null?void 0:k.like[0].id:"",A=ne?(V=H==null?void 0:H.like)==null?void 0:V.map(ve=>{var ce,ye,Oe;return{id:(ce=ve==null?void 0:ve.user)==null?void 0:ce.id,name:(Oe=(ye=ve==null?void 0:ve.user)==null?void 0:ye.data)==null?void 0:Oe.name}}):!1,Y=_==null?void 0:_.actor;return g.jsxs("section",{className:"activity-section",children:[g.jsx(u1,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:B,title:_==null?void 0:_.title,body:y===fi.Courses?HN({content:_.content,locale:p}):_==null?void 0:_.content,categories:Zv((_==null?void 0:_.categories)||[],m||[]),createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${e}/${t}`,answer:_==null?void 0:_.id},slug:n,author:Ll(Y),userLiked:J,likes:((z=_==null?void 0:_.reaction_counts)==null?void 0:z.like)||0,comments:(_==null?void 0:_.total_replies)||0,peopleWhoLiked:A,data:{mentions:$,...F||{}},pinned:((j=_==null?void 0:_.reaction_counts)==null?void 0:j.pin)&&((le=_==null?void 0:_.reaction_counts)==null?void 0:le.pin)>0||!1,pollOptions:O3(_,p),pollSettings:{showRemoveVote:(Q=_==null?void 0:_.settings)==null?void 0:Q.show_remove_vote,allowMultipleVotes:(ie=_==null?void 0:_.settings)==null?void 0:ie.allow_multiple_votes,deadlineAt:(se=_==null?void 0:_.settings)==null?void 0:se.deadline_at,hideParticipants:(te=_==null?void 0:_.settings)==null?void 0:te.hide_participants,numberOfWinners:(Ae=_==null?void 0:_.settings)==null?void 0:Ae.number_of_winners,resultsVisibility:(De=_==null?void 0:_.settings)==null?void 0:De.results_visibility}},originalAuthorId:Y==null?void 0:Y.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ve,{title:ce,body:ye})=>x({title:ce,content:ye})},likes:{createLike:()=>w({activityId:n}),deleteLike:()=>I({activityId:n,reactionId:P}),listLikes:ve=>s.list({activityId:n,...ve})},comments:{openComments:()=>{}},pins:{createPin:()=>O({activityId:n}),deletePin:()=>{var ve;return M({activityId:n,reactionId:(ve=H==null?void 0:H.pin)==null?void 0:ve[0].id})}},polls:{createVote:({reactionId:ve})=>R({reactionId:ve}),removeVote:({reactionId:ve})=>D({reactionId:ve}),removePoll:()=>f.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:Rn.Communities,area:t||""},{scope:Rn.Platform,area:"all"}]},basePath:e,parentId:t},n),g.jsx(j3,{basePath:e,parentId:t,activityId:n,showReplies:B===at.Poll?Hge(_):!0,activityTotalReplies:(_==null?void 0:_.total_replies)||0,isMember:r,functions:{reactions:l,likes:s,form:u,join:c,leave:d},profile:h,type:y})]})};const mD=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=me.useIntl(),o="discussionFormModal_",{onClose:s=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:d}=n,{title:f="",body:h="",mentions:m}=r||{},p="discussion-form-modal";return g.jsx(ka,{id:p,title:a.formatMessage({id:`${o}title`}),isOpen:e,functions:{onClose:()=>{(f!==""||h!=="")&&l(y=>({...y,showCachedText:!0})),s()}},className:ee("discussion-form-modal",i),children:g.jsx(l1,{...n,data:{...u,mentions:m||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${p}-overlay`,hasTitleField:{text:f},isPrepopulated:{text:h||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${o}cta`})},functions:{...d,onChange:y=>{l(v=>({...v,...y}))},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const b=m||{};b[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l(_=>({..._,mentions:b}))},create:async y=>{s(),d.create&&await d.create(y),l({showCachedText:!1})},createPoll:async y=>{const v=()=>{s(),l({showCachedText:!1})};if(d.createPoll)try{const b=await d.createPoll(y);return new Promise(_=>(v(),_(b)))}catch{return new Promise((_,T)=>T())}else return v(),new Promise(b=>b({}))},handleSaveEdit:async y=>{s(),d.handleSaveEdit&&await d.handleSaveEdit(y),l({showCachedText:!1})}}})})},Xge=Object.freeze(Object.defineProperty({__proto__:null,default:mD},Symbol.toStringTag,{value:"Module"}));const Jge=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:o,showIcon:s,onClose:l,reportError:u=()=>{},sendInvites:c})=>{const d=me.useIntl();return i||(i=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),o||(o=d.formatMessage({id:"inviteModal_cta"})),g.jsx(ka,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:l},className:ee("invite-modal",e,{success:!!n}),children:g.jsx(kw,{title:i,label:a,messagePlaceholder:r,ctaMessage:o,onClose:l,sendInvites:c,reportError:u})})};const eve=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:o})=>{const s=me.useIntl(),[l,u]=E.useState(YC("showProfile")==="true"||e);E.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=i;return g.jsx(ka,{id:"profile-form-modal",title:t||n||s.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:ee("profile-modal",o,{success:!!t}),maxWidth:700,children:g.jsxs(g.Fragment,{children:[t&&n||r?g.jsxs("div",{className:"intro",children:[t&&n?g.jsx("h3",{children:n}):"",r?g.jsx("p",{children:r}):""]}):null,g.jsx(Dw,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async d=>{var f;try{(f=a==null?void 0:a.functions)!=null&&f.onSuccess&&await a.functions.onSuccess(d)}finally{c()}}}})]})})},xp=eve,tve=Object.freeze(Object.defineProperty({__proto__:null,default:xp},Symbol.toStringTag,{value:"Module"}));const nve=({members:e})=>{const[t,n]=E.useState(!1),r=i=>{const{fullName:a,jobTitle:o,organisation:s,photo:l}=i||{};return g.jsxs(g.Fragment,{children:[g.jsx(Sa,{name:a,src:l}),g.jsx("p",{children:a}),g.jsx("small",{className:"text-medium",children:s?`${o}, ${s}`:o})]})};return g.jsxs("div",{className:"directory-wrapper",children:[g.jsx("ul",{className:"directory",children:e.map(i=>g.jsx("li",{children:g.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),g.jsx(ka,{isOpen:t!==!1,children:t===!1?"":g.jsxs(g.Fragment,{children:[r(t),g.jsx(Qo,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const rve=({email:e,settings:t={}})=>{const{formatMessage:n}=me.useIntl(),r=E.useContext(gn),{myProfile:i,isConnected:a,cannotConnect:o}=t,[s,l]=E.useState(!1),[u,c]=E.useState(!1);return r?e&&i?g.jsx(Ke,{icon:{icon:"info-inside-circle",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_mine"}),forceTooltip:!0,className:"show-email fake-button",children:e}):o?g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_private"}),forceTooltip:!0,className:"show-email fake-button",children:n({id:"member_show_email_private"})}):a?e&&a?g.jsx(g.Fragment,{children:s?g.jsx(Ke,{icon:{icon:"copy",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},className:"show-email copy-button",tooltip:n({id:`member_show_email_tooltip${u?"_copied":""}`}),forceTooltip:!0,"data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"copy-email-click",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{c(!0),setTimeout(()=>{c(!1)},2e3)})},children:e}):g.jsx(Ke,{icon:"email",size:"small","data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"show-email-click",onClick:()=>l(!0),children:n({id:"member_show_email_show"})})}):g.jsx(g.Fragment,{}):g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):g.jsx(g.Fragment,{})};const ive=({author:e,authorCite:t,content:n,member:r,className:i=""})=>g.jsxs("blockquote",{className:ee("testimonial-block",i),children:[g.jsx(Ri,{className:"testimonial",children:n}),r?g.jsx(Ea,{member:r,styling:{size:"large"}}):g.jsxs(g.Fragment,{children:[e&&g.jsx("p",{className:ee("author",{"text-small":!i.includes("new")}),children:e}),t&&g.jsx("p",{className:ee("author-cite",{"text-small":!i.includes("new")}),children:g.jsx("cite",{children:t})})]})]}),ave=E.memo(ive);const ove=({items:e=[],selector:t="",className:n=""})=>{const r=me.useIntl(),[i,a]=E.useState(e);return E.useEffect(()=>{if(e.length)return;let o="";Array(6).fill(0).forEach((u,c)=>{o+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(o)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&g.jsxs(br,{variant:"subtle",className:ee("table-of-contents",n),children:[g.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),g.jsx("nav",{children:g.jsx("ul",{children:i.map(({id:o,text:s})=>g.jsx("li",{children:g.jsx("a",{href:`#${o}`,children:s})},o))})})]})};const wp=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=me.useIntl(),o="timeToComplete_";if(!e||typeof e!="number")return null;const s=c=>{const d=c/60,f=Math.floor(d),h=(d-f)*60,m=Math.round(h),p=`${a.formatMessage({id:`${o}hours`},{time:f})}${f>0&&m>0?", ":""}${a.formatMessage({id:`${o}minutes`},{time:m})}`;return{text:`${f>0?`${a.formatMessage({id:`${o}hours_short`},{time:f})} `:""}${m>0?a.formatMessage({id:`${o}minutes_short`},{time:m}):""}`,ariaText:p}};let{text:l,ariaText:u}=s(e);if(t){const{text:c,ariaText:d}=s(e+t);l=a.formatMessage({id:`${o}range`},{early:l,late:c}),u=a.formatMessage({id:`${o}range_aria`},{early:u,late:d})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),g.jsx("span",{className:ee("time-to-complete",i),"aria-label":u,children:l})};const sve=({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",g.jsx(uo,{...n,className:ee("banner",e),image:{...t,aspect:"banner"}})):null;const lve=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],uve=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:o={eyebrow:!1,title:!1,text:!1},cta:s,children:l})=>{var m,p;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],d={eyebrow:"small",title:"h1",text:"p"},f={};c.forEach(y=>{if(!t[y]){f[y]=!1;return}if(!o[y]){if(typeof t[y]=="object"){f[y]=t[y];const{text:v,element:b}=t[y];if(b&&lve.includes(b.toLowerCase()))return;f[y]={text:v,element:d[y]};return}f[y]={text:t[y],element:d[y]}}});const h=s&&s.text&&s.link;return h&&s.link[0]==="#"&&(s.props||(s.props={}),s.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(s.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),g.jsx(po,{className:ee("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&i==="normal"&&f.eyebrow&&f.title}),children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:v,element:b=""}=f[y];return y==="text"?g.jsx(Qo,{overrideType:"text-only",className:"text",children:v},y):E.createElement(b,{key:y,className:y},v)}return null}),l,h&&g.jsx(Ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:s.link,...s.props,className:ee({new:r==="subtle",[(m=s.props)==null?void 0:m.className]:(p=s.props)==null?void 0:p.className}),children:s.text})]}),n&&g.jsx(uo,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},cve=E.memo(uve);const dve=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),g.jsx(po,{className:ee("custom-content-banner",t,r,{"has-image":e}),style:i,children:g.jsx("div",{className:"content-slim",children:n})})};const fve=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?g.jsx(Qo,{children:n}):n;return g.jsxs(po,{className:ee("highlight-section",t),children:[r&&g.jsx("div",{className:ee("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:g.jsx(uo,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),g.jsx("div",{className:ee("highlight-container highlight-content-wrapper",{"no-image":!r}),children:g.jsx("div",{className:ee("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:g.jsx("div",{className:"content-default",children:i})})})]})},hve=E.memo(fve);const pve=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:g.jsxs("aside",{className:ee("marketing-block",e),children:[n&&g.jsx("p",{className:"title",children:n}),r&&g.jsx("p",{children:r}),t&&g.jsx(Ke,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),mve=({type:e,data:t})=>{const n=me.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:o,pill:s,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const d=i&&J0(i);return g.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&g.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(c&&!a||o)return g.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Dv(c)});if(s)return g.jsx(Fi,{variant:s==="free"?"subtle":"highlighted",className:s,"data-testid":"course-type",children:s});if(l||u){const d=u&&J0(u);return g.jsxs("ul",{className:"details",children:[l&&g.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&g.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},gve={title:66,text:3e3,secondaryText:1e3,partner:34},hh={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"}},vve=({data:e,cta:t,link:n,gtmContext:r})=>{var p,y;const i=me.useIntl(),[a,o]=E.useState({loading:!1,registered:e.registered||!1});E.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:s,startDate:l,dateHasPassed:u,pill:c,slug:d}=e,f=e.contentType;let h="";if((p=hh[f])!=null&&p.gtmEvent&&(h=hh[f].gtmEvent),l&&u)return n?g.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?g.jsx(Ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_cta_people"})}):null;const m=["communityPage","microcourse","event"];if(t&&t.onClick&&m.includes(f)&&c!=="premium"){const v=a.loading||a.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),b=async _=>{var T;if(_.preventDefault(),_.stopPropagation(),window&&((T=window.dataLayer)==null||T.push({event:"gtm.click","gtm.element":n,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":n,EventType:`${r}-${f}-register-click`,EventContext:`${r}Page-${f}: ${d}`})),!(v||!t||!t.onClick)){o(C=>({...C,loading:!0}));try{const C=await t.onClick(e);o(C==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return g.jsx("p",{className:ee("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:g.jsx(Ke,{onClick:b,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${f}: ${d}`,"data-gtm-event-type":`${r}-${f}-register-click`,"data-testid":"in-card-button",children:s||i.formatMessage({id:`card_cta_${f}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function yve({buildMemberData:e,communitySlug:t}){const n=me.useIntl(),r=E.useContext(gn),[i,a]=E.useState({count:"...",isMember:!1,memberType:""});return E.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(o=>{if(!o)return;const{membersCount:s,role:l="",pagination:u}=o;let c=0;s?c=s:u!=null&&u.total&&(c=u==null?void 0:u.total),a({count:c.toString(),isMember:!!l,memberType:l})})},[t,e]),g.jsxs("span",{className:"member-information",children:[i.isMember&&g.jsx(Fi,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),g.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const d5=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:o="Carousel",handleCardClick:s,meta:l})=>{var k,B;const u=me.useIntl(),c=E.useContext(gn),d=!!(c!=null&&c.id),{isTabbable:f=!0,setFocus:h=!1}=l||{},m=E.useRef(null),[p,y]=E.useState({data:null,isLoading:!0});E.useEffect(()=>{n(i,d).then(H=>{y({data:H,isLoading:!1})}).catch(()=>y(H=>({...H,isLoading:!1})))},[i,d,n]);const{data:v,isLoading:b}=p;if(b||!v)return g.jsx(Vr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:s});const{contentType:_}=v;if(!_||!hh[_])return g.jsx(Vr,{element:"li",className:"card-wrapper"});const{basePath:T="",className:C,length:x,gtmEvent:w}=hh[_];let I=f&&v.slug?`${T}${v.slug}`:!1;f&&v.slug&&(v.slug.slice(0,4)==="http"||v.slug.slice(0,2)==="//"||v.slug.slice(0,6)==="mailto"||v.slug.slice(0,3)==="tel")&&(I=v.slug);const O=H=>{if(I){H.preventDefault(),H.stopPropagation();const $=H.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":$,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":$,EventType:`${o}-CarouselCard`,EventContext:`${w}-click`}),window.location.href=$}},M={...gve,...x};let R={className:"card"},D={};return I&&(D={href:I,className:"gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},v.openInNewTab&&(D.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),h&&(R={...R,tabIndex:"0"},(k=m==null?void 0:m.current)==null||k.focus(),(B=m==null?void 0:m.current)==null||B.scrollIntoView({behavior:"smooth"})),g.jsx("li",{className:ee("card-wrapper text-medium",C,t,{"has-link":I,"no-link":!I,"has-image":v.banner}),"data-testid":`${_}-card`,children:g.jsxs("div",{...R,ref:m,"data-url":I,children:[g.jsx(QC,{className:"card-label",contentType:_,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),_==="communityPage"&&(v==null?void 0:v.createdAt)&&qD(v==null?void 0:v.createdAt,60)&&g.jsx(Fi,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&g.jsx(Fi,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):WC(v.startDate)}),v.banner?g.jsxs("p",{className:"img",children:[v.registered&&g.jsx(Fi,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),g.jsx(uo,{image:{...v.banner,description:""}})]}):C==="people"?g.jsx(Sa,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&g.jsx(Bv,{contributors:{data:v.contributors},styling:{size:"small",showGap:C!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(_)?u.formatMessage({id:`card_contributors_${_}`}):void 0,"data-testid":"contributors"}),v.partner&&g.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?u.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):hl(v.partner[0],M.partner)}),["title","text","secondaryText"].map(H=>{const $=v[H];if(!$)return null;const F=HC(H),ne={key:H,className:F,"data-testid":F},J={wrapper:"p",forceWrapper:!0,forceInline:!0},P=hl($,M[H]);return["title","text"].includes(H)&&I?(J.wrapper="a",g.jsx("p",{...ne,children:g.jsx(Ri,{options:J,...D,children:P})})):g.jsx(Ri,{options:J,...ne,children:P})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&g.jsx(yve,{communitySlug:i.slug||v.slug,buildMemberData:r}),g.jsx(mve,{type:C||"",data:v}),g.jsx(vve,{data:v,cta:a,link:I||"",gtmContext:o})]})})};const gD=({cards:e,cardTypes:t,className:n="",...r})=>g.jsx("ul",{className:ee("card-block",n),children:e.map((i,a)=>{const o=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return g.jsx(d5,{id:o,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},o)})}),bve=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),o=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:o}},Eve=({id:e,title:t})=>{const n=me.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:o="medium",link:s}=t;return E.createElement(i,{className:ee("title",a,o,{"highlighted-title":a==="highlighted"}),children:g.jsxs(g.Fragment,{children:[r,s&&g.jsx("a",{href:s,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 Y0={fourCards:1024,threeCards:769,twoCards:480};let vd=null,Z0=null;const _ve=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:o,...s})=>{const l=me.useIntl(),u="carousel_pagination_",[c,d]=E.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:h}=c,[m,p]=E.useState({currentPage:0,loadedPages:[0]}),{currentPage:y,loadedPages:v}=m,[b,_]=E.useState(""),T=t.length,C=Math.ceil(T/f),x=E.useRef(null),w=lo(!0,!0,x==null?void 0:x.current);E.useEffect(()=>{let k=1;w&&(w>=Y0.fourCards?k=4:w>=Y0.threeCards?k=3:w>=Y0.twoCards&&(k=2),k>T&&(k=T)),d(B=>({...B,cardsPerPage:k,isLoading:!1}))},[w,T]);const I=(k="next")=>{Z0&&clearTimeout(Z0);let B=y;if(typeof k=="string")if(k==="next")if(y<C-1)B=y+1;else return;else if(y>0)B=y-1;else return;else B=k;_(""),p($=>({...$,currentPage:B,loadedPages:[...new Set([...v,B])]}));const H=()=>{const $=B*c.cardsPerPage,F=$+c.cardsPerPage;return t.slice($,F).length};Z0=setTimeout(()=>{_(l.formatMessage({id:`${u}ariaLive${typeof k=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof k=="string"?k:"next"}`}),slide:typeof k=="string"?1:k+1,count:H()}))},500)},O=k=>{vd=k.touches[0].clientX},M=k=>{if(vd===null)return;const B=k.touches[0].clientX,H=vd-B;H>5?I("next"):H<-5&&I("previous"),vd=null},R={"--width":`${w||0}px`,"--total-cards":T,"--cards-per-page":f,"--page":y};if(h)return g.jsx(bh,{layout:`carousel${i?"-with-title":""}`});const D=(k,B)=>{var $;let H=null;return($=k==null?void 0:k.sys)!=null&&$.id?H=`card-${k.sys.id}`:k!=null&&k.slug?H=`card-${k.slug}`:[n[B],k.contentType].includes("customCard")&&(H=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${B}`),H};return g.jsxs("section",{ref:x,className:ee("carousel-wrapper",a),"data-testid":"carousel",children:[g.jsx(Eve,{id:e,title:i}),g.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:M,style:R,"data-testid":"carousel-list",children:t.map((k,B)=>{let H=D(k,B);const{inView:$,isLoaded:F}=bve(B,f,y,v);return H&&($||F)?g.jsx(d5,{id:H,card:{...k,contentType:n[B]},buildCardData:r,gtmContext:o,meta:{isTabbable:$},...s},H):(H=H||`${e}-card-${B}`,g.jsx(Vr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},H))})}),C<=1?null:g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[g.jsx("li",{className:"arrow previous",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),I("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:y<=0})}),[...Array(C)].map((k,B)=>g.jsx("li",{"data-testid":"carousel-controls-button",children:g.jsx("button",{className:ee("page-indicator",{selected:B===y}),onClick:H=>{H.preventDefault(),H.stopPropagation(),I(B)},children:g.jsx(xt,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:B+1,total:C})})})},`page-indicator-${B}`)),g.jsx("li",{className:"arrow next",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),I("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:y>=C-1})})]}),g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},Tve=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:o,cards:s,cardsTypes:l},u)=>{const c=a?window.btoa(a):`carousel-${u}`,d=u===e.length-1;return t?g.jsxs(E.Fragment,{children:[g.jsx(bh,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:g.jsx(di,{})]},`placeholder-${c}`):g.jsxs(E.Fragment,{children:[g.jsx(_ve,{cards:s,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:o},...i}),d?null:g.jsx(di,{})]},`carousel-${c}`)});const Cve=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:o,isPrivate:s,slug:l}=n;let u={};return l&&(u={onClick:d=>{l&&(d.preventDefault(),d.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),E.createElement(e,{className:ee("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ee("img",{private:s,"no-image":!i}),children:i&&g.jsx(uo,{image:i})}),g.jsxs("div",{className:"content",children:[a&&g.jsx("p",{className:"title text-medium",children:a}),o&&g.jsx("p",{className:"text text-medium",children:o})]})]})})};const xve=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:o={},className:s=""})=>{const l=me.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=o;return E.createElement(e,{className:ee("course-progression",s,{"highlight-percentage":c,"has-circle-graph":a==="circle"}),children:g.jsxs(g.Fragment,{children:[g.jsx(Mv,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}}),g.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:d=>g.jsx("strong",{children:d}),number:u})}),u<100&&i&&g.jsx(wp,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})})]})})};const vD=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>E.createElement(e,{className:ee("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yD=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const o=me.useIntl(),s=gh(`lessonType_${i}`)?o.formatMessage({id:`lessonType_${i}`}):zC(i||"");return g.jsxs("small",{className:ee("content-type",{[e]:e!=="default"}),children:[g.jsx("span",{className:ee("type",n),children:s})," ",t>0&&!r&&g.jsx(wp,{time:t})," ",a?g.jsx("span",{className:"additional",children:a}):null]})};const wve=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:o,slug:s,timeLeft:l,title:u},quizScores:c})=>{const d=me.useIntl(),f="courseStructure_",h=u.toLowerCase().includes("course conclusion");return g.jsxs(vh,{className:"course-structure",label:g.jsxs(g.Fragment,{children:[g.jsxs("small",{children:[d.formatMessage({id:`${f}section${h?"_end":""}`},{number:a})," ",!r&&o>=0&&g.jsx("span",{className:"time",children:i&&l===0?d.formatMessage({id:`${f}time_completed`}):g.jsx(wp,{time:o,appendedText:i?d.formatMessage({id:`${f}time_left`}):""})})]}),g.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[g.jsx("p",{children:n}),g.jsx("ol",{children:e&&e.length>0&&e.map(({completed:m,completionTime:p,contentType:y,icon:v,image:b,isIntroduction:_,optional:T,slug:C,subsectionId:x,title:w,type:I})=>{const O=i&&t||_,M={};return b&&(M.style={"--image":`url(${b})`}),g.jsx("li",{className:ee({article:y===Du.ARTICLE,discussion:y===Du.DISCUSSION,quiz:y===Du.QUIZ,completed:m&&y===Du.ARTICLE,locked:!O}),...M,children:g.jsx(co,{href:O?`/microcourses/en/${s}/${C}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${UC(w)}`,gtmType:"article-click",children:g.jsxs(g.Fragment,{children:[g.jsx(vD,{sectionId:a,subsectionId:x,title:w,className:"course-title"})," ",g.jsx(yD,{completionTime:p,icon:v,optional:T,type:I,children:c&&c[C]&&g.jsx("span",{className:"quiz-score",children:`${c[C]}%`})})]})})},C)})})]})};const Ave=({isComplete:e=!1,onClick:t,...n})=>{const r=me.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),g.jsx(Ke,{...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:ee("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Sve=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),DC=[{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 yd="notFoundError_",kve=()=>{const e=me.useIntl(),t=[];return DC.forEach((n,r)=>{n.title=e.formatMessage({id:`${yd}post_${r+1}`}),t.push("solutionArticle")}),g.jsxs(sD,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:g.jsxs(po,{children:[g.jsx(gD,{cards:DC,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),g.jsx(Ke,{href:"/solution-articles/",children:e.formatMessage({id:`${yd}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[g.jsx("h1",{children:e.formatMessage({id:`${yd}title`})}),g.jsx("p",{children:e.formatMessage({id:`${yd}text`})})]})};exports.ASSETS_URL=Hi;exports.ActionBar=V3;exports.ActionButton=bc;exports.ActivitiesFeed=dI;exports.ActivitySection=Qge;exports.ActivityType=Bl;exports.AddPost=u5;exports.Badge=f3;exports.BadgeScope=Rn;exports.Badges=h3;exports.BadgesContext=Nv;exports.BadgesProvider=n3;exports.Banner=sve;exports.BannerSection=cve;exports.Breadcrumbs=II;exports.Buckets=sO;exports.Button=Ke;exports.ButtonWrapper=Fl;exports.COURSE_CONTENT_TYPES=Du;exports.CacheProvider=r3;exports.Card=d5;exports.CardBlock=gD;exports.Carousel=Tve;exports.CharacterLimit=Jv;exports.Checkbox=ey;exports.CollapsibleSection=vh;exports.Columns=K3;exports.CommunityDetails=DN;exports.ConnectionCta=p3;exports.ConnectionDirectionType=Fv;exports.ConnectionStatusType=Rv;exports.ContactFooter=MU;exports.ContactForm=Sw;exports.ContentTypeLabel=QC;exports.Contributors=Bv;exports.ConversationContext=Cp;exports.CookieBanner=Pw;exports.CourseProgression=xve;exports.CourseStructure=wve;exports.CustomContentBanner=dve;exports.CustomEvents=bn;exports.DELETED_USER_ID=gc;exports.Directory=nve;exports.DiscussionContentType=at;exports.DiscussionConversation=cD;exports.DiscussionForm=l1;exports.DiscussionFormCard=fD;exports.DiscussionFormModal=mD;exports.DiscussionPost=u1;exports.DiscussionThread=pD;exports.DiscussionType=fi;exports.Divider=di;exports.DownloadSection=IU;exports.EMAILS=Us;exports.EditSection=RU;exports.EmailHelperTextBox=Y3;exports.EmptyStateBox=Ui;exports.EnrichedUrl=Qv;exports.FeatureFlags=o3;exports.Filters=q3;exports.FlagsProvider=a3;exports.Footer=ky;exports.Form=Zi;exports.Formatting=ae;exports.Fragment=Ir;exports.FullWidthSection=po;exports.GET_STREAM_USER_PREFIX=X0;exports.GlobalProviders=yO;exports.Header=l5;exports.HelperTextBox=JC;exports.HiddenFromScreenReaders=mh;exports.HideShowTextBox=e3;exports.HighlightSection=hve;exports.HighlightedTextBox=br;exports.INVALID_TOKEN=VC;exports.IconBulletedList=cO;exports.ImageContainer=rO;exports.IntlProvider=s3;exports.InviteForm=kw;exports.InviteModal=Jge;exports.JoinButton=Uv;exports.Label=Af;exports.LanguageContext=Iv;exports.LanguageSwitcher=RI;exports.LessonName=vD;exports.LessonType=yD;exports.LikesButton=L3;exports.LikesFeed=H3;exports.LikesModal=U3;exports.Link=co;exports.LoadMore=Vc;exports.LoadingBlock=m3;exports.LoadingPlaceholder=Vr;exports.LoadingState=bh;exports.Logo=Xv;exports.LogoSection=FU;exports.MEMBERS_PER_PAGE=lD;exports.MENTION_REGEX=qC;exports.MarkCompleteButton=Ave;exports.MarkdownText=Qo;exports.MarketingBlock=pve;exports.Marks=Pi;exports.Member=Ea;exports.MembersList=uD;exports.Modal=Lv;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=UD;exports.NUMBER_OF_USERS=HD;exports.NarrowCard=Cve;exports.NavigationMenu=W3;exports.NotFoundError=kve;exports.Overlay=ka;exports.OverlayContext=Pv;exports.OverlayProvider=c3;exports.PageHeading=d3;exports.PageLayout=sD;exports.Password=Z3;exports.PasswordForm=TU;exports.PasswordRules=tx;exports.Pill=Fi;exports.Poll=dD;exports.Popover=ZC;exports.Portal=Ml;exports.ProfileForm=Dw;exports.ProfileImageChange=Aw;exports.ProfileModal=xp;exports.ProfileModalLauncher=c5;exports.ProfilePicture=Sa;exports.ProgressBar=Mv;exports.ProgressTracker=aO;exports.PublishArticleForm=wU;exports.Rating=QI;exports.RepliesFeed=j3;exports.ResponsesHeading=hD;exports.ResponsiveImage=uo;exports.ResultsVisibility=fh;exports.ReturnToNavButton=oO;exports.RichTextEditor=Sy;exports.STORAGE_KEYS=kv;exports.SearchForm=Nw;exports.ShareLink=z3;exports.ShareLinks=jI;exports.ShowEmail=rve;exports.SignupForm=NU;exports.Span=ng;exports.StatusBanner=ml;exports.TableOfContents=ove;exports.Tabs=HI;exports.Tags=Cge;exports.TestimonialBlock=ave;exports.TimeToComplete=wp;exports.Toggle=EU;exports.Tooltip=os;exports.TopLevelPage=BU;exports.UUID_V4_REGEX=vc;exports.UserContext=gn;exports.UserProvider=l3;exports.VisuallyHidden=xt;exports.addAriaProps=D3;exports.basicReducer=Pl;exports.camelCaseToDashCase=HC;exports.checkIntlPathExists=gh;exports.courseDiscussionRepliesFeedMock=hI;exports.enrichPostCategories=Zv;exports.generateConditions=Dd;exports.generateCssIcon=zD;exports.getAuthorData=Ll;exports.getCharacterLimitProps=G3;exports.getLongDate=Dv;exports.getMember=Eh;exports.getPostBody=Yv;exports.getShortDate=WC;exports.getValueLength=_h;exports.headerData=zc;exports.likesResponseMock=OI;exports.mapGetStreamData=Sve;exports.pageReady=KC;exports.passwordValidator=eg;exports.repliesFeedMock=fI;exports.supportedLanguages=_d;exports.toCamelCase=UC;exports.toCapitalisedCase=jD;exports.toSentenceCase=zC;exports.transformSlugs=sg;exports.useAutoResize=FC;exports.useBadges=t3;exports.useCurrentPath=MC;exports.useEffectAfterMount=pl;exports.useElementWidth=lo;exports.useOverlay=u3;exports.useScrollListener=LC;exports.useScrollToHash=Av;exports.useTooltips=Sv;exports.useUser=yh;
|
package/index.mjs
CHANGED
|
@@ -59620,10 +59620,10 @@ const xp = ({
|
|
|
59620
59620
|
canReply: n ?? !0,
|
|
59621
59621
|
functions: { onClick: Et }
|
|
59622
59622
|
} : !1,
|
|
59623
|
-
shareLink: {
|
|
59623
|
+
shareLink: !(o != null && o.shareLink) && {
|
|
59624
59624
|
url: `${window.location.origin}${(ge = t.slugs) == null ? void 0 : ge.question}/${(Ie = t.slugs) == null ? void 0 : Ie.answer}${(Ee = t.slugs) != null && Ee.reply ? `#${(X = t.slugs) == null ? void 0 : X.reply}` : ""}`
|
|
59625
59625
|
},
|
|
59626
|
-
moreMenu: {
|
|
59626
|
+
moreMenu: !(o != null && o.moreMenu) && {
|
|
59627
59627
|
options: ut,
|
|
59628
59628
|
contentSlug: t.slug,
|
|
59629
59629
|
reportData: {
|