@apolitical/component-library 1.4.1-beta.0 → 1.4.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +63 -90
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -102,4 +102,4 @@ For more details see https://formatjs.io/docs/getting-started/message-distributi
|
|
|
102
102
|
`},paragraph:{t:gT,i:ve.LOW,l:Rs,h:(c,p,m)=>r("p",{key:m.k},p(c.v,m))},ref:{t:hr($S),i:ve.MAX,l:c=>(a[c[1]]={B:c[2],F:c[4]},{}),h:Is},refImage:{t:pr(jS),i:ve.MAX,l:c=>({D:c[1]||void 0,P:c[2]}),h:(c,p,m)=>r("img",{key:m.k,alt:c.D,src:_n(a[c.P].B),title:a[c.P].F})},refLink:{t:hr(HS),i:ve.MAX,l:(c,p,m)=>({v:p(c[1],m),Z:p(c[0].replace(qS,"\\$1"),m),P:c[2]}),h:(c,p,m)=>a[c.P]?r("a",{key:m.k,href:_n(a[c.P].B),title:a[c.P].F},p(c.v,m)):r("span",{key:m.k},p(c.Z,m))},table:{t:er(bm),i:ve.HIGH,l:mT,h:(c,p,m)=>r("table",{key:m.k},r("thead",null,r("tr",null,c.L.map(function(_,T){return r("th",{key:T,style:od(c,T)},p(_,m))}))),r("tbody",null,c.A.map(function(_,T){return r("tr",{key:T},_.map(function(E,b){return r("td",{key:b,style:od(c,b)},p(E,m))}))})))},tableSeparator:{t:function(c,p){return p.$?(p._=!0,VS.exec(c)):null},i:ve.HIGH,l:function(){return{type:"tableSeparator"}},h:()=>" | "},text:{t:Mi(nT),i:ve.MIN,l:c=>({v:c[0].replace(LS,(p,m)=>t.namedCodesToUnicode[m]?t.namedCodesToUnicode[m]:p)}),h:c=>c.v},textBolded:{t:pr(JS),i:ve.MED,l:(c,p,m)=>({v:p(c[2],m)}),h:(c,p,m)=>r("strong",{key:m.k},p(c.v,m))},textEmphasized:{t:pr(ZS),i:ve.LOW,l:(c,p,m)=>({v:p(c[2],m)}),h:(c,p,m)=>r("em",{key:m.k},p(c.v,m))},textEscaped:{t:pr(rT),i:ve.HIGH,l:c=>({v:c[1],type:"text"})},textMarked:{t:pr(eT),i:ve.LOW,l:Rs,h:(c,p,m)=>r("mark",{key:m.k},p(c.v,m))},textStrikethroughed:{t:pr(tT),i:ve.LOW,l:Rs,h:(c,p,m)=>r("del",{key:m.k},p(c.v,m))}};t.disableParsingRawHTML!==!0&&(l.htmlBlock={t:Mi(pu),i:ve.HIGH,l(c,p,m){const[,_]=c[3].match(oT),T=new RegExp(`^${_}`,"gm"),E=c[3].replace(T,""),b=(A=E,dT.some(M=>M.test(A))?vT:Po);var A;const w=c[1].toLowerCase(),N=ES.indexOf(w)!==-1;m.N=m.N||w==="a";const F=N?c[3]:b(p,E,m);return m.N=!1,{O:i(c[2]),v:F,G:N,H:N?w:c[1]}},h:(c,p,m)=>r(c.H,zr({key:m.k},c.O),c.G?c.v:p(c.v,m))},l.htmlSelfClosing={t:Mi(mu),i:ve.HIGH,l:c=>({O:i(c[2]||""),H:c[1]}),h:(c,p,m)=>r(c.H,zr({},c.O,{key:m.k}))});const f=function(c){let p=Object.keys(c);function m(_,T){let E=[],b="";for(;_;){let A=0;for(;A<p.length;){const w=p[A],N=c[w],F=N.t(_,T,b);if(F){const M=F[0];_=_.substring(M.length);const q=N.l(F,m,T);q.type==null&&(q.type=w),E.push(q),b=M;break}A++}}return E}return p.sort(function(_,T){let E=c[_].i,b=c[T].i;return E!==b?E-b:_<T?-1:1}),function(_,T){return m(function(E){return E.replace(CS,`
|
|
103
103
|
`).replace(IS,"").replace(WS," ")}(_),T)}}(l),u=(h=function(c){return function(p,m,_){return c[p.type].h(p,m,_)}}(l),function c(p,m={}){if(Array.isArray(p)){const _=m.k,T=[];let E=!1;for(let b=0;b<p.length;b++){m.k=b;const A=c(p[b],m),w=typeof A=="string";w&&E?T[T.length-1]+=A:A!==null&&T.push(A),E=w}return m.k=_,T}return h(p,c,m)});var h;const d=o(e);return s.length?r("div",null,d,r("footer",{key:"footer"},s.map(function(c){return r("div",{id:t.slugify(c.j),key:c.j},c.j,u(f(c.I,{_:!0})))}))):d}(function(e){e[e.MAX=0]="MAX",e[e.HIGH=1]="HIGH",e[e.MED=2]="MED",e[e.LOW=3]="LOW",e[e.MIN=4]="MIN"})(ve||(ve={}));const Zo=e=>{let{children:t,options:n}=e,r=function(o,i){if(o==null)return{};var s,a,l={},f=Object.keys(o);for(a=0;a<f.length;a++)i.indexOf(s=f[a])>=0||(l[s]=o[s]);return l}(e,vS);return Oe.cloneElement(_T(t,n),r)};const nr=({variant:e="primary",className:t="",children:n,...r})=>C.jsx("div",{className:se("highlighted-text-box",e,t),...r,children:n});const Lm=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let o=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Ki(i);if(i&&typeof n=="object"&&typeof s=="number"){const u=Object.assign({},n.breakpoints),h=Np(Object.keys(u));o=Lp(s,h,u)}const{breakpoints:a,text:l,...f}=n;return C.jsx(nr,{variant:"subtle",className:se("empty-state-box",e,r),children:C.jsxs(C.Fragment,{children:[t&&C.jsx(Zo,{options:{forceBlock:!0},children:t}),o&&typeof n=="object"&&C.jsx(ut,{...f,variant:n.variant?n.variant:"secondary",children:l})]})})};const gu=({children:e,...t})=>C.jsx("p",{...t,children:e}),km={q:gu,blockquote:gu};for(let e=1;e<=6;e++)km[`h${e}`]={component:gu,props:{className:"title"}};const Bm=({type:e="default",className:t="",heading:n=!1,children:r})=>C.jsxs("div",{className:se("helper-text-box text-small",e,t),children:[n&&C.jsx("p",{className:"title",children:n}),typeof r=="string"?C.jsx(Zo,{options:{wrapper:G.Fragment,forceBlock:!0,overrides:km},children:r}):C.jsx("p",{children:r})]});const bT=({className:e="",show:t=!1,hide:n=!1,text:r,children:o})=>{const i=Ie(),s=G.useRef(null),[a,l]=G.useState(""),[f,u]=G.useState("closed");G.useEffect(()=>{const c=s.current;if(c)return c.addEventListener("transitionend",h),()=>{c.removeEventListener("transitionend",h)}},[]),G.useEffect(()=>{if(!r||typeof r!="string")return;const c=r.split(`
|
|
104
104
|
`);l(c.length<3?`${r.substring(0,400)}...`:c.slice(0,3).join(`
|
|
105
|
-
`))},[r]),G.useEffect(()=>{f==="ready-to-close"&&u("closing")},[f]);const h=({propertyName:c})=>{c==="max-height"&&u(p=>p==="opening"?"open":p==="closing"?"closed":p)};if(!r)return null;const d=["opening","open"].includes(f);return C.jsxs(nr,{variant:"subtle",className:se("hide-show-text-box",e),children:[C.jsxs("div",{ref:s,className:se("content",f),children:[C.jsx(Zo,{options:{forceBlock:!0},children:f==="closed"?a:r}),f!=="closed"&&o]}),C.jsx("p",{className:"cta",children:C.jsx(ut,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:se({"rotate-180":d}),onClick:()=>{u(d?"ready-to-close":"opening")},children:d?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},wT=()=>G.Fragment,ST=({children:e})=>C.jsx(nr,{variant:"secondary",children:e}),TT=["span","strong","h1","h2","h3","h4","h5","h6","p"],OT=({children:e})=>{const t=Ie();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of G.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(G.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of G.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&G.isValidElement(s)){const a=s.type;if(TT.includes(a)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const o=n?n.toString():"";return C.jsx(qu,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(i=>i)})},xT=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return C.jsx(nr,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return C.jsx(nr,{variant:"primary",children:e});case"pink-textbox":return C.jsx(nr,{variant:"tertiary",children:e});default:return C.jsx("div",{...t,children:e})}return C.jsx("div",{...t,children:e})},AT=e=>{const t=Ie(),n=Date.now().toString();let r="default";const o=e.src;return o.includes("youtube")||o.includes("vimeo")?r="video":o.includes("riddle")||o.includes("sli.do")?r="poll":o.includes("padlet")&&(r="padlet"),C.jsxs(C.Fragment,{children:[C.jsx(it,{children:C.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),C.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),C.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},sd=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},CT=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,o=!1;for(const i of G.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&G.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||sd(i.props.children[0])==="button")&&(o=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!G.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&sd(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},C.jsx("p",{className:"center",children:C.jsx(ut,{variant:"primary",size:"medium",...n,children:r})})):C.jsx("a",{...n,children:r})};const Mm=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:G.Fragment,forceBlock:!0,overrides:{a:CT,CollapsibleSection:qu,TextBox:nr,CaseStudy:ST,style:wT,details:OT,div:xT,iframe:AT}};return C.jsx("div",{className:se("markdown-text",e),children:C.jsx(Zo,{options:{...r,...t},children:n})})};const RT=({className:e="",children:t})=>C.jsx("span",{className:se("pill",e),children:t});const PT=({progress:e=0,text:t=!1,className:n=""})=>{const r=Ie(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return C.jsx("span",{className:se(`progress-bar section-${o}`,n),style:i,children:C.jsx(it,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Fm=G.memo(PT);const Ls="loadingBlock_",IT=({progress:e=0,steps:t=!1,className:n=""})=>{const r=Ie();t||(t={0:{text:r.formatMessage({id:`${Ls}loading`})},75:{text:r.formatMessage({id:`${Ls}almostDone`})},100:{text:r.formatMessage({id:`${Ls}complete`})}});let o=null;const i=Object.keys(t);for(let a=0;a<i.length&&!(e<parseInt(i[a]));a++)o=i[a];const s=o&&t[o].icon?{"--icon":`url(${$o}icons/${t[o].icon}.svg)`}:{};return C.jsxs(nr,{className:se("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:s,children:[o&&C.jsx("span",{className:"step",children:t[o].text}),C.jsx(Fm,{progress:e})]})},NT=G.memo(IT);const vr=({element:e="div",className:t="",...n})=>C.jsx(Eu,{element:e,className:se("loading-placeholder",t),...n});const yu={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Um=(e,t)=>e in yu?C.jsx("div",{className:e,children:yu[e].map((n,r)=>Um(n,r))},t):C.jsx(vr,{className:e},t),Dm=({layout:e="overview-page"})=>C.jsx("div",{className:se("loading-state",e),children:yu[e].map((t,n)=>Um(t,n))}),$m=e=>{const t=e&&e.toUpperCase().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},To=["#5AB6A3","#A2D7AF","#806056","#3962B3"],LT=e=>{const t=Math.ceil(26/To.length),n=$m(e).toLowerCase();if(n==="")return To[0];const r=n.charCodeAt(0)-96;for(let o=0;o<To.length;o++)if(r<=t*(o+1))return To[o]};const ud=256,ea=({className:e="",src:t="",name:n,alt:r,width:o=ud,height:i=ud,...s})=>{const[a,l]=G.useState(!1),f=G.useRef(null);return G.useEffect(()=>{const u=f.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const d=o,c=i;typeof window<"u"&&window.devicePixelRatio&&(u.width=d*window.devicePixelRatio,u.height=c*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=LT(n),h.fillRect(0,0,d,c),h.font=`${d/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText($m(n),d/2,c/1.6)},[n]),C.jsxs("figure",{className:se("profile-picture",e,{error:a}),...s,children:[t!==""&&!a&&C.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:o,height:i}),(t===""||a)&&C.jsx("canvas",{ref:f})]})},Vu=e=>e==="apolitical"?{image:`${$o}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${$o}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id||e.slug}`,image:e.image&&e.image.thumbnail},kT=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",i=t!=="",s=n!=="";if(!o&&!i&&!s)return"";const a=`${e}${o&&i?` — ${t}`:t}`;let l=`${a}${(o||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=a),l.length>r&&(l=hm(l,r)),l};const zu=({member:e="community",additionalContent:t=!1,gtmContext:n="member",gtmType:r="member-click",className:o=""})=>{const i=Ie(),s=Vu(e);s.name||(s.name=i.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:a,url:l,image:f}=s,u=kT(s),h=t&&t.createdAt?Bb(t.createdAt):!1;return C.jsx("div",{className:se("member text-medium",o),children:C.jsxs(kp,{href:l,gtmType:r,gtmContext:n,children:[C.jsx(ea,{name:a,src:f}),C.jsxs("p",{className:"details",children:[C.jsx("strong",{children:a}),t&&C.jsxs("span",{className:"additional-content",children:[t.createdAt&&h&&C.jsx("span",{className:"date",title:Df(t&&t.createdAt),"aria-label":Df(t&&t.createdAt),children:i.formatMessage({id:`dates_${h.path}`},{number:h.number})}),t.didEdit&&C.jsx("em",{children:i.formatMessage({id:"discussion_edited"})})]}),u&&C.jsx("small",{children:u})]})]})})};const cd={small:24,medium:48},jm=({element:e="div",contributors:t=[],styling:{showText:n,size:r,showGap:o,showPlaceholders:i}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:s=2,className:a=""})=>{const l=Ie();return t.length===0?null:G.createElement(e,{className:se("contributors",a,r,{"has-gap":o}),children:C.jsxs(C.Fragment,{children:[C.jsx("ul",{children:t.map((f,u)=>{let h,d="";if(u<s){const{name:c="",image:p=""}=Vu(f);if(i)return C.jsx(vr,{element:"li",className:"contributor"},u);h=C.jsx(ea,{name:c,src:p,width:cd[r||"medium"],height:cd[r||"medium"]})}else u===s&&(h=C.jsxs("small",{children:["+",t.length-s]}),d="number-left");return h?C.jsx("li",{className:se("contributor",d),children:h},u):null})}),n&&C.jsx("span",{className:"label",children:typeof n=="string"?n:t.length===1?typeof t[0]=="string"?l.formatMessage({id:`member_${t[0]}`}):hm(t[0].name||"",20):null})]})})},BT=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...Ub[r],...n||{}};return C.jsx(pS,{locale:r,messages:o,children:e})},Bn=G.createContext(null),MT=({children:e,user:t})=>C.jsx(Bn.Provider,{value:t,children:e});const Hm=({isMember:e=!1,functions:{join:t,leave:n}={join:()=>{},leave:()=>{}}})=>{const r=Ie(),o=G.useContext(Bn),i=o&&typeof o.id=="string",[s,a]=G.useState(e);return C.jsx(ut,{variant:s?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:s?{icon:"tick",position:"left"}:!1,onClick:async()=>{s?typeof n=="function"&&await n():typeof t=="function"&&await t(),a(!s)},className:"join-community-button",disabled:!i,children:r.formatMessage({id:`joinCommunityButton${s?"_member":""}`})})};const FT=({className:e="",...t})=>{const n=Ie();return C.jsxs("div",{className:se("community-details",e),children:[C.jsx(Hm,{...t}),C.jsxs("div",{className:"additional-details",children:[C.jsx("hr",{}),C.jsx("h3",{children:n.formatMessage({id:"communityDetails_members"})}),C.jsx(jm,{contributors:[{},{},{},{},{}],styling:{size:"medium",showGap:!0,showPlaceholders:!0},cutoff:5})]})]})},UT={showThread:!1,showForm:!1},Yu=G.createContext(UT),DT=({children:e})=>{const[t,n]=G.useState({showThread:!1,showForm:!1});return C.jsx(Yu.Provider,{value:{...t,updateConversation:n},children:e})};function vu(){return vu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vu.apply(this,arguments)}function $T(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var jT=G.useLayoutEffect,HT=function(t){var n=Oe.useRef(t);return jT(function(){n.current=t}),n},ld=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},qT=function(t,n){var r=G.useRef();return G.useCallback(function(o){t.current=o,r.current&&ld(r.current,null),r.current=n,n&&ld(n,o)},[n])},fd={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},GT=function(t){Object.keys(fd).forEach(function(n){t.style.setProperty(n,fd[n],"important")})},dd=GT,rt=null,hd=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function WT(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),rt||(rt=document.createElement("textarea"),rt.setAttribute("tabindex","-1"),rt.setAttribute("aria-hidden","true"),dd(rt)),rt.parentNode===null&&document.body.appendChild(rt);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(d){var c=d;rt.style[c]=s[c]}),dd(rt),rt.value=t;var l=hd(rt,e);rt.value=t,l=hd(rt,e),rt.value="x";var f=rt.scrollHeight-o,u=f*n;a==="border-box"&&(u=u+o+i),l=Math.max(u,l);var h=f*r;return a==="border-box"&&(h=h+o+i),l=Math.min(h,l),[l,f]}var pd=function(){},VT=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},zT=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],YT=!!document.documentElement.currentStyle,KT=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=VT(zT,n),o=r.boxSizing;if(o==="")return null;YT&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),s=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:s}},QT=KT;function qm(e,t,n){var r=HT(n);Oe.useLayoutEffect(function(){var o=function(s){return r.current(s)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var XT=function(t){qm(window,"resize",t)},JT=function(t){qm(document.fonts,"loadingdone",t)},ZT=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],eO=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,a=s===void 0?pd:s,l=t.onHeightChange,f=l===void 0?pd:l,u=$T(t,ZT),h=u.value!==void 0,d=Oe.useRef(null),c=qT(d,n),p=Oe.useRef(0),m=Oe.useRef(),_=function(){var b=d.current,A=r&&m.current?m.current:QT(b);if(A){m.current=A;var w=WT(A,b.value||b.placeholder||"x",i,o),N=w[0],F=w[1];p.current!==N&&(p.current=N,b.style.setProperty("height",N+"px","important"),f(N,{rowHeight:F}))}},T=function(b){h||_(),a(b)};return Oe.useLayoutEffect(_),XT(_),JT(_),Oe.createElement("textarea",vu({},u,{onChange:T,ref:c}))},tO=Oe.forwardRef(eO);let Oo=null;const pt="discussion_form_",Gm=({content:e={type:"response",slugs:{}},meta:t={isLoading:!1,isInWrapper:!1,isEditing:!1},inputRef:n,maxLength:r=5e4,minRows:o=4,forceShow:i={cancel:!1,error:!1},functions:s={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:a="DiscussionForm"})=>{var M,q;const l=Ie(),f=G.useContext(Bn),[u,h]=G.useState(t.isEditing&&t.isEditing.text||""),[d,c]=G.useState(i.error||!1),[p,m]=G.useState(!1),_=G.useRef(null);if(n||(n=_),t.isLoading)return C.jsx(vr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const T=W=>{const V=W.target.value;h(V);let j;!f||!f.id?j=dr(l.formatMessage,`${pt}error_loggedOut`,e.type,"action"):V.length>=r&&(j=`${pt}error_tooLong`),j?c(j):d&&c(!1)};let E=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const W=e.type==="response"?((M=e.slugs)==null?void 0:M.question)||"":((q=e.slugs)==null?void 0:q.answer)||"";W&&(E=`${E}-${W.slice(-15)}`)}const b=async W=>{var j;if(W.preventDefault(),W.stopPropagation(),w)return;Oo&&clearTimeout(Oo),m("submitting");const V=window.location.pathname;try{let Y;switch(e.type){case"post":Y=await s.create({content:u});break;case"question":Y=await s.create({title:u,authorId:f&&f.id,...(j=s.props)==null?void 0:j.create});break;case"response":Y=await s.create({question:e.slugs.question},{body:u,authorId:f&&f.id,contentPath:V});break;case"reply":Y=await s.create({question:e.slugs.question,answer:e.slugs.answer},{body:u,authorId:f&&f.id,contentPath:V});break;default:break}await Mb(1e3),s.callback&&await s.callback(Y),Oo=setTimeout(()=>{h(""),m("submitted"),A()},500)}catch(Y){const oe=Y;let K=`${pt}error`;oe.message.includes("entry already exists")&&(K=dr(l.formatMessage,`${pt}error_alreadyExists`,e.type,"action")),oe.message.includes("429")?K=dr(l.formatMessage,`${pt}error_tooMany`,e.type,"action"):oe.message.includes("400")&&(K=`${pt}error`),c(K),A()}},A=()=>{Oo=setTimeout(()=>{c(!1),m(!1)},5e3)},w=!u||!$b(u),N=p==="submitting",F=[];return(t.isEditing&&!N||i.cancel)&&F.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:s.handleCancel,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!i.cancel&&(!f||!f.id||!u),children:l.formatMessage({id:`${pt}cancel`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:W=>{if(t.isEditing){m("submitting"),s.handleSaveEdit&&s.handleSaveEdit(_.current&&"value"in _.current?_.current.value:"");return}b(W)},className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":`${t.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!f||!f.id||w||N||t.isEditing&&u===t.isEditing.text,children:l.formatMessage({id:`${pt}${N?t.isEditing?"saving":"posting":t.isEditing?"save":"post"}`})}),C.jsxs("form",{id:E,className:se("discussion-card discussion-form",{"no-styling":t.isInWrapper&&t.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[!t.isEditing&&["question"].includes(e.type)&&C.jsx("h2",{children:dr(l.formatMessage,`${pt}title`,e.type,"action")}),C.jsx(zu,{member:f||"community",gtmContext:a,gtmType:"profile-click"}),C.jsx(it,{element:"label",showOnFocus:!1,htmlFor:`${E}-input`,children:dr(l.formatMessage,`${pt}label`,e.type,"action")}),C.jsx(tO,{ref:n,id:`${E}-input`,name:e.type,placeholder:dr(l.formatMessage,`${pt}placeholder`,e.type,"action"),onChange:T,value:u,maxLength:r,"aria-invalid":!!d,"aria-errormessage":"error-message",minRows:o,autoFocus:!!t.isEditing}),C.jsx("small",{children:dr(l.formatMessage,`${pt}explainer`,e.type,"action",{a:W=>C.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"community-guidelines-link",children:W})})}),p==="submitted"&&C.jsx(hu,{className:"success","data-testid":"success",children:dr(l.formatMessage,`${pt}success`,e.type,"action")}),d&&C.jsx(hu,{id:"error-message",className:"error","data-testid":"error",children:i.error?i.error:typeof d=="string"?d.includes(" ")?d:l.formatMessage({id:d},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:r}):d}),C.jsx(Xo,{buttons:F})]})},rO=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}});let $i=!1;const ks=()=>{$i!==!1&&(clearTimeout($i),$i=!1)},Wm=({element:e="p",likes:t=0,isShort:n=!0,userLiked:r=!1,content:o={type:"reply",slugs:{}},canLike:i=!0,createLike:s=()=>{},deleteLike:a=()=>{}})=>{const l=Ie();console.log({likes:t,userLiked:r}),G.useEffect(()=>{d(r)},[r]);const[f,u]=G.useState(t),[h,d]=G.useState(r),[c,p]=G.useState(!1),m=window.location.pathname,_=E=>{if(E.preventDefault(),E.stopPropagation(),$i)return ks(),!1;if(ks(),c||!i)return!1;$i=setTimeout(T,350)},T=async()=>{if(ks(),c||!i)return!1;let E=h?f-1:f+1;E<0&&(E=0),p(!0),u(E),d(!h);try{if(o&&o.slugs){const b=rO(o.slugs);h?await a(b):await s(b,{contentPath:m})}}catch{u(t),d(r)}finally{p(!1)}};return G.createElement(e,{className:se("likes-wrapper text-medium",{"show-spinner":c,"is-liked":h,disabled:!i}),onClick:_,children:C.jsxs(C.Fragment,{children:[C.jsx(ut,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:se({"do-animation":h&&!r}),screenreaderText:i?l.formatMessage({id:`discussion_${o.type}_likes_${h?"unlike":"like"}`}):!1,onClick:_,disabled:!i,"aria-hidden":!i,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${o.type}-click`}),C.jsx("span",{className:"number-of-likes","data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${n?"_short":""}`},{number:f})})]})})};var jo={exports:{}};jo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",f="[object AsyncFunction]",u="[object Boolean]",h="[object Date]",d="[object Error]",c="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",T="[object Null]",E="[object Object]",b="[object Promise]",A="[object Proxy]",w="[object RegExp]",N="[object Set]",F="[object String]",M="[object Symbol]",q="[object Undefined]",W="[object WeakMap]",V="[object ArrayBuffer]",j="[object DataView]",Y="[object Float32Array]",oe="[object Float64Array]",K="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",J="[object Uint8Array]",de="[object Uint8ClampedArray]",X="[object Uint16Array]",ee="[object Uint32Array]",ue=/[\\^$.*+?()[\]{}|]/g,ce=/^\[object .+?Constructor\]$/,Ve=/^(?:0|[1-9]\d*)$/,Q={};Q[Y]=Q[oe]=Q[K]=Q[k]=Q[z]=Q[J]=Q[de]=Q[X]=Q[ee]=!0,Q[a]=Q[l]=Q[V]=Q[u]=Q[j]=Q[h]=Q[d]=Q[c]=Q[m]=Q[_]=Q[E]=Q[w]=Q[N]=Q[F]=Q[W]=!1;var re=typeof ae=="object"&&ae&&ae.Object===Object&&ae,Pe=typeof self=="object"&&self&&self.Object===Object&&self,xe=re||Pe||Function("return this")(),at=t&&!t.nodeType&&t,ct=at&&!0&&e&&!e.nodeType&&e,_t=ct&&ct.exports===at,te=_t&&re.process,ze=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),De=ze&&ze.isTypedArray;function bt(y,O){for(var R=-1,$=y==null?0:y.length,fe=0,ie=[];++R<$;){var pe=y[R];O(pe,R,y)&&(ie[fe++]=pe)}return ie}function Gt(y,O){for(var R=-1,$=O.length,fe=y.length;++R<$;)y[fe+R]=O[R];return y}function Rt(y,O){for(var R=-1,$=y==null?0:y.length;++R<$;)if(O(y[R],R,y))return!0;return!1}function mt(y,O){for(var R=-1,$=Array(y);++R<y;)$[R]=O(R);return $}function br(y){return function(O){return y(O)}}function wt(y,O){return y.has(O)}function gt(y,O){return y==null?void 0:y[O]}function $e(y){var O=-1,R=Array(y.size);return y.forEach(function($,fe){R[++O]=[fe,$]}),R}function St(y,O){return function(R){return y(O(R))}}function tt(y){var O=-1,R=Array(y.size);return y.forEach(function($){R[++O]=$}),R}var Ye=Array.prototype,wr=Function.prototype,S=Object.prototype,g=xe["__core-js_shared__"],v=wr.toString,x=S.hasOwnProperty,P=function(){var y=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return y?"Symbol(src)_1."+y:""}(),U=S.toString,H=RegExp("^"+v.call(x).replace(ue,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),le=_t?xe.Buffer:void 0,be=xe.Symbol,we=xe.Uint8Array,Se=S.propertyIsEnumerable,he=Ye.splice,lt=be?be.toStringTag:void 0,ir=Object.getOwnPropertySymbols,Sr=le?le.isBuffer:void 0,Wt=St(Object.keys,Object),Tr=Ot(xe,"DataView"),Vt=Ot(xe,"Map"),Or=Ot(xe,"Promise"),xr=Ot(xe,"Set"),Ar=Ot(xe,"WeakMap"),Pt=Ot(Object,"create"),nn=Ke(Tr),Tt=Ke(Vt),Fn=Ke(Or),Un=Ke(xr),Dn=Ke(Ar),on=be?be.prototype:void 0,Cr=on?on.valueOf:void 0;function Fe(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function Rr(){this.__data__=Pt?Pt(null):{},this.size=0}function Pr(y){var O=this.has(y)&&delete this.__data__[y];return this.size-=O?1:0,O}function zt(y){var O=this.__data__;if(Pt){var R=O[y];return R===r?void 0:R}return x.call(O,y)?O[y]:void 0}function an(y){var O=this.__data__;return Pt?O[y]!==void 0:x.call(O,y)}function $n(y,O){var R=this.__data__;return this.size+=this.has(y)?0:1,R[y]=Pt&&O===void 0?r:O,this}Fe.prototype.clear=Rr,Fe.prototype.delete=Pr,Fe.prototype.get=zt,Fe.prototype.has=an,Fe.prototype.set=$n;function je(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function jn(){this.__data__=[],this.size=0}function Hn(y){var O=this.__data__,R=sr(O,y);if(R<0)return!1;var $=O.length-1;return R==$?O.pop():he.call(O,R,1),--this.size,!0}function qn(y){var O=this.__data__,R=sr(O,y);return R<0?void 0:O[R][1]}function Gn(y){return sr(this.__data__,y)>-1}function Ir(y,O){var R=this.__data__,$=sr(R,y);return $<0?(++this.size,R.push([y,O])):R[$][1]=O,this}je.prototype.clear=jn,je.prototype.delete=Hn,je.prototype.get=qn,je.prototype.has=Gn,je.prototype.set=Ir;function Je(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function Wn(){this.size=0,this.__data__={hash:new Fe,map:new(Vt||je),string:new Fe}}function Vn(y){var O=ft(this,y).delete(y);return this.size-=O?1:0,O}function zn(y){return ft(this,y).get(y)}function Yn(y){return ft(this,y).has(y)}function Kn(y,O){var R=ft(this,y),$=R.size;return R.set(y,O),this.size+=R.size==$?0:1,this}Je.prototype.clear=Wn,Je.prototype.delete=Vn,Je.prototype.get=zn,Je.prototype.has=Yn,Je.prototype.set=Kn;function or(y){var O=-1,R=y==null?0:y.length;for(this.__data__=new Je;++O<R;)this.add(y[O])}function sn(y){return this.__data__.set(y,r),this}function ar(y){return this.__data__.has(y)}or.prototype.add=or.prototype.push=sn,or.prototype.has=ar;function st(y){var O=this.__data__=new je(y);this.size=O.size}function Nr(){this.__data__=new je,this.size=0}function Qn(y){var O=this.__data__,R=O.delete(y);return this.size=O.size,R}function Xn(y){return this.__data__.get(y)}function Jn(y){return this.__data__.has(y)}function Zn(y,O){var R=this.__data__;if(R instanceof je){var $=R.__data__;if(!Vt||$.length<n-1)return $.push([y,O]),this.size=++R.size,this;R=this.__data__=new Je($)}return R.set(y,O),this.size=R.size,this}st.prototype.clear=Nr,st.prototype.delete=Qn,st.prototype.get=Xn,st.prototype.has=Jn,st.prototype.set=Zn;function ei(y,O){var R=ur(y),$=!R&&hn(y),fe=!R&&!$&&lr(y),ie=!R&&!$&&!fe&&Fr(y),pe=R||$||fe||ie,me=pe?mt(y.length,String):[],ke=me.length;for(var _e in y)(O||x.call(y,_e))&&!(pe&&(_e=="length"||fe&&(_e=="offset"||_e=="parent")||ie&&(_e=="buffer"||_e=="byteLength"||_e=="byteOffset")||It(_e,ke)))&&me.push(_e);return me}function sr(y,O){for(var R=y.length;R--;)if(dn(y[R][0],O))return R;return-1}function Lr(y,O,R){var $=O(y);return ur(y)?$:Gt($,R(y))}function Yt(y){return y==null?y===void 0?q:T:lt&< in Object(y)?xt(y):fn(y)}function un(y){return yt(y)&&Yt(y)==a}function cn(y,O,R,$,fe){return y===O?!0:y==null||O==null||!yt(y)&&!yt(O)?y!==y&&O!==O:ln(y,O,R,$,cn,fe)}function ln(y,O,R,$,fe,ie){var pe=ur(y),me=ur(O),ke=pe?l:dt(y),_e=me?l:dt(O);ke=ke==a?E:ke,_e=_e==a?E:_e;var He=ke==E,Qe=_e==E,Me=ke==_e;if(Me&&lr(y)){if(!lr(O))return!1;pe=!0,He=!1}if(Me&&!He)return ie||(ie=new st),pe||Fr(y)?kr(y,O,R,$,fe,ie):ii(y,O,ke,R,$,fe,ie);if(!(R&o)){var qe=He&&x.call(y,"__wrapped__"),Ue=Qe&&x.call(O,"__wrapped__");if(qe||Ue){var Nt=qe?y.value():y,At=Ue?O.value():O;return ie||(ie=new st),fe(Nt,At,R,$,ie)}}return Me?(ie||(ie=new st),Br(y,O,R,$,fe,ie)):!1}function ti(y){if(!mn(y)||si(y))return!1;var O=pn(y)?H:ce;return O.test(Ke(y))}function ri(y){return yt(y)&&Mr(y.length)&&!!Q[Yt(y)]}function ni(y){if(!ui(y))return Wt(y);var O=[];for(var R in Object(y))x.call(y,R)&&R!="constructor"&&O.push(R);return O}function kr(y,O,R,$,fe,ie){var pe=R&o,me=y.length,ke=O.length;if(me!=ke&&!(pe&&ke>me))return!1;var _e=ie.get(y);if(_e&&ie.get(O))return _e==O;var He=-1,Qe=!0,Me=R&i?new or:void 0;for(ie.set(y,O),ie.set(O,y);++He<me;){var qe=y[He],Ue=O[He];if($)var Nt=pe?$(Ue,qe,He,O,y,ie):$(qe,Ue,He,y,O,ie);if(Nt!==void 0){if(Nt)continue;Qe=!1;break}if(Me){if(!Rt(O,function(At,Qt){if(!wt(Me,Qt)&&(qe===At||fe(qe,At,R,$,ie)))return Me.push(Qt)})){Qe=!1;break}}else if(!(qe===Ue||fe(qe,Ue,R,$,ie))){Qe=!1;break}}return ie.delete(y),ie.delete(O),Qe}function ii(y,O,R,$,fe,ie,pe){switch(R){case j:if(y.byteLength!=O.byteLength||y.byteOffset!=O.byteOffset)return!1;y=y.buffer,O=O.buffer;case V:return!(y.byteLength!=O.byteLength||!ie(new we(y),new we(O)));case u:case h:case _:return dn(+y,+O);case d:return y.name==O.name&&y.message==O.message;case w:case F:return y==O+"";case m:var me=$e;case N:var ke=$&o;if(me||(me=tt),y.size!=O.size&&!ke)return!1;var _e=pe.get(y);if(_e)return _e==O;$|=i,pe.set(y,O);var He=kr(me(y),me(O),$,fe,ie,pe);return pe.delete(y),He;case M:if(Cr)return Cr.call(y)==Cr.call(O)}return!1}function Br(y,O,R,$,fe,ie){var pe=R&o,me=Kt(y),ke=me.length,_e=Kt(O),He=_e.length;if(ke!=He&&!pe)return!1;for(var Qe=ke;Qe--;){var Me=me[Qe];if(!(pe?Me in O:x.call(O,Me)))return!1}var qe=ie.get(y);if(qe&&ie.get(O))return qe==O;var Ue=!0;ie.set(y,O),ie.set(O,y);for(var Nt=pe;++Qe<ke;){Me=me[Qe];var At=y[Me],Qt=O[Me];if($)var Ji=pe?$(Qt,At,Me,O,y,ie):$(At,Qt,Me,y,O,ie);if(!(Ji===void 0?At===Qt||fe(At,Qt,R,$,ie):Ji)){Ue=!1;break}Nt||(Nt=Me=="constructor")}if(Ue&&!Nt){var Lt=y.constructor,fr=O.constructor;Lt!=fr&&"constructor"in y&&"constructor"in O&&!(typeof Lt=="function"&&Lt instanceof Lt&&typeof fr=="function"&&fr instanceof fr)&&(Ue=!1)}return ie.delete(y),ie.delete(O),Ue}function Kt(y){return Lr(y,gn,oi)}function ft(y,O){var R=y.__data__;return ai(O)?R[typeof O=="string"?"string":"hash"]:R.map}function Ot(y,O){var R=gt(y,O);return ti(R)?R:void 0}function xt(y){var O=x.call(y,lt),R=y[lt];try{y[lt]=void 0;var $=!0}catch{}var fe=U.call(y);return $&&(O?y[lt]=R:delete y[lt]),fe}var oi=ir?function(y){return y==null?[]:(y=Object(y),bt(ir(y),function(O){return Se.call(y,O)}))}:yn,dt=Yt;(Tr&&dt(new Tr(new ArrayBuffer(1)))!=j||Vt&&dt(new Vt)!=m||Or&&dt(Or.resolve())!=b||xr&&dt(new xr)!=N||Ar&&dt(new Ar)!=W)&&(dt=function(y){var O=Yt(y),R=O==E?y.constructor:void 0,$=R?Ke(R):"";if($)switch($){case nn:return j;case Tt:return m;case Fn:return b;case Un:return N;case Dn:return W}return O});function It(y,O){return O=O??s,!!O&&(typeof y=="number"||Ve.test(y))&&y>-1&&y%1==0&&y<O}function ai(y){var O=typeof y;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?y!=="__proto__":y===null}function si(y){return!!P&&P in y}function ui(y){var O=y&&y.constructor,R=typeof O=="function"&&O.prototype||S;return y===R}function fn(y){return U.call(y)}function Ke(y){if(y!=null){try{return v.call(y)}catch{}try{return y+""}catch{}}return""}function dn(y,O){return y===O||y!==y&&O!==O}var hn=un(function(){return arguments}())?un:function(y){return yt(y)&&x.call(y,"callee")&&!Se.call(y,"callee")},ur=Array.isArray;function cr(y){return y!=null&&Mr(y.length)&&!pn(y)}var lr=Sr||li;function ci(y,O){return cn(y,O)}function pn(y){if(!mn(y))return!1;var O=Yt(y);return O==c||O==p||O==f||O==A}function Mr(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=s}function mn(y){var O=typeof y;return y!=null&&(O=="object"||O=="function")}function yt(y){return y!=null&&typeof y=="object"}var Fr=De?br(De):ri;function gn(y){return cr(y)?ei(y):ni(y)}function yn(){return[]}function li(){return!1}e.exports=ci})(jo,jo.exports);var nO=jo.exports;const iO=jt(nO),oO=e=>{const t={};return Object.keys(e).forEach(n=>{t[`${n}Slug`]=e[n]}),t},md="discussion_",aO=({content:e,isLoading:t=!1,originalAuthorId:n,functions:{content:{createContent:r,deleteContent:o,updateContent:i},likes:{createLike:s,deleteLike:a}},className:l,gtmContext:f="DiscussionAnswer",locale:u="en",children:h})=>{const d=Ie();G.useContext(Bn);const c=G.useContext(Yu);console.log("from post",{likes:e.likes,userLiked:e.userLiked});const[p,m]=G.useState({body:e&&e.body||"",isEditing:!1,didEdit:e&&e.isEdited||!1}),[_,T]=G.useState("");if(G.useEffect(()=>{m({...p,body:e&&e.body||"",didEdit:e&&e.isEdited||!1})},[e.isEdited]),t||!e||e.type==="answer"&&(!e.slugs||!e.slugs.question))return C.jsx(vr,{className:"discussion-card discussion-post"});const{author:E,createdAt:b,likes:A=0,userLiked:w}=e,N=!0,F=async q=>{q||(q=""),T("");try{iO(q,p.body)||await i(oO(e.slugs),{body:q}),m({body:q,isEditing:!1,didEdit:!0})}catch{T(`${md}form_error`)}},M=()=>{c&&c.updateConversation&&c.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const W=`reply-form-${(e.type==="answer"?e.slug:e.slugs.answer||"").toLowerCase().slice(-15)}`,V=document.getElementById(W),j=document.getElementById(`${W}-input`);j&&j.focus(),V&&V.scrollIntoView({behavior:"smooth"})},0)};return C.jsxs("div",{className:se("discussion-post",l),"data-testid":`discussion-${e.type}-thread`,children:[C.jsxs("div",{className:se("discussion-card",e.type,{editing:p.isEditing}),children:[!p.isEditing&&C.jsx(zu,{member:E,additionalContent:{createdAt:b,didEdit:p.didEdit},className:typeof E!="string"&&E.id===n?"highlighted":"",gtmContext:f,gtmType:"profile-click"}),p.isEditing?C.jsx(Gm,{content:{type:e.type,slugs:e.slugs},meta:{isLoading:t,isInWrapper:!0,isEditing:{text:p.body}},forceShow:{error:_!==""&&_!=="delete-error"?d.formatMessage({id:_},{action:d.formatMessage({id:`discussion_action_${e.type}`})}):!1},functions:{create:r,handleSaveEdit:F,handleCancel:()=>{T(""),m({...p,isEditing:!1})}},gtmContext:`${f}Form`}):C.jsx(Mm,{children:p.body}),!p.isEditing&&C.jsxs("ul",{className:se("actions",e.type),"data-testid":`${e.type}-actions`,children:[C.jsx(Wm,{element:"li",likes:A,isShort:!1,userLiked:w,content:{type:e.type,slugs:e.slugs},canLike:N,createLike:s,deleteLike:a,locale:u}),(e.type==="answer"||e.type==="reply")&&C.jsx("li",{children:C.jsx(ut,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:M,children:d.formatMessage({id:`${md}thread_reply_button`})})})]})]}),h]})};const xo="emailHelperTextBox_",sO=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=Ie(),[i,s]=G.useState({path:`${xo}default`,type:"default",link:{},mail:{},error:""}),[a,l]=G.useState(!1),f=G.useCallback(c=>{c.preventDefault(),c.stopPropagation();const p=m=>{s({path:`${xo}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>f(_),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:m})};if(typeof r!="function"){p(o.formatMessage({id:`${xo}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(m=>{p(m.message)}).finally(()=>{l(!1)})},[t,n,r]);G.useEffect(()=>{let c=xo,p="default",m={},_={};switch(e){case"gov":c+="autoApproved",p="success";break;case"nonGov":c+="unrecognisedEmail",p="error",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":c+="pendingApproval",p="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":c+="emailUnverified",p="error",m={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:T=>f(T),"data-testid":"send-verify-email-click"};break;case"exists":c+="emailAlreadyExists",p="error",m={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:c+="default",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:c,type:p,link:m,mail:_})},[e]);const u={};return["link","mail"].forEach(c=>{u[c]=Object.keys(i[c]).length?p=>C.jsx("a",{...i[c],children:p}):p=>p}),C.jsx(Bm,{type:i.type,heading:a?!1:o.formatMessage({id:`${i.path}_title`}),children:a?C.jsxs(C.Fragment,{children:[C.jsx(vr,{element:"span"}),C.jsx(vr,{element:"span"})]}):o.formatMessage({id:`${i.path}_text`},{...u,strong:c=>C.jsx("strong",{children:c}),em:c=>C.jsx("em",{children:c}),br:C.jsxs(C.Fragment,{children:[C.jsx("br",{}),C.jsx("br",{})]}),error:i.error})})};const Ao="passwordRules_",Vm="isMoreThanEightCharacters",zm="includesNumberAndSymbol",Ym="includesLowerAndUppercase",uO={[Vm]:"8Characters",[zm]:"numberSymbol",[Ym]:"lowercaseUppercase"},cO=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=Ie();return C.jsxs("aside",{className:se("password-rules",t),children:[C.jsx("small",{children:n.formatMessage({id:`${Ao}intro`})}),C.jsx("ul",{children:[Vm,zm,Ym].map(r=>C.jsxs("li",{className:se({matches:e[r]}),children:[C.jsxs(it,{children:[n.formatMessage({id:`${Ao}rule_label`})," "]}),C.jsx("span",{children:n.formatMessage({id:`${Ao}rule_${uO[r]}`})}),!e[r]&&C.jsxs(it,{element:"strong",children:[" "," ",n.formatMessage({id:`${Ao}notMet`})]})]},`rule-${r}`))})]})},lO=G.memo(cO);const fO=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:i="",hasLoaded:s=!1})=>{const a=Ie(),[l,f]=G.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const T=await n();f(E=>({...E,setUp:!0,id:T&&T.id,disabled:!1}))}catch(T){f(E=>({...E,setUp:!0,disabled:!0})),o(T)}};if(G.useEffect(()=>{s&&!l.setUp&&u()},[s]),!s)return C.jsx(vr,{className:"rating-placeholder"});const{id:h,rating:d,disabled:c}=l,p="ratings_",m={text:a.formatMessage({id:`${p}text`}),low:a.formatMessage({id:`${p}low`}),high:a.formatMessage({id:`${p}high`}),success:a.formatMessage({id:`${p}success`}),...e},_=async T=>{if(!(!h||c))try{f(E=>({...E,rating:T,disabled:!0})),await r({id:h,value:T})}catch(E){f(b=>({...b,rating:null})),o(E)}finally{f(E=>({...E,disabled:!1}))}};return C.jsxs("div",{className:se("rating",i),children:[C.jsx("span",{className:"label",children:m[d?"success":"text"]}),C.jsx("ol",{children:Array.from(new Array(t).keys()).map(T=>{const E=T+1;return C.jsx("li",{className:se({selected:d&&E<=d}),children:C.jsx(ut,{variant:"tertiary",size:"small",icon:{icon:`star${!d||E>d?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${p}stars`},{number:E,total:t})}${E===1||E===t?` - ${m[E===1?"low":"high"]}`:""}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),_(E)},disabled:c})},`rating-${E}`)})})]})};const Km=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:a=!1}=n||{},l=Ie(),f=G.useRef(null);Io(()=>{!n||a||!s||f.current&&f.current.focus()},[s]);const u=h=>{if(h.preventDefault(),h.stopPropagation(),!(!f.current||!f.current.value||f.current.value.length<1))return window&&window.location&&window.location.replace(`/search?search=${encodeURIComponent(f.current.value)}`)};return C.jsx("form",{onSubmit:u,className:se("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":i,children:C.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,role:"search",children:C.jsxs("p",{children:[C.jsx(it,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),C.jsx("input",{ref:f,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&u(h)}}),C.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),f.current&&f.current.value&&(f.current.value="")},children:C.jsx(it,{children:l.formatMessage({id:"search_clear"})})}),C.jsx("button",{className:"search",onClick:u,children:C.jsx(it,{children:l.formatMessage({id:"search_cta"})})})]})})})};const dO={"2-1":901},hO=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Ki(!0);let i=r;return G.Children.count(r)===1&&(i=G.Children.toArray(r)[0],i.props&&(i=i.props.children)),C.jsx("section",{className:se("columns",`layout-${e}`,n),children:G.Children.map(i,(s,a)=>t!==!1&&a===t&&o&&o<dO[e]?null:s)})};const Bs="cookieBanner_",Ms=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Fs=new Date(Date.now()+12*30*24*60*60*1e3),Qm=()=>{const e=Ie(),[t,n,r]=Cd(Ms),[o,i]=G.useState(!t["apol-cookie-banner"]),s=()=>{Ms.forEach(u=>{n(u,!0,{path:"/",expires:Fs,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Fs}),Ms.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:Fs});return}r(u)}),i(!1)};if(!o)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],f=[];return l.forEach(u=>{f.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${Bs}buttons_${u.id}`})})}),C.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[C.jsx("h6",{children:e.formatMessage({id:`${Bs}title`})}),C.jsx("p",{children:e.formatMessage({id:`${Bs}text`})}),C.jsx(Xo,{buttons:f})]})};const pO=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const i=Ie(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[a,l]=G.useState(t?["all"]:[]),f=(u,h)=>{let d=[];a.includes(u)?d=a.filter(c=>c!==u):u==="all"?d=["all"]:n?d=[...a.filter(c=>c!=="all"),u]:d=[u],l(c=>(r&&typeof r=="function"&&r({current:d,previous:c}),d)),h&&typeof h=="function"&&h()};return C.jsx("ul",{className:se("filters",o),children:s.map(({id:u,text:h,disabled:d=!1,callback:c=()=>{}})=>{let p={};return d&&(p={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),C.jsx("li",{children:C.jsx("button",{className:se(u,{selected:a.includes(u)}),onClick:m=>{m.preventDefault(),m.stopPropagation(),f(u,c)},...p,children:h})},u)})})};const Us=du({locale:"en",messages:Fu}),mO=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:o=!1,messages:i={button:Us.formatMessage({id:"loadMore_button"}),endOfFeed:Us.formatMessage({id:"loadMore_endOfFeed"}),error:Us.formatMessage({id:"loadMore_error"})},className:s="",gtmContext:a="LoadMore"})=>{const[l,f]=G.useState(!1),[u,h]=G.useState(!1);if(t<=0||t<n*e)return null;const d=async c=>{try{await r(c)}catch(p){p instanceof Error&&p.message&&p.message.includes("Cannot read items")?h(!0):f(!0)}};return C.jsxs("footer",{className:se("load-more",s),children:[l&&C.jsx("p",{className:"error",children:i.error}),u?C.jsx("p",{children:i.endOfFeed}):C.jsx(ut,{variant:"secondary",icon:o,onClick:d,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};const Ku=({variant:e="default",version:t="default",className:n="",...r})=>C.jsx("p",{className:"logo-wrapper",children:C.jsx("a",{className:se("logo",e,t,n),href:"/home/",...r,children:C.jsx(it,{children:C.jsx(Yr,{id:"apolitical"})})})}),gd={default:"tags_",headerTopics:"header_topics_topics_"},Ds={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"},gO={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ds.topic[e.replace("topic_","")],e){const t=Gi.topics.topics[e].href;return t?{id:e,href:t,text:`${gd.headerTopics}${e}`}:null}return null}return Ds[e]?(e=Ds[e],{id:e,text:`${gd.default}${e}`}):null}};const yO=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const a=Ie();if(!e||e.length<1)return null;const l=[];return e.forEach(f=>{if(!f)return;const u=gO.getTagDetails(f);u&&l.push(u)}),l.length<1?null:C.jsx("ul",{className:se("tags text-small",t,o,{"one-line":n}),children:l.map(f=>{const u=a.formatMessage({id:f.text});return C.jsx("li",{children:f.href&&r?C.jsx("a",{href:f.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:u}):u},f.id)})})},rr={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:"dpo@apolitical.co",gtmType:"email-dpo-link"},euDataProtection:{email:"dpo.agl@apolitical.foundation",gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:"concierge@apolitical.co",gtmType:"concierge-email-click"},business:{email:"hello@apolitical.co",gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Sn="footer_",Ho="SiteFooter",yd=({group:e})=>{const t=rr[e].order||[];let n=!1;return"text"in rr[e]&&(n=rr[e].text),C.jsxs(G.Fragment,{children:[C.jsx("p",{className:"pre-title",children:C.jsx(Yr,{id:`${Sn}${e}`})}),Array.isArray(t)&&t.length>0&&C.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:o,gtmType:i}=rr[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),C.jsx("li",{children:C.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":i,...s,children:C.jsx(Yr,{id:`${Sn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&C.jsx("dl",{className:"text-medium",children:n.order.map(r=>C.jsxs(G.Fragment,{children:[C.jsx("dt",{children:C.jsx(Yr,{id:`${Sn}${e}_${r}`})}),C.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&C.jsx("address",{children:C.jsx(Yr,{id:`${Sn}${e}_${r}_address`,values:{br:C.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&C.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Qu=()=>C.jsx("div",{id:"footer",children:C.jsxs("div",{className:"wrapper",children:[C.jsx(Eu,{element:"hr"}),C.jsx(Ku,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":"logo-homepage-link"}),C.jsx("footer",{children:["platform","community","company","contact"].map(e=>C.jsxs("div",{className:"group",children:[C.jsx(yd,{group:e}),Object.keys(rr[e]).includes("child")&&C.jsx(yd,{group:rr[e].child})]},e))}),C.jsx("hr",{}),C.jsxs("div",{className:"sub-footer",children:[C.jsx("ul",{children:Array.isArray(rr.social.order)&&rr.social.order.map(e=>{const t=rr.social[e];return C.jsx("li",{className:e,children:C.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":"social-click",children:C.jsx("span",{className:"hidden",children:C.jsx(Yr,{id:`${Sn}social_${e}`})})})},e)})}),C.jsx("small",{children:C.jsx(Yr,{id:`${Sn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});var vO="Expected a function",Xm="__lodash_hash_undefined__",Jm=1/0,EO="[object Function]",_O="[object GeneratorFunction]",bO="[object Symbol]",wO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SO=/^\w*$/,TO=/^\./,OO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xO=/[\\^$.*+?()[\]{}|]/g,AO=/\\(\\)?/g,CO=/^\[object .+?Constructor\]$/,RO=typeof ae=="object"&&ae&&ae.Object===Object&&ae,PO=typeof self=="object"&&self&&self.Object===Object&&self,Xu=RO||PO||Function("return this")();function IO(e,t){return e==null?void 0:e[t]}function NO(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var LO=Array.prototype,kO=Function.prototype,Zm=Object.prototype,$s=Xu["__core-js_shared__"],vd=function(){var e=/[^.]+$/.exec($s&&$s.keys&&$s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),eg=kO.toString,Ju=Zm.hasOwnProperty,tg=Zm.toString,BO=RegExp("^"+eg.call(Ju).replace(xO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ed=Xu.Symbol,MO=LO.splice,FO=rg(Xu,"Map"),qi=rg(Object,"create"),_d=Ed?Ed.prototype:void 0,bd=_d?_d.toString:void 0;function Zr(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function UO(){this.__data__=qi?qi(null):{}}function DO(e){return this.has(e)&&delete this.__data__[e]}function $O(e){var t=this.__data__;if(qi){var n=t[e];return n===Xm?void 0:n}return Ju.call(t,e)?t[e]:void 0}function jO(e){var t=this.__data__;return qi?t[e]!==void 0:Ju.call(t,e)}function HO(e,t){var n=this.__data__;return n[e]=qi&&t===void 0?Xm:t,this}Zr.prototype.clear=UO;Zr.prototype.delete=DO;Zr.prototype.get=$O;Zr.prototype.has=jO;Zr.prototype.set=HO;function Mn(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qO(){this.__data__=[]}function GO(e){var t=this.__data__,n=ta(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():MO.call(t,n,1),!0}function WO(e){var t=this.__data__,n=ta(t,e);return n<0?void 0:t[n][1]}function VO(e){return ta(this.__data__,e)>-1}function zO(e,t){var n=this.__data__,r=ta(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Mn.prototype.clear=qO;Mn.prototype.delete=GO;Mn.prototype.get=WO;Mn.prototype.has=VO;Mn.prototype.set=zO;function rn(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function YO(){this.__data__={hash:new Zr,map:new(FO||Mn),string:new Zr}}function KO(e){return ra(this,e).delete(e)}function QO(e){return ra(this,e).get(e)}function XO(e){return ra(this,e).has(e)}function JO(e,t){return ra(this,e).set(e,t),this}rn.prototype.clear=YO;rn.prototype.delete=KO;rn.prototype.get=QO;rn.prototype.has=XO;rn.prototype.set=JO;function ta(e,t){for(var n=e.length;n--;)if(cx(e[n][0],t))return n;return-1}function ZO(e,t){t=nx(t,e)?[t]:rx(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[sx(t[n++])];return n&&n==r?e:void 0}function ex(e){if(!ig(e)||ox(e))return!1;var t=lx(e)||NO(e)?BO:CO;return t.test(ux(e))}function tx(e){if(typeof e=="string")return e;if(ec(e))return bd?bd.call(e):"";var t=e+"";return t=="0"&&1/e==-Jm?"-0":t}function rx(e){return ng(e)?e:ax(e)}function ra(e,t){var n=e.__data__;return ix(t)?n[typeof t=="string"?"string":"hash"]:n.map}function rg(e,t){var n=IO(e,t);return ex(n)?n:void 0}function nx(e,t){if(ng(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||ec(e)?!0:SO.test(e)||!wO.test(e)||t!=null&&e in Object(t)}function ix(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ox(e){return!!vd&&vd in e}var ax=Zu(function(e){e=dx(e);var t=[];return TO.test(e)&&t.push(""),e.replace(OO,function(n,r,o,i){t.push(o?i.replace(AO,"$1"):r||n)}),t});function sx(e){if(typeof e=="string"||ec(e))return e;var t=e+"";return t=="0"&&1/e==-Jm?"-0":t}function ux(e){if(e!=null){try{return eg.call(e)}catch{}try{return e+""}catch{}}return""}function Zu(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(vO);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(Zu.Cache||rn),n}Zu.Cache=rn;function cx(e,t){return e===t||e!==e&&t!==t}var ng=Array.isArray;function lx(e){var t=ig(e)?tg.call(e):"";return t==EO||t==_O}function ig(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function fx(e){return!!e&&typeof e=="object"}function ec(e){return typeof e=="symbol"||fx(e)&&tg.call(e)==bO}function dx(e){return e==null?"":tx(e)}function hx(e,t,n){var r=e==null?void 0:ZO(e,t);return r===void 0?n:r}var px=hx;const og=jt(px),Re={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let o={};return["navigation","search"].forEach(i=>{o[i]=r(i)}),o},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(o=>o===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const o=Date.now();if(!t&&Re.handlerCalled[e]&&o-Re.handlerCalled[e]<500)return;Re.handlerCalled[e]=o;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(s=>{s===e||n[s]===!1||i.push({type:`menus.${s}`,value:!1})}),r(i)},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 o=og(e[r],t);if(!(typeof o>"u")&&(!n||o[t]&&o[t].includes(n)||o.value&&o.value.includes(n)||o.toString().includes(n)))return e[r]}return e[0].children?Re.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:o})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let s,a;switch(e){case"navigation":if(n){const l=Re.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Re.findFirstChild(l.children,"href")}else s=Re.findFirstChild(t.current.children,"href");s||(s=t.current);break;case"account":if(a=Re.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;s=Re.findFirstChild(a.children,"href");break;default:return}s&&(o([{type:`focusElements.${e}.${i}`,value:s}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Gi={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},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:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},qo=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:i=null})=>{const s=Ie(),a=og(Gi,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const l="doTrack"in a,f=i===null?l?a.doTrack:!0:i,u=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let d=!1;if(a.href){let E=a.gtmType||`${e}-click`;if(E.includes(".")){const b=E.split("."),A=b[b.length-2];E=`${A==="topics"?`${A}-`:""}${b[b.length-1]}`}d={href:a.href,role:"menuitem"},f&&(d={...d,className:"gtm-trackable","data-gtm-event-type":E,"data-gtm-event-context":"HeaderButtons"}),u&&(d={...d,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const c=a.order&&a.order[0]&&a[a.order[0]],p=c&&a[a.order[0]].order,m=d&&typeof window<"u"&&window.location&&window.location.pathname===a.href;let _={},T={};if(c){const E=a.menuId||e,b={onClick:A=>Re.events.onClick(A,{id:E,callback:o,isOpen:r[E]}),onFocus:()=>Re.events.onFocus({id:E}),onBlur:()=>Re.events.onBlur({id:E,callback:o}),onMouseLeave:()=>Re.events.onBlur({id:E,callback:o}),onMouseEnter:()=>Re.events.onMouseEnter({id:E,callback:o})};n&&(p&&(_={...b,onKeyPress:A=>{A.key==="Enter"&&Re.events.onClick(A,{id:E,callback:o,isOpen:r[E]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[E],"aria-controls":E}),T={hidden:E in r?!r[E]:!0}),p||(T={...T,...b})}return C.jsxs("li",{className:se({[a.className]:a.className,"has-submenu":c,parent:p,active:m}),role:"none",..._,children:[d?G.createElement(u?ut:"a",d,s.formatMessage({id:h})):s.formatMessage({id:h}),a.order&&C.jsx("ul",{...T,children:a.order.map(E=>{if(!a[E])return null;const b={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:l?f:null};return a[E].order?C.jsxs("li",{className:se({[a[E].className]:a[E].className}),children:[s.formatMessage({id:`${h}_${E}`}),C.jsx("ul",{children:a[E].order.map(A=>C.jsx(qo,{id:`${e}.${E}.${A}`,...b},A))})]},E):C.jsx(qo,{id:`${e}.${E}`,...b},E)})})]},e)};const mx={height:67,height_desktop:83},tc=()=>{const e=Ie(),t=G.useContext(Bn),n=Ki(!0,!0),r=t&&typeof t.id=="string",o=G.useMemo(()=>Re.getIsDesktopVersion(r,n),[r,n]),[i,s]=G.useReducer(kb,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:a,menus:l,focusElements:f}=i;Sp({scrollPosition:mx[`height${o.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!o&&l.navigation||Re.shouldChangeHeaderIsVisible(!0,l,s)},scrollDown:()=>{!o&&l.navigation||Re.shouldChangeHeaderIsVisible(!1,l,s)}}});const u=(d,c)=>{Re.handleMenus({id:d,value:c,menus:l,dispatch:s})},h=G.useRef(null);return Io(()=>{l.navigation&&Re.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:o.navigation,focusElements:f,dispatch:s})},[l.navigation]),Io(()=>{l.account&&Re.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:o.navigation,focusElements:f,dispatch:s})},[l.account]),t&&t.isLoading?null:C.jsxs(C.Fragment,{children:[C.jsxs("nav",{id:"header",className:se({"logged-in":r,"logged-out":!r,visible:a}),children:[C.jsx(it,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),C.jsx(Ku,{}),!o.navigation&&C.jsx("button",{className:"menu-button gtm-trackable",onClick:d=>{d.preventDefault(),d.stopPropagation(),u("navigation",!l.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":l.navigation,"aria-controls":"navigation",children:C.jsx(it,{children:e.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),C.jsx("ul",{ref:h,id:"navigation",hidden:o.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!o.navigation&&l.account?"account":"default",children:Gi.order.map(d=>C.jsx(qo,{id:d,isLoggedIn:r,isDesktopVersion:o.navigation,menus:{navigation:l.navigation,account:l.account},callback:u},d))}),!o.search&&C.jsx("button",{className:"search toggle-search-button",onClick:d=>{d.preventDefault(),d.stopPropagation(),u("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:C.jsx(it,{children:e.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),C.jsx(Km,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:o.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?C.jsxs("button",{className:"account-button",onClick:d=>Re.events.onClick(d,{id:"account",callback:u,isOpen:l.account}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>Re.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[C.jsx(it,{children:e.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),C.jsx(ea,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):C.jsx("ul",{className:"sign-in-buttons",children:Gi.buttons.order.map(d=>C.jsx(qo,{id:`buttons.${d}`},d))})]}),C.jsx("hr",{id:"content-of-page"}),C.jsx("div",{className:se("overlay",{open:l.navigation||l.account||!o.search&&l.search})})]})},gx=G.createContext(null),js={didCatch:!1,error:null};class yx extends G.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=js}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(js)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&vx(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(js)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(G.isValidElement(o))a=o;else if(typeof n=="function")a=n(l);else if(r)a=G.createElement(r,l);else throw s}return G.createElement(gx.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function vx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const Ex=()=>{const e=Ie();return C.jsxs(C.Fragment,{children:[C.jsx(tc,{}),C.jsx("div",{className:"content",children:C.jsx(Lm,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),C.jsx(Qu,{})]})},_x=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:o="",locale:i="en"})=>{const s=Db(e,{locale:i});return C.jsx(yx,{onError:t,fallback:C.jsx(Ex,{}),children:C.jsx(G.Suspense,{fallback:C.jsx(Dm,{layout:"overview-page"}),children:C.jsx("div",{id:"wrapper",className:se(o,{[r]:r!=="default"}),children:C.jsxs(Cg,{children:[C.jsx(tc,{}),C.jsx("div",{className:"content",children:s}),n&&C.jsx(Qu,{}),C.jsx(Qm,{})]})})})})};const bx=({children:e,className:t})=>C.jsx("section",{className:se("modal",t),children:typeof e=="string"?C.jsx("p",{children:e}):e});exports.ASSETS_BUCKET=$o;exports.Alert=hu;exports.BannerSection=zb;exports.Button=ut;exports.ButtonWrapper=Xo;exports.CollapsibleSection=qu;exports.Columns=hO;exports.CommunityDetails=FT;exports.Contributors=jm;exports.ConversationContext=Yu;exports.CookieBanner=Qm;exports.DiscussionConversation=DT;exports.DiscussionForm=Gm;exports.DiscussionLikes=Wm;exports.DiscussionPost=aO;exports.DownloadSection=qb;exports.EmailHelperTextBox=sO;exports.EmptyStateBox=Lm;exports.Filters=pO;exports.Footer=Qu;exports.FullWidthSection=Uu;exports.Header=tc;exports.HelperTextBox=Bm;exports.HiddenFromScreenReaders=Eu;exports.HideShowTextBox=bT;exports.HighlightedTextBox=nr;exports.IntlProvider=BT;exports.JoinButton=Hm;exports.Link=kp;exports.LoadMore=mO;exports.LoadingBlock=NT;exports.LoadingPlaceholder=vr;exports.LoadingState=Dm;exports.Logo=Ku;exports.LogoSection=Gb;exports.MarkdownText=Mm;exports.MarketingBox=Yb;exports.Member=zu;exports.Modal=bx;exports.NUMBER_OF_USERS=yS;exports.PageLayout=_x;exports.PasswordRules=lO;exports.Pill=RT;exports.ProfilePicture=ea;exports.ProgressBar=Fm;exports.Rating=fO;exports.ResponsiveImage=Bp;exports.SearchForm=Km;exports.Tags=yO;exports.UserContext=Bn;exports.UserProvider=MT;exports.VisuallyHidden=it;exports.getMember=Vu;exports.headerData=Gi;exports.useEffectAfterMount=Io;exports.useFeatureFlag=R_;exports.useScreenWidth=Ki;exports.useScrollListener=Sp;
|
|
105
|
+
`))},[r]),G.useEffect(()=>{f==="ready-to-close"&&u("closing")},[f]);const h=({propertyName:c})=>{c==="max-height"&&u(p=>p==="opening"?"open":p==="closing"?"closed":p)};if(!r)return null;const d=["opening","open"].includes(f);return C.jsxs(nr,{variant:"subtle",className:se("hide-show-text-box",e),children:[C.jsxs("div",{ref:s,className:se("content",f),children:[C.jsx(Zo,{options:{forceBlock:!0},children:f==="closed"?a:r}),f!=="closed"&&o]}),C.jsx("p",{className:"cta",children:C.jsx(ut,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:se({"rotate-180":d}),onClick:()=>{u(d?"ready-to-close":"opening")},children:d?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},wT=()=>G.Fragment,ST=({children:e})=>C.jsx(nr,{variant:"secondary",children:e}),TT=["span","strong","h1","h2","h3","h4","h5","h6","p"],OT=({children:e})=>{const t=Ie();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of G.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(G.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of G.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&G.isValidElement(s)){const a=s.type;if(TT.includes(a)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const o=n?n.toString():"";return C.jsx(qu,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(i=>i)})},xT=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return C.jsx(nr,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return C.jsx(nr,{variant:"primary",children:e});case"pink-textbox":return C.jsx(nr,{variant:"tertiary",children:e});default:return C.jsx("div",{...t,children:e})}return C.jsx("div",{...t,children:e})},AT=e=>{const t=Ie(),n=Date.now().toString();let r="default";const o=e.src;return o.includes("youtube")||o.includes("vimeo")?r="video":o.includes("riddle")||o.includes("sli.do")?r="poll":o.includes("padlet")&&(r="padlet"),C.jsxs(C.Fragment,{children:[C.jsx(it,{children:C.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),C.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),C.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},sd=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},CT=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,o=!1;for(const i of G.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&G.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||sd(i.props.children[0])==="button")&&(o=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!G.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&sd(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},C.jsx("p",{className:"center",children:C.jsx(ut,{variant:"primary",size:"medium",...n,children:r})})):C.jsx("a",{...n,children:r})};const Mm=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:G.Fragment,forceBlock:!0,overrides:{a:CT,CollapsibleSection:qu,TextBox:nr,CaseStudy:ST,style:wT,details:OT,div:xT,iframe:AT}};return C.jsx("div",{className:se("markdown-text",e),children:C.jsx(Zo,{options:{...r,...t},children:n})})};const RT=({className:e="",children:t})=>C.jsx("span",{className:se("pill",e),children:t});const PT=({progress:e=0,text:t=!1,className:n=""})=>{const r=Ie(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return C.jsx("span",{className:se(`progress-bar section-${o}`,n),style:i,children:C.jsx(it,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Fm=G.memo(PT);const Ls="loadingBlock_",IT=({progress:e=0,steps:t=!1,className:n=""})=>{const r=Ie();t||(t={0:{text:r.formatMessage({id:`${Ls}loading`})},75:{text:r.formatMessage({id:`${Ls}almostDone`})},100:{text:r.formatMessage({id:`${Ls}complete`})}});let o=null;const i=Object.keys(t);for(let a=0;a<i.length&&!(e<parseInt(i[a]));a++)o=i[a];const s=o&&t[o].icon?{"--icon":`url(${$o}icons/${t[o].icon}.svg)`}:{};return C.jsxs(nr,{className:se("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:s,children:[o&&C.jsx("span",{className:"step",children:t[o].text}),C.jsx(Fm,{progress:e})]})},NT=G.memo(IT);const vr=({element:e="div",className:t="",...n})=>C.jsx(Eu,{element:e,className:se("loading-placeholder",t),...n});const yu={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Um=(e,t)=>e in yu?C.jsx("div",{className:e,children:yu[e].map((n,r)=>Um(n,r))},t):C.jsx(vr,{className:e},t),Dm=({layout:e="overview-page"})=>C.jsx("div",{className:se("loading-state",e),children:yu[e].map((t,n)=>Um(t,n))}),$m=e=>{const t=e&&e.toUpperCase().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},To=["#5AB6A3","#A2D7AF","#806056","#3962B3"],LT=e=>{const t=Math.ceil(26/To.length),n=$m(e).toLowerCase();if(n==="")return To[0];const r=n.charCodeAt(0)-96;for(let o=0;o<To.length;o++)if(r<=t*(o+1))return To[o]};const ud=256,ea=({className:e="",src:t="",name:n,alt:r,width:o=ud,height:i=ud,...s})=>{const[a,l]=G.useState(!1),f=G.useRef(null);return G.useEffect(()=>{const u=f.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const d=o,c=i;typeof window<"u"&&window.devicePixelRatio&&(u.width=d*window.devicePixelRatio,u.height=c*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=LT(n),h.fillRect(0,0,d,c),h.font=`${d/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText($m(n),d/2,c/1.6)},[n]),C.jsxs("figure",{className:se("profile-picture",e,{error:a}),...s,children:[t!==""&&!a&&C.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:o,height:i}),(t===""||a)&&C.jsx("canvas",{ref:f})]})},Vu=e=>e==="apolitical"?{image:`${$o}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${$o}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id||e.slug}`,image:e.image&&e.image.thumbnail},kT=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",i=t!=="",s=n!=="";if(!o&&!i&&!s)return"";const a=`${e}${o&&i?` — ${t}`:t}`;let l=`${a}${(o||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=a),l.length>r&&(l=hm(l,r)),l};const zu=({member:e="community",additionalContent:t=!1,gtmContext:n="member",gtmType:r="member-click",className:o=""})=>{const i=Ie(),s=Vu(e);s.name||(s.name=i.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:a,url:l,image:f}=s,u=kT(s),h=t&&t.createdAt?Bb(t.createdAt):!1;return C.jsx("div",{className:se("member text-medium",o),children:C.jsxs(kp,{href:l,gtmType:r,gtmContext:n,children:[C.jsx(ea,{name:a,src:f}),C.jsxs("p",{className:"details",children:[C.jsx("strong",{children:a}),t&&C.jsxs("span",{className:"additional-content",children:[t.createdAt&&h&&C.jsx("span",{className:"date",title:Df(t&&t.createdAt),"aria-label":Df(t&&t.createdAt),children:i.formatMessage({id:`dates_${h.path}`},{number:h.number})}),t.didEdit&&C.jsx("em",{children:i.formatMessage({id:"discussion_edited"})})]}),u&&C.jsx("small",{children:u})]})]})})};const cd={small:24,medium:48},jm=({element:e="div",contributors:t=[],styling:{showText:n,size:r,showGap:o,showPlaceholders:i}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:s=2,className:a=""})=>{const l=Ie();return t.length===0?null:G.createElement(e,{className:se("contributors",a,r,{"has-gap":o}),children:C.jsxs(C.Fragment,{children:[C.jsx("ul",{children:t.map((f,u)=>{let h,d="";if(u<s){const{name:c="",image:p=""}=Vu(f);if(i)return C.jsx(vr,{element:"li",className:"contributor"},u);h=C.jsx(ea,{name:c,src:p,width:cd[r||"medium"],height:cd[r||"medium"]})}else u===s&&(h=C.jsxs("small",{children:["+",t.length-s]}),d="number-left");return h?C.jsx("li",{className:se("contributor",d),children:h},u):null})}),n&&C.jsx("span",{className:"label",children:typeof n=="string"?n:t.length===1?typeof t[0]=="string"?l.formatMessage({id:`member_${t[0]}`}):hm(t[0].name||"",20):null})]})})},BT=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...Ub[r],...n||{}};return C.jsx(pS,{locale:r,messages:o,children:e})},Bn=G.createContext(null),MT=({children:e,user:t})=>C.jsx(Bn.Provider,{value:t,children:e});const Hm=({isMember:e=!1,functions:{join:t,leave:n}={join:()=>{},leave:()=>{}}})=>{const r=Ie(),o=G.useContext(Bn),i=o&&typeof o.id=="string",[s,a]=G.useState(e);return C.jsx(ut,{variant:s?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:s?{icon:"tick",position:"left"}:!1,onClick:async()=>{s?typeof n=="function"&&await n():typeof t=="function"&&await t(),a(!s)},className:"join-community-button",disabled:!i,children:r.formatMessage({id:`joinCommunityButton${s?"_member":""}`})})};const FT=({className:e="",...t})=>{const n=Ie();return C.jsxs("div",{className:se("community-details",e),children:[C.jsx(Hm,{...t}),C.jsxs("div",{className:"additional-details",children:[C.jsx("hr",{}),C.jsx("h3",{children:n.formatMessage({id:"communityDetails_members"})}),C.jsx(jm,{contributors:[{},{},{},{},{}],styling:{size:"medium",showGap:!0,showPlaceholders:!0},cutoff:5})]})]})},UT={showThread:!1,showForm:!1},Yu=G.createContext(UT),DT=({children:e})=>{const[t,n]=G.useState({showThread:!1,showForm:!1});return C.jsx(Yu.Provider,{value:{...t,updateConversation:n},children:e})};function vu(){return vu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vu.apply(this,arguments)}function $T(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var jT=G.useLayoutEffect,HT=function(t){var n=Oe.useRef(t);return jT(function(){n.current=t}),n},ld=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},qT=function(t,n){var r=G.useRef();return G.useCallback(function(o){t.current=o,r.current&&ld(r.current,null),r.current=n,n&&ld(n,o)},[n])},fd={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},GT=function(t){Object.keys(fd).forEach(function(n){t.style.setProperty(n,fd[n],"important")})},dd=GT,rt=null,hd=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function WT(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),rt||(rt=document.createElement("textarea"),rt.setAttribute("tabindex","-1"),rt.setAttribute("aria-hidden","true"),dd(rt)),rt.parentNode===null&&document.body.appendChild(rt);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(d){var c=d;rt.style[c]=s[c]}),dd(rt),rt.value=t;var l=hd(rt,e);rt.value=t,l=hd(rt,e),rt.value="x";var f=rt.scrollHeight-o,u=f*n;a==="border-box"&&(u=u+o+i),l=Math.max(u,l);var h=f*r;return a==="border-box"&&(h=h+o+i),l=Math.min(h,l),[l,f]}var pd=function(){},VT=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},zT=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],YT=!!document.documentElement.currentStyle,KT=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=VT(zT,n),o=r.boxSizing;if(o==="")return null;YT&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),s=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:s}},QT=KT;function qm(e,t,n){var r=HT(n);Oe.useLayoutEffect(function(){var o=function(s){return r.current(s)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var XT=function(t){qm(window,"resize",t)},JT=function(t){qm(document.fonts,"loadingdone",t)},ZT=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],eO=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,a=s===void 0?pd:s,l=t.onHeightChange,f=l===void 0?pd:l,u=$T(t,ZT),h=u.value!==void 0,d=Oe.useRef(null),c=qT(d,n),p=Oe.useRef(0),m=Oe.useRef(),_=function(){var b=d.current,A=r&&m.current?m.current:QT(b);if(A){m.current=A;var w=WT(A,b.value||b.placeholder||"x",i,o),N=w[0],F=w[1];p.current!==N&&(p.current=N,b.style.setProperty("height",N+"px","important"),f(N,{rowHeight:F}))}},T=function(b){h||_(),a(b)};return Oe.useLayoutEffect(_),XT(_),JT(_),Oe.createElement("textarea",vu({},u,{onChange:T,ref:c}))},tO=Oe.forwardRef(eO);let Oo=null;const pt="discussion_form_",Gm=({content:e={type:"response",slugs:{}},meta:t={isLoading:!1,isInWrapper:!1,isEditing:!1},inputRef:n,maxLength:r=5e4,minRows:o=4,forceShow:i={cancel:!1,error:!1},functions:s={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:a="DiscussionForm"})=>{var M,q;const l=Ie(),f=G.useContext(Bn),[u,h]=G.useState(t.isEditing&&t.isEditing.text||""),[d,c]=G.useState(i.error||!1),[p,m]=G.useState(!1),_=G.useRef(null);if(n||(n=_),t.isLoading)return C.jsx(vr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const T=W=>{const V=W.target.value;h(V);let j;!f||!f.id?j=dr(l.formatMessage,`${pt}error_loggedOut`,e.type,"action"):V.length>=r&&(j=`${pt}error_tooLong`),j?c(j):d&&c(!1)};let E=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const W=e.type==="response"?((M=e.slugs)==null?void 0:M.question)||"":((q=e.slugs)==null?void 0:q.answer)||"";W&&(E=`${E}-${W.slice(-15)}`)}const b=async W=>{var j;if(W.preventDefault(),W.stopPropagation(),w)return;Oo&&clearTimeout(Oo),m("submitting");const V=window.location.pathname;try{let Y;switch(e.type){case"post":Y=await s.create({content:u});break;case"question":Y=await s.create({title:u,authorId:f&&f.id,...(j=s.props)==null?void 0:j.create});break;case"response":Y=await s.create({question:e.slugs.question},{body:u,authorId:f&&f.id,contentPath:V});break;case"reply":Y=await s.create({question:e.slugs.question,answer:e.slugs.answer},{body:u,authorId:f&&f.id,contentPath:V});break;default:break}await Mb(1e3),s.callback&&await s.callback(Y),Oo=setTimeout(()=>{h(""),m("submitted"),A()},500)}catch(Y){const oe=Y;let K=`${pt}error`;oe.message.includes("entry already exists")&&(K=dr(l.formatMessage,`${pt}error_alreadyExists`,e.type,"action")),oe.message.includes("429")?K=dr(l.formatMessage,`${pt}error_tooMany`,e.type,"action"):oe.message.includes("400")&&(K=`${pt}error`),c(K),A()}},A=()=>{Oo=setTimeout(()=>{c(!1),m(!1)},5e3)},w=!u||!$b(u),N=p==="submitting",F=[];return(t.isEditing&&!N||i.cancel)&&F.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:s.handleCancel,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!i.cancel&&(!f||!f.id||!u),children:l.formatMessage({id:`${pt}cancel`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:W=>{if(t.isEditing){m("submitting"),s.handleSaveEdit&&s.handleSaveEdit(_.current&&"value"in _.current?_.current.value:"");return}b(W)},className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":`${t.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!f||!f.id||w||N||t.isEditing&&u===t.isEditing.text,children:l.formatMessage({id:`${pt}${N?t.isEditing?"saving":"posting":t.isEditing?"save":"post"}`})}),C.jsxs("form",{id:E,className:se("discussion-card discussion-form",{"no-styling":t.isInWrapper&&t.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[!t.isEditing&&["question"].includes(e.type)&&C.jsx("h2",{children:dr(l.formatMessage,`${pt}title`,e.type,"action")}),C.jsx(zu,{member:f||"community",gtmContext:a,gtmType:"profile-click"}),C.jsx(it,{element:"label",showOnFocus:!1,htmlFor:`${E}-input`,children:dr(l.formatMessage,`${pt}label`,e.type,"action")}),C.jsx(tO,{ref:n,id:`${E}-input`,name:e.type,placeholder:dr(l.formatMessage,`${pt}placeholder`,e.type,"action"),onChange:T,value:u,maxLength:r,"aria-invalid":!!d,"aria-errormessage":"error-message",minRows:o,autoFocus:!!t.isEditing}),C.jsx("small",{children:dr(l.formatMessage,`${pt}explainer`,e.type,"action",{a:W=>C.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"community-guidelines-link",children:W})})}),p==="submitted"&&C.jsx(hu,{className:"success","data-testid":"success",children:dr(l.formatMessage,`${pt}success`,e.type,"action")}),d&&C.jsx(hu,{id:"error-message",className:"error","data-testid":"error",children:i.error?i.error:typeof d=="string"?d.includes(" ")?d:l.formatMessage({id:d},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:r}):d}),C.jsx(Xo,{buttons:F})]})},rO=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}});let $i=!1;const ks=()=>{$i!==!1&&(clearTimeout($i),$i=!1)},Wm=({element:e="p",likes:t=0,isShort:n=!0,userLiked:r=!1,content:o={type:"reply",slugs:{}},canLike:i=!0,createLike:s=()=>{},deleteLike:a=()=>{}})=>{const l=Ie();console.log("from like",{likes:t,userLiked:r,slug:o.slugs}),G.useEffect(()=>{d(r)},[r]);const[f,u]=G.useState(t),[h,d]=G.useState(r),[c,p]=G.useState(!1),m=window.location.pathname,_=E=>{if(E.preventDefault(),E.stopPropagation(),$i)return ks(),!1;if(ks(),c||!i)return!1;$i=setTimeout(T,350)},T=async()=>{if(ks(),c||!i)return!1;let E=h?f-1:f+1;E<0&&(E=0),p(!0),u(E),d(!h);try{if(o&&o.slugs){const b=rO(o.slugs);h?await a(b):await s(b,{contentPath:m})}}catch{u(t),d(r)}finally{p(!1)}};return G.createElement(e,{className:se("likes-wrapper text-medium",{"show-spinner":c,"is-liked":h,disabled:!i}),onClick:_,children:C.jsxs(C.Fragment,{children:[C.jsx(ut,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:se({"do-animation":h&&!r}),screenreaderText:i?l.formatMessage({id:`discussion_${o.type}_likes_${h?"unlike":"like"}`}):!1,onClick:_,disabled:!i,"aria-hidden":!i,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${o.type}-click`}),C.jsx("span",{className:"number-of-likes","data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${n?"_short":""}`},{number:f})})]})})};var jo={exports:{}};jo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",f="[object AsyncFunction]",u="[object Boolean]",h="[object Date]",d="[object Error]",c="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",T="[object Null]",E="[object Object]",b="[object Promise]",A="[object Proxy]",w="[object RegExp]",N="[object Set]",F="[object String]",M="[object Symbol]",q="[object Undefined]",W="[object WeakMap]",V="[object ArrayBuffer]",j="[object DataView]",Y="[object Float32Array]",oe="[object Float64Array]",K="[object Int8Array]",k="[object Int16Array]",z="[object Int32Array]",J="[object Uint8Array]",de="[object Uint8ClampedArray]",X="[object Uint16Array]",ee="[object Uint32Array]",ue=/[\\^$.*+?()[\]{}|]/g,ce=/^\[object .+?Constructor\]$/,Ve=/^(?:0|[1-9]\d*)$/,Q={};Q[Y]=Q[oe]=Q[K]=Q[k]=Q[z]=Q[J]=Q[de]=Q[X]=Q[ee]=!0,Q[a]=Q[l]=Q[V]=Q[u]=Q[j]=Q[h]=Q[d]=Q[c]=Q[m]=Q[_]=Q[E]=Q[w]=Q[N]=Q[F]=Q[W]=!1;var re=typeof ae=="object"&&ae&&ae.Object===Object&&ae,Pe=typeof self=="object"&&self&&self.Object===Object&&self,xe=re||Pe||Function("return this")(),at=t&&!t.nodeType&&t,ct=at&&!0&&e&&!e.nodeType&&e,_t=ct&&ct.exports===at,te=_t&&re.process,ze=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),De=ze&&ze.isTypedArray;function bt(y,O){for(var R=-1,$=y==null?0:y.length,fe=0,ie=[];++R<$;){var pe=y[R];O(pe,R,y)&&(ie[fe++]=pe)}return ie}function Gt(y,O){for(var R=-1,$=O.length,fe=y.length;++R<$;)y[fe+R]=O[R];return y}function Rt(y,O){for(var R=-1,$=y==null?0:y.length;++R<$;)if(O(y[R],R,y))return!0;return!1}function mt(y,O){for(var R=-1,$=Array(y);++R<y;)$[R]=O(R);return $}function br(y){return function(O){return y(O)}}function wt(y,O){return y.has(O)}function gt(y,O){return y==null?void 0:y[O]}function $e(y){var O=-1,R=Array(y.size);return y.forEach(function($,fe){R[++O]=[fe,$]}),R}function St(y,O){return function(R){return y(O(R))}}function tt(y){var O=-1,R=Array(y.size);return y.forEach(function($){R[++O]=$}),R}var Ye=Array.prototype,wr=Function.prototype,S=Object.prototype,g=xe["__core-js_shared__"],v=wr.toString,x=S.hasOwnProperty,P=function(){var y=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return y?"Symbol(src)_1."+y:""}(),U=S.toString,H=RegExp("^"+v.call(x).replace(ue,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),le=_t?xe.Buffer:void 0,be=xe.Symbol,we=xe.Uint8Array,Se=S.propertyIsEnumerable,he=Ye.splice,lt=be?be.toStringTag:void 0,ir=Object.getOwnPropertySymbols,Sr=le?le.isBuffer:void 0,Wt=St(Object.keys,Object),Tr=Ot(xe,"DataView"),Vt=Ot(xe,"Map"),Or=Ot(xe,"Promise"),xr=Ot(xe,"Set"),Ar=Ot(xe,"WeakMap"),Pt=Ot(Object,"create"),nn=Ke(Tr),Tt=Ke(Vt),Fn=Ke(Or),Un=Ke(xr),Dn=Ke(Ar),on=be?be.prototype:void 0,Cr=on?on.valueOf:void 0;function Fe(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function Rr(){this.__data__=Pt?Pt(null):{},this.size=0}function Pr(y){var O=this.has(y)&&delete this.__data__[y];return this.size-=O?1:0,O}function zt(y){var O=this.__data__;if(Pt){var R=O[y];return R===r?void 0:R}return x.call(O,y)?O[y]:void 0}function an(y){var O=this.__data__;return Pt?O[y]!==void 0:x.call(O,y)}function $n(y,O){var R=this.__data__;return this.size+=this.has(y)?0:1,R[y]=Pt&&O===void 0?r:O,this}Fe.prototype.clear=Rr,Fe.prototype.delete=Pr,Fe.prototype.get=zt,Fe.prototype.has=an,Fe.prototype.set=$n;function je(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function jn(){this.__data__=[],this.size=0}function Hn(y){var O=this.__data__,R=sr(O,y);if(R<0)return!1;var $=O.length-1;return R==$?O.pop():he.call(O,R,1),--this.size,!0}function qn(y){var O=this.__data__,R=sr(O,y);return R<0?void 0:O[R][1]}function Gn(y){return sr(this.__data__,y)>-1}function Ir(y,O){var R=this.__data__,$=sr(R,y);return $<0?(++this.size,R.push([y,O])):R[$][1]=O,this}je.prototype.clear=jn,je.prototype.delete=Hn,je.prototype.get=qn,je.prototype.has=Gn,je.prototype.set=Ir;function Je(y){var O=-1,R=y==null?0:y.length;for(this.clear();++O<R;){var $=y[O];this.set($[0],$[1])}}function Wn(){this.size=0,this.__data__={hash:new Fe,map:new(Vt||je),string:new Fe}}function Vn(y){var O=ft(this,y).delete(y);return this.size-=O?1:0,O}function zn(y){return ft(this,y).get(y)}function Yn(y){return ft(this,y).has(y)}function Kn(y,O){var R=ft(this,y),$=R.size;return R.set(y,O),this.size+=R.size==$?0:1,this}Je.prototype.clear=Wn,Je.prototype.delete=Vn,Je.prototype.get=zn,Je.prototype.has=Yn,Je.prototype.set=Kn;function or(y){var O=-1,R=y==null?0:y.length;for(this.__data__=new Je;++O<R;)this.add(y[O])}function sn(y){return this.__data__.set(y,r),this}function ar(y){return this.__data__.has(y)}or.prototype.add=or.prototype.push=sn,or.prototype.has=ar;function st(y){var O=this.__data__=new je(y);this.size=O.size}function Nr(){this.__data__=new je,this.size=0}function Qn(y){var O=this.__data__,R=O.delete(y);return this.size=O.size,R}function Xn(y){return this.__data__.get(y)}function Jn(y){return this.__data__.has(y)}function Zn(y,O){var R=this.__data__;if(R instanceof je){var $=R.__data__;if(!Vt||$.length<n-1)return $.push([y,O]),this.size=++R.size,this;R=this.__data__=new Je($)}return R.set(y,O),this.size=R.size,this}st.prototype.clear=Nr,st.prototype.delete=Qn,st.prototype.get=Xn,st.prototype.has=Jn,st.prototype.set=Zn;function ei(y,O){var R=ur(y),$=!R&&hn(y),fe=!R&&!$&&lr(y),ie=!R&&!$&&!fe&&Fr(y),pe=R||$||fe||ie,me=pe?mt(y.length,String):[],ke=me.length;for(var _e in y)(O||x.call(y,_e))&&!(pe&&(_e=="length"||fe&&(_e=="offset"||_e=="parent")||ie&&(_e=="buffer"||_e=="byteLength"||_e=="byteOffset")||It(_e,ke)))&&me.push(_e);return me}function sr(y,O){for(var R=y.length;R--;)if(dn(y[R][0],O))return R;return-1}function Lr(y,O,R){var $=O(y);return ur(y)?$:Gt($,R(y))}function Yt(y){return y==null?y===void 0?q:T:lt&< in Object(y)?xt(y):fn(y)}function un(y){return yt(y)&&Yt(y)==a}function cn(y,O,R,$,fe){return y===O?!0:y==null||O==null||!yt(y)&&!yt(O)?y!==y&&O!==O:ln(y,O,R,$,cn,fe)}function ln(y,O,R,$,fe,ie){var pe=ur(y),me=ur(O),ke=pe?l:dt(y),_e=me?l:dt(O);ke=ke==a?E:ke,_e=_e==a?E:_e;var He=ke==E,Qe=_e==E,Me=ke==_e;if(Me&&lr(y)){if(!lr(O))return!1;pe=!0,He=!1}if(Me&&!He)return ie||(ie=new st),pe||Fr(y)?kr(y,O,R,$,fe,ie):ii(y,O,ke,R,$,fe,ie);if(!(R&o)){var qe=He&&x.call(y,"__wrapped__"),Ue=Qe&&x.call(O,"__wrapped__");if(qe||Ue){var Nt=qe?y.value():y,At=Ue?O.value():O;return ie||(ie=new st),fe(Nt,At,R,$,ie)}}return Me?(ie||(ie=new st),Br(y,O,R,$,fe,ie)):!1}function ti(y){if(!mn(y)||si(y))return!1;var O=pn(y)?H:ce;return O.test(Ke(y))}function ri(y){return yt(y)&&Mr(y.length)&&!!Q[Yt(y)]}function ni(y){if(!ui(y))return Wt(y);var O=[];for(var R in Object(y))x.call(y,R)&&R!="constructor"&&O.push(R);return O}function kr(y,O,R,$,fe,ie){var pe=R&o,me=y.length,ke=O.length;if(me!=ke&&!(pe&&ke>me))return!1;var _e=ie.get(y);if(_e&&ie.get(O))return _e==O;var He=-1,Qe=!0,Me=R&i?new or:void 0;for(ie.set(y,O),ie.set(O,y);++He<me;){var qe=y[He],Ue=O[He];if($)var Nt=pe?$(Ue,qe,He,O,y,ie):$(qe,Ue,He,y,O,ie);if(Nt!==void 0){if(Nt)continue;Qe=!1;break}if(Me){if(!Rt(O,function(At,Qt){if(!wt(Me,Qt)&&(qe===At||fe(qe,At,R,$,ie)))return Me.push(Qt)})){Qe=!1;break}}else if(!(qe===Ue||fe(qe,Ue,R,$,ie))){Qe=!1;break}}return ie.delete(y),ie.delete(O),Qe}function ii(y,O,R,$,fe,ie,pe){switch(R){case j:if(y.byteLength!=O.byteLength||y.byteOffset!=O.byteOffset)return!1;y=y.buffer,O=O.buffer;case V:return!(y.byteLength!=O.byteLength||!ie(new we(y),new we(O)));case u:case h:case _:return dn(+y,+O);case d:return y.name==O.name&&y.message==O.message;case w:case F:return y==O+"";case m:var me=$e;case N:var ke=$&o;if(me||(me=tt),y.size!=O.size&&!ke)return!1;var _e=pe.get(y);if(_e)return _e==O;$|=i,pe.set(y,O);var He=kr(me(y),me(O),$,fe,ie,pe);return pe.delete(y),He;case M:if(Cr)return Cr.call(y)==Cr.call(O)}return!1}function Br(y,O,R,$,fe,ie){var pe=R&o,me=Kt(y),ke=me.length,_e=Kt(O),He=_e.length;if(ke!=He&&!pe)return!1;for(var Qe=ke;Qe--;){var Me=me[Qe];if(!(pe?Me in O:x.call(O,Me)))return!1}var qe=ie.get(y);if(qe&&ie.get(O))return qe==O;var Ue=!0;ie.set(y,O),ie.set(O,y);for(var Nt=pe;++Qe<ke;){Me=me[Qe];var At=y[Me],Qt=O[Me];if($)var Ji=pe?$(Qt,At,Me,O,y,ie):$(At,Qt,Me,y,O,ie);if(!(Ji===void 0?At===Qt||fe(At,Qt,R,$,ie):Ji)){Ue=!1;break}Nt||(Nt=Me=="constructor")}if(Ue&&!Nt){var Lt=y.constructor,fr=O.constructor;Lt!=fr&&"constructor"in y&&"constructor"in O&&!(typeof Lt=="function"&&Lt instanceof Lt&&typeof fr=="function"&&fr instanceof fr)&&(Ue=!1)}return ie.delete(y),ie.delete(O),Ue}function Kt(y){return Lr(y,gn,oi)}function ft(y,O){var R=y.__data__;return ai(O)?R[typeof O=="string"?"string":"hash"]:R.map}function Ot(y,O){var R=gt(y,O);return ti(R)?R:void 0}function xt(y){var O=x.call(y,lt),R=y[lt];try{y[lt]=void 0;var $=!0}catch{}var fe=U.call(y);return $&&(O?y[lt]=R:delete y[lt]),fe}var oi=ir?function(y){return y==null?[]:(y=Object(y),bt(ir(y),function(O){return Se.call(y,O)}))}:yn,dt=Yt;(Tr&&dt(new Tr(new ArrayBuffer(1)))!=j||Vt&&dt(new Vt)!=m||Or&&dt(Or.resolve())!=b||xr&&dt(new xr)!=N||Ar&&dt(new Ar)!=W)&&(dt=function(y){var O=Yt(y),R=O==E?y.constructor:void 0,$=R?Ke(R):"";if($)switch($){case nn:return j;case Tt:return m;case Fn:return b;case Un:return N;case Dn:return W}return O});function It(y,O){return O=O??s,!!O&&(typeof y=="number"||Ve.test(y))&&y>-1&&y%1==0&&y<O}function ai(y){var O=typeof y;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?y!=="__proto__":y===null}function si(y){return!!P&&P in y}function ui(y){var O=y&&y.constructor,R=typeof O=="function"&&O.prototype||S;return y===R}function fn(y){return U.call(y)}function Ke(y){if(y!=null){try{return v.call(y)}catch{}try{return y+""}catch{}}return""}function dn(y,O){return y===O||y!==y&&O!==O}var hn=un(function(){return arguments}())?un:function(y){return yt(y)&&x.call(y,"callee")&&!Se.call(y,"callee")},ur=Array.isArray;function cr(y){return y!=null&&Mr(y.length)&&!pn(y)}var lr=Sr||li;function ci(y,O){return cn(y,O)}function pn(y){if(!mn(y))return!1;var O=Yt(y);return O==c||O==p||O==f||O==A}function Mr(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=s}function mn(y){var O=typeof y;return y!=null&&(O=="object"||O=="function")}function yt(y){return y!=null&&typeof y=="object"}var Fr=De?br(De):ri;function gn(y){return cr(y)?ei(y):ni(y)}function yn(){return[]}function li(){return!1}e.exports=ci})(jo,jo.exports);var nO=jo.exports;const iO=jt(nO),oO=e=>{const t={};return Object.keys(e).forEach(n=>{t[`${n}Slug`]=e[n]}),t},md="discussion_",aO=({content:e,isLoading:t=!1,originalAuthorId:n,functions:{content:{createContent:r,deleteContent:o,updateContent:i},likes:{createLike:s,deleteLike:a}},className:l,gtmContext:f="DiscussionAnswer",locale:u="en",children:h})=>{const d=Ie();G.useContext(Bn);const c=G.useContext(Yu),[p,m]=G.useState({body:e&&e.body||"",isEditing:!1,didEdit:e&&e.isEdited||!1}),[_,T]=G.useState("");if(G.useEffect(()=>{m({...p,body:e&&e.body||"",didEdit:e&&e.isEdited||!1})},[e.isEdited]),t||!e||e.type==="answer"&&(!e.slugs||!e.slugs.question))return C.jsx(vr,{className:"discussion-card discussion-post"});const{author:E,createdAt:b,likes:A=0,userLiked:w}=e,N=!0;console.log({likes:e.likes,userLiked:e.userLiked,slug:e.slug});const F=async q=>{q||(q=""),T("");try{iO(q,p.body)||await i(oO(e.slugs),{body:q}),m({body:q,isEditing:!1,didEdit:!0})}catch{T(`${md}form_error`)}},M=()=>{c&&c.updateConversation&&c.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const W=`reply-form-${(e.type==="answer"?e.slug:e.slugs.answer||"").toLowerCase().slice(-15)}`,V=document.getElementById(W),j=document.getElementById(`${W}-input`);j&&j.focus(),V&&V.scrollIntoView({behavior:"smooth"})},0)};return C.jsxs("div",{className:se("discussion-post",l),"data-testid":`discussion-${e.type}-thread`,children:[C.jsxs("div",{className:se("discussion-card",e.type,{editing:p.isEditing}),children:[!p.isEditing&&C.jsx(zu,{member:E,additionalContent:{createdAt:b,didEdit:p.didEdit},className:typeof E!="string"&&E.id===n?"highlighted":"",gtmContext:f,gtmType:"profile-click"}),p.isEditing?C.jsx(Gm,{content:{type:e.type,slugs:e.slugs},meta:{isLoading:t,isInWrapper:!0,isEditing:{text:p.body}},forceShow:{error:_!==""&&_!=="delete-error"?d.formatMessage({id:_},{action:d.formatMessage({id:`discussion_action_${e.type}`})}):!1},functions:{create:r,handleSaveEdit:F,handleCancel:()=>{T(""),m({...p,isEditing:!1})}},gtmContext:`${f}Form`}):C.jsx(Mm,{children:p.body}),!p.isEditing&&C.jsxs("ul",{className:se("actions",e.type),"data-testid":`${e.type}-actions`,children:[C.jsx(Wm,{element:"li",likes:A,isShort:!1,userLiked:w,content:{type:e.type,slugs:e.slugs},canLike:N,createLike:s,deleteLike:a,locale:u}),(e.type==="answer"||e.type==="reply")&&C.jsx("li",{children:C.jsx(ut,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:M,children:d.formatMessage({id:`${md}thread_reply_button`})})})]})]}),h]})};const xo="emailHelperTextBox_",sO=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=Ie(),[i,s]=G.useState({path:`${xo}default`,type:"default",link:{},mail:{},error:""}),[a,l]=G.useState(!1),f=G.useCallback(c=>{c.preventDefault(),c.stopPropagation();const p=m=>{s({path:`${xo}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>f(_),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:m})};if(typeof r!="function"){p(o.formatMessage({id:`${xo}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(m=>{p(m.message)}).finally(()=>{l(!1)})},[t,n,r]);G.useEffect(()=>{let c=xo,p="default",m={},_={};switch(e){case"gov":c+="autoApproved",p="success";break;case"nonGov":c+="unrecognisedEmail",p="error",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":c+="pendingApproval",p="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":c+="emailUnverified",p="error",m={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:T=>f(T),"data-testid":"send-verify-email-click"};break;case"exists":c+="emailAlreadyExists",p="error",m={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:c+="default",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:c,type:p,link:m,mail:_})},[e]);const u={};return["link","mail"].forEach(c=>{u[c]=Object.keys(i[c]).length?p=>C.jsx("a",{...i[c],children:p}):p=>p}),C.jsx(Bm,{type:i.type,heading:a?!1:o.formatMessage({id:`${i.path}_title`}),children:a?C.jsxs(C.Fragment,{children:[C.jsx(vr,{element:"span"}),C.jsx(vr,{element:"span"})]}):o.formatMessage({id:`${i.path}_text`},{...u,strong:c=>C.jsx("strong",{children:c}),em:c=>C.jsx("em",{children:c}),br:C.jsxs(C.Fragment,{children:[C.jsx("br",{}),C.jsx("br",{})]}),error:i.error})})};const Ao="passwordRules_",Vm="isMoreThanEightCharacters",zm="includesNumberAndSymbol",Ym="includesLowerAndUppercase",uO={[Vm]:"8Characters",[zm]:"numberSymbol",[Ym]:"lowercaseUppercase"},cO=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=Ie();return C.jsxs("aside",{className:se("password-rules",t),children:[C.jsx("small",{children:n.formatMessage({id:`${Ao}intro`})}),C.jsx("ul",{children:[Vm,zm,Ym].map(r=>C.jsxs("li",{className:se({matches:e[r]}),children:[C.jsxs(it,{children:[n.formatMessage({id:`${Ao}rule_label`})," "]}),C.jsx("span",{children:n.formatMessage({id:`${Ao}rule_${uO[r]}`})}),!e[r]&&C.jsxs(it,{element:"strong",children:[" "," ",n.formatMessage({id:`${Ao}notMet`})]})]},`rule-${r}`))})]})},lO=G.memo(cO);const fO=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:i="",hasLoaded:s=!1})=>{const a=Ie(),[l,f]=G.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const T=await n();f(E=>({...E,setUp:!0,id:T&&T.id,disabled:!1}))}catch(T){f(E=>({...E,setUp:!0,disabled:!0})),o(T)}};if(G.useEffect(()=>{s&&!l.setUp&&u()},[s]),!s)return C.jsx(vr,{className:"rating-placeholder"});const{id:h,rating:d,disabled:c}=l,p="ratings_",m={text:a.formatMessage({id:`${p}text`}),low:a.formatMessage({id:`${p}low`}),high:a.formatMessage({id:`${p}high`}),success:a.formatMessage({id:`${p}success`}),...e},_=async T=>{if(!(!h||c))try{f(E=>({...E,rating:T,disabled:!0})),await r({id:h,value:T})}catch(E){f(b=>({...b,rating:null})),o(E)}finally{f(E=>({...E,disabled:!1}))}};return C.jsxs("div",{className:se("rating",i),children:[C.jsx("span",{className:"label",children:m[d?"success":"text"]}),C.jsx("ol",{children:Array.from(new Array(t).keys()).map(T=>{const E=T+1;return C.jsx("li",{className:se({selected:d&&E<=d}),children:C.jsx(ut,{variant:"tertiary",size:"small",icon:{icon:`star${!d||E>d?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${p}stars`},{number:E,total:t})}${E===1||E===t?` - ${m[E===1?"low":"high"]}`:""}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),_(E)},disabled:c})},`rating-${E}`)})})]})};const Km=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:a=!1}=n||{},l=Ie(),f=G.useRef(null);Io(()=>{!n||a||!s||f.current&&f.current.focus()},[s]);const u=h=>{if(h.preventDefault(),h.stopPropagation(),!(!f.current||!f.current.value||f.current.value.length<1))return window&&window.location&&window.location.replace(`/search?search=${encodeURIComponent(f.current.value)}`)};return C.jsx("form",{onSubmit:u,className:se("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":i,children:C.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,role:"search",children:C.jsxs("p",{children:[C.jsx(it,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),C.jsx("input",{ref:f,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&u(h)}}),C.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),f.current&&f.current.value&&(f.current.value="")},children:C.jsx(it,{children:l.formatMessage({id:"search_clear"})})}),C.jsx("button",{className:"search",onClick:u,children:C.jsx(it,{children:l.formatMessage({id:"search_cta"})})})]})})})};const dO={"2-1":901},hO=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Ki(!0);let i=r;return G.Children.count(r)===1&&(i=G.Children.toArray(r)[0],i.props&&(i=i.props.children)),C.jsx("section",{className:se("columns",`layout-${e}`,n),children:G.Children.map(i,(s,a)=>t!==!1&&a===t&&o&&o<dO[e]?null:s)})};const Bs="cookieBanner_",Ms=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Fs=new Date(Date.now()+12*30*24*60*60*1e3),Qm=()=>{const e=Ie(),[t,n,r]=Cd(Ms),[o,i]=G.useState(!t["apol-cookie-banner"]),s=()=>{Ms.forEach(u=>{n(u,!0,{path:"/",expires:Fs,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Fs}),Ms.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:Fs});return}r(u)}),i(!1)};if(!o)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],f=[];return l.forEach(u=>{f.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${Bs}buttons_${u.id}`})})}),C.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[C.jsx("h6",{children:e.formatMessage({id:`${Bs}title`})}),C.jsx("p",{children:e.formatMessage({id:`${Bs}text`})}),C.jsx(Xo,{buttons:f})]})};const pO=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const i=Ie(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[a,l]=G.useState(t?["all"]:[]),f=(u,h)=>{let d=[];a.includes(u)?d=a.filter(c=>c!==u):u==="all"?d=["all"]:n?d=[...a.filter(c=>c!=="all"),u]:d=[u],l(c=>(r&&typeof r=="function"&&r({current:d,previous:c}),d)),h&&typeof h=="function"&&h()};return C.jsx("ul",{className:se("filters",o),children:s.map(({id:u,text:h,disabled:d=!1,callback:c=()=>{}})=>{let p={};return d&&(p={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),C.jsx("li",{children:C.jsx("button",{className:se(u,{selected:a.includes(u)}),onClick:m=>{m.preventDefault(),m.stopPropagation(),f(u,c)},...p,children:h})},u)})})};const Us=du({locale:"en",messages:Fu}),mO=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:o=!1,messages:i={button:Us.formatMessage({id:"loadMore_button"}),endOfFeed:Us.formatMessage({id:"loadMore_endOfFeed"}),error:Us.formatMessage({id:"loadMore_error"})},className:s="",gtmContext:a="LoadMore"})=>{const[l,f]=G.useState(!1),[u,h]=G.useState(!1);if(t<=0||t<n*e)return null;const d=async c=>{try{await r(c)}catch(p){p instanceof Error&&p.message&&p.message.includes("Cannot read items")?h(!0):f(!0)}};return C.jsxs("footer",{className:se("load-more",s),children:[l&&C.jsx("p",{className:"error",children:i.error}),u?C.jsx("p",{children:i.endOfFeed}):C.jsx(ut,{variant:"secondary",icon:o,onClick:d,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};const Ku=({variant:e="default",version:t="default",className:n="",...r})=>C.jsx("p",{className:"logo-wrapper",children:C.jsx("a",{className:se("logo",e,t,n),href:"/home/",...r,children:C.jsx(it,{children:C.jsx(Yr,{id:"apolitical"})})})}),gd={default:"tags_",headerTopics:"header_topics_topics_"},Ds={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"},gO={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ds.topic[e.replace("topic_","")],e){const t=Gi.topics.topics[e].href;return t?{id:e,href:t,text:`${gd.headerTopics}${e}`}:null}return null}return Ds[e]?(e=Ds[e],{id:e,text:`${gd.default}${e}`}):null}};const yO=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const a=Ie();if(!e||e.length<1)return null;const l=[];return e.forEach(f=>{if(!f)return;const u=gO.getTagDetails(f);u&&l.push(u)}),l.length<1?null:C.jsx("ul",{className:se("tags text-small",t,o,{"one-line":n}),children:l.map(f=>{const u=a.formatMessage({id:f.text});return C.jsx("li",{children:f.href&&r?C.jsx("a",{href:f.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:u}):u},f.id)})})},rr={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:"dpo@apolitical.co",gtmType:"email-dpo-link"},euDataProtection:{email:"dpo.agl@apolitical.foundation",gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:"concierge@apolitical.co",gtmType:"concierge-email-click"},business:{email:"hello@apolitical.co",gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Sn="footer_",Ho="SiteFooter",yd=({group:e})=>{const t=rr[e].order||[];let n=!1;return"text"in rr[e]&&(n=rr[e].text),C.jsxs(G.Fragment,{children:[C.jsx("p",{className:"pre-title",children:C.jsx(Yr,{id:`${Sn}${e}`})}),Array.isArray(t)&&t.length>0&&C.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:o,gtmType:i}=rr[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),C.jsx("li",{children:C.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":i,...s,children:C.jsx(Yr,{id:`${Sn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&C.jsx("dl",{className:"text-medium",children:n.order.map(r=>C.jsxs(G.Fragment,{children:[C.jsx("dt",{children:C.jsx(Yr,{id:`${Sn}${e}_${r}`})}),C.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&C.jsx("address",{children:C.jsx(Yr,{id:`${Sn}${e}_${r}_address`,values:{br:C.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&C.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Qu=()=>C.jsx("div",{id:"footer",children:C.jsxs("div",{className:"wrapper",children:[C.jsx(Eu,{element:"hr"}),C.jsx(Ku,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":"logo-homepage-link"}),C.jsx("footer",{children:["platform","community","company","contact"].map(e=>C.jsxs("div",{className:"group",children:[C.jsx(yd,{group:e}),Object.keys(rr[e]).includes("child")&&C.jsx(yd,{group:rr[e].child})]},e))}),C.jsx("hr",{}),C.jsxs("div",{className:"sub-footer",children:[C.jsx("ul",{children:Array.isArray(rr.social.order)&&rr.social.order.map(e=>{const t=rr.social[e];return C.jsx("li",{className:e,children:C.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ho,"data-gtm-event-type":"social-click",children:C.jsx("span",{className:"hidden",children:C.jsx(Yr,{id:`${Sn}social_${e}`})})})},e)})}),C.jsx("small",{children:C.jsx(Yr,{id:`${Sn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});var vO="Expected a function",Xm="__lodash_hash_undefined__",Jm=1/0,EO="[object Function]",_O="[object GeneratorFunction]",bO="[object Symbol]",wO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SO=/^\w*$/,TO=/^\./,OO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xO=/[\\^$.*+?()[\]{}|]/g,AO=/\\(\\)?/g,CO=/^\[object .+?Constructor\]$/,RO=typeof ae=="object"&&ae&&ae.Object===Object&&ae,PO=typeof self=="object"&&self&&self.Object===Object&&self,Xu=RO||PO||Function("return this")();function IO(e,t){return e==null?void 0:e[t]}function NO(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var LO=Array.prototype,kO=Function.prototype,Zm=Object.prototype,$s=Xu["__core-js_shared__"],vd=function(){var e=/[^.]+$/.exec($s&&$s.keys&&$s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),eg=kO.toString,Ju=Zm.hasOwnProperty,tg=Zm.toString,BO=RegExp("^"+eg.call(Ju).replace(xO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ed=Xu.Symbol,MO=LO.splice,FO=rg(Xu,"Map"),qi=rg(Object,"create"),_d=Ed?Ed.prototype:void 0,bd=_d?_d.toString:void 0;function Zr(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function UO(){this.__data__=qi?qi(null):{}}function DO(e){return this.has(e)&&delete this.__data__[e]}function $O(e){var t=this.__data__;if(qi){var n=t[e];return n===Xm?void 0:n}return Ju.call(t,e)?t[e]:void 0}function jO(e){var t=this.__data__;return qi?t[e]!==void 0:Ju.call(t,e)}function HO(e,t){var n=this.__data__;return n[e]=qi&&t===void 0?Xm:t,this}Zr.prototype.clear=UO;Zr.prototype.delete=DO;Zr.prototype.get=$O;Zr.prototype.has=jO;Zr.prototype.set=HO;function Mn(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qO(){this.__data__=[]}function GO(e){var t=this.__data__,n=ta(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():MO.call(t,n,1),!0}function WO(e){var t=this.__data__,n=ta(t,e);return n<0?void 0:t[n][1]}function VO(e){return ta(this.__data__,e)>-1}function zO(e,t){var n=this.__data__,r=ta(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Mn.prototype.clear=qO;Mn.prototype.delete=GO;Mn.prototype.get=WO;Mn.prototype.has=VO;Mn.prototype.set=zO;function rn(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function YO(){this.__data__={hash:new Zr,map:new(FO||Mn),string:new Zr}}function KO(e){return ra(this,e).delete(e)}function QO(e){return ra(this,e).get(e)}function XO(e){return ra(this,e).has(e)}function JO(e,t){return ra(this,e).set(e,t),this}rn.prototype.clear=YO;rn.prototype.delete=KO;rn.prototype.get=QO;rn.prototype.has=XO;rn.prototype.set=JO;function ta(e,t){for(var n=e.length;n--;)if(cx(e[n][0],t))return n;return-1}function ZO(e,t){t=nx(t,e)?[t]:rx(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[sx(t[n++])];return n&&n==r?e:void 0}function ex(e){if(!ig(e)||ox(e))return!1;var t=lx(e)||NO(e)?BO:CO;return t.test(ux(e))}function tx(e){if(typeof e=="string")return e;if(ec(e))return bd?bd.call(e):"";var t=e+"";return t=="0"&&1/e==-Jm?"-0":t}function rx(e){return ng(e)?e:ax(e)}function ra(e,t){var n=e.__data__;return ix(t)?n[typeof t=="string"?"string":"hash"]:n.map}function rg(e,t){var n=IO(e,t);return ex(n)?n:void 0}function nx(e,t){if(ng(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||ec(e)?!0:SO.test(e)||!wO.test(e)||t!=null&&e in Object(t)}function ix(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ox(e){return!!vd&&vd in e}var ax=Zu(function(e){e=dx(e);var t=[];return TO.test(e)&&t.push(""),e.replace(OO,function(n,r,o,i){t.push(o?i.replace(AO,"$1"):r||n)}),t});function sx(e){if(typeof e=="string"||ec(e))return e;var t=e+"";return t=="0"&&1/e==-Jm?"-0":t}function ux(e){if(e!=null){try{return eg.call(e)}catch{}try{return e+""}catch{}}return""}function Zu(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(vO);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(Zu.Cache||rn),n}Zu.Cache=rn;function cx(e,t){return e===t||e!==e&&t!==t}var ng=Array.isArray;function lx(e){var t=ig(e)?tg.call(e):"";return t==EO||t==_O}function ig(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function fx(e){return!!e&&typeof e=="object"}function ec(e){return typeof e=="symbol"||fx(e)&&tg.call(e)==bO}function dx(e){return e==null?"":tx(e)}function hx(e,t,n){var r=e==null?void 0:ZO(e,t);return r===void 0?n:r}var px=hx;const og=jt(px),Re={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let o={};return["navigation","search"].forEach(i=>{o[i]=r(i)}),o},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(o=>o===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const o=Date.now();if(!t&&Re.handlerCalled[e]&&o-Re.handlerCalled[e]<500)return;Re.handlerCalled[e]=o;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(s=>{s===e||n[s]===!1||i.push({type:`menus.${s}`,value:!1})}),r(i)},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 o=og(e[r],t);if(!(typeof o>"u")&&(!n||o[t]&&o[t].includes(n)||o.value&&o.value.includes(n)||o.toString().includes(n)))return e[r]}return e[0].children?Re.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:o})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let s,a;switch(e){case"navigation":if(n){const l=Re.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Re.findFirstChild(l.children,"href")}else s=Re.findFirstChild(t.current.children,"href");s||(s=t.current);break;case"account":if(a=Re.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;s=Re.findFirstChild(a.children,"href");break;default:return}s&&(o([{type:`focusElements.${e}.${i}`,value:s}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Gi={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},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:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},qo=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:i=null})=>{const s=Ie(),a=og(Gi,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const l="doTrack"in a,f=i===null?l?a.doTrack:!0:i,u=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let d=!1;if(a.href){let E=a.gtmType||`${e}-click`;if(E.includes(".")){const b=E.split("."),A=b[b.length-2];E=`${A==="topics"?`${A}-`:""}${b[b.length-1]}`}d={href:a.href,role:"menuitem"},f&&(d={...d,className:"gtm-trackable","data-gtm-event-type":E,"data-gtm-event-context":"HeaderButtons"}),u&&(d={...d,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const c=a.order&&a.order[0]&&a[a.order[0]],p=c&&a[a.order[0]].order,m=d&&typeof window<"u"&&window.location&&window.location.pathname===a.href;let _={},T={};if(c){const E=a.menuId||e,b={onClick:A=>Re.events.onClick(A,{id:E,callback:o,isOpen:r[E]}),onFocus:()=>Re.events.onFocus({id:E}),onBlur:()=>Re.events.onBlur({id:E,callback:o}),onMouseLeave:()=>Re.events.onBlur({id:E,callback:o}),onMouseEnter:()=>Re.events.onMouseEnter({id:E,callback:o})};n&&(p&&(_={...b,onKeyPress:A=>{A.key==="Enter"&&Re.events.onClick(A,{id:E,callback:o,isOpen:r[E]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[E],"aria-controls":E}),T={hidden:E in r?!r[E]:!0}),p||(T={...T,...b})}return C.jsxs("li",{className:se({[a.className]:a.className,"has-submenu":c,parent:p,active:m}),role:"none",..._,children:[d?G.createElement(u?ut:"a",d,s.formatMessage({id:h})):s.formatMessage({id:h}),a.order&&C.jsx("ul",{...T,children:a.order.map(E=>{if(!a[E])return null;const b={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:l?f:null};return a[E].order?C.jsxs("li",{className:se({[a[E].className]:a[E].className}),children:[s.formatMessage({id:`${h}_${E}`}),C.jsx("ul",{children:a[E].order.map(A=>C.jsx(qo,{id:`${e}.${E}.${A}`,...b},A))})]},E):C.jsx(qo,{id:`${e}.${E}`,...b},E)})})]},e)};const mx={height:67,height_desktop:83},tc=()=>{const e=Ie(),t=G.useContext(Bn),n=Ki(!0,!0),r=t&&typeof t.id=="string",o=G.useMemo(()=>Re.getIsDesktopVersion(r,n),[r,n]),[i,s]=G.useReducer(kb,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:a,menus:l,focusElements:f}=i;Sp({scrollPosition:mx[`height${o.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!o&&l.navigation||Re.shouldChangeHeaderIsVisible(!0,l,s)},scrollDown:()=>{!o&&l.navigation||Re.shouldChangeHeaderIsVisible(!1,l,s)}}});const u=(d,c)=>{Re.handleMenus({id:d,value:c,menus:l,dispatch:s})},h=G.useRef(null);return Io(()=>{l.navigation&&Re.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:o.navigation,focusElements:f,dispatch:s})},[l.navigation]),Io(()=>{l.account&&Re.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:o.navigation,focusElements:f,dispatch:s})},[l.account]),t&&t.isLoading?null:C.jsxs(C.Fragment,{children:[C.jsxs("nav",{id:"header",className:se({"logged-in":r,"logged-out":!r,visible:a}),children:[C.jsx(it,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),C.jsx(Ku,{}),!o.navigation&&C.jsx("button",{className:"menu-button gtm-trackable",onClick:d=>{d.preventDefault(),d.stopPropagation(),u("navigation",!l.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":l.navigation,"aria-controls":"navigation",children:C.jsx(it,{children:e.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),C.jsx("ul",{ref:h,id:"navigation",hidden:o.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!o.navigation&&l.account?"account":"default",children:Gi.order.map(d=>C.jsx(qo,{id:d,isLoggedIn:r,isDesktopVersion:o.navigation,menus:{navigation:l.navigation,account:l.account},callback:u},d))}),!o.search&&C.jsx("button",{className:"search toggle-search-button",onClick:d=>{d.preventDefault(),d.stopPropagation(),u("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:C.jsx(it,{children:e.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),C.jsx(Km,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:o.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?C.jsxs("button",{className:"account-button",onClick:d=>Re.events.onClick(d,{id:"account",callback:u,isOpen:l.account}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>Re.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[C.jsx(it,{children:e.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),C.jsx(ea,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):C.jsx("ul",{className:"sign-in-buttons",children:Gi.buttons.order.map(d=>C.jsx(qo,{id:`buttons.${d}`},d))})]}),C.jsx("hr",{id:"content-of-page"}),C.jsx("div",{className:se("overlay",{open:l.navigation||l.account||!o.search&&l.search})})]})},gx=G.createContext(null),js={didCatch:!1,error:null};class yx extends G.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=js}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(js)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&vx(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(js)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(G.isValidElement(o))a=o;else if(typeof n=="function")a=n(l);else if(r)a=G.createElement(r,l);else throw s}return G.createElement(gx.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function vx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const Ex=()=>{const e=Ie();return C.jsxs(C.Fragment,{children:[C.jsx(tc,{}),C.jsx("div",{className:"content",children:C.jsx(Lm,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),C.jsx(Qu,{})]})},_x=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:o="",locale:i="en"})=>{const s=Db(e,{locale:i});return C.jsx(yx,{onError:t,fallback:C.jsx(Ex,{}),children:C.jsx(G.Suspense,{fallback:C.jsx(Dm,{layout:"overview-page"}),children:C.jsx("div",{id:"wrapper",className:se(o,{[r]:r!=="default"}),children:C.jsxs(Cg,{children:[C.jsx(tc,{}),C.jsx("div",{className:"content",children:s}),n&&C.jsx(Qu,{}),C.jsx(Qm,{})]})})})})};const bx=({children:e,className:t})=>C.jsx("section",{className:se("modal",t),children:typeof e=="string"?C.jsx("p",{children:e}):e});exports.ASSETS_BUCKET=$o;exports.Alert=hu;exports.BannerSection=zb;exports.Button=ut;exports.ButtonWrapper=Xo;exports.CollapsibleSection=qu;exports.Columns=hO;exports.CommunityDetails=FT;exports.Contributors=jm;exports.ConversationContext=Yu;exports.CookieBanner=Qm;exports.DiscussionConversation=DT;exports.DiscussionForm=Gm;exports.DiscussionLikes=Wm;exports.DiscussionPost=aO;exports.DownloadSection=qb;exports.EmailHelperTextBox=sO;exports.EmptyStateBox=Lm;exports.Filters=pO;exports.Footer=Qu;exports.FullWidthSection=Uu;exports.Header=tc;exports.HelperTextBox=Bm;exports.HiddenFromScreenReaders=Eu;exports.HideShowTextBox=bT;exports.HighlightedTextBox=nr;exports.IntlProvider=BT;exports.JoinButton=Hm;exports.Link=kp;exports.LoadMore=mO;exports.LoadingBlock=NT;exports.LoadingPlaceholder=vr;exports.LoadingState=Dm;exports.Logo=Ku;exports.LogoSection=Gb;exports.MarkdownText=Mm;exports.MarketingBox=Yb;exports.Member=zu;exports.Modal=bx;exports.NUMBER_OF_USERS=yS;exports.PageLayout=_x;exports.PasswordRules=lO;exports.Pill=RT;exports.ProfilePicture=ea;exports.ProgressBar=Fm;exports.Rating=fO;exports.ResponsiveImage=Bp;exports.SearchForm=Km;exports.Tags=yO;exports.UserContext=Bn;exports.UserProvider=MT;exports.VisuallyHidden=it;exports.getMember=Vu;exports.headerData=Gi;exports.useEffectAfterMount=Io;exports.useFeatureFlag=R_;exports.useScreenWidth=Ki;exports.useScrollListener=Sp;
|
package/index.mjs
CHANGED
|
@@ -17025,7 +17025,7 @@ const Us = () => {
|
|
|
17025
17025
|
}
|
|
17026
17026
|
}) => {
|
|
17027
17027
|
const l = Pe();
|
|
17028
|
-
console.log({ likes: t, userLiked: r }), ut(() => {
|
|
17028
|
+
console.log("from like", { likes: t, userLiked: r, slug: o.slugs }), ut(() => {
|
|
17029
17029
|
d(r);
|
|
17030
17030
|
}, [r]);
|
|
17031
17031
|
const [f, u] = Be(t), [h, d] = Be(r), [c, p] = Be(!1), m = window.location.pathname, E = (_) => {
|
|
@@ -17578,9 +17578,7 @@ const aO = /* @__PURE__ */ Vt(oO), sO = (e) => {
|
|
|
17578
17578
|
}) => {
|
|
17579
17579
|
const d = Pe();
|
|
17580
17580
|
In(no);
|
|
17581
|
-
const c = In(qm)
|
|
17582
|
-
console.log("from post", { likes: e.likes, userLiked: e.userLiked });
|
|
17583
|
-
const [p, m] = Be({
|
|
17581
|
+
const c = In(qm), [p, m] = Be({
|
|
17584
17582
|
body: e && e.body || "",
|
|
17585
17583
|
isEditing: !1,
|
|
17586
17584
|
didEdit: e && e.isEdited || !1
|
|
@@ -17593,7 +17591,9 @@ const aO = /* @__PURE__ */ Vt(oO), sO = (e) => {
|
|
|
17593
17591
|
});
|
|
17594
17592
|
}, [e.isEdited]), t || !e || e.type === "answer" && (!e.slugs || !e.slugs.question))
|
|
17595
17593
|
return /* @__PURE__ */ R(nn, { className: "discussion-card discussion-post" });
|
|
17596
|
-
const { author: _, createdAt: b, likes: x = 0, userLiked: w } = e, P = !0
|
|
17594
|
+
const { author: _, createdAt: b, likes: x = 0, userLiked: w } = e, P = !0;
|
|
17595
|
+
console.log({ likes: e.likes, userLiked: e.userLiked, slug: e.slug });
|
|
17596
|
+
const F = async (q) => {
|
|
17597
17597
|
q || (q = ""), T("");
|
|
17598
17598
|
try {
|
|
17599
17599
|
aO(q, p.body) || await i(sO(e.slugs), { body: q }), m({ body: q, isEditing: !1, didEdit: !0 });
|
|
@@ -17606,94 +17606,67 @@ const aO = /* @__PURE__ */ Vt(oO), sO = (e) => {
|
|
|
17606
17606
|
H && H.focus(), W && W.scrollIntoView({ behavior: "smooth" });
|
|
17607
17607
|
}, 0);
|
|
17608
17608
|
};
|
|
17609
|
-
return /* @__PURE__ */ se(
|
|
17610
|
-
"div",
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
"
|
|
17609
|
+
return /* @__PURE__ */ se("div", { className: ae("discussion-post", l), "data-testid": `discussion-${e.type}-thread`, children: [
|
|
17610
|
+
/* @__PURE__ */ se("div", { className: ae("discussion-card", e.type, { editing: p.isEditing }), children: [
|
|
17611
|
+
!p.isEditing && /* @__PURE__ */ R(
|
|
17612
|
+
jm,
|
|
17613
|
+
{
|
|
17614
|
+
member: _,
|
|
17615
|
+
additionalContent: { createdAt: b, didEdit: p.didEdit },
|
|
17616
|
+
className: typeof _ != "string" && _.id === n ? "highlighted" : "",
|
|
17617
|
+
gtmContext: f,
|
|
17618
|
+
gtmType: "profile-click"
|
|
17619
|
+
}
|
|
17620
|
+
),
|
|
17621
|
+
p.isEditing ? /* @__PURE__ */ R(
|
|
17622
|
+
rO,
|
|
17623
|
+
{
|
|
17624
|
+
content: { type: e.type, slugs: e.slugs },
|
|
17625
|
+
meta: { isLoading: t, isInWrapper: !0, isEditing: { text: p.body } },
|
|
17626
|
+
forceShow: { error: E !== "" && E !== "delete-error" ? d.formatMessage({ id: E }, {
|
|
17627
|
+
action: d.formatMessage({
|
|
17628
|
+
id: `discussion_action_${e.type}`
|
|
17629
|
+
})
|
|
17630
|
+
}) : !1 },
|
|
17631
|
+
functions: {
|
|
17632
|
+
create: r,
|
|
17633
|
+
handleSaveEdit: F,
|
|
17634
|
+
handleCancel: () => {
|
|
17635
|
+
T(""), m({ ...p, isEditing: !1 });
|
|
17636
|
+
}
|
|
17637
|
+
},
|
|
17638
|
+
gtmContext: `${f}Form`
|
|
17639
|
+
}
|
|
17640
|
+
) : /* @__PURE__ */ R(IT, { children: p.body }),
|
|
17641
|
+
!p.isEditing && /* @__PURE__ */ se("ul", { className: ae("actions", e.type), "data-testid": `${e.type}-actions`, children: [
|
|
17642
|
+
/* @__PURE__ */ R(
|
|
17643
|
+
iO,
|
|
17617
17644
|
{
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
className: typeof _ != "string" && _.id === n ? "highlighted" : "",
|
|
17628
|
-
gtmContext: f,
|
|
17629
|
-
gtmType: "profile-click"
|
|
17630
|
-
}
|
|
17631
|
-
),
|
|
17632
|
-
p.isEditing ? /* @__PURE__ */ R(
|
|
17633
|
-
rO,
|
|
17634
|
-
{
|
|
17635
|
-
content: { type: e.type, slugs: e.slugs },
|
|
17636
|
-
meta: { isLoading: t, isInWrapper: !0, isEditing: { text: p.body } },
|
|
17637
|
-
forceShow: {
|
|
17638
|
-
error: E !== "" && E !== "delete-error" ? d.formatMessage(
|
|
17639
|
-
{ id: E },
|
|
17640
|
-
{
|
|
17641
|
-
action: d.formatMessage({
|
|
17642
|
-
id: `discussion_action_${e.type}`
|
|
17643
|
-
})
|
|
17644
|
-
}
|
|
17645
|
-
) : !1
|
|
17646
|
-
},
|
|
17647
|
-
functions: {
|
|
17648
|
-
create: r,
|
|
17649
|
-
handleSaveEdit: F,
|
|
17650
|
-
handleCancel: () => {
|
|
17651
|
-
T(""), m({ ...p, isEditing: !1 });
|
|
17652
|
-
}
|
|
17653
|
-
},
|
|
17654
|
-
gtmContext: `${f}Form`
|
|
17655
|
-
}
|
|
17656
|
-
) : /* @__PURE__ */ R(IT, { children: p.body }),
|
|
17657
|
-
!p.isEditing && /* @__PURE__ */ se(
|
|
17658
|
-
"ul",
|
|
17659
|
-
{
|
|
17660
|
-
className: ae("actions", e.type),
|
|
17661
|
-
"data-testid": `${e.type}-actions`,
|
|
17662
|
-
children: [
|
|
17663
|
-
/* @__PURE__ */ R(
|
|
17664
|
-
iO,
|
|
17665
|
-
{
|
|
17666
|
-
element: "li",
|
|
17667
|
-
likes: x,
|
|
17668
|
-
isShort: !1,
|
|
17669
|
-
userLiked: w,
|
|
17670
|
-
content: { type: e.type, slugs: e.slugs },
|
|
17671
|
-
canLike: P,
|
|
17672
|
-
createLike: s,
|
|
17673
|
-
deleteLike: a,
|
|
17674
|
-
locale: u
|
|
17675
|
-
}
|
|
17676
|
-
),
|
|
17677
|
-
(e.type === "answer" || e.type === "reply") && /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(
|
|
17678
|
-
vt,
|
|
17679
|
-
{
|
|
17680
|
-
variant: "tertiary",
|
|
17681
|
-
size: "medium",
|
|
17682
|
-
styling: { muted: !0 },
|
|
17683
|
-
onClick: M,
|
|
17684
|
-
children: d.formatMessage({ id: `${vd}thread_reply_button` })
|
|
17685
|
-
}
|
|
17686
|
-
) })
|
|
17687
|
-
]
|
|
17688
|
-
}
|
|
17689
|
-
)
|
|
17690
|
-
]
|
|
17645
|
+
element: "li",
|
|
17646
|
+
likes: x,
|
|
17647
|
+
isShort: !1,
|
|
17648
|
+
userLiked: w,
|
|
17649
|
+
content: { type: e.type, slugs: e.slugs },
|
|
17650
|
+
canLike: P,
|
|
17651
|
+
createLike: s,
|
|
17652
|
+
deleteLike: a,
|
|
17653
|
+
locale: u
|
|
17691
17654
|
}
|
|
17692
17655
|
),
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17656
|
+
(e.type === "answer" || e.type === "reply") && /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(
|
|
17657
|
+
vt,
|
|
17658
|
+
{
|
|
17659
|
+
variant: "tertiary",
|
|
17660
|
+
size: "medium",
|
|
17661
|
+
styling: { muted: !0 },
|
|
17662
|
+
onClick: M,
|
|
17663
|
+
children: d.formatMessage({ id: `${vd}thread_reply_button` })
|
|
17664
|
+
}
|
|
17665
|
+
) })
|
|
17666
|
+
] })
|
|
17667
|
+
] }),
|
|
17668
|
+
h
|
|
17669
|
+
] });
|
|
17697
17670
|
};
|
|
17698
17671
|
const Po = "emailHelperTextBox_", kA = ({ type: e, email: t, redirectPath: n, resendVerificationCode: r }) => {
|
|
17699
17672
|
const o = Pe(), [i, s] = Be({ path: `${Po}default`, type: "default", link: {}, mail: {}, error: "" }), [a, l] = Be(!1), f = Ad(
|