@apolitical/component-library 1.17.2-rc.3 → 1.17.2
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 +9 -9
- package/index.mjs +66 -74
- package/layout/page-layout/components/header/header.data.d.ts +33 -29
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18,22 +18,22 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var jn;function Zs(){return jn||(jn=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),a=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,k="@@iterator";function w(f){if(f===null||typeof f!="object")return null;var y=g&&f[g]||f[k];return typeof y=="function"?y:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(f){{for(var y=arguments.length,
|
|
22
|
-
`+xe+f}}var be=!1,ge;{var X=typeof WeakMap=="function"?WeakMap:Map;ge=new X}function ne(f,y){if(!f||be)return"";{var
|
|
21
|
+
*/var jn;function Zs(){return jn||(jn=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),a=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,k="@@iterator";function w(f){if(f===null||typeof f!="object")return null;var y=g&&f[g]||f[k];return typeof y=="function"?y:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(f){{for(var y=arguments.length,M=new Array(y>1?y-1:0),P=1;P<y;P++)M[P-1]=arguments[P];x("error",f,M)}}function x(f,y,M){{var P=E.ReactDebugCurrentFrame,O=P.getStackAddendum();O!==""&&(y+="%s",M=M.concat([O]));var U=M.map(function(B){return String(B)});U.unshift("Warning: "+y),Function.prototype.apply.call(console[f],console,U)}}var T=!1,D=!1,R=!1,V=!1,F=!1,$;$=Symbol.for("react.module.reference");function N(f){return!!(typeof f=="string"||typeof f=="function"||f===r||f===i||F||f===o||f===l||f===m||V||f===h||T||D||R||typeof f=="object"&&f!==null&&(f.$$typeof===p||f.$$typeof===u||f.$$typeof===c||f.$$typeof===a||f.$$typeof===d||f.$$typeof===$||f.getModuleId!==void 0))}function v(f,y,M){var P=f.displayName;if(P)return P;var O=y.displayName||y.name||"";return O!==""?M+"("+O+")":M}function z(f){return f.displayName||"Context"}function j(f){if(f==null)return null;if(typeof f.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case m:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case a:var y=f;return z(y)+".Consumer";case c:var M=f;return z(M._context)+".Provider";case d:return v(f,f.render,"ForwardRef");case u:var P=f.displayName||null;return P!==null?P:j(f.type)||"Memo";case p:{var O=f,U=O._payload,B=O._init;try{return j(B(U))}catch{return null}}}return null}var I=Object.assign,G=0,J,oe,ie,le,Y,te,re;function L(){}L.__reactDisabledLog=!0;function ce(){{if(G===0){J=console.log,oe=console.info,ie=console.warn,le=console.error,Y=console.group,te=console.groupCollapsed,re=console.groupEnd;var f={configurable:!0,enumerable:!0,value:L,writable:!0};Object.defineProperties(console,{info:f,log:f,warn:f,error:f,group:f,groupCollapsed:f,groupEnd:f})}G++}}function he(){{if(G--,G===0){var f={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},f,{value:J}),info:I({},f,{value:oe}),warn:I({},f,{value:ie}),error:I({},f,{value:le}),group:I({},f,{value:Y}),groupCollapsed:I({},f,{value:te}),groupEnd:I({},f,{value:re})})}G<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=E.ReactCurrentDispatcher,xe;function pe(f,y,M){{if(xe===void 0)try{throw Error()}catch(O){var P=O.stack.trim().match(/\n( *(at )?)/);xe=P&&P[1]||""}return`
|
|
22
|
+
`+xe+f}}var be=!1,ge;{var X=typeof WeakMap=="function"?WeakMap:Map;ge=new X}function ne(f,y){if(!f||be)return"";{var M=ge.get(f);if(M!==void 0)return M}var P;be=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=ue.current,ue.current=null,ce();try{if(y){var B=function(){throw Error()};if(Object.defineProperty(B.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(B,[])}catch(Ee){P=Ee}Reflect.construct(f,[],B)}else{try{B.call()}catch(Ee){P=Ee}f.call(B.prototype)}}else{try{throw Error()}catch(Ee){P=Ee}f()}}catch(Ee){if(Ee&&P&&typeof Ee.stack=="string"){for(var A=Ee.stack.split(`
|
|
23
23
|
`),me=P.stack.split(`
|
|
24
24
|
`),q=A.length-1,ee=me.length-1;q>=1&&ee>=0&&A[q]!==me[ee];)ee--;for(;q>=1&&ee>=0;q--,ee--)if(A[q]!==me[ee]){if(q!==1||ee!==1)do if(q--,ee--,ee<0||A[q]!==me[ee]){var ve=`
|
|
25
|
-
`+A[q].replace(" at new "," at ");return f.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",f.displayName)),typeof f=="function"&&ge.set(f,ve),ve}while(q>=1&&ee>=0);break}}}finally{be=!1,ue.current=U,he(),Error.prepareStackTrace=O}var Fe=f?f.displayName||f.name:"",wn=Fe?pe(Fe):"";return typeof f=="function"&&ge.set(f,wn),wn}function de(f,y,
|
|
25
|
+
`+A[q].replace(" at new "," at ");return f.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",f.displayName)),typeof f=="function"&&ge.set(f,ve),ve}while(q>=1&&ee>=0);break}}}finally{be=!1,ue.current=U,he(),Error.prepareStackTrace=O}var Fe=f?f.displayName||f.name:"",wn=Fe?pe(Fe):"";return typeof f=="function"&&ge.set(f,wn),wn}function de(f,y,M){return ne(f,!1)}function Z(f){var y=f.prototype;return!!(y&&y.isReactComponent)}function ae(f,y,M){if(f==null)return"";if(typeof f=="function")return ne(f,Z(f));if(typeof f=="string")return pe(f);switch(f){case l:return pe("Suspense");case m:return pe("SuspenseList")}if(typeof f=="object")switch(f.$$typeof){case d:return de(f.render);case u:return ae(f.type,y,M);case p:{var P=f,O=P._payload,U=P._init;try{return ae(U(O),y,M)}catch{}}}return""}var _e=Object.prototype.hasOwnProperty,Ce={},He=E.ReactDebugCurrentFrame;function Ne(f){if(f){var y=f._owner,M=ae(f.type,f._source,y?y.type:null);He.setExtraStackFrame(M)}else He.setExtraStackFrame(null)}function st(f,y,M,P,O){{var U=Function.call.bind(_e);for(var B in f)if(U(f,B)){var A=void 0;try{if(typeof f[B]!="function"){var me=Error((P||"React class")+": "+M+" type `"+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof f[B]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw me.name="Invariant Violation",me}A=f[B](y,B,P,M,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){A=q}A&&!(A instanceof Error)&&(Ne(O),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",P||"React class",M,B,typeof A),Ne(null)),A instanceof Error&&!(A.message in Ce)&&(Ce[A.message]=!0,Ne(O),b("Failed %s type: %s",M,A.message),Ne(null))}}}var K=Array.isArray;function je(f){return K(f)}function Pe(f){{var y=typeof Symbol=="function"&&Symbol.toStringTag,M=y&&f[Symbol.toStringTag]||f.constructor.name||"Object";return M}}function rt(f){try{return at(f),!1}catch{return!0}}function at(f){return""+f}function mn(f){if(rt(f))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pe(f)),at(f)}var Qe=E.ReactCurrentOwner,ys={key:!0,ref:!0,__self:!0,__source:!0},fn,hn,yt;yt={};function Es(f){if(_e.call(f,"ref")){var y=Object.getOwnPropertyDescriptor(f,"ref").get;if(y&&y.isReactWarning)return!1}return f.ref!==void 0}function Ss(f){if(_e.call(f,"key")){var y=Object.getOwnPropertyDescriptor(f,"key").get;if(y&&y.isReactWarning)return!1}return f.key!==void 0}function $s(f,y){if(typeof f.ref=="string"&&Qe.current&&y&&Qe.current.stateNode!==y){var M=j(Qe.current.type);yt[M]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',j(Qe.current.type),f.ref),yt[M]=!0)}}function Ms(f,y){{var M=function(){fn||(fn=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",y))};M.isReactWarning=!0,Object.defineProperty(f,"key",{get:M,configurable:!0})}}function Ts(f,y){{var M=function(){hn||(hn=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",y))};M.isReactWarning=!0,Object.defineProperty(f,"ref",{get:M,configurable:!0})}}var Cs=function(f,y,M,P,O,U,B){var A={$$typeof:t,type:f,key:y,ref:M,props:B,_owner:U};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function Ns(f,y,M,P,O){{var U,B={},A=null,me=null;M!==void 0&&(mn(M),A=""+M),Ss(y)&&(mn(y.key),A=""+y.key),Es(y)&&(me=y.ref,$s(y,O));for(U in y)_e.call(y,U)&&!ys.hasOwnProperty(U)&&(B[U]=y[U]);if(f&&f.defaultProps){var q=f.defaultProps;for(U in q)B[U]===void 0&&(B[U]=q[U])}if(A||me){var ee=typeof f=="function"?f.displayName||f.name||"Unknown":f;A&&Ms(B,ee),me&&Ts(B,ee)}return Cs(f,A,me,O,P,Qe.current,B)}}var Et=E.ReactCurrentOwner,pn=E.ReactDebugCurrentFrame;function Re(f){if(f){var y=f._owner,M=ae(f.type,f._source,y?y.type:null);pn.setExtraStackFrame(M)}else pn.setExtraStackFrame(null)}var St;St=!1;function $t(f){return typeof f=="object"&&f!==null&&f.$$typeof===t}function gn(){{if(Et.current){var f=j(Et.current.type);if(f)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+f+"`."}return""}}function Ps(f){{if(f!==void 0){var y=f.fileName.replace(/^.*[\\\/]/,""),
|
|
27
|
+
Check the render method of \``+f+"`."}return""}}function Ps(f){{if(f!==void 0){var y=f.fileName.replace(/^.*[\\\/]/,""),M=f.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+y+":"+
|
|
29
|
+
Check your code at `+y+":"+M+"."}return""}}var _n={};function Ds(f){{var y=gn();if(!y){var M=typeof f=="string"?f:f.displayName||f.name;M&&(y=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+T+">.")}return y}}function xn(f,y){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var T=Ds(y);if(_n[T])return;_n[T]=!0;var P="";f&&f._owner&&f._owner!==Et.current&&(P=" It was passed a child from "+j(f._owner.type)+"."),Re(f),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',T,P),Re(null)}}function bn(f,y){{if(typeof f!="object")return;if(je(f))for(var T=0;T<f.length;T++){var P=f[T];$t(P)&&xn(P,y)}else if($t(f))f._store&&(f._store.validated=!0);else if(f){var O=w(f);if(typeof O=="function"&&O!==f.entries)for(var U=O.call(f),B;!(B=U.next()).done;)$t(B.value)&&xn(B.value,y)}}}function Rs(f){{var y=f.type;if(y==null||typeof y=="string")return;var T;if(typeof y=="function")T=y.propTypes;else if(typeof y=="object"&&(y.$$typeof===d||y.$$typeof===u))T=y.propTypes;else return;if(T){var P=j(y);st(T,f.props,"prop",P,f)}else if(y.PropTypes!==void 0&&!St){St=!0;var O=j(y);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof y.getDefaultProps=="function"&&!y.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Fs(f){{for(var y=Object.keys(f.props),T=0;T<y.length;T++){var P=y[T];if(P!=="children"&&P!=="key"){Re(f),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),Re(null);break}}f.ref!==null&&(Re(f),b("Invalid attribute `ref` supplied to `React.Fragment`."),Re(null))}}function vn(f,y,T,P,O,U){{var B=N(f);if(!B){var A="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(A+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var me=Ps(O);me?A+=me:A+=gn();var q;f===null?q="null":je(f)?q="array":f!==void 0&&f.$$typeof===t?(q="<"+(j(f.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):q=typeof f,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,A)}var ee=Ns(f,y,T,O,U);if(ee==null)return ee;if(B){var ve=y.children;if(ve!==void 0)if(P)if(je(ve)){for(var Fe=0;Fe<ve.length;Fe++)bn(ve[Fe],f);Object.freeze&&Object.freeze(ve)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else bn(ve,f)}return f===r?Fs(ee):Rs(ee),ee}}function As(f,y,T){return vn(f,y,T,!0)}function Is(f,y,T){return vn(f,y,T,!1)}var Ls=Is,Bs=As;We.Fragment=r,We.jsx=Ls,We.jsxs=Bs}()),We}process.env.NODE_ENV==="production"?Ut.exports=Xs():Ut.exports=Zs();var s=Ut.exports;const On=()=>{const[e,t]=_.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return _.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},De=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Ks(e,t,n){var r=this,o=_.useRef(null),i=_.useRef(0),c=_.useRef(null),a=_.useRef([]),d=_.useRef(),l=_.useRef(),m=_.useRef(e),u=_.useRef(!0);m.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,k=!("trailing"in n)||!!n.trailing,w="maxWait"in n,E="debounceOnServer"in n&&!!n.debounceOnServer,b=w?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return u.current=!0,function(){u.current=!1}},[]);var x=_.useMemo(function(){var M=function(N){var v=a.current,z=d.current;return a.current=d.current=null,i.current=N,l.current=m.current.apply(z,v)},D=function(N,v){h&&cancelAnimationFrame(c.current),c.current=h?requestAnimationFrame(N):setTimeout(N,v)},R=function(N){if(!u.current)return!1;var v=N-o.current;return!o.current||v>=t||v<0||w&&N-i.current>=b},V=function(N){return c.current=null,k&&a.current?M(N):(a.current=d.current=null,l.current)},F=function N(){var v=Date.now();if(R(v))return V(v);if(u.current){var z=t-(v-o.current),j=w?Math.min(z,b-(v-i.current)):z;D(N,j)}},$=function(){if(p||E){var N=Date.now(),v=R(N);if(a.current=[].slice.call(arguments),d.current=r,o.current=N,v){if(!c.current&&u.current)return i.current=o.current,D(F,t),g?M(o.current):l.current;if(w)return D(F,t),M(o.current)}return c.current||D(F,t),l.current}};return $.cancel=function(){c.current&&(h?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=o.current=d.current=c.current=null},$.isPending=function(){return!!c.current},$.flush=function(){return c.current?V(Date.now()):l.current},$},[g,w,t,b,k,h,p,E]);return x}function Hn(e,t,n){var r=n===void 0?{}:n,o=r.leading,i=r.trailing;return Ks(e,t,{maxWait:t,leading:o===void 0||o,trailing:i===void 0||i})}let Tt;const Be=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,o]=_.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",d),()=>{clearTimeout(Tt),d.flush(),window.removeEventListener("resize",d)}),i);const c=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{o(c())},d=Hn(()=>{c()!==r&&(t&&(clearTimeout(Tt),document.body.classList.add("is-resizing"),Tt=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},Qn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[o,i]=_.useState({current:0,past:0})||[!1,()=>{}],[c,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(d(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const d=()=>{const m=window.scrollY,u=o.current,p=m-u,h=p>0?"down":"up";if(i({current:m,past:u}),h==="down"){m>=e+t.down&&!c.scrollDown&&(!c.scrollUp||p>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!c.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},l=Hn(()=>{d()},250);return o},Un=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);De(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Wn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},zn=(e,t,n)=>{let r=n.mobile;for(const o in t){const i=parseInt(String(t[o]));if(e>=i)r=n[i];else if(e<i)break}return r},er=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),tr=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Vn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Wt=e=>{let i;const c=yn(),a=yn(new Date(e));try{i=c.getTime()-a.getTime()}catch{return""}const d=i/36e5,l=Math.floor(i/864e5);if(l<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(l<7)return{path:"days",number:l};const m=Math.floor(l/7);return m<=52?{path:"weeks",number:m}:{path:"years",number:Math.floor(l/365)}},yn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Jt={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",card_carousel_viewAll:"View all",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_cta_people:"View profile",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",activitySection_notFoundError:"Post not found",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+M+">.")}return y}}function xn(f,y){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var M=Ds(y);if(_n[M])return;_n[M]=!0;var P="";f&&f._owner&&f._owner!==Et.current&&(P=" It was passed a child from "+j(f._owner.type)+"."),Re(f),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',M,P),Re(null)}}function bn(f,y){{if(typeof f!="object")return;if(je(f))for(var M=0;M<f.length;M++){var P=f[M];$t(P)&&xn(P,y)}else if($t(f))f._store&&(f._store.validated=!0);else if(f){var O=w(f);if(typeof O=="function"&&O!==f.entries)for(var U=O.call(f),B;!(B=U.next()).done;)$t(B.value)&&xn(B.value,y)}}}function Rs(f){{var y=f.type;if(y==null||typeof y=="string")return;var M;if(typeof y=="function")M=y.propTypes;else if(typeof y=="object"&&(y.$$typeof===d||y.$$typeof===u))M=y.propTypes;else return;if(M){var P=j(y);st(M,f.props,"prop",P,f)}else if(y.PropTypes!==void 0&&!St){St=!0;var O=j(y);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof y.getDefaultProps=="function"&&!y.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Fs(f){{for(var y=Object.keys(f.props),M=0;M<y.length;M++){var P=y[M];if(P!=="children"&&P!=="key"){Re(f),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),Re(null);break}}f.ref!==null&&(Re(f),b("Invalid attribute `ref` supplied to `React.Fragment`."),Re(null))}}function vn(f,y,M,P,O,U){{var B=N(f);if(!B){var A="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(A+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var me=Ps(O);me?A+=me:A+=gn();var q;f===null?q="null":je(f)?q="array":f!==void 0&&f.$$typeof===t?(q="<"+(j(f.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):q=typeof f,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,A)}var ee=Ns(f,y,M,O,U);if(ee==null)return ee;if(B){var ve=y.children;if(ve!==void 0)if(P)if(je(ve)){for(var Fe=0;Fe<ve.length;Fe++)bn(ve[Fe],f);Object.freeze&&Object.freeze(ve)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else bn(ve,f)}return f===r?Fs(ee):Rs(ee),ee}}function As(f,y,M){return vn(f,y,M,!0)}function Is(f,y,M){return vn(f,y,M,!1)}var Ls=Is,Bs=As;We.Fragment=r,We.jsx=Ls,We.jsxs=Bs}()),We}process.env.NODE_ENV==="production"?Ut.exports=Xs():Ut.exports=Zs();var s=Ut.exports;const On=()=>{const[e,t]=_.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return _.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},De=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Ks(e,t,n){var r=this,o=_.useRef(null),i=_.useRef(0),c=_.useRef(null),a=_.useRef([]),d=_.useRef(),l=_.useRef(),m=_.useRef(e),u=_.useRef(!0);m.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,k=!("trailing"in n)||!!n.trailing,w="maxWait"in n,E="debounceOnServer"in n&&!!n.debounceOnServer,b=w?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return u.current=!0,function(){u.current=!1}},[]);var x=_.useMemo(function(){var T=function(N){var v=a.current,z=d.current;return a.current=d.current=null,i.current=N,l.current=m.current.apply(z,v)},D=function(N,v){h&&cancelAnimationFrame(c.current),c.current=h?requestAnimationFrame(N):setTimeout(N,v)},R=function(N){if(!u.current)return!1;var v=N-o.current;return!o.current||v>=t||v<0||w&&N-i.current>=b},V=function(N){return c.current=null,k&&a.current?T(N):(a.current=d.current=null,l.current)},F=function N(){var v=Date.now();if(R(v))return V(v);if(u.current){var z=t-(v-o.current),j=w?Math.min(z,b-(v-i.current)):z;D(N,j)}},$=function(){if(p||E){var N=Date.now(),v=R(N);if(a.current=[].slice.call(arguments),d.current=r,o.current=N,v){if(!c.current&&u.current)return i.current=o.current,D(F,t),g?T(o.current):l.current;if(w)return D(F,t),T(o.current)}return c.current||D(F,t),l.current}};return $.cancel=function(){c.current&&(h?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=o.current=d.current=c.current=null},$.isPending=function(){return!!c.current},$.flush=function(){return c.current?V(Date.now()):l.current},$},[g,w,t,b,k,h,p,E]);return x}function Hn(e,t,n){var r=n===void 0?{}:n,o=r.leading,i=r.trailing;return Ks(e,t,{maxWait:t,leading:o===void 0||o,trailing:i===void 0||i})}let Mt;const Be=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,o]=_.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",d),()=>{clearTimeout(Mt),d.flush(),window.removeEventListener("resize",d)}),i);const c=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{o(c())},d=Hn(()=>{c()!==r&&(t&&(clearTimeout(Mt),document.body.classList.add("is-resizing"),Mt=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},Qn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[o,i]=_.useState({current:0,past:0})||[!1,()=>{}],[c,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(d(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const d=()=>{const m=window.scrollY,u=o.current,p=m-u,h=p>0?"down":"up";if(i({current:m,past:u}),h==="down"){m>=e+t.down&&!c.scrollDown&&(!c.scrollUp||p>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!c.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},l=Hn(()=>{d()},250);return o},Un=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);De(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Wn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},zn=(e,t,n)=>{let r=n.mobile;for(const o in t){const i=parseInt(String(t[o]));if(e>=i)r=n[i];else if(e<i)break}return r},er=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),tr=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Vn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Wt=e=>{let i;const c=yn(),a=yn(new Date(e));try{i=c.getTime()-a.getTime()}catch{return""}const d=i/36e5,l=Math.floor(i/864e5);if(l<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(l<7)return{path:"days",number:l};const m=Math.floor(l/7);return m<=52?{path:"weeks",number:m}:{path:"years",number:Math.floor(l/365)}},yn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Jt={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",card_carousel_viewAll:"View all",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_cta_people:"View profile",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",activitySection_notFoundError:"Post not found",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",overlay_close:"Close",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",progressBar:"{number}% loaded",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tags_community:"From the community",tooltip_loading:"Loading..."},nr={languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},sr={collapsibleSection_summary:"En savoir plus",languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>"},rr={languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},ar=Object.freeze(Object.defineProperty({__proto__:null,en:Jt,es:nr,fr:sr,pt:rr},Symbol.toStringTag,{value:"Module"})),Yn=e=>e in Jt,ye=(e,t,n,r,o={})=>{let i="";return Yn(`${t}_${n}`)?i=e({id:`${t}_${n}`},o):i=e({id:t},{[r]:n,...o}),i},or=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let o=n.length-1;o>=0;o--){const i=Math.pow(10,(o+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&o<n.length-1&&(e=1,o++),r=`${e}${n[o]}`;break}}return r},Gn=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},ir=e=>e.replace(/\s+/g,"").length>0,lr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Os(e);return t.forEach(({type:r,value:o})=>{Hs(n,r,o)}),n},cr=e=>new Promise(t=>setTimeout(t,e)),pt=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),H=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:o=!1,element:i="button",onClick:c=!1,className:a="",disabled:d=!1,screenreaderText:l=!1,children:m=!1,...u})=>{const h=Be(typeof t=="object");if(typeof t=="object"&&typeof h=="number"){const w=Object.assign({},t),E=Wn(Object.keys(w));t=zn(h,E,w)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const k={...u,className:S(e,a,g,{"no-text":!m,disabled:d,button:o}),onClick:w=>{(!o||o[0]==="#")&&c&&(w.preventDefault(),w.stopPropagation()),c&&c(w)},disabled:typeof d=="object"&&"isClickable"in d?!d.isClickable:d};return o&&(i="a",k.href=o),_.createElement(i,k,m||(l?s.jsx(se,{showOnFocus:!1,children:l}):null))},Xe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",o=e.map((i,c)=>r==="p"?s.jsx(H,{...i},c):s.jsx("li",{children:s.jsx(H,{...i})},c));return _.createElement(r,{className:S("button-wrapper",t),...n,children:o})};const Me=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:S(e,{"has-max-width":t}),style:n})},Ze=({href:e,children:t,fallbackElement:n,className:r="",onClick:o,gtmContext:i,gtmType:c,...a})=>{if(e){const d={...a};return o&&(d.onClick=o),i&&(d["data-gtm-event-context"]=i),c&&(d["data-gtm-event-type"]=c),s.jsx("a",{href:e,className:S("gtm-trackable",r),...d,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},En={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},ur=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:o}=e?En[e]:En.fallback;return{range:t&&t.length>0?t:r,sizes:n||o}},dr=({format:e,height:t,query:n,width:r})=>{let o=`w=${r}&h=${t}`;return o=e?`${o}&fm=${e}`:o,o=n?`${o}&${n}`:o,o},Mt=({format:e,range:t,url:n,query:r})=>t.map(({height:o,width:i})=>`${n}?${dr({format:e,height:o,query:r,width:i})} ${i}w`).join(", ");const qt=({image:e,className:t,testId:n})=>{const{description:r,height:o,type:i,query:c,url:a,width:d,loading:l,decoding:m,fetchPriority:u}=e,{range:p,sizes:h}=ur(e),g=Mt({format:"avif",query:c,range:p,url:a}),k=Mt({format:"webp",query:c,range:p,url:a}),w=Mt({format:"",query:c,range:p,url:a});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:k,sizes:h,"data-testid":"source"}),s.jsx("img",{srcSet:w,sizes:h,src:a,alt:r,loading:l||"lazy",decoding:m||"async",fetchpriority:u||"auto",width:d,height:o,"data-testid":n||"image"})]})};let ze=!1;const Jn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=C.useIntl(),o=_.useRef(null),[i,c]=_.useState("hidden");_.useEffect(()=>{const d=o.current;if(d)return d.addEventListener("transitionend",a),()=>{d.removeEventListener("transitionend",a)}},[]);const a=({propertyName:d})=>{d==="opacity"&&(ze!==!1&&clearTimeout(ze),c(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return De(()=>{ze!==!1&&clearTimeout(ze);let d="open";e?c("opening"):(c("closing"),d="hidden"),ze=setTimeout(()=>{c(d)},300)},[e]),s.jsx("aside",{ref:o,className:S("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Ke=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const mr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(o=>{r.push({href:o.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":o.eventContext||"Download",target:"_blank",children:o.text})}),s.jsx(Ke,{className:S("download-section",n),children:s.jsxs(s.Fragment,{children:[_.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Xe,{buttons:r})]})})};const fr=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const o={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&_.createElement(o.element,{className:"title"},o.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:c,link:a=!1,description:d=!1},l)=>{if(!i||!i.url)return null;const m=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:c});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),d&&s.jsx("small",{children:d})]},window.btoa(`${i.url}_${l}`))})})]})};const hr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],pr=({className:e="",content:t,image:n,variant:r="default",spacing:o="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:c,children:a})=>{const d=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},m={};return d.forEach(u=>{if(!t[u]){m[u]=!1;return}if(!i[u]){if(typeof t[u]=="object"){m[u]=t[u];const{text:p,element:h}=t[u];if(h&&hr.includes(h.toLowerCase()))return;m[u]={text:p,element:l[u]};return}m[u]={text:t[u],element:l[u]}}}),c&&c.link&&c.link[0]==="#"&&(c.props||(c.props={}),c.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const p=document.getElementById(c.link.substring(1));p&&p.scrollIntoView({behavior:"smooth"})}),s.jsx(Ke,{className:S("banner-section",r,o,e,{"has-image":n,"has-extra-spacing":o==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[d.map(u=>{if(m[u]&&typeof m[u]=="object"){const{text:p,element:h=""}=m[u];return _.createElement(h.toLowerCase(),{key:u,className:u},p)}return null}),a,c&&c.text&&c.link&&s.jsx(H,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:c.link,...c.props,children:c.text})]}),n&&s.jsx(qt,{image:{...n,aspect:"banner"}})]})})},gr=_.memo(pr);const _r=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:o})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(H,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":"learn-more-click",children:t.text})]}),qn=({showDevTools:e=!0,children:t})=>{const n=new W.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(W.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Qs.ReactQueryDevtools,{initialIsOpen:!1})]})};var xr=_.createContext({client:ht});function br(e){var t=e.children,n=e.client,r=e.apiKey,o=e.options,i=_.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&o&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ht.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ht.init(r,o)),ht)},[n,r]);return _.createElement(xr.Provider,{value:{client:i}},t)}const Xn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(br,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,Zn=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...ar[r],...n||{}};return s.jsx(C.IntlProvider,{locale:r,messages:o,children:e})},ke=_.createContext({isLoading:!0});function Kn(){return _.useContext(ke)}const es=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),vr=({bootstrap:e,children:t,intl:n})=>{const[r,o]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(i=>{o({...i,isLoading:!1}),Gn(5e3)}).catch(()=>o({isLoading:!1}))},[]),s.jsx(Zn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(In.CookiesProvider,{children:s.jsx(es,{user:r,children:s.jsx(qn,{children:s.jsx(Xn,{user:r,children:t})})})})})},Ge="https://storage.googleapis.com/apolitical-assets/",Ae={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},wr="200,000+";const Xt=({label:e=!1,className:t="",children:n})=>{const r=C.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Te=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const et=({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,c=Be(i);if(i&&typeof n=="object"&&typeof c=="number"){const u=Object.assign({},n.breakpoints),p=Wn(Object.keys(u));o=zn(c,p,u)}const{breakpoints:a,text:d="",component:l,...m}=n;return s.jsx(Te,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(wt,{options:{forceBlock:!0},children:t}),o&&typeof n=="object"&&(l||s.jsx(H,{...m,variant:n.variant?n.variant:"secondary",children:d}))]})})};const zt=({children:e,...t})=>s.jsx("p",{...t,children:e}),ts={q:zt,blockquote:zt};for(let e=1;e<=6;e++)ts[`h${e}`]={component:zt,props:{className:"title"}};const ns=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(wt,{options:{wrapper:_.Fragment,forceBlock:!0,overrides:ts},children:r}):s.jsx("p",{children:r})]});const kr=({className:e="",show:t=!1,hide:n=!1,text:r,children:o})=>{const i=C.useIntl(),c=_.useRef(null),[a,d]=_.useState(""),[l,m]=_.useState("closed");_.useEffect(()=>{const h=c.current;if(h)return h.addEventListener("transitionend",u),()=>{h.removeEventListener("transitionend",u)}},[]),_.useEffect(()=>{if(!r||typeof r!="string")return;const h=r.split(`
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",overlay_close:"Close",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",progressBar:"{number}% loaded",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tags_community:"From the community",tooltip_loading:"Loading..."},nr={languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},sr={collapsibleSection_summary:"En savoir plus",languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>"},rr={languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},ar=Object.freeze(Object.defineProperty({__proto__:null,en:Jt,es:nr,fr:sr,pt:rr},Symbol.toStringTag,{value:"Module"})),Yn=e=>e in Jt,ye=(e,t,n,r,o={})=>{let i="";return Yn(`${t}_${n}`)?i=e({id:`${t}_${n}`},o):i=e({id:t},{[r]:n,...o}),i},or=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let o=n.length-1;o>=0;o--){const i=Math.pow(10,(o+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&o<n.length-1&&(e=1,o++),r=`${e}${n[o]}`;break}}return r},Gn=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},ir=e=>e.replace(/\s+/g,"").length>0,lr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Os(e);return t.forEach(({type:r,value:o})=>{Hs(n,r,o)}),n},cr=e=>new Promise(t=>setTimeout(t,e)),pt=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),H=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:o=!1,element:i="button",onClick:c=!1,className:a="",disabled:d=!1,screenreaderText:l=!1,children:m=!1,...u})=>{const h=Be(typeof t=="object");if(typeof t=="object"&&typeof h=="number"){const w=Object.assign({},t),E=Wn(Object.keys(w));t=zn(h,E,w)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const k={...u,className:S(e,a,g,{"no-text":!m,disabled:d,button:o}),onClick:w=>{(!o||o[0]==="#")&&c&&(w.preventDefault(),w.stopPropagation()),c&&c(w)},disabled:typeof d=="object"&&"isClickable"in d?!d.isClickable:d};return o&&(i="a",k.href=o),_.createElement(i,k,m||(l?s.jsx(se,{showOnFocus:!1,children:l}):null))},Xe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",o=e.map((i,c)=>r==="p"?s.jsx(H,{...i},c):s.jsx("li",{children:s.jsx(H,{...i})},c));return _.createElement(r,{className:S("button-wrapper",t),...n,children:o})};const Te=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:S(e,{"has-max-width":t}),style:n})},Ze=({href:e,children:t,fallbackElement:n,className:r="",onClick:o,gtmContext:i,gtmType:c,...a})=>{if(e){const d={...a};return o&&(d.onClick=o),i&&(d["data-gtm-event-context"]=i),c&&(d["data-gtm-event-type"]=c),s.jsx("a",{href:e,className:S("gtm-trackable",r),...d,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},En={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},ur=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:o}=e?En[e]:En.fallback;return{range:t&&t.length>0?t:r,sizes:n||o}},dr=({format:e,height:t,query:n,width:r})=>{let o=`w=${r}&h=${t}`;return o=e?`${o}&fm=${e}`:o,o=n?`${o}&${n}`:o,o},Tt=({format:e,range:t,url:n,query:r})=>t.map(({height:o,width:i})=>`${n}?${dr({format:e,height:o,query:r,width:i})} ${i}w`).join(", ");const qt=({image:e,className:t,testId:n})=>{const{description:r,height:o,type:i,query:c,url:a,width:d,loading:l,decoding:m,fetchPriority:u}=e,{range:p,sizes:h}=ur(e),g=Tt({format:"avif",query:c,range:p,url:a}),k=Tt({format:"webp",query:c,range:p,url:a}),w=Tt({format:"",query:c,range:p,url:a});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:k,sizes:h,"data-testid":"source"}),s.jsx("img",{srcSet:w,sizes:h,src:a,alt:r,loading:l||"lazy",decoding:m||"async",fetchpriority:u||"auto",width:d,height:o,"data-testid":n||"image"})]})};let ze=!1;const Jn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=C.useIntl(),o=_.useRef(null),[i,c]=_.useState("hidden");_.useEffect(()=>{const d=o.current;if(d)return d.addEventListener("transitionend",a),()=>{d.removeEventListener("transitionend",a)}},[]);const a=({propertyName:d})=>{d==="opacity"&&(ze!==!1&&clearTimeout(ze),c(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return De(()=>{ze!==!1&&clearTimeout(ze);let d="open";e?c("opening"):(c("closing"),d="hidden"),ze=setTimeout(()=>{c(d)},300)},[e]),s.jsx("aside",{ref:o,className:S("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Ke=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const mr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(o=>{r.push({href:o.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":o.eventContext||"Download",target:"_blank",children:o.text})}),s.jsx(Ke,{className:S("download-section",n),children:s.jsxs(s.Fragment,{children:[_.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Xe,{buttons:r})]})})};const fr=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const o={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&_.createElement(o.element,{className:"title"},o.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:c,link:a=!1,description:d=!1},l)=>{if(!i||!i.url)return null;const m=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:c});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),d&&s.jsx("small",{children:d})]},window.btoa(`${i.url}_${l}`))})})]})};const hr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],pr=({className:e="",content:t,image:n,variant:r="default",spacing:o="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:c,children:a})=>{const d=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},m={};return d.forEach(u=>{if(!t[u]){m[u]=!1;return}if(!i[u]){if(typeof t[u]=="object"){m[u]=t[u];const{text:p,element:h}=t[u];if(h&&hr.includes(h.toLowerCase()))return;m[u]={text:p,element:l[u]};return}m[u]={text:t[u],element:l[u]}}}),c&&c.link&&c.link[0]==="#"&&(c.props||(c.props={}),c.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const p=document.getElementById(c.link.substring(1));p&&p.scrollIntoView({behavior:"smooth"})}),s.jsx(Ke,{className:S("banner-section",r,o,e,{"has-image":n,"has-extra-spacing":o==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[d.map(u=>{if(m[u]&&typeof m[u]=="object"){const{text:p,element:h=""}=m[u];return _.createElement(h.toLowerCase(),{key:u,className:u},p)}return null}),a,c&&c.text&&c.link&&s.jsx(H,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:c.link,...c.props,children:c.text})]}),n&&s.jsx(qt,{image:{...n,aspect:"banner"}})]})})},gr=_.memo(pr);const _r=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:o})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(H,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":"learn-more-click",children:t.text})]}),qn=({showDevTools:e=!0,children:t})=>{const n=new W.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(W.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Qs.ReactQueryDevtools,{initialIsOpen:!1})]})};var xr=_.createContext({client:ht});function br(e){var t=e.children,n=e.client,r=e.apiKey,o=e.options,i=_.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&o&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ht.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ht.init(r,o)),ht)},[n,r]);return _.createElement(xr.Provider,{value:{client:i}},t)}const Xn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(br,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",ui_host:"eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,Zn=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...ar[r],...n||{}};return s.jsx(C.IntlProvider,{locale:r,messages:o,children:e})},ke=_.createContext({isLoading:!0});function Kn(){return _.useContext(ke)}const es=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),vr=({bootstrap:e,children:t,intl:n})=>{const[r,o]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(i=>{o({...i,isLoading:!1}),Gn(5e3)}).catch(()=>o({isLoading:!1}))},[]),s.jsx(Zn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(In.CookiesProvider,{children:s.jsx(es,{user:r,children:s.jsx(qn,{children:s.jsx(Xn,{user:r,children:t})})})})})},Ge="https://storage.googleapis.com/apolitical-assets/",Ae={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},wr="200,000+";const Xt=({label:e=!1,className:t="",children:n})=>{const r=C.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Me=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const et=({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,c=Be(i);if(i&&typeof n=="object"&&typeof c=="number"){const u=Object.assign({},n.breakpoints),p=Wn(Object.keys(u));o=zn(c,p,u)}const{breakpoints:a,text:d="",component:l,...m}=n;return s.jsx(Me,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(wt,{options:{forceBlock:!0},children:t}),o&&typeof n=="object"&&(l||s.jsx(H,{...m,variant:n.variant?n.variant:"secondary",children:d}))]})})};const zt=({children:e,...t})=>s.jsx("p",{...t,children:e}),ts={q:zt,blockquote:zt};for(let e=1;e<=6;e++)ts[`h${e}`]={component:zt,props:{className:"title"}};const ns=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(wt,{options:{wrapper:_.Fragment,forceBlock:!0,overrides:ts},children:r}):s.jsx("p",{children:r})]});const kr=({className:e="",show:t=!1,hide:n=!1,text:r,children:o})=>{const i=C.useIntl(),c=_.useRef(null),[a,d]=_.useState(""),[l,m]=_.useState("closed");_.useEffect(()=>{const h=c.current;if(h)return h.addEventListener("transitionend",u),()=>{h.removeEventListener("transitionend",u)}},[]),_.useEffect(()=>{if(!r||typeof r!="string")return;const h=r.split(`
|
|
36
36
|
`);d(h.length<3?`${r.substring(0,400)}...`:h.slice(0,3).join(`
|
|
37
|
-
`))},[r]),_.useEffect(()=>{l==="ready-to-close"&&m("closing")},[l]);const u=({propertyName:h})=>{h==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const p=["opening","open"].includes(l);return s.jsxs(Te,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:c,className:S("content",l),children:[s.jsx(wt,{options:{forceBlock:!0},children:l==="closed"?a:r}),l!=="closed"&&o]}),s.jsx("p",{className:"cta",children:s.jsx(H,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{m(p?"ready-to-close":"opening")},children:p?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},jr=()=>_.Fragment,yr=({children:e})=>s.jsx(Te,{variant:"secondary",children:e}),Er=["span","strong","h1","h2","h3","h4","h5","h6","p"],Sr=({children:e})=>{const t=C.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(_.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const c of _.Children.toArray(i.props.children))if(!(!c||typeof c=="string"||typeof c=="number")&&_.isValidElement(c)){const a=c.type;if(Er.includes(a)){for(n=c.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 s.jsx(Xt,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(i=>i)})},$r=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Te,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Te,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Te,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},Tr=e=>{const t=C.useIntl(),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"),s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},Sn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Mr=({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 _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&_.isValidElement(i)){const c=i.type;if(["button","center","span","strong"].includes(c)&&i.props&&i.props.children&&i.props.children[0])for((c==="button"||Sn(i.props.children[0])==="button")&&(o=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Sn(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(H,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},ss=({children:e})=>s.jsx("span",{children:e});const Vt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:_.Fragment,forceBlock:!0,overrides:{a:Mr,CollapsibleSection:Xt,TextBox:Te,CaseStudy:yr,style:jr,details:Sr,div:$r,iframe:Tr}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(wt,{options:{...r,...t},children:n})})};const rs=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:o=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:S("page-heading",o),children:[s.jsxs("div",{className:S("content",{"has-max-width":e}),style:i,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Je=({size:e="medium",variant:t="default",className:n="",children:r,...o})=>s.jsx("span",{className:S("pill",e,t,n),...o,children:r});const gt=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const Cr=({progress:e=0,text:t=!1,className:n=""})=>{const r=C.useIntl(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${o}`,n),style:i,children:s.jsx(se,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},as=_.memo(Cr);const Ct="loadingBlock_",Nr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=C.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ct}loading`})},75:{text:r.formatMessage({id:`${Ct}almostDone`})},100:{text:r.formatMessage({id:`${Ct}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 c=o&&t[o].icon?{"--icon":`url(${Ge}icons/${t[o].icon}.svg)`}:{};return s.jsxs(Te,{className:S("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:c,children:[o&&s.jsx("span",{className:"step",children:t[o].text}),s.jsx(as,{progress:e})]})},Pr=_.memo(Nr);const we=({element:e="div",className:t="",...n})=>s.jsx(Gt,{element:e,className:S("loading-placeholder",t),...n});const Yt={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},os=(e,t)=>e in Yt?s.jsx("div",{className:e,children:Yt[e].map((n,r)=>os(n,r))},t):s.jsx(we,{className:e},t),Zt=({layout:e="overview-page",...t})=>s.jsx("div",{className:S("loading-state",e),...t,children:Yt[e].map((n,r)=>os(n,r))}),is=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):""},ot=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Dr=e=>{const t=Math.ceil(26/ot.length),n=is(e).toLowerCase();if(n==="")return ot[0];const r=n.charCodeAt(0)-96;for(let o=0;o<ot.length;o++)if(r<=t*(o+1))return ot[o]};const $n=256,Oe=({className:e="",src:t="",name:n,alt:r,width:o=$n,height:i=$n,...c})=>{const[a,d]=_.useState(!1),l=_.useRef(null);_.useEffect(()=>{const u=l.current;if(!u)return;const p=u.getContext("2d");if(!p)return;const h=o,g=i;typeof window<"u"&&window.devicePixelRatio&&(u.width=h*window.devicePixelRatio,u.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=Dr(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(is(n),h/2,g/1.6)},[n]);let m=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(m=!0),s.jsx("figure",{className:S("profile-picture",e,{error:a}),...c,children:m?s.jsx("img",{src:t,alt:r||n,onError:()=>{d(!0)},width:o,height:i}):s.jsx("canvas",{ref:l})})},Kt=e=>e==="apolitical"?{image:`${Ge}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ge}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Rr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",i=t!=="",c=n!=="";if(!o&&!i&&!c)return"";const a=`${e}${o&&i?` — ${t}`:t}`;let d=`${a}${(o||i)&&c?`, ${n}`:n}`;return d.length>r&&(d=a),d.length>r&&(d=Le(d,r)),d};const kt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:o="member-click",className:i=""})=>{const c=C.useIntl(),a=Kt(t);a.name||(a.name=c.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:d,url:l,image:m}=a,u=Rr(a),p=n&&n.createdAt?Wt(n.createdAt):!1,h=n&&n.createdAt?Vn(n.createdAt):"";return _.createElement(e,{className:S("member text-medium",i),children:s.jsxs(Ze,{href:l,gtmType:o,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Oe,{name:d,src:m}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:d}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:h,"aria-label":h,children:c.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:c.formatMessage({id:"discussion_edited"})})]}),u&&s.jsx("small",{children:u})]})]})})};const Tn={small:24,medium:48},en=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:o,showGap:i,showPlaceholders:c}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:d="",...l})=>{const m=C.useIntl();return!n||n.length===0?null:_.createElement(e,{...l,className:S("contributors",d,o,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((u,p)=>{let h,g="";if(p<a){const{name:k="",image:w=""}=Kt(u);if(c)return s.jsx(we,{element:"li",className:"contributor"},p);h=s.jsx(Oe,{name:k,src:w,width:Tn[o||"medium"],height:Tn[o||"medium"]})}else if(p===a){const k=(t||n.length)-a;h=s.jsxs("small",{className:S({"large-number":k>99}),children:["+",or(k,0)]}),g="number-left"}return h?s.jsx("li",{className:S("contributor",g),children:h},p):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Le(n[0].name||"",20):null})]})})},Fr=({type:e,data:t})=>{const n=C.useIntl(),{answers:r,createdAt:o,dateHasPassed:i,isOngoingEvent:c,pill:a,readingTime:d,publishedDate:l,startDate:m}=t;if(e==="question"){const u=o&&Wt(o);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),o&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.number}):0})]})]})}if(m&&!i||c)return s.jsx("p",{className:"details",children:c?n.formatMessage({id:"card_bootcamp"}):Vn(m)});if(a)return s.jsx(Je,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(d||l){const u=l&&Wt(l);return s.jsxs("ul",{className:"details",children:[d&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:d})}),l&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.number}):0})})]})}return null},_t={customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Ar=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const o=C.useIntl(),[i,c]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&c(k=>({...k,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:d,pill:l,slug:m}=e,u=e.contentType;let p="";if((g=_t[u])!=null&&g.gtmEvent&&(p=_t[u].gtmEvent),a&&d)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o.formatMessage({id:"card_watch"})});if(u==="people")return s.jsx(H,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o.formatMessage({id:"card_cta_people"})});const h=["microcourse","event"];if(t&&t.onClick&&h.includes(u)&&l!=="premium"){const k=i.loading||i.registered,w=async E=>{if(E.preventDefault(),E.stopPropagation(),!(k||!t||!t.onClick)){c(b=>({...b,loading:!0}));try{const b=await t.onClick(e);c(b==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{c(x=>({...x,loading:!1}))}}};return s.jsx(H,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:k,"data-gtm-event-context":`${r}Page-${u}: ${m}`,"data-gtm-event-type":`${r}-${u}-register-click`,"data-testid":"in-card-button",children:o.formatMessage({id:`card_cta_${u}${k?`_${i.loading?"loading":"done"}`:""}`})})}return null},Mn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ir=e=>{let t=e;return Object.keys(Mn).includes(e)&&(t=Mn[e]),`url(${Ge}icons/${t}.svg)`};const Lr={title:66,text:3e3,secondaryText:1e3,partner:25},tn=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:o="Carousel",className:i=""})=>{const c=C.useIntl(),a=_.useContext(ke),d=a&&typeof a.id=="string",[l,m]=_.useState({data:null,isLoading:!0}),{data:u,isLoading:p}=l,h=_.useCallback(()=>{n(t,d).then(F=>{m(()=>({data:F,isLoading:!1}))}).catch(()=>m(F=>({...F,isLoading:!1})))},[e]);if(_.useEffect(()=>{h()},[]),p||!u)return s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=u;if(!g||!_t[g])return s.jsx(we,{element:"li",className:"card-wrapper"});const{basePath:k="",className:w,length:E,gtmEvent:b}=_t[g],x=Yn(`card_label_${g}`)?c.formatMessage({id:`card_label_${g}`}):!1,M=u.slug?`${k}${u.slug}`:!1,D={...Lr,...E};let R={className:"card"};M&&(R={href:M,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${b}-click`,"data-testid":"link"},u.openInNewTab&&(R.target="_blank"));const V=u.customIcon?{"--custom-icon":Ir(u.customIcon)}:{};return s.jsx("li",{className:S("card-wrapper text-medium",w,i,{"has-link":M,"no-link":!M,"has-custom-icon":u.customIcon,"has-image":u.banner}),style:V,"data-testid":`${g}-card`,children:_.createElement(M?"a":"div",R,s.jsxs(s.Fragment,{children:[(u.customLabel||x)&&s.jsx("small",{className:S("card-label text-small",w),children:u.customLabel||x}),u.startDate&&!u.isOngoingEvent&&s.jsx(Je,{size:"small",variant:u.dateHasPassed?"default":"information","data-testid":"date",children:u.dateHasPassed?c.formatMessage({id:"card_ended"}):tr(u.startDate)}),u.banner?s.jsxs("p",{className:"img",children:[u.registered&&s.jsx(Je,{size:"small",variant:"registered",children:c.formatMessage({id:"card_registered"})}),s.jsx(qt,{image:u.banner})]}):w==="people"?s.jsx(Oe,{name:u.title||"",src:u.profile,"data-testid":"people-profile-picture"}):null,u.contributors&&s.jsx(en,{contributors:{data:u.contributors},styling:{size:"small",showGap:w!=="question",showText:!0},"data-testid":"contributors"}),u.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Le(u.partner.title,D.partner)}),["title","text","secondaryText"].map(F=>{const $=u[F];if(!$)return null;const N=er(F);return s.jsx("p",{className:N,"data-testid":N,children:Le($,D[F])},F)}),s.jsx(Fr,{type:w||"",data:u}),s.jsx(Ar,{data:u,cta:r,link:M||"",gtmContext:o})]}))})};const ls=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:S("card-block",n),children:e.map((o,i)=>{const c=o.slug?`${o.slug}-${t[i]}`:`${t[i]}-${i}`;return s.jsx(tn,{id:c,card:{...o,contentType:t[i]},...r},c)})}),Br=(e,t,n,r)=>{const o=t*n<=e,i=e<t*(n+1),c=r.includes(Math.floor(e/t));return o&&i||c},Or=({id:e,title:t})=>{const n=C.useIntl();if(!t||!t.text)return null;const{text:r,element:o="h2",variant:i="default",size:c="medium",link:a}=t;return _.createElement(o,{className:S("title",i,c,{"highlighted-title":i==="highlighted"}),children:s.jsxs(s.Fragment,{children:[r,a&&s.jsx("a",{href:a,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Nt={fourCards:1024,threeCards:769,twoCards:480};let it=null;const Hr=({id:e,cards:t,cardTypes:n,buildCardData:r,title:o,className:i,gtmContext:c})=>{var F;const a=C.useIntl(),[d,l]=_.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:u}=d,[p,h]=_.useState({currentPage:0,loadedPages:[0]}),{currentPage:g,loadedPages:k}=p,w=t.length,E=Math.ceil(w/m),b=_.useRef(null),x=Be(!0,!0,b==null?void 0:b.current);_.useEffect(()=>{let $=1;x&&(x>=Nt.fourCards?$=4:x>=Nt.threeCards?$=3:x>=Nt.twoCards&&($=2),$>w&&($=w)),l(N=>({...N,cardsPerPage:$,isLoading:!1}))},[x,w]);const M=($="next")=>{let N=g;if(typeof $=="string")if($==="next")if(g<E-1)N=g+1;else return;else if(g>0)N=g-1;else return;else N=$;h(v=>({...v,currentPage:N,loadedPages:[...new Set([...k,N])]}))},D=$=>{it=$.touches[0].clientX},R=$=>{if(it===null)return;const N=$.touches[0].clientX,v=it-N;v>5?M("next"):v<-5&&M("previous"),it=null},V={"--width":`${((F=b==null?void 0:b.current)==null?void 0:F.offsetWidth)||0}px`,"--total-cards":w,"--cards-per-page":m,"--page":g};return u?s.jsx(Zt,{layout:`carousel${o?"-with-title":""}`}):s.jsxs("section",{ref:b,className:S("carousel-wrapper",i),"data-testid":"carousel",children:[s.jsx(Or,{id:e,title:o}),s.jsx("ul",{className:"carousel",onTouchStart:D,onTouchMove:R,style:V,"data-testid":"carousel-list",children:t.map(($,N)=>{let v=$&&$.sys&&$.sys.id?`${e}-card-${$.sys.id}`:null;return v&&Br(N,m,g,k)?s.jsx(tn,{id:v,card:{...$,contentType:n[N]},buildCardData:r,gtmContext:c},v):(v=v||`${e}-card-${N}`,s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},v))})}),E<=1?null:s.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[s.jsx("li",{className:"arrow previous",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:$=>{$.preventDefault(),$.stopPropagation(),M("previous")},screenreaderText:a.formatMessage({id:"carousel_pagination_previous"}),disabled:g<=0})}),[...Array(E)].map(($,N)=>s.jsx("li",{"data-testid":"carousel-controls-button",children:s.jsx("button",{className:S("page-indicator",{selected:N===g}),onClick:v=>{v.preventDefault(),v.stopPropagation(),M(N)},children:s.jsx(se,{showOnFocus:!1,children:a.formatMessage({id:"carousel_pagination_page"},{number:N+1,total:E})})})},`page-indicator-${N}`)),s.jsx("li",{className:"arrow next",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:$=>{$.preventDefault(),$.stopPropagation(),M("next")},screenreaderText:a.formatMessage({id:"carousel_pagination_next"}),disabled:g>=E-1})})]})]})},Qr=({carousels:e=[],isLoading:t,title:n,className:r="",...o})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:c,cards:a,cardsTypes:d},l)=>{const m=i?window.btoa(i):`carousel-${l}`,u=l===e.length-1;return t?s.jsxs(_.Fragment,{children:[s.jsx(Zt,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),u?null:s.jsx(Me,{})]},`placeholder-${m}`):s.jsxs(_.Fragment,{children:[s.jsx(Hr,{cards:a,cardTypes:d,title:{...n,text:i,link:c},...o}),u?null:s.jsx(Me,{})]},`carousel-${m}`)});const Pt="joinCommunityButton",nn=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const o=C.useIntl(),i=_.useContext(ke),c=i&&typeof i.id=="string",[a,d]=_.useState(e),[l,m]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{l==="joining"?m("joined"):l==="leaving"&&m("notJoined")},[a]);const u={},p={};return a&&l!=="leaving"&&(u["data-hover-text"]=o.formatMessage({id:`${Pt}_leave`}),u["aria-label"]=o.formatMessage({id:`${Pt}_member_aria`}),p["aria-hidden"]="true"),s.jsx(H,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&l!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async h=>{c&&(h.currentTarget.blur(),a?(m("leaving"),typeof r=="function"&&await r()):(m("joining"),typeof n=="function"&&await n()),d(!a))},className:S("join-community-button",l,{active:l==="joining"}),disabled:!c,...u,children:s.jsx("span",{className:"text",...p,children:o.formatMessage({id:`${Pt}${["joining","leaving"].includes(l)?`_${l}`:a?"_member":t?"_short":""}`})})})};const Dt="communityDetails_",Ur=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:o=[]}={number:0,data:[]},functions:{invite:i,...c}})=>{const a=C.useIntl(),d=5,l=r||o.length,m=o.length?o:Array(d).fill({}),u=`/communities/${n}/members`===window.location.pathname;return s.jsxs("div",{className:S("community-details",e),children:[s.jsx(Me,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Dt}members`}),s.jsx("span",{className:"count",children:l})]}),!u&&s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:a.formatMessage({id:`${Dt}viewAll`})})})]}),s.jsx(en,{contributors:{total:r,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:l===0},cutoff:d})]}),s.jsx(nn,{isMember:t,functions:{...c}}),t&&s.jsx(H,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Dt}invite`})})]})};const Wr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(se,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:o,href:i,current:c=!1},a)=>s.jsxs("li",{children:[c&&s.jsx(se,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Ze,{href:c?void 0:i,children:Le(o,t)})]},`${window.btoa(o)}_${a}`))})]})};const zr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const i=C.useIntl(),c=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[a,d]=_.useState(t?["all"]:[]),l=(m,u)=>{let p=[];a.includes(m)?p=a.filter(h=>h!==m):m==="all"?p=["all"]:n?p=[...a.filter(h=>h!=="all"),m]:p=[m],d(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),u&&typeof u=="function"&&u()};return s.jsx("ul",{className:S("filters",o),children:c.map(({id:m,text:u,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:u})}),s.jsx("li",{children:s.jsx("button",{className:S(m,{selected:a.includes(m)}),onClick:k=>{k.preventDefault(),k.stopPropagation(),l(m,h)},...g,children:u})},m)})})},Vr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:o,position:i})=>{i==="before-lang"?r+=`/${o}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${o}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Rt={en:"English",es:"Español",fr:"Français",pt:"Português"},lt="languageSwitcher_",Yr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:o=()=>{},urlParts:i,variant:c="default",label:a,className:d=""})=>{const l=C.useIntl(),[m,u]=_.useState(e);if(_.useEffect(()=>{e!==m&&u(e)},[e]),!r||!Object.values(r).some(k=>k&&k.post_name))return null;const h=Object.keys(r),g=m!==e;return s.jsxs("div",{className:S("language-switcher text-small",c,d),children:[s.jsxs("nav",{children:[c!=="short"&&s.jsx("p",{children:a||l.formatMessage({id:`${lt}label`})}),s.jsx("ul",{children:h.map(k=>{if(!Rt[k])return null;let w={className:k};return m===k?w["aria-label"]=l.formatMessage({id:`${lt}selected`},{language:Rt[k]}):w={...w,href:Vr(k,i),onClick:E=>{E.preventDefault(),E.stopPropagation(),u(k),o(k)}},s.jsx("li",{children:s.jsx(Ze,{...w,fallbackElement:"span",children:Rt[k]})},k)})}),c!=="short"&&!g&&s.jsx("p",{children:l.formatMessage({id:`${lt}translation_${t?"original":n?"human":"machine"}`})})]}),c!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:l.formatMessage({id:`${lt}disclaimer`},{email:Ae.support,link:k=>{const w=`mailto:${k}`;return s.jsx("a",{href:w,children:k})}})})]})};const Ft=C.createIntl({locale:"en",messages:Jt}),sn=({hasNextPage:e=!0,loadNextPage:t=()=>{},icon:n=!1,messages:r={button:Ft.formatMessage({id:"loadMore_button"}),endOfFeed:Ft.formatMessage({id:"loadMore_endOfFeed"}),error:Ft.formatMessage({id:"loadMore_error"})},className:o="",gtmContext:i="LoadMore"})=>{const[c,a]=_.useState(""),d=async l=>{try{await t(l)}catch(m){m instanceof Error?a(m.message):a("Unknown error")}};return s.jsx("footer",{className:S("load-more",o),children:!c&&e?s.jsx(H,{variant:"secondary",icon:n,onClick:d,"data-gtm-event-context":i,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):!c||c!=null&&c.includes("Cannot read items")?s.jsx("p",{children:r.endOfFeed}):s.jsx("p",{className:"error",children:r.error})})};const rn=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(se,{children:s.jsx(C.FormattedMessage,{id:"apolitical"})})})});let ct=!1;const cs=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const o=C.useIntl(),i=_.useRef(null),[c,a]=_.useState(!1),d=l=>{i.current&&l.target instanceof HTMLElement&&!i.current.contains(l.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)})),_.createElement(e,{ref:i,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!c),"aria-haspopup":"true","aria-expanded":c,"aria-controls":t,screenreaderText:o.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!c,children:n.map(({href:l,onClick:m,text:u,icon:p,...h},g)=>{const k={...h,onClick:w=>{a(!1),typeof m=="function"&&m(w)},onFocus:()=>{ct&&(clearTimeout(ct),ct=!1)},onBlur:()=>{ct=setTimeout(()=>{a(!1)},100)}};return l&&(k.href=l),s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...k,children:u})},`${window.btoa(u)}_${g}`)})})]})})},Gr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Jr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],us=({activeLink:e})=>{const t=C.useIntl(),n=_.useContext(ke),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Jr.map(({key:o,href:i})=>s.jsx("li",{className:S(o,{active:Gr(i,e)}),children:s.jsx("a",{href:i,"data-gtm-event-type":`${o}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${o}`})})},o)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Oe,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},Ve=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,qr=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ve(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${Ve(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${Ve(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
37
|
+
`))},[r]),_.useEffect(()=>{l==="ready-to-close"&&m("closing")},[l]);const u=({propertyName:h})=>{h==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const p=["opening","open"].includes(l);return s.jsxs(Me,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:c,className:S("content",l),children:[s.jsx(wt,{options:{forceBlock:!0},children:l==="closed"?a:r}),l!=="closed"&&o]}),s.jsx("p",{className:"cta",children:s.jsx(H,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{m(p?"ready-to-close":"opening")},children:p?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},jr=()=>_.Fragment,yr=({children:e})=>s.jsx(Me,{variant:"secondary",children:e}),Er=["span","strong","h1","h2","h3","h4","h5","h6","p"],Sr=({children:e})=>{const t=C.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(_.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const c of _.Children.toArray(i.props.children))if(!(!c||typeof c=="string"||typeof c=="number")&&_.isValidElement(c)){const a=c.type;if(Er.includes(a)){for(n=c.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 s.jsx(Xt,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(i=>i)})},$r=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Me,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Me,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Me,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},Mr=e=>{const t=C.useIntl(),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"),s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},Sn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Tr=({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 _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&_.isValidElement(i)){const c=i.type;if(["button","center","span","strong"].includes(c)&&i.props&&i.props.children&&i.props.children[0])for((c==="button"||Sn(i.props.children[0])==="button")&&(o=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Sn(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(H,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},ss=({children:e})=>s.jsx("span",{children:e});const Vt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:_.Fragment,forceBlock:!0,overrides:{a:Tr,CollapsibleSection:Xt,TextBox:Me,CaseStudy:yr,style:jr,details:Sr,div:$r,iframe:Mr}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(wt,{options:{...r,...t},children:n})})};const rs=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:o=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:S("page-heading",o),children:[s.jsxs("div",{className:S("content",{"has-max-width":e}),style:i,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Je=({size:e="medium",variant:t="default",className:n="",children:r,...o})=>s.jsx("span",{className:S("pill",e,t,n),...o,children:r});const gt=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const Cr=({progress:e=0,text:t=!1,className:n=""})=>{const r=C.useIntl(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${o}`,n),style:i,children:s.jsx(se,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},as=_.memo(Cr);const Ct="loadingBlock_",Nr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=C.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ct}loading`})},75:{text:r.formatMessage({id:`${Ct}almostDone`})},100:{text:r.formatMessage({id:`${Ct}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 c=o&&t[o].icon?{"--icon":`url(${Ge}icons/${t[o].icon}.svg)`}:{};return s.jsxs(Me,{className:S("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:c,children:[o&&s.jsx("span",{className:"step",children:t[o].text}),s.jsx(as,{progress:e})]})},Pr=_.memo(Nr);const we=({element:e="div",className:t="",...n})=>s.jsx(Gt,{element:e,className:S("loading-placeholder",t),...n});const Yt={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},os=(e,t)=>e in Yt?s.jsx("div",{className:e,children:Yt[e].map((n,r)=>os(n,r))},t):s.jsx(we,{className:e},t),Zt=({layout:e="overview-page",...t})=>s.jsx("div",{className:S("loading-state",e),...t,children:Yt[e].map((n,r)=>os(n,r))}),is=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):""},ot=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Dr=e=>{const t=Math.ceil(26/ot.length),n=is(e).toLowerCase();if(n==="")return ot[0];const r=n.charCodeAt(0)-96;for(let o=0;o<ot.length;o++)if(r<=t*(o+1))return ot[o]};const $n=256,Oe=({className:e="",src:t="",name:n,alt:r,width:o=$n,height:i=$n,...c})=>{const[a,d]=_.useState(!1),l=_.useRef(null);_.useEffect(()=>{const u=l.current;if(!u)return;const p=u.getContext("2d");if(!p)return;const h=o,g=i;typeof window<"u"&&window.devicePixelRatio&&(u.width=h*window.devicePixelRatio,u.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=Dr(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(is(n),h/2,g/1.6)},[n]);let m=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(m=!0),s.jsx("figure",{className:S("profile-picture",e,{error:a}),...c,children:m?s.jsx("img",{src:t,alt:r||n,onError:()=>{d(!0)},width:o,height:i}):s.jsx("canvas",{ref:l})})},Kt=e=>e==="apolitical"?{image:`${Ge}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ge}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Rr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",i=t!=="",c=n!=="";if(!o&&!i&&!c)return"";const a=`${e}${o&&i?` — ${t}`:t}`;let d=`${a}${(o||i)&&c?`, ${n}`:n}`;return d.length>r&&(d=a),d.length>r&&(d=Le(d,r)),d};const kt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:o="member-click",className:i=""})=>{const c=C.useIntl(),a=Kt(t);a.name||(a.name=c.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:d,url:l,image:m}=a,u=Rr(a),p=n&&n.createdAt?Wt(n.createdAt):!1,h=n&&n.createdAt?Vn(n.createdAt):"";return _.createElement(e,{className:S("member text-medium",i),children:s.jsxs(Ze,{href:l,gtmType:o,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Oe,{name:d,src:m}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:d}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:h,"aria-label":h,children:c.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:c.formatMessage({id:"discussion_edited"})})]}),u&&s.jsx("small",{children:u})]})]})})};const Mn={small:24,medium:48},en=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:o,showGap:i,showPlaceholders:c}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:d="",...l})=>{const m=C.useIntl();return!n||n.length===0?null:_.createElement(e,{...l,className:S("contributors",d,o,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((u,p)=>{let h,g="";if(p<a){const{name:k="",image:w=""}=Kt(u);if(c)return s.jsx(we,{element:"li",className:"contributor"},p);h=s.jsx(Oe,{name:k,src:w,width:Mn[o||"medium"],height:Mn[o||"medium"]})}else if(p===a){const k=(t||n.length)-a;h=s.jsxs("small",{className:S({"large-number":k>99}),children:["+",or(k,0)]}),g="number-left"}return h?s.jsx("li",{className:S("contributor",g),children:h},p):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Le(n[0].name||"",20):null})]})})},Fr=({type:e,data:t})=>{const n=C.useIntl(),{answers:r,createdAt:o,dateHasPassed:i,isOngoingEvent:c,pill:a,readingTime:d,publishedDate:l,startDate:m}=t;if(e==="question"){const u=o&&Wt(o);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),o&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.number}):0})]})]})}if(m&&!i||c)return s.jsx("p",{className:"details",children:c?n.formatMessage({id:"card_bootcamp"}):Vn(m)});if(a)return s.jsx(Je,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(d||l){const u=l&&Wt(l);return s.jsxs("ul",{className:"details",children:[d&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:d})}),l&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.number}):0})})]})}return null},_t={customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Ar=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const o=C.useIntl(),[i,c]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&c(k=>({...k,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:d,pill:l,slug:m}=e,u=e.contentType;let p="";if((g=_t[u])!=null&&g.gtmEvent&&(p=_t[u].gtmEvent),a&&d)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o.formatMessage({id:"card_watch"})});if(u==="people")return s.jsx(H,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o.formatMessage({id:"card_cta_people"})});const h=["microcourse","event"];if(t&&t.onClick&&h.includes(u)&&l!=="premium"){const k=i.loading||i.registered,w=async E=>{if(E.preventDefault(),E.stopPropagation(),!(k||!t||!t.onClick)){c(b=>({...b,loading:!0}));try{const b=await t.onClick(e);c(b==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{c(x=>({...x,loading:!1}))}}};return s.jsx(H,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:k,"data-gtm-event-context":`${r}Page-${u}: ${m}`,"data-gtm-event-type":`${r}-${u}-register-click`,"data-testid":"in-card-button",children:o.formatMessage({id:`card_cta_${u}${k?`_${i.loading?"loading":"done"}`:""}`})})}return null},Tn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ir=e=>{let t=e;return Object.keys(Tn).includes(e)&&(t=Tn[e]),`url(${Ge}icons/${t}.svg)`};const Lr={title:66,text:3e3,secondaryText:1e3,partner:25},tn=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:o="Carousel",className:i=""})=>{const c=C.useIntl(),a=_.useContext(ke),d=a&&typeof a.id=="string",[l,m]=_.useState({data:null,isLoading:!0}),{data:u,isLoading:p}=l,h=_.useCallback(()=>{n(t,d).then(F=>{m(()=>({data:F,isLoading:!1}))}).catch(()=>m(F=>({...F,isLoading:!1})))},[e]);if(_.useEffect(()=>{h()},[]),p||!u)return s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=u;if(!g||!_t[g])return s.jsx(we,{element:"li",className:"card-wrapper"});const{basePath:k="",className:w,length:E,gtmEvent:b}=_t[g],x=Yn(`card_label_${g}`)?c.formatMessage({id:`card_label_${g}`}):!1,T=u.slug?`${k}${u.slug}`:!1,D={...Lr,...E};let R={className:"card"};T&&(R={href:T,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${b}-click`,"data-testid":"link"},u.openInNewTab&&(R.target="_blank"));const V=u.customIcon?{"--custom-icon":Ir(u.customIcon)}:{};return s.jsx("li",{className:S("card-wrapper text-medium",w,i,{"has-link":T,"no-link":!T,"has-custom-icon":u.customIcon,"has-image":u.banner}),style:V,"data-testid":`${g}-card`,children:_.createElement(T?"a":"div",R,s.jsxs(s.Fragment,{children:[(u.customLabel||x)&&s.jsx("small",{className:S("card-label text-small",w),children:u.customLabel||x}),u.startDate&&!u.isOngoingEvent&&s.jsx(Je,{size:"small",variant:u.dateHasPassed?"default":"information","data-testid":"date",children:u.dateHasPassed?c.formatMessage({id:"card_ended"}):tr(u.startDate)}),u.banner?s.jsxs("p",{className:"img",children:[u.registered&&s.jsx(Je,{size:"small",variant:"registered",children:c.formatMessage({id:"card_registered"})}),s.jsx(qt,{image:u.banner})]}):w==="people"?s.jsx(Oe,{name:u.title||"",src:u.profile,"data-testid":"people-profile-picture"}):null,u.contributors&&s.jsx(en,{contributors:{data:u.contributors},styling:{size:"small",showGap:w!=="question",showText:!0},"data-testid":"contributors"}),u.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Le(u.partner.title,D.partner)}),["title","text","secondaryText"].map(F=>{const $=u[F];if(!$)return null;const N=er(F);return s.jsx("p",{className:N,"data-testid":N,children:Le($,D[F])},F)}),s.jsx(Fr,{type:w||"",data:u}),s.jsx(Ar,{data:u,cta:r,link:T||"",gtmContext:o})]}))})};const ls=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:S("card-block",n),children:e.map((o,i)=>{const c=o.slug?`${o.slug}-${t[i]}`:`${t[i]}-${i}`;return s.jsx(tn,{id:c,card:{...o,contentType:t[i]},...r},c)})}),Br=(e,t,n,r)=>{const o=t*n<=e,i=e<t*(n+1),c=r.includes(Math.floor(e/t));return o&&i||c},Or=({id:e,title:t})=>{const n=C.useIntl();if(!t||!t.text)return null;const{text:r,element:o="h2",variant:i="default",size:c="medium",link:a}=t;return _.createElement(o,{className:S("title",i,c,{"highlighted-title":i==="highlighted"}),children:s.jsxs(s.Fragment,{children:[r,a&&s.jsx("a",{href:a,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Nt={fourCards:1024,threeCards:769,twoCards:480};let it=null;const Hr=({id:e,cards:t,cardTypes:n,buildCardData:r,title:o,className:i,gtmContext:c})=>{var F;const a=C.useIntl(),[d,l]=_.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:u}=d,[p,h]=_.useState({currentPage:0,loadedPages:[0]}),{currentPage:g,loadedPages:k}=p,w=t.length,E=Math.ceil(w/m),b=_.useRef(null),x=Be(!0,!0,b==null?void 0:b.current);_.useEffect(()=>{let $=1;x&&(x>=Nt.fourCards?$=4:x>=Nt.threeCards?$=3:x>=Nt.twoCards&&($=2),$>w&&($=w)),l(N=>({...N,cardsPerPage:$,isLoading:!1}))},[x,w]);const T=($="next")=>{let N=g;if(typeof $=="string")if($==="next")if(g<E-1)N=g+1;else return;else if(g>0)N=g-1;else return;else N=$;h(v=>({...v,currentPage:N,loadedPages:[...new Set([...k,N])]}))},D=$=>{it=$.touches[0].clientX},R=$=>{if(it===null)return;const N=$.touches[0].clientX,v=it-N;v>5?T("next"):v<-5&&T("previous"),it=null},V={"--width":`${((F=b==null?void 0:b.current)==null?void 0:F.offsetWidth)||0}px`,"--total-cards":w,"--cards-per-page":m,"--page":g};return u?s.jsx(Zt,{layout:`carousel${o?"-with-title":""}`}):s.jsxs("section",{ref:b,className:S("carousel-wrapper",i),"data-testid":"carousel",children:[s.jsx(Or,{id:e,title:o}),s.jsx("ul",{className:"carousel",onTouchStart:D,onTouchMove:R,style:V,"data-testid":"carousel-list",children:t.map(($,N)=>{let v=$&&$.sys&&$.sys.id?`${e}-card-${$.sys.id}`:null;return v&&Br(N,m,g,k)?s.jsx(tn,{id:v,card:{...$,contentType:n[N]},buildCardData:r,gtmContext:c},v):(v=v||`${e}-card-${N}`,s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},v))})}),E<=1?null:s.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[s.jsx("li",{className:"arrow previous",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:$=>{$.preventDefault(),$.stopPropagation(),T("previous")},screenreaderText:a.formatMessage({id:"carousel_pagination_previous"}),disabled:g<=0})}),[...Array(E)].map(($,N)=>s.jsx("li",{"data-testid":"carousel-controls-button",children:s.jsx("button",{className:S("page-indicator",{selected:N===g}),onClick:v=>{v.preventDefault(),v.stopPropagation(),T(N)},children:s.jsx(se,{showOnFocus:!1,children:a.formatMessage({id:"carousel_pagination_page"},{number:N+1,total:E})})})},`page-indicator-${N}`)),s.jsx("li",{className:"arrow next",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:$=>{$.preventDefault(),$.stopPropagation(),T("next")},screenreaderText:a.formatMessage({id:"carousel_pagination_next"}),disabled:g>=E-1})})]})]})},Qr=({carousels:e=[],isLoading:t,title:n,className:r="",...o})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:c,cards:a,cardsTypes:d},l)=>{const m=i?window.btoa(i):`carousel-${l}`,u=l===e.length-1;return t?s.jsxs(_.Fragment,{children:[s.jsx(Zt,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),u?null:s.jsx(Te,{})]},`placeholder-${m}`):s.jsxs(_.Fragment,{children:[s.jsx(Hr,{cards:a,cardTypes:d,title:{...n,text:i,link:c},...o}),u?null:s.jsx(Te,{})]},`carousel-${m}`)});const Pt="joinCommunityButton",nn=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const o=C.useIntl(),i=_.useContext(ke),c=i&&typeof i.id=="string",[a,d]=_.useState(e),[l,m]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{l==="joining"?m("joined"):l==="leaving"&&m("notJoined")},[a]);const u={},p={};return a&&l!=="leaving"&&(u["data-hover-text"]=o.formatMessage({id:`${Pt}_leave`}),u["aria-label"]=o.formatMessage({id:`${Pt}_member_aria`}),p["aria-hidden"]="true"),s.jsx(H,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&l!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async h=>{c&&(h.currentTarget.blur(),a?(m("leaving"),typeof r=="function"&&await r()):(m("joining"),typeof n=="function"&&await n()),d(!a))},className:S("join-community-button",l,{active:l==="joining"}),disabled:!c,...u,children:s.jsx("span",{className:"text",...p,children:o.formatMessage({id:`${Pt}${["joining","leaving"].includes(l)?`_${l}`:a?"_member":t?"_short":""}`})})})};const Dt="communityDetails_",Ur=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:o=[]}={number:0,data:[]},functions:{invite:i,...c}})=>{const a=C.useIntl(),d=5,l=r||o.length,m=o.length?o:Array(d).fill({}),u=`/communities/${n}/members`===window.location.pathname;return s.jsxs("div",{className:S("community-details",e),children:[s.jsx(Te,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Dt}members`}),s.jsx("span",{className:"count",children:l})]}),!u&&s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:a.formatMessage({id:`${Dt}viewAll`})})})]}),s.jsx(en,{contributors:{total:r,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:l===0},cutoff:d})]}),s.jsx(nn,{isMember:t,functions:{...c}}),t&&s.jsx(H,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Dt}invite`})})]})};const Wr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(se,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:o,href:i,current:c=!1},a)=>s.jsxs("li",{children:[c&&s.jsx(se,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Ze,{href:c?void 0:i,children:Le(o,t)})]},`${window.btoa(o)}_${a}`))})]})};const zr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const i=C.useIntl(),c=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[a,d]=_.useState(t?["all"]:[]),l=(m,u)=>{let p=[];a.includes(m)?p=a.filter(h=>h!==m):m==="all"?p=["all"]:n?p=[...a.filter(h=>h!=="all"),m]:p=[m],d(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),u&&typeof u=="function"&&u()};return s.jsx("ul",{className:S("filters",o),children:c.map(({id:m,text:u,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:u})}),s.jsx("li",{children:s.jsx("button",{className:S(m,{selected:a.includes(m)}),onClick:k=>{k.preventDefault(),k.stopPropagation(),l(m,h)},...g,children:u})},m)})})},Vr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:o,position:i})=>{i==="before-lang"?r+=`/${o}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${o}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Rt={en:"English",es:"Español",fr:"Français",pt:"Português"},lt="languageSwitcher_",Yr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:o=()=>{},urlParts:i,variant:c="default",label:a,className:d=""})=>{const l=C.useIntl(),[m,u]=_.useState(e);if(_.useEffect(()=>{e!==m&&u(e)},[e]),!r||!Object.values(r).some(k=>k&&k.post_name))return null;const h=Object.keys(r),g=m!==e;return s.jsxs("div",{className:S("language-switcher text-small",c,d),children:[s.jsxs("nav",{children:[c!=="short"&&s.jsx("p",{children:a||l.formatMessage({id:`${lt}label`})}),s.jsx("ul",{children:h.map(k=>{if(!Rt[k])return null;let w={className:k};return m===k?w["aria-label"]=l.formatMessage({id:`${lt}selected`},{language:Rt[k]}):w={...w,href:Vr(k,i),onClick:E=>{E.preventDefault(),E.stopPropagation(),u(k),o(k)}},s.jsx("li",{children:s.jsx(Ze,{...w,fallbackElement:"span",children:Rt[k]})},k)})}),c!=="short"&&!g&&s.jsx("p",{children:l.formatMessage({id:`${lt}translation_${t?"original":n?"human":"machine"}`})})]}),c!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:l.formatMessage({id:`${lt}disclaimer`},{email:Ae.support,link:k=>{const w=`mailto:${k}`;return s.jsx("a",{href:w,children:k})}})})]})};const Ft=C.createIntl({locale:"en",messages:Jt}),sn=({hasNextPage:e=!0,loadNextPage:t=()=>{},icon:n=!1,messages:r={button:Ft.formatMessage({id:"loadMore_button"}),endOfFeed:Ft.formatMessage({id:"loadMore_endOfFeed"}),error:Ft.formatMessage({id:"loadMore_error"})},className:o="",gtmContext:i="LoadMore"})=>{const[c,a]=_.useState(""),d=async l=>{try{await t(l)}catch(m){m instanceof Error?a(m.message):a("Unknown error")}};return s.jsx("footer",{className:S("load-more",o),children:!c&&e?s.jsx(H,{variant:"secondary",icon:n,onClick:d,"data-gtm-event-context":i,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):!c||c!=null&&c.includes("Cannot read items")?s.jsx("p",{children:r.endOfFeed}):s.jsx("p",{className:"error",children:r.error})})};const rn=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(se,{children:s.jsx(C.FormattedMessage,{id:"apolitical"})})})});let ct=!1;const cs=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const o=C.useIntl(),i=_.useRef(null),[c,a]=_.useState(!1),d=l=>{i.current&&l.target instanceof HTMLElement&&!i.current.contains(l.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)})),_.createElement(e,{ref:i,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!c),"aria-haspopup":"true","aria-expanded":c,"aria-controls":t,screenreaderText:o.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!c,children:n.map(({href:l,onClick:m,text:u,icon:p,...h},g)=>{const k={...h,onClick:w=>{a(!1),typeof m=="function"&&m(w)},onFocus:()=>{ct&&(clearTimeout(ct),ct=!1)},onBlur:()=>{ct=setTimeout(()=>{a(!1)},100)}};return l&&(k.href=l),s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...k,children:u})},`${window.btoa(u)}_${g}`)})})]})})},Gr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Jr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"}],us=({activeLink:e})=>{const t=C.useIntl(),n=_.useContext(ke),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Jr.map(({key:o,href:i})=>s.jsx("li",{className:S(o,{active:Gr(i,e)}),children:s.jsx("a",{href:i,"data-gtm-event-type":`${o}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${o}`})})},o)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Oe,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},Ve=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,qr=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ve(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${Ve(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${Ve(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
38
38
|
|
|
39
|
-
${Ve(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ve(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,o)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(o))}];const Xr="shareLinks_",Zr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:o="large",variant:i="default",className:c=""})=>{const a=C.useIntl(),d=qr({title:e,link:t,referrer:n});return s.jsxs("aside",{className:S("share-links",o,i,c),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:d.map(({key:l,icon:m,url:u,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=k=>h(k,u)),s.jsx("li",{children:s.jsx(H,{size:o,variant:"tertiary",icon:{icon:m||l},href:u,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:a.formatMessage({id:`${Xr}link_${l}`}),...g})},l)})})]})};const Kr=({tabs:e,className:t=""})=>{var d;const n=(l,m,u)=>(l||(l=`panel-${window.btoa(m)}-${u}`),l);let r=e.findIndex(l=>l.current===!0);if(r<0&&(r=0),window.location.hash){const l=window.location.hash.replace("#","");if(e.find(u=>u.id===l)){for(let u=0;u<e.length;u++)if(n(e[u].id,e[u].text,u)===l){r=u;break}}}const[o,i]=_.useState((d=e[r])!=null&&d.id?e[r].id:n(e[r].id,e[r].text,r)),c=[],a=[];return e.forEach(({id:l,text:m,content:u,href:p},h)=>{l=n(l,m,h);const g=o===l,k={};p||(k["aria-controls"]=l,k.onClick=w=>{w.preventDefault(),w.stopPropagation(),i(l),window.location.hash=`#${l}`},a.push(s.jsx("section",{id:l,hidden:!g,role:"tabpanel","aria-labelledby":`tab-${l}`,"aria-live":g?"assertive":"off",children:typeof u=="string"?s.jsx("p",{children:u}):u},`section-${l}`))),c.push(s.jsx("li",{children:s.jsx("a",{href:p||`#${l}`,id:`tab-${l}`,className:S({selected:g}),role:"tab","aria-selected":g,...k,children:m})},`tab-${l}`))}),s.jsxs("div",{className:S("tabs-wrapper",t),children:[s.jsx("ul",{className:"tabs",role:"tablist",children:c}),s.jsx("div",{className:"tab-content",children:a})]})};const ea={"2-1":901,"1-3":769},ds=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Be(!0);let i=r;return _.Children.count(r)===1&&(i=_.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:_.Children.map(i,(c,a)=>t!==!1&&a===t&&o&&o<ea[e]?null:c)})},ta=({activeLink:e,...t})=>s.jsx(Ke,{children:s.jsx(ds,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(us,{activeLink:e}),s.jsx(rs,{...t})]})})});const At="cookieBanner_",It=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Lt=new Date(Date.now()+12*30*24*60*60*1e3),ms=()=>{const e=C.useIntl(),[t,n,r]=In.useCookies(It),[o,i]=_.useState(!t["apol-cookie-banner"]),c=()=>{It.forEach(m=>{n(m,!0,{path:"/",expires:Lt,domain:m==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Lt}),It.forEach(m=>{if(m==="apol-cookie-banner"){n(m,!0,{path:"/",expires:Lt});return}r(m)}),i(!1)};if(!o)return null;const d=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:c,gtmType:"accepted-all"}],l=[];return d.forEach(m=>{l.push({variant:m.href?"tertiary":"primary",href:m.href,onClick:m.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${m.gtmType}-click`,children:e.formatMessage({id:`${At}buttons_${m.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${At}title`})}),s.jsx("p",{children:e.formatMessage({id:`${At}text`})}),s.jsx(Xe,{buttons:l})]})},$e={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:Ae["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ae["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Ae.support,gtmType:"concierge-email-click"},business:{email:Ae.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Ie="footer_",xt="SiteFooter",Cn=({group:e})=>{const t=$e[e].order||[];let n=!1;return"text"in $e[e]&&(n=$e[e].text),s.jsxs(_.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:o,gtmType:i}=$e[e][r],c={};return["legal"].includes(e)&&(c.target="_blank",c.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":i,...c,children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},an=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(Gt,{element:"hr"}),s.jsx(rn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(Cn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(Cn,{group:$e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray($e.social.order)&&$e.social.order.map(e=>{const t=$e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(C.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(C.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ut="emailHelperTextBox_",na=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=C.useIntl(),[i,c]=_.useState({path:`${ut}default`,type:"default",link:{},mail:{},error:""}),[a,d]=_.useState(!1),l=_.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=k=>{c({path:`${ut}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>l(w),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:k})};if(typeof r!="function"){g(o.formatMessage({id:`${ut}error_noFunction`}));return}d(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(k=>{g(k.message)}).finally(()=>{d(!1)})},[t,n,r]);_.useEffect(()=>{let h=ut,g="default",k={},w={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",k={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",k={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>l(E),"data-testid":"send-verify-email-click"};break;case"exists":h+="emailAlreadyExists",g="error",k={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",k={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}c({...i,path:h,type:g,link:k,mail:w})},[e]);const m={};return["link","mail"].forEach(h=>{m[h]=Object.keys(i[h]).length?g=>s.jsx("a",{...i[h],children:g}):g=>g}),s.jsx(ns,{type:i.type,heading:a?!1:o.formatMessage({id:`${i.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(we,{element:"span"}),s.jsx(we,{element:"span"})]}):o.formatMessage({id:`${i.path}_text`},{...m,strong:h=>s.jsx("strong",{children:h}),em:h=>s.jsx("em",{children:h}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const dt="passwordRules_",fs="isMoreThanEightCharacters",hs="includesNumberAndSymbol",ps="includesLowerAndUppercase",sa={[fs]:"8Characters",[hs]:"numberSymbol",[ps]:"lowercaseUppercase"},ra=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=C.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${dt}intro`})}),s.jsx("ul",{children:[fs,hs,ps].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(se,{children:[n.formatMessage({id:`${dt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${dt}rule_${sa[r]}`})}),!e[r]&&s.jsxs(se,{element:"strong",children:[" "," ",n.formatMessage({id:`${dt}notMet`})]})]},`rule-${r}`))})]})},aa=_.memo(ra);const oa=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:i="",hasLoaded:c=!1})=>{const a=C.useIntl(),[d,l]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),m=async()=>{try{const E=await n();l(b=>({...b,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){l(b=>({...b,setUp:!0,disabled:!0})),o(E)}};if(_.useEffect(()=>{c&&!d.setUp&&m()},[c]),!c)return s.jsx(we,{className:"rating-placeholder"});const{id:u,rating:p,disabled:h}=d,g="ratings_",k={text:a.formatMessage({id:`${g}text`}),low:a.formatMessage({id:`${g}low`}),high:a.formatMessage({id:`${g}high`}),success:a.formatMessage({id:`${g}success`}),...e},w=async E=>{if(!(!u||h))try{l(b=>({...b,rating:E,disabled:!0})),await r({id:u,value:E})}catch(b){l(x=>({...x,rating:null})),o(b)}finally{l(b=>({...b,disabled:!1}))}};return s.jsxs("div",{className:S("rating",i),children:[s.jsx("span",{className:"label",children:k[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const b=E+1;return s.jsx("li",{className:S({selected:p&&b<=p}),children:s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:`star${!p||b>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:b,total:t})}${b===1||b===t?` - ${k[b===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),w(b)},disabled:h})},`rating-${b}`)})})]})};const gs=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:c=!0,isDesktopVersion:a=!1}=n||{},d=C.useIntl(),l=_.useRef(null);De(()=>{!n||a||!c||l.current&&l.current.focus()},[c]);const m=u=>{u.preventDefault(),u.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return s.jsx("form",{onSubmit:m,className:S("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!c:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(se,{element:"label",htmlFor:e,children:d.formatMessage({id:"search_label"})}),s.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:d.formatMessage({id:"search_placeholder"}),onKeyDown:u=>{u.key==="Enter"&&m(u)}}),s.jsx("button",{className:"clear",onClick:u=>{u.preventDefault(),u.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:s.jsx(se,{children:d.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:m,children:s.jsx(se,{children:d.formatMessage({id:"search_cta"})})})]})})})};const _s=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:o,backgroundColor:i,onClose:c,reportError:a,sendInvites:d,initialFormStatus:l="NOT_SUBMITTED"})=>{const[m,u]=_.useState([]),[p,h]=_.useState(!0),[g,k]=_.useState(l),{formatMessage:w}=C.useIntl(),E=async M=>{M.preventDefault();try{await d(m),u([]),k("SUCCESS")}catch(D){k("ERROR"),a(D)}},b=M=>{M.preventDefault(),k("NOT_SUBMITTED"),h(!0),u([])},x=M=>{M.preventDefault(),c(),k("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:g==="SUCCESS"?s.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),s.jsx(Me,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"secondary",onClick:b,children:w({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(H,{onClick:x,children:w({id:"inviteForm_ctaDone"})})]}):s.jsx(H,{onClick:b,children:w({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:o},children:t}),s.jsx(Us.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:m,onChange:M=>{u(M),h(!M.length)},autoFocus:!1,getLabel:(M,D,R)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:M}),s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{R(D),h(!m.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},D)})]}),s.jsx(Me,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(H,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Q={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const c=`logged${e?"In":"Out"}`;return t>=n[i][c]};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&&Q.handlerCalled[e]&&o-Q.handlerCalled[e]<500)return;Q.handlerCalled[e]=o;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(c=>{c===e||n[c]===!1||i.push({type:`menus.${c}`,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=Ln(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?Q.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 c,a;switch(e){case"navigation":if(n){const d=Q.findFirstChild(t.current.children,"attributes.aria-controls","navigation");c=Q.findFirstChild(d.children,"href")}else c=Q.findFirstChild(t.current.children,"href");c||(c=t.current);break;case"account":if(a=Q.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;c=Q.findFirstChild(a.children,"href");break;default:return}c&&(o([{type:`focusElements.${e}.${i}`,value:c}]),c.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Q.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Q.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Q.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Q.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},qe={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"}}}},bt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:i=null})=>{const c=C.useIntl(),a=Ln(qe,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const d="doTrack"in a,l=i===null?d?a.doTrack:!0:i,m=e.includes("buttons.");let u=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(u+=`_logged${t?"In":"Out"}`);let p=!1;if(a.href){let b=a.gtmType||`${e}-click`;if(b.includes(".")){const x=b.split("."),M=x[x.length-2];b=`${M==="topics"?`${M}-`:""}${x[x.length-1]}`}p={href:a.href,role:"menuitem"},l&&(p={...p,className:"gtm-trackable","data-gtm-event-type":b,"data-gtm-event-context":"HeaderButtons"}),m&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const h=a.order&&a.order[0]&&a[a.order[0]],g=h&&a[a.order[0]].order,k=p&&window.location.pathname===a.href;let w={},E={};if(h){const b=a.menuId||e,x={onClick:M=>Q.events.onClick(M,{id:b,callback:o,isOpen:r[b]}),onFocus:()=>Q.events.onFocus({id:b}),onBlur:()=>Q.events.onBlur({id:b,callback:o}),onMouseLeave:()=>Q.events.onBlur({id:b,callback:o}),onMouseEnter:()=>Q.events.onMouseEnter({id:b,callback:o})};n&&(g&&(w={...x,onKeyPress:M=>{M.key==="Enter"&&Q.events.onClick(M,{id:b,callback:o,isOpen:r[b]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[b],"aria-controls":b}),E={hidden:b in r?!r[b]:!0}),g||(E={...E,...x})}return s.jsxs("li",{className:S({[a.className]:a.className,"has-submenu":h,parent:g,active:k}),role:"none",...w,children:[p?_.createElement(m?H:"a",p,c.formatMessage({id:u})):c.formatMessage({id:u}),a.order&&s.jsx("ul",{...E,children:a.order.map(b=>{if(!a[b])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:d?l:null};return a[b].order?s.jsxs("li",{className:S({[a[b].className]:a[b].className}),children:[c.formatMessage({id:`${u}_${b}`}),s.jsx("ul",{children:a[b].order.map(M=>s.jsx(bt,{id:`${e}.${b}.${M}`,...x},M))})]},b):s.jsx(bt,{id:`${e}.${b}`,...x},b)})})]},e)};const ia={height:67,height_desktop:83},on=({showNavigation:e=!0})=>{const t=C.useIntl(),n=_.useContext(ke),r=Be(!0,!0),o=n&&typeof n.id=="string",i=_.useMemo(()=>Q.getIsDesktopVersion(o,r),[o,r]),[c,a]=_.useReducer(lr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:d,menus:l,focusElements:m}=c;Qn({scrollPosition:ia[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&l.navigation||Q.shouldChangeHeaderIsVisible(!0,l,a)},scrollDown:()=>{!i&&l.navigation||Q.shouldChangeHeaderIsVisible(!1,l,a)}}});const u=(h,g)=>{Q.handleMenus({id:h,value:g,menus:l,dispatch:a})},p=_.useRef(null);return De(()=>{l.navigation&&Q.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:m,dispatch:a})},[l.navigation]),De(()=>{l.account&&Q.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:m,dispatch:a})},[l.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":o,"logged-out":!o,visible:d}),children:[s.jsx(se,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(rn,{}),e&&s.jsxs(s.Fragment,{children:[!i.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.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:s.jsx(se,{children:t.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!i.navigation&&l.account?"account":"default",children:qe.order.map(h=>s.jsx(bt,{id:h,isLoggedIn:o,isDesktopVersion:i.navigation,menus:{navigation:l.navigation,account:l.account},callback:u},h))}),!i.search&&s.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),u("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:s.jsx(se,{children:t.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),s.jsx(gs,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),o?s.jsxs("button",{className:"account-button",onClick:h=>Q.events.onClick(h,{id:"account",callback:u,isOpen:l.account}),onMouseEnter:()=>Q.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>Q.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[s.jsx(se,{children:t.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),s.jsx(Oe,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:qe.buttons.order.map(h=>s.jsx(bt,{id:`buttons.${h}`},h))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:l.navigation||l.account||!i.search&&l.search})})]})};const ln=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const cn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:o=()=>{},onClose:i=()=>{}}={},forceShow:{error:c=!1}={},title:a,children:d,buttons:l,className:m="",gtmContext:u="Modal"})=>{const p=C.useIntl(),[h,g]=_.useState(t),k=E=>{g(E),E?(o(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{k(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:h}),children:s.jsx(ln,{id:e,className:S("overlay-modal",m,{"has-max-width":r}),hidden:!h,style:w,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>k(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":u,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Me,{}),d,l&&s.jsxs("div",{className:"bottom",children:[s.jsx(Me,{}),s.jsx(Xe,{buttons:l})]}),c&&s.jsx(gt,{className:"error",children:c})]})})})},xs=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const la=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:o="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:c,onClose:a,reportError:d=()=>{},sendInvites:l})=>s.jsx(cn,{title:n,isOpen:t,showDivider:!1,showIcon:c,functions:{onClose:a},className:S("invite-modal",e,{success:!!n}),children:s.jsx(_s,{title:r,label:o,ctaMessage:i,onClose:a,sendInvites:l,reportError:d})});const ca=()=>{const e=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(on,{}),s.jsx("div",{id:"content",children:s.jsx(et,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(an,{})]})},bs=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:o={},styling:i={},className:c="",locale:a="en"})=>{const{navigation:d=!0,footer:l=!0}=o,{background:m="default",variant:u="default",circle:p="default"}=i,h=On();_.useEffect(()=>{window.scrollTo(0,0)},[h]);const g=pt(e,{locale:a}),k=pt(t,{locale:a}),w=pt(n,{locale:a}),E={};return m!=="default"&&(E[m]=!0),u!=="default"&&(E[u]=!0),p!=="default"&&(E[p]=!0),s.jsx(Ws.ErrorBoundary,{onError:r,fallback:s.jsx(ca,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:S(c,E,{"has-footer":l}),children:[s.jsx(on,{showNavigation:d}),s.jsxs("section",{id:"content-wrapper",children:[k&&s.jsx("div",{className:"additional-content prepended",children:k}),_.createElement(m==="bold"?ln:"div",{id:"content",children:g})]}),w&&s.jsx("div",{className:"additional-content appended",children:w}),l&&s.jsx(an,{}),s.jsx(ms,{})]})})})},Nn={default:"tags_",headerTopics:"header_topics_topics_"},Bt={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"},ua={getTagDetails:e=>{if(e.includes("topic_")){if(e=Bt.topic[e.replace("topic_","")],e){const t=qe.topics.topics[e].href;return t?{id:e,href:t,text:`${Nn.headerTopics}${e}`}:null}return null}return Bt[e]?(e=Bt[e],{id:e,text:`${Nn.default}${e}`}):null}};const da=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:i="tag-click",gtmContext:c="tags"})=>{const a=C.useIntl();if(!e||e.length<1)return null;const d=[];return e.forEach(l=>{if(!l)return;const m=ua.getTagDetails(l);m&&d.push(m)}),d.length<1?null:s.jsx("ul",{className:S("tags text-small",t,o,{"one-line":n}),children:d.map(l=>{const m=a.formatMessage({id:l.text});return s.jsx("li",{children:l.href&&r?s.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":c,children:m}):m},l.id)})})};const ma=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:o="member",gtmType:i="member-click",className:c=""})=>{const a=C.useIntl();return e.length===0?null:s.jsxs("div",{className:S("members-list",c),children:[s.jsxs("h1",{children:[a.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:t})]}),s.jsx("ul",{children:e.map((d,l)=>s.jsxs("li",{children:[s.jsx(kt,{member:d,gtmContext:o,gtmType:i}),d.isAdmin&&s.jsx(Je,{children:a.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(sn,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:o})]})};let mt=null;const fe="discussion_form_",un=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:o=5e4,minRows:i=4,forceShow:c={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:d="DiscussionForm"})=>{var $,N;const l=C.useIntl(),m=_.useContext(ke),[u,p]=_.useState(n.isEditing&&n.isEditing.text||""),[h,g]=_.useState(c.error||!1),[k,w]=_.useState(!1),E=_.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(we,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=v=>{const z=v.target.value;p(z);let j;!m||!m.id?j=ye(l.formatMessage,`${fe}error_loggedOut`,e.type,"action"):t?z.length>=o&&(j=`${fe}error_tooLong`):j=ye(l.formatMessage,`${fe}error_noPermission`,e.type,"action"),j?g(j):h&&g(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const v=e.type==="response"?(($=e.slugs)==null?void 0:$.question)||"":((N=e.slugs)==null?void 0:N.answer)||"";v&&(x=`${x}-${v.slice(-15)}`)}const M=async v=>{var j;if(v.preventDefault(),v.stopPropagation(),!m||!m.id||!t||R)return;mt&&clearTimeout(mt),w("submitting");const z=window.location.pathname;try{let I;switch(e.type){case"post":I=await a.create({content:u});break;case"question":I=await a.create({title:u,authorId:m&&m.id,...(j=a.props)==null?void 0:j.create});break;case"response":I=await a.create({question:e.slugs.question},{body:u,authorId:m&&m.id,contentPath:z});break;case"reply":I=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:u,authorId:m&&m.id,contentPath:z});break;default:break}await cr(1e3),a.callback&&await a.callback(I),mt=setTimeout(()=>{p(""),w("submitted"),D()},500)}catch(I){const G=I;let J=`${fe}error`;G.message.includes("entry already exists")&&(J=ye(l.formatMessage,`${fe}error_alreadyExists`,e.type,"action")),G.message.includes("429")?J=ye(l.formatMessage,`${fe}error_tooMany`,e.type,"action"):G.message.includes("400")&&(J=`${fe}error`),g(J),D()}},D=()=>{mt=setTimeout(()=>{g(!1),w(!1)},5e3)},R=!u||!ir(u),V=k==="submitting",F=[];return(n.isEditing&&!V||c.cancel)&&F.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!c.cancel&&(!m||!m.id||!u),children:l.formatMessage({id:`${fe}cancel`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:v=>{if(n.isEditing){w("submitting"),a.handleSaveEdit&&a.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}M(v)},className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!t||R||V||n.isEditing&&u===n.isEditing.text,children:l.formatMessage({id:`${fe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:x,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ye(l.formatMessage,`${fe}title`,e.type,"action")}),s.jsx(kt,{member:m||"community",gtmContext:d,gtmType:"profile-click"}),s.jsx(se,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:ye(l.formatMessage,`${fe}label`,e.type,"action")}),s.jsx(zs,{ref:r,id:`${x}-input`,name:e.type,placeholder:ye(l.formatMessage,`${fe}placeholder`,e.type,"action"),onChange:b,value:u,maxLength:o,"aria-invalid":!!h,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(l.formatMessage,`${fe}explainer`,e.type,"action",{a:v=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:v})})}),s.jsx(Xe,{buttons:F}),k==="submitted"&&s.jsx(gt,{className:"success","data-testid":"success",children:ye(l.formatMessage,`${fe}success`,e.type,"action")}),h&&s.jsx(gt,{id:"error-message",className:"error","data-testid":"error",children:c.error?c.error:typeof h=="string"?h.includes(" ")?h:l.formatMessage({id:h},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:o}):h})]})},jt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:o,leave:i,notMemberStateText:c}})=>r&&!n?s.jsx(et,{text:c,button:{breakpoints:{mobile:!0,901:!1},component:s.jsx(nn,{isShort:!0,functions:{join:o,leave:i}})}}):s.jsx(un,{content:{type:e,slugs:{}},functions:{create:t}}),fa={showThread:!1,showForm:!1},tt=_.createContext(fa),vs=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(tt.Provider,{value:{...t,updateConversation:n},children:e})},ha=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),pa=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ye=!1;const Ot=()=>{Ye!==!1&&(clearTimeout(Ye),Ye=!1)},Ht=5,ws=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:o=!1,content:i={type:"reply",slugs:{}},canLike:c=!0,functions:{createLike:a=()=>{},deleteLike:d=()=>{}}={}})=>{const l=C.useIntl();_.useEffect(()=>{h(o)},[o]);const[m,u]=_.useState(t),[p,h]=_.useState(o),[g,k]=_.useState(!1),[w,E]=_.useState(!1),b=_.useMemo(()=>pa(n,Ht),[n]),x=D=>{if(D.preventDefault(),D.stopPropagation(),E(!1),Ye)return Ot(),!1;if(Ot(),g||!c)return!1;Ye=setTimeout(M,350)},M=async()=>{if(Ot(),g||!c)return!1;let D=p?m-1:m+1;D<0&&(D=0),k(!0),u(D),h(!p);try{if(i&&i.slugs){const R=ha(i.slugs);p?await d(R):await a(R,{contentPath:window.location.pathname})}}catch{u(t),h(o)}finally{k(!1)}};return _.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!c}),onClick:x,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!o}),screenreaderText:c?l.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:l.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:x,disabled:!c,"aria-hidden":!c,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":m===0}),"data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})}),n&&s.jsx(Jn,{isOpen:w,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[b.map(D=>typeof D=="string"||!D.name?null:s.jsx("li",{children:s.jsx(Ze,{href:D.id?`/profiles/${D.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:R=>R==null?void 0:R.stopPropagation(),children:D.name})},D.id||window.btoa(D.name))),n.length>Ht&&s.jsx("li",{children:l.formatMessage({id:"discussion_likes_more"},{number:n.length-Ht})})]})})]})})},Pn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},dn=(e,t)=>e&&!t;const Se="discussion_",ga=280,nt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:o,functions:{content:{createContent:i,deleteContent:c,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:d,deleteLike:l}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:u={},className:p,gtmContext:h="DiscussionAnswer",children:g,isTruncated:k=!1})=>{const w=C.useIntl(),E=_.useContext(ke),b=_.useContext(tt),[x,M]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[D,R]=_.useState(!1),[V,F]=_.useState("");if(_.useEffect(()=>{M({...x,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(we,{className:"discussion-card discussion-post"});const{author:$,canLike:N,createdAt:v,id:z,likes:j=0,userLiked:I,comments:G=0}=t,J=k?Le(x.body,ga):x.body,oe=E&&E.id&&typeof $!="string"&&$.id&&$.id===E.id||!1,ie=typeof N=="boolean"?N:n?!oe:!1,le=async L=>{L||(L=""),F("");try{if(!Vs(L,x.body)){const ce=t.type==="question"?{title:L}:{body:L};await a(Pn(t.slugs),ce)}M({body:L,isEditing:!1,didEdit:!0})}catch{F(`${Se}form_error`)}},Y=()=>{b&&b.updateConversation&&b.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ce=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,he=document.getElementById(ce),ue=document.getElementById(`${ce}-input`);ue&&ue.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},te=()=>{R(!1);try{c(Pn(t.slugs))}catch{F("delete-error")}},re=[{text:w.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${Se}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&oe&&re.push({text:w.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>M({...x,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${Se}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`delete-${t.type}-click`,...xs(`delete-${t.slug}-modal`,D)}),_.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:z||t.slug,className:S("discussion-card",t.type,{editing:x.isEditing,"has-link":u.post&&!x.isEditing}),onClick:L=>{!u.post||x.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=u.post)},children:[!x.isEditing&&s.jsx(kt,{member:$,additionalContent:{createdAt:v,didEdit:x.didEdit},className:typeof $!="string"&&$.id===o?"highlighted":"",gtmContext:h,gtmType:"profile-click"}),x.isEditing?s.jsx(un,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:x.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?w.formatMessage({id:V},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:le,handleCancel:()=>{F(""),M({...x,isEditing:!1})}},gtmContext:`${h}Form`}):u.post?s.jsx("a",{href:u.post,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":"title-click",children:s.jsx(Vt,{options:{overrides:{a:ss}},children:J})}):s.jsx(Vt,{options:{wrapper:t.type==="question"?"h1":_.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!x.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(ws,{element:"li",likes:j,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:ie,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:d,deleteLike:l}}),(["question","post"].includes(t.type)||u.comments||typeof m=="function")&&s.jsxs("li",{className:"action-button",onClick:L=>{L.preventDefault(),L.stopPropagation(),u.comments&&(window.location.href=u.comments),typeof m=="function"&&m()},children:[s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:u.comments?u.comments:!1,onClick:u.comments||typeof m!="function"?!1:m,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${Se}comments_screenReader`},{count:G})}),s.jsx("span",{children:w.formatMessage({id:`${Se}comments`},{count:G})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:Y,children:w.formatMessage({id:`${Se}reply`})})}),s.jsx(cs,{element:"li",id:`more-${t.slug}`,options:re})]})]}),g,s.jsx(cn,{id:`delete-${t.slug}-modal`,isOpen:D,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:V==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:te,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(C.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>s.jsx("p",{children:L}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Qt="discussion_responses_",_a=({type:e="answer",responses:t=0})=>{const n=C.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Qt}title`},{action:n.formatMessage({id:`${Qt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Qt}empty`,e,e)})]})};const ks=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=C.useIntl(),o=_.useRef(null),i=_.useContext(tt),[c,a]=_.useState("closed");_.useEffect(()=>{const u=o.current;if(u)return u.addEventListener("transitionend",d),()=>{u.removeEventListener("transitionend",d)}},[]),De(()=>{c==="closed"&&!i.showThread||a(["opening","open"].includes(c)?"ready-to-close":"opening")},[i.showThread]),_.useEffect(()=>{c==="ready-to-close"&&a("closing")},[c]);const d=({propertyName:u})=>{u==="max-height"&&a(p=>p==="opening"?"open":p==="closing"?"closed":p)},l=["opening","open"].includes(c),m=pt(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(H,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${l?"left":"right"}`},onClick:()=>{var u;(u=i.updateConversation)==null||u.call(i,p=>({showThread:!p.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${l?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:o,className:S("thread",c),hidden:!i.showThread,children:m})]})};function xa({queryClient:e,queryKey:t}){function n(r,o,i){e.setQueryData(t,i)}return n}function ba({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return e.setQueryData(t,r),o}return n}function va(e){const{id:t="",name:n="",organization:r="",jobTitle:o="",image:i={}}=e,{thumbnail:c=""}=i;return{actor:{id:t,data:{name:n,organization:r,jobTitle:o,thumbnail:c}}}}function wa(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Dn({activity:e,user:t}){const n={...e,...va(t),...wa()};return n.id?n:{...n,id:"00000000-0000-0000-0000-000000000000",time:new Date().toISOString(),verb:"post"}}function Rn({activity:e,reaction:t}){const{latest_reactions:n,own_reactions:r,reaction_counts:o}=e;n&&t&&(n.like=[...n.like||[],t]),r&&t&&(r.like=[...r.like||[],t]),o&&(o.like=o.like+1||1)}function ka({activity:e,user:t}){const{latest_reactions:n,own_reactions:r,reaction_counts:o}=e;o&&(o.like=o.like-1||0),n&&(t!=null&&t.id)&&(n.like=n.like.filter(({user_id:i})=>i!==t.id)),r&&(t!=null&&t.id)&&(r.like=r.like.filter(({user_id:i})=>i!==t.id))}function Fn(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function vt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:o})=>o===e);if(r)return r}}function ja(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:o})=>o===e);if(r!==-1){n.splice(r,1);break}}return t}function ya(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}function Ea({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:o,user:i}){const{mutate:c}=W.useMutation({mutationFn:e,onMutate:a=>t(d=>{const l=Dn({activity:a,user:i});return Fn(l,d)}),onError:n,onSuccess:(a,d,l)=>{const m=Dn({activity:a,user:i});r.setQueryData(o,Fn(m,l,!0))}});return c}function Sa({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=W.useMutation({mutationFn:e,onMutate:({activityId:o,body:i})=>t(c=>{const a=vt(o,c);return a&&(a.content=i),c}),onError:n});return r}function $a({queryFns:{create:e,edit:t,like:n,list:r,remove:o,unlike:i},queryKey:c}){const a=W.useQueryClient(),d=Kn(),l={queryClient:a,queryKey:c},m={mutationHandlers:{error:xa(l),mutate:ba(l)},user:d,...l},u=Ea({...m,mutationFn:e}),p=Sa({...m,mutationFn:t}),h=Ta({...m,mutationFn:n}),g=Ca({...m,mutationFn:o}),k=Na({...m,mutationFn:i}),{activities:w,...E}=Ma({queryKey:c,queryFn:r});return{activities:w,mutations:{create:u,edit:p,remove:g,like:h,unlike:k},user:d,...E}}function Ta({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:o}){const{mutate:i}=W.useMutation({mutationFn:e,onMutate:({activityId:c})=>t(a=>{const d=vt(c,a);return d&&Rn({activity:d}),a}),onError:n,onSuccess:(c,{activityId:a},d)=>{const l=vt(a,d);l&&Rn({activity:l,reaction:c}),r.setQueryData(o,d)}});return i}function Ma({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:o,hasNextPage:i,fetchNextPage:c}=W.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:a=>a==null?void 0:a.next});return{activities:ya(n),error:r,isLoading:o,hasNextPage:i,fetchNextPage:c}}function Ca({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=W.useMutation({mutationFn:e,onMutate:({activityId:o})=>t(i=>ja(o,i)),onError:n});return r}function Na({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:o}=W.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(c=>{const a=vt(i,c);return a&&ka({activity:a,user:r}),c}),onError:n});return o}const Pa=({basePath:e,parentId:t,isMember:n,functions:{join:r,leave:o,...i}})=>{const c=C.useIntl(),{activities:a,error:d,fetchNextPage:l,hasNextPage:m,isLoading:u,mutations:{create:p,edit:h,remove:g,like:k,unlike:w},user:E}=$a({queryKey:[e,t],queryFns:i});return d?s.jsx(et,{variant:"error",text:d.message}):s.jsxs("section",{children:[s.jsx(jt,{contentType:"post",createPost:p,membershipRequiredToPost:{isMember:n,required:!0,join:r,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),a==null?void 0:a.map(b=>{var v,z,j,I,G,J,oe,ie,le;const{own_reactions:x,latest_reactions:M}=b,D=(((v=M==null?void 0:M.like)==null?void 0:v.length)||0)>0,R=(((z=x==null?void 0:x.like)==null?void 0:z.length)||0)>0,V=R?x==null?void 0:x.like[0].id:null,F=D?(j=M==null?void 0:M.like)==null?void 0:j.map(Y=>{var te,re,L;return{id:(te=Y==null?void 0:Y.user)==null?void 0:te.id,name:(L=(re=Y==null?void 0:Y.user)==null?void 0:re.data)==null?void 0:L.name}}):!1,$=b==null?void 0:b.actor,N=($==null?void 0:$.id)===(E==null?void 0:E.id);return s.jsxs(_.Fragment,{children:[s.jsx(nt,{content:{type:"post",body:b==null?void 0:b.content,canLike:dn(n,N),createdAt:(b==null?void 0:b.time)||"",slugs:{parentId:t,activityId:b==null?void 0:b.id},slug:b==null?void 0:b.id,author:{id:$==null?void 0:$.id,name:(I=$==null?void 0:$.data)==null?void 0:I.name,organization:(G=$==null?void 0:$.data)==null?void 0:G.organization,jobTitle:(J=$==null?void 0:$.data)==null?void 0:J.jobTitle,image:{thumbnail:((oe=$==null?void 0:$.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:R,likes:((ie=b==null?void 0:b.reaction_counts)==null?void 0:ie.like)||0,comments:((le=b==null?void 0:b.reaction_counts)==null?void 0:le.reply)||0,peopleWhoLiked:F},links:{post:`${e}/${t}/${b==null?void 0:b.id}`,comments:`${e}/${t}/${b==null?void 0:b.id}`},functions:{content:{createContent:()=>null,deleteContent:Y=>g(Y),updateContent:(Y,te)=>h({...Y,...te})},likes:{createLike:()=>k({activityId:b==null?void 0:b.id}),deleteLike:()=>w({activityId:b==null?void 0:b.id,reactionId:V})},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Me,{})]},b==null?void 0:b.id)}),!u&&s.jsx(sn,{hasNextPage:m,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})},Da=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:a=>{var l;const d=e.getQueryData(t);if(d)return(l=d==null?void 0:d.latest_reactions)!=null&&l.reply?(d.latest_reactions.reply.unshift(a),d&&(d.reaction_counts={reply:d.latest_reactions.reply.length})):(d.latest_reactions={reply:[a]},d.reaction_counts={reply:1}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ra=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:c}})=>{var l,m,u;if(c.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>(p.id===i.replySlug&&(p.data.content=c),p));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)}}),Fa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:i})=>{var d,l,m;await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);if(!c||!((d=c==null?void 0:c.latest_reactions)!=null&&d.reply))return;const a=(m=(l=c==null?void 0:c.latest_reactions)==null?void 0:l.reply)==null?void 0:m.filter(u=>u.id!==i);return e.setQueryData(t,()=>({...c,latest_reactions:{reply:a}})),{previousActivity:c}},onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)}}),Aa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c})=>{var l,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),d=(m=(l=a==null?void 0:a.latest_reactions)==null?void 0:l.reply)==null?void 0:m.map(u=>{var p;return u.id===c&&((p=u.children_counts)!=null&&p.like?u.children_counts.like+=1:u.children_counts={like:1}),u});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:c=>{var l;const a=e.getQueryData(t),d=(l=a==null?void 0:a.latest_reactions.reply)==null?void 0:l.map(m=>{var u,p;return m.id===c.id&&((u=m.own_children)!=null&&u.like?m.own_children.like.push(c):m.own_children={like:[c]},(p=m.latest_children)!=null&&p.like?m.latest_children.like.push(c):m.latest_children={like:[c]}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Ia=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d)return;const l=(m=d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a&&u.children_counts.like&&(u.children_counts.like-=1),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(a,{replyId:d})=>{var u;const l=e.getQueryData(t);if(!l)return;const m=(u=l.latest_reactions.reply)==null?void 0:u.map(p=>{var h,g,k;if(p.id===d){let w=(h=p.latest_children.reply)==null?void 0:h.filter(E=>E.user_id!==(n==null?void 0:n.id));return w=(k=(g=p==null?void 0:p.own_children)==null?void 0:g.reply)==null?void 0:k.filter(E=>E.user_id!==(n==null?void 0:n.id)),w}return p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}}}),La=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var m;const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a.parent&&(u.latest_children.reply&&u.children_counts.reply?(u.latest_children.reply.push(a),u.children_counts.reply+=1):(u.latest_children.reply=[a],u.children_counts.reply=1)),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ba=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:i,content:{body:c}})=>{var l,m,u;if(c.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h;return p.id===i.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>(g.id===i.replySlug&&(g.data.content=c),g))),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Oa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:i,replyParentId:c})=>{var l,m,u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h,g;return p.id===c&&(p.latest_children.reply=(h=p.latest_children.reply)==null?void 0:h.filter(k=>k.id!==i),(g=p.children_counts)!=null&&g.reply&&(p.children_counts.reply-=1)),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Ha=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c,replyParentId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a&&((p=u.latest_children.reply)==null||p.map(h=>{var g;return h.id===c&&((g=h.children_counts)!=null&&g.like?h.children_counts.like+=1:h.children_counts={like:1}),h})),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:(c,a)=>{var m;const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a.replyParentId&&((p=u.latest_children.reply)==null||p.map(h=>(h.id===a.replyId&&(h.latest_children=h.latest_children||{},h.own_children=h.own_children||{},h.latest_children.like=h.latest_children.like||[],h.own_children.like=h.own_children.like||[],h.latest_children.like.push(c),h.own_children.like.push(c)),h))),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}}}),Qa=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:d})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),m=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d&&((h=p.latest_children.reply)==null||h.map(g=>{var k;return g.id===a&&((k=g.children_counts)!=null&&k.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(a,d)=>{var u;const l=e.getQueryData(t),m=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>{var k,w;return g.id===d.replyId&&((k=g.own_children)!=null&&k.like&&(g.own_children.like=g.own_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id))),(w=g.latest_children)!=null&&w.like&&(g.latest_children.like=g.latest_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id)))),g})),p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}}}),Ua=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:o,replies:i,functions:{create:c,edit:a,remove:d,join:l,leave:m,like:u,unlike:p}})=>{const h=C.useIntl(),g=W.useQueryClient(),k=_.useContext(ke),w=_.useContext(tt),E=La({queryClient:g,queryKey:[e,t,r],mutationFn:async j=>c({replyId:n,content:j.body})}),{mutate:b}=W.useMutation(E),x=Ba({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:M}=W.useMutation(x),D=Oa({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:j})=>d({replyId:j})}),{mutate:R}=W.useMutation(D),V=Ha({queryClient:g,queryKey:[e,t,r],mutationFn:u}),{mutate:F}=W.useMutation(V),$=Qa({queryClient:g,queryKey:[e,t,r],user:k,mutationFn:p}),{mutate:N}=W.useMutation($),v=_.useCallback(({replyId:j,replyParentId:I})=>F({replyId:j,replyParentId:I}),[F]),z=_.useCallback(({replyId:j,replyParentId:I})=>N({replyId:j,replyParentId:I}),[N]);return s.jsx(ks,{count:o,showRepliesButton:o>0||w.showForm,children:s.jsxs(s.Fragment,{children:[w.showForm&&s.jsx(jt,{contentType:"reply",createPost:(j,I)=>b(I),membershipRequiredToPost:{isMember:!0,required:!0,join:l,leave:m,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(i==null?void 0:i.length)===0||(i==null?void 0:i.map(j=>{var I,G,J,oe,ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge;return s.jsx(nt,{content:{type:"reply",body:typeof j.data.content=="string"?(I=j==null?void 0:j.data)==null?void 0:I.content:((J=(G=j==null?void 0:j.data)==null?void 0:G.content)==null?void 0:J.text)||"",createdAt:j==null?void 0:j.created_at,slugs:{parentId:t,activityId:r,replyParentId:j==null?void 0:j.parent,reply:j==null?void 0:j.id},slug:"",author:{id:(oe=j==null?void 0:j.user)==null?void 0:oe.id,name:(le=(ie=j==null?void 0:j.user)==null?void 0:ie.data)==null?void 0:le.name,organization:(te=(Y=j==null?void 0:j.user)==null?void 0:Y.data)==null?void 0:te.organization,jobTitle:(L=(re=j==null?void 0:j.user)==null?void 0:re.data)==null?void 0:L.jobTitle,image:{thumbnail:((he=(ce=j==null?void 0:j.user)==null?void 0:ce.data)==null?void 0:he.thumbnail)||void 0}},userLiked:((ue=j==null?void 0:j.own_children)==null?void 0:ue.like)&&((xe=j==null?void 0:j.own_children)==null?void 0:xe.like.length)>0,likes:((pe=j==null?void 0:j.children_counts)==null?void 0:pe.like)||0,peopleWhoLiked:((be=j==null?void 0:j.latest_children)==null?void 0:be.like)&&((ge=j==null?void 0:j.latest_children)==null?void 0:ge.like.map(X=>{var ne,de;return{id:X==null?void 0:X.user_id,name:(de=(ne=X==null?void 0:X.user)==null?void 0:ne.data)==null?void 0:de.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:X=>{const{replySlug:ne,replyParentId:de}=X;return R({replyId:ne,replyParentId:de})},updateContent:(X,ne)=>M({replyInfo:X,content:ne})},likes:{createLike:()=>v({replyId:j==null?void 0:j.id,replyParentId:j==null?void 0:j.parent}),deleteLike:()=>{var ne,de,Z;const X=((ne=j==null?void 0:j.own_children)==null?void 0:ne.like)&&((Z=(de=j==null?void 0:j.own_children)==null?void 0:de.like[0])==null?void 0:Z.id);return z({replyId:X||""})}},comments:{}}},j==null?void 0:j.id)}))]})})},js=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:o,functions:{create:i,edit:c,remove:a,like:d,unlike:l,join:m,leave:u}})=>{const p=C.useIntl(),h=W.useQueryClient(),g=_.useContext(ke),k=Da({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>i({activityId:n,content:v.body})}),{mutate:w}=W.useMutation(k),E=Ra({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>c(v)}),{mutate:b}=W.useMutation(E),x=Fa({queryClient:h,queryKey:[e,t,n],mutationFn:async({replyId:v})=>a({replyId:v})}),{mutate:M}=W.useMutation(x),D=Aa({queryClient:h,queryKey:[e,t,n],mutationFn:d}),{mutate:R}=W.useMutation(D),V=Ia({queryClient:h,queryKey:[e,t,n],user:g,mutationFn:l}),{mutate:F}=W.useMutation(V),$=_.useCallback(({replyId:v})=>R({replyId:v}),[R]),N=_.useCallback(({replyId:v})=>F({replyId:v}),[F]);return Un(),s.jsxs(s.Fragment,{children:[s.jsx(jt,{contentType:"reply",createPost:(v,z)=>w(z),membershipRequiredToPost:{isMember:o,required:!0,join:m,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(v=>{var I,G,J,oe,ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge,X,ne,de;const z=((I=v==null?void 0:v.user)==null?void 0:I.id)===(g==null?void 0:g.id),j=dn(o,z);return s.jsx(vs,{children:s.jsx(nt,{content:{type:"reply",body:typeof v.data.content=="string"?(G=v==null?void 0:v.data)==null?void 0:G.content:((oe=(J=v==null?void 0:v.data)==null?void 0:J.content)==null?void 0:oe.text)||"",canLike:j,createdAt:v==null?void 0:v.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:v==null?void 0:v.id},slug:v==null?void 0:v.id,author:{id:(ie=v==null?void 0:v.user)==null?void 0:ie.id,name:(Y=(le=v==null?void 0:v.user)==null?void 0:le.data)==null?void 0:Y.name,organization:(re=(te=v==null?void 0:v.user)==null?void 0:te.data)==null?void 0:re.organization,jobTitle:(ce=(L=v==null?void 0:v.user)==null?void 0:L.data)==null?void 0:ce.jobTitle,image:{thumbnail:((ue=(he=v==null?void 0:v.user)==null?void 0:he.data)==null?void 0:ue.thumbnail)||void 0}},userLiked:((xe=v==null?void 0:v.own_children)==null?void 0:xe.like)&&((pe=v==null?void 0:v.own_children)==null?void 0:pe.like.length)>0,likes:((be=v==null?void 0:v.children_counts)==null?void 0:be.like)||0,peopleWhoLiked:((ge=v==null?void 0:v.latest_children)==null?void 0:ge.like)&&((X=v==null?void 0:v.latest_children)==null?void 0:X.like.map(Z=>{var ae,_e;return{id:Z==null?void 0:Z.user_id,name:(_e=(ae=Z==null?void 0:Z.user)==null?void 0:ae.data)==null?void 0:_e.name}}))},functions:{content:{createContent:()=>null,deleteContent:Z=>{const{replySlug:ae}=Z;return M({replyId:ae})},updateContent:(Z,ae)=>b({replyInfo:Z,content:ae})},likes:{createLike:()=>$({replyId:v==null?void 0:v.id}),deleteLike:()=>{var ae,_e,Ce;const Z=((ae=v==null?void 0:v.own_children)==null?void 0:ae.like)&&((Ce=(_e=v==null?void 0:v.own_children)==null?void 0:_e.like[0])==null?void 0:Ce.id);return N({replyId:Z||""})}},comments:{}},children:s.jsx(Ua,{basePath:e,parentId:t,replyParentId:v==null?void 0:v.id,activityId:n,replyCount:((ne=v==null?void 0:v.children_counts)==null?void 0:ne.reply)||0,replies:(de=v==null?void 0:v.latest_children)==null?void 0:de.reply,isMember:o,functions:{create:i,edit:c,remove:a,like:d,unlike:l,join:m,leave:u}})},v==null?void 0:v.id)},v==null?void 0:v.id)}))]})},Wa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:c,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);return d&&d.id===(c==null?void 0:c.activityId)&&(d.content=a),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),za=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),Va=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var d;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(d=a==null?void 0:a.reaction_counts)!=null&&d.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:a=>{const d=e.getQueryData(t);return d!=null&&d.own_reactions.like?d.own_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),d!=null&&d.latest_reactions.like?d.latest_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ya=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:o})=>({mutationFn:o,onMutate:async()=>{var m;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return(m=l==null?void 0:l.reaction_counts)!=null&&m.like&&l.reaction_counts.like>0&&(l.reaction_counts.like-=1),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(l,m,u)=>{e.setQueryData(t,u.previousActivity)},onSuccess:()=>{var u,p,h;if(!r)return;const l=(h=(p=(u=r.own_reactions)==null?void 0:u.like)==null?void 0:p.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:h.id,m=e.getQueryData(t);if(m!=null&&m.own_reactions.like&&(m.own_reactions.like=m.own_reactions.like.filter(g=>g.id!==l),!!(m!=null&&m.latest_reactions.like)))return m.latest_reactions.like=m.latest_reactions.like.filter(g=>g.id!==l),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const Ga=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:o,editActivity:i,removeActivity:c,likeActivity:a,unlikeActivity:d,createReply:l,editReply:m,removeReply:u,likeReply:p,unlikeReply:h,join:g,leave:k}})=>{var ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge,X,ne,de,Z,ae,_e,Ce,He,Ne,st;const w=C.useIntl(),E=_.useContext(ke),b=W.useQueryClient(),{data:x,isLoading:M,isFetching:D}=W.useQuery({queryKey:[e,t,n],queryFn:o}),R=Wa({queryClient:b,queryKey:[e,t,n],mutationFn:async K=>await i(K)}),{mutate:V}=W.useMutation(R),F=za({queryClient:b,queryKey:[e,t,n],mutationFn:async({activityId:K})=>c({activityId:K}),redirectUrl:`${e}/${t}`}),{mutate:$}=W.useMutation(F),N=Va({queryClient:b,queryKey:[e,t,n],mutationFn:a}),{mutate:v}=W.useMutation(N),z=Ya({queryClient:b,queryKey:[e,t,n],user:E,mutationFn:async()=>{var je,Pe,rt;const K=(rt=(Pe=(je=x==null?void 0:x.own_reactions)==null?void 0:je.like)==null?void 0:Pe.find(at=>at.user_id===(E==null?void 0:E.id)))==null?void 0:rt.id;await d({activityId:n,reactionId:K})},activity:x}),{mutate:j}=W.useMutation(z),I=_.useCallback(({activityId:K})=>v({activityId:K}),[v]),G=_.useCallback(async({activityId:K})=>j({activityId:K}),[j]);if(M||D)return s.jsx(we,{style:{height:"400px"}});if(!x)return s.jsx(et,{variant:"error",text:w.formatMessage({id:"activitySection_notFoundError"})});const J=((ie=x==null?void 0:x.actor)==null?void 0:ie.id)===(E==null?void 0:E.id),oe=dn(r,J);return s.jsx(nt,{className:"activity-section",content:{type:"post",body:x==null?void 0:x.content,canLike:oe,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:x==null?void 0:x.id},slug:n,author:{id:(le=x==null?void 0:x.actor)==null?void 0:le.id,name:((Y=x==null?void 0:x.actor)==null?void 0:Y.data)&&((re=(te=x==null?void 0:x.actor)==null?void 0:te.data)==null?void 0:re.name),organization:((L=x==null?void 0:x.actor)==null?void 0:L.data)&&((he=(ce=x==null?void 0:x.actor)==null?void 0:ce.data)==null?void 0:he.organization),jobTitle:((ue=x==null?void 0:x.actor)==null?void 0:ue.data)&&((pe=(xe=x==null?void 0:x.actor)==null?void 0:xe.data)==null?void 0:pe.jobTitle),image:{thumbnail:((be=x==null?void 0:x.actor)==null?void 0:be.data)&&((X=(ge=x==null?void 0:x.actor)==null?void 0:ge.data)==null?void 0:X.thumbnail)||void 0}},userLiked:((ne=x==null?void 0:x.own_reactions)==null?void 0:ne.like)&&((de=x==null?void 0:x.own_reactions)==null?void 0:de.like.length)>0,likes:x&&((Z=x==null?void 0:x.reaction_counts)==null?void 0:Z.like),comments:x&&((ae=x==null?void 0:x.reaction_counts)==null?void 0:ae.reply),peopleWhoLiked:((_e=x==null?void 0:x.latest_reactions)==null?void 0:_e.like)&&((Ce=x==null?void 0:x.latest_reactions)==null?void 0:Ce.like.map(K=>{var je,Pe;return{id:K==null?void 0:K.user_id,name:(Pe=(je=K==null?void 0:K.user)==null?void 0:je.data)==null?void 0:Pe.name}}))},originalAuthorId:(He=x==null?void 0:x.actor)==null?void 0:He.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>$({activityId:n}),updateContent:(K,je)=>V({activityInfo:K,content:je})},likes:{createLike:()=>I({activityId:n}),deleteLike:()=>G({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ne=x==null?void 0:x.reaction_counts)==null?void 0:Ne.reply)||0,")"]}),s.jsx(js,{basePath:e,parentId:t,activityId:n,repliesList:(st=x==null?void 0:x.latest_reactions)==null?void 0:st.reply,isMember:r,functions:{create:l,edit:m,remove:u,like:p,unlike:h,join:g,leave:k}})]})},n)},Ja=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:o}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:o}}),An=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ft="notFoundError_",qa=()=>{const e=C.useIntl(),t=[];return An.forEach((n,r)=>{n.title=e.formatMessage({id:`${ft}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(bs,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(Ke,{children:[s.jsx(ls,{cards:An,cardTypes:t,buildCardData:n=>new Promise((r,o)=>{r(n)})}),s.jsx(H,{href:"/solution-articles/",children:e.formatMessage({id:`${ft}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${ft}title`})}),s.jsx("p",{children:e.formatMessage({id:`${ft}text`})})]})};exports.ASSETS_BUCKET=Ge;exports.ActivitiesFeed=Pa;exports.ActivitySection=Ga;exports.AddPost=jt;exports.BannerSection=gr;exports.Breadcrumbs=Wr;exports.Button=H;exports.ButtonWrapper=Xe;exports.CacheProvider=qn;exports.Card=tn;exports.CardBlock=ls;exports.Carousel=Qr;exports.CollapsibleSection=Xt;exports.Columns=ds;exports.CommunityDetails=Ur;exports.Contributors=en;exports.ConversationContext=tt;exports.CookieBanner=ms;exports.DiscussionConversation=vs;exports.DiscussionForm=un;exports.DiscussionLikes=ws;exports.DiscussionPost=nt;exports.DiscussionThread=ks;exports.Divider=Me;exports.DownloadSection=mr;exports.EMAILS=Ae;exports.EmailHelperTextBox=na;exports.EmptyStateBox=et;exports.Filters=zr;exports.FlagsProvider=Xn;exports.Footer=an;exports.FullWidthSection=Ke;exports.GlobalProviders=vr;exports.Header=on;exports.HelperTextBox=ns;exports.HiddenFromScreenReaders=Gt;exports.HideShowTextBox=kr;exports.HighlightedTextBox=Te;exports.IntlProvider=Zn;exports.InviteForm=_s;exports.InviteModal=la;exports.JoinButton=nn;exports.LanguageSwitcher=Yr;exports.Link=Ze;exports.LoadMore=sn;exports.LoadingBlock=Pr;exports.LoadingPlaceholder=we;exports.LoadingState=Zt;exports.Logo=rn;exports.LogoSection=fr;exports.MarkdownText=Vt;exports.MarketingBox=_r;exports.Member=kt;exports.MembersList=ma;exports.Modal=ln;exports.MoreMenu=cs;exports.NUMBER_OF_USERS=wr;exports.NavigationMenu=us;exports.NotFoundError=qa;exports.Overlay=cn;exports.PageHeading=rs;exports.PageLayout=bs;exports.PasswordRules=aa;exports.Pill=Je;exports.ProfilePicture=Oe;exports.ProgressBar=as;exports.Rating=oa;exports.RepliesFeed=js;exports.ResponsesHeading=_a;exports.ResponsiveImage=qt;exports.SearchForm=gs;exports.ShareLinks=Zr;exports.Span=ss;exports.StatusBanner=gt;exports.Tabs=Kr;exports.Tags=da;exports.Tooltip=Jn;exports.TopLevelPage=ta;exports.UserContext=ke;exports.UserProvider=es;exports.VisuallyHidden=se;exports.addAriaProps=xs;exports.getMember=Kt;exports.headerData=qe;exports.mapGetStreamData=Ja;exports.pageReady=Gn;exports.useCurrentPath=On;exports.useEffectAfterMount=De;exports.useElementWidth=Be;exports.useScrollListener=Qn;exports.useScrollToHash=Un;exports.useUser=Kn;
|
|
39
|
+
${Ve(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ve(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,o)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(o))}];const Xr="shareLinks_",Zr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:o="large",variant:i="default",className:c=""})=>{const a=C.useIntl(),d=qr({title:e,link:t,referrer:n});return s.jsxs("aside",{className:S("share-links",o,i,c),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:d.map(({key:l,icon:m,url:u,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=k=>h(k,u)),s.jsx("li",{children:s.jsx(H,{size:o,variant:"tertiary",icon:{icon:m||l},href:u,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:a.formatMessage({id:`${Xr}link_${l}`}),...g})},l)})})]})};const Kr=({tabs:e,className:t=""})=>{var d;const n=(l,m,u)=>(l||(l=`panel-${window.btoa(m)}-${u}`),l);let r=e.findIndex(l=>l.current===!0);if(r<0&&(r=0),window.location.hash){const l=window.location.hash.replace("#","");if(e.find(u=>u.id===l)){for(let u=0;u<e.length;u++)if(n(e[u].id,e[u].text,u)===l){r=u;break}}}const[o,i]=_.useState((d=e[r])!=null&&d.id?e[r].id:n(e[r].id,e[r].text,r)),c=[],a=[];return e.forEach(({id:l,text:m,content:u,href:p},h)=>{l=n(l,m,h);const g=o===l,k={};p||(k["aria-controls"]=l,k.onClick=w=>{w.preventDefault(),w.stopPropagation(),i(l),window.location.hash=`#${l}`},a.push(s.jsx("section",{id:l,hidden:!g,role:"tabpanel","aria-labelledby":`tab-${l}`,"aria-live":g?"assertive":"off",children:typeof u=="string"?s.jsx("p",{children:u}):u},`section-${l}`))),c.push(s.jsx("li",{children:s.jsx("a",{href:p||`#${l}`,id:`tab-${l}`,className:S({selected:g}),role:"tab","aria-selected":g,...k,children:m})},`tab-${l}`))}),s.jsxs("div",{className:S("tabs-wrapper",t),children:[s.jsx("ul",{className:"tabs",role:"tablist",children:c}),s.jsx("div",{className:"tab-content",children:a})]})};const ea={"2-1":901,"1-3":769},ds=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Be(!0);let i=r;return _.Children.count(r)===1&&(i=_.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:_.Children.map(i,(c,a)=>t!==!1&&a===t&&o&&o<ea[e]?null:c)})},ta=({activeLink:e,...t})=>s.jsx(Ke,{children:s.jsx(ds,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(us,{activeLink:e}),s.jsx(rs,{...t})]})})});const At="cookieBanner_",It=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Lt=new Date(Date.now()+12*30*24*60*60*1e3),ms=()=>{const e=C.useIntl(),[t,n,r]=In.useCookies(It),[o,i]=_.useState(!t["apol-cookie-banner"]),c=()=>{It.forEach(m=>{n(m,!0,{path:"/",expires:Lt,domain:m==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Lt}),It.forEach(m=>{if(m==="apol-cookie-banner"){n(m,!0,{path:"/",expires:Lt});return}r(m)}),i(!1)};if(!o)return null;const d=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:c,gtmType:"accepted-all"}],l=[];return d.forEach(m=>{l.push({variant:m.href?"tertiary":"primary",href:m.href,onClick:m.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${m.gtmType}-click`,children:e.formatMessage({id:`${At}buttons_${m.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${At}title`})}),s.jsx("p",{children:e.formatMessage({id:`${At}text`})}),s.jsx(Xe,{buttons:l})]})},$e={platform:{order:["events","courses","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-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:Ae["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ae["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Ae.support,gtmType:"concierge-email-click"},business:{email:Ae.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Ie="footer_",xt="SiteFooter",Cn=({group:e})=>{const t=$e[e].order||[];let n=!1;return"text"in $e[e]&&(n=$e[e].text),s.jsxs(_.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:o,gtmType:i}=$e[e][r],c={};return["legal"].includes(e)&&(c.target="_blank",c.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":i,...c,children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},an=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(Gt,{element:"hr"}),s.jsx(rn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(Cn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(Cn,{group:$e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray($e.social.order)&&$e.social.order.map(e=>{const t=$e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":xt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(C.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(C.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ut="emailHelperTextBox_",na=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=C.useIntl(),[i,c]=_.useState({path:`${ut}default`,type:"default",link:{},mail:{},error:""}),[a,d]=_.useState(!1),l=_.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=k=>{c({path:`${ut}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>l(w),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:k})};if(typeof r!="function"){g(o.formatMessage({id:`${ut}error_noFunction`}));return}d(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(k=>{g(k.message)}).finally(()=>{d(!1)})},[t,n,r]);_.useEffect(()=>{let h=ut,g="default",k={},w={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",k={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",k={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>l(E),"data-testid":"send-verify-email-click"};break;case"exists":h+="emailAlreadyExists",g="error",k={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",k={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}c({...i,path:h,type:g,link:k,mail:w})},[e]);const m={};return["link","mail"].forEach(h=>{m[h]=Object.keys(i[h]).length?g=>s.jsx("a",{...i[h],children:g}):g=>g}),s.jsx(ns,{type:i.type,heading:a?!1:o.formatMessage({id:`${i.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(we,{element:"span"}),s.jsx(we,{element:"span"})]}):o.formatMessage({id:`${i.path}_text`},{...m,strong:h=>s.jsx("strong",{children:h}),em:h=>s.jsx("em",{children:h}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const dt="passwordRules_",fs="isMoreThanEightCharacters",hs="includesNumberAndSymbol",ps="includesLowerAndUppercase",sa={[fs]:"8Characters",[hs]:"numberSymbol",[ps]:"lowercaseUppercase"},ra=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=C.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${dt}intro`})}),s.jsx("ul",{children:[fs,hs,ps].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(se,{children:[n.formatMessage({id:`${dt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${dt}rule_${sa[r]}`})}),!e[r]&&s.jsxs(se,{element:"strong",children:[" "," ",n.formatMessage({id:`${dt}notMet`})]})]},`rule-${r}`))})]})},aa=_.memo(ra);const oa=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:i="",hasLoaded:c=!1})=>{const a=C.useIntl(),[d,l]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),m=async()=>{try{const E=await n();l(b=>({...b,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){l(b=>({...b,setUp:!0,disabled:!0})),o(E)}};if(_.useEffect(()=>{c&&!d.setUp&&m()},[c]),!c)return s.jsx(we,{className:"rating-placeholder"});const{id:u,rating:p,disabled:h}=d,g="ratings_",k={text:a.formatMessage({id:`${g}text`}),low:a.formatMessage({id:`${g}low`}),high:a.formatMessage({id:`${g}high`}),success:a.formatMessage({id:`${g}success`}),...e},w=async E=>{if(!(!u||h))try{l(b=>({...b,rating:E,disabled:!0})),await r({id:u,value:E})}catch(b){l(x=>({...x,rating:null})),o(b)}finally{l(b=>({...b,disabled:!1}))}};return s.jsxs("div",{className:S("rating",i),children:[s.jsx("span",{className:"label",children:k[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const b=E+1;return s.jsx("li",{className:S({selected:p&&b<=p}),children:s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:`star${!p||b>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:b,total:t})}${b===1||b===t?` - ${k[b===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),w(b)},disabled:h})},`rating-${b}`)})})]})};const gs=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:c=!0,isDesktopVersion:a=!1}=n||{},d=C.useIntl(),l=_.useRef(null);De(()=>{!n||a||!c||l.current&&l.current.focus()},[c]);const m=u=>{u.preventDefault(),u.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return s.jsx("form",{onSubmit:m,className:S("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!c:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(se,{element:"label",htmlFor:e,children:d.formatMessage({id:"search_label"})}),s.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:d.formatMessage({id:"search_placeholder"}),onKeyDown:u=>{u.key==="Enter"&&m(u)}}),s.jsx("button",{className:"clear",onClick:u=>{u.preventDefault(),u.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:s.jsx(se,{children:d.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:m,children:s.jsx(se,{children:d.formatMessage({id:"search_cta"})})})]})})})};const _s=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:o,backgroundColor:i,onClose:c,reportError:a,sendInvites:d,initialFormStatus:l="NOT_SUBMITTED"})=>{const[m,u]=_.useState([]),[p,h]=_.useState(!0),[g,k]=_.useState(l),{formatMessage:w}=C.useIntl(),E=async T=>{T.preventDefault();try{await d(m),u([]),k("SUCCESS")}catch(D){k("ERROR"),a(D)}},b=T=>{T.preventDefault(),k("NOT_SUBMITTED"),h(!0),u([])},x=T=>{T.preventDefault(),c(),k("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:g==="SUCCESS"?s.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),s.jsx(Te,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"secondary",onClick:b,children:w({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(H,{onClick:x,children:w({id:"inviteForm_ctaDone"})})]}):s.jsx(H,{onClick:b,children:w({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:o},children:t}),s.jsx(Us.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:m,onChange:T=>{u(T),h(!T.length)},autoFocus:!1,getLabel:(T,D,R)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:T}),s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{R(D),h(!m.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},D)})]}),s.jsx(Te,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(H,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Q={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const c=`logged${e?"In":"Out"}`;return t>=n[i][c]};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&&Q.handlerCalled[e]&&o-Q.handlerCalled[e]<500)return;Q.handlerCalled[e]=o;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(c=>{c===e||n[c]===!1||i.push({type:`menus.${c}`,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=Ln(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?Q.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 c,a;switch(e){case"navigation":if(n){const d=Q.findFirstChild(t.current.children,"attributes.aria-controls","navigation");c=Q.findFirstChild(d.children,"href")}else c=Q.findFirstChild(t.current.children,"href");c||(c=t.current);break;case"account":if(a=Q.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;c=Q.findFirstChild(a.children,"href");break;default:return}c&&(o([{type:`focusElements.${e}.${i}`,value:c}]),c.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Q.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Q.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Q.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Q.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},qe={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},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"}}}},bt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:i=null})=>{const c=C.useIntl(),a=Ln(qe,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const d="doTrack"in a,l=i===null?d?a.doTrack:!0:i,m=e.includes("buttons.");let u=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(u+=`_logged${t?"In":"Out"}`);let p=!1;if(a.href){let b=a.gtmType||`${e}-click`;if(b.includes(".")){const x=b.split("."),T=x[x.length-2];b=`${T==="topics"?`${T}-`:""}${x[x.length-1]}`}p={href:a.href,role:"menuitem"},l&&(p={...p,className:"gtm-trackable","data-gtm-event-type":b,"data-gtm-event-context":"HeaderButtons"}),m&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const h=a.order&&a.order[0]&&a[a.order[0]],g=h&&a[a.order[0]].order,k=p&&window.location.pathname===a.href;let w={},E={};if(h){const b=a.menuId||e,x={onClick:T=>Q.events.onClick(T,{id:b,callback:o,isOpen:r[b]}),onFocus:()=>Q.events.onFocus({id:b}),onBlur:()=>Q.events.onBlur({id:b,callback:o}),onMouseLeave:()=>Q.events.onBlur({id:b,callback:o}),onMouseEnter:()=>Q.events.onMouseEnter({id:b,callback:o})};n&&(g&&(w={...x,onKeyPress:T=>{T.key==="Enter"&&Q.events.onClick(T,{id:b,callback:o,isOpen:r[b]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[b],"aria-controls":b}),E={hidden:b in r?!r[b]:!0}),g||(E={...E,...x})}return s.jsxs("li",{className:S({[a.className]:a.className,"has-submenu":h,parent:g,active:k}),role:"none",...w,children:[p?_.createElement(m?H:"a",p,c.formatMessage({id:u})):c.formatMessage({id:u}),a.order&&s.jsx("ul",{...E,children:a.order.map(b=>{if(!a[b])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:d?l:null};return a[b].order?s.jsxs("li",{className:S({[a[b].className]:a[b].className}),children:[c.formatMessage({id:`${u}_${b}`}),s.jsx("ul",{children:a[b].order.map(T=>s.jsx(bt,{id:`${e}.${b}.${T}`,...x},T))})]},b):s.jsx(bt,{id:`${e}.${b}`,...x},b)})})]},e)};const ia={height:67,height_desktop:83},on=({showNavigation:e=!0})=>{const t=C.useIntl(),n=_.useContext(ke),r=Be(!0,!0),o=n&&typeof n.id=="string",i=_.useMemo(()=>Q.getIsDesktopVersion(o,r),[o,r]),[c,a]=_.useReducer(lr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:d,menus:l,focusElements:m}=c;Qn({scrollPosition:ia[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&l.navigation||Q.shouldChangeHeaderIsVisible(!0,l,a)},scrollDown:()=>{!i&&l.navigation||Q.shouldChangeHeaderIsVisible(!1,l,a)}}});const u=(h,g)=>{Q.handleMenus({id:h,value:g,menus:l,dispatch:a})},p=_.useRef(null);return De(()=>{l.navigation&&Q.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:m,dispatch:a})},[l.navigation]),De(()=>{l.account&&Q.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:m,dispatch:a})},[l.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":o,"logged-out":!o,visible:d}),children:[s.jsx(se,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(rn,{}),e&&s.jsxs(s.Fragment,{children:[!i.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.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:s.jsx(se,{children:t.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!i.navigation&&l.account?"account":"default",children:qe.order.map(h=>s.jsx(bt,{id:h,isLoggedIn:o,isDesktopVersion:i.navigation,menus:{navigation:l.navigation,account:l.account},callback:u},h))}),!i.search&&s.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),u("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:s.jsx(se,{children:t.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),s.jsx(gs,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),o?s.jsxs("button",{className:"account-button",onClick:h=>Q.events.onClick(h,{id:"account",callback:u,isOpen:l.account}),onMouseEnter:()=>Q.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>Q.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[s.jsx(se,{children:t.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),s.jsx(Oe,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:qe.buttons.order.map(h=>s.jsx(bt,{id:`buttons.${h}`},h))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:l.navigation||l.account||!i.search&&l.search})})]})};const ln=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const cn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:o=()=>{},onClose:i=()=>{}}={},forceShow:{error:c=!1}={},title:a,children:d,buttons:l,className:m="",gtmContext:u="Modal"})=>{const p=C.useIntl(),[h,g]=_.useState(t),k=E=>{g(E),E?(o(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{k(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:h}),children:s.jsx(ln,{id:e,className:S("overlay-modal",m,{"has-max-width":r}),hidden:!h,style:w,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>k(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":u,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Te,{}),d,l&&s.jsxs("div",{className:"bottom",children:[s.jsx(Te,{}),s.jsx(Xe,{buttons:l})]}),c&&s.jsx(gt,{className:"error",children:c})]})})})},xs=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const la=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:o="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:c,onClose:a,reportError:d=()=>{},sendInvites:l})=>s.jsx(cn,{title:n,isOpen:t,showDivider:!1,showIcon:c,functions:{onClose:a},className:S("invite-modal",e,{success:!!n}),children:s.jsx(_s,{title:r,label:o,ctaMessage:i,onClose:a,sendInvites:l,reportError:d})});const ca=()=>{const e=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(on,{}),s.jsx("div",{id:"content",children:s.jsx(et,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(an,{})]})},bs=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:o={},styling:i={},className:c="",locale:a="en"})=>{const{navigation:d=!0,footer:l=!0}=o,{background:m="default",variant:u="default",circle:p="default"}=i,h=On();_.useEffect(()=>{window.scrollTo(0,0)},[h]);const g=pt(e,{locale:a}),k=pt(t,{locale:a}),w=pt(n,{locale:a}),E={};return m!=="default"&&(E[m]=!0),u!=="default"&&(E[u]=!0),p!=="default"&&(E[p]=!0),s.jsx(Ws.ErrorBoundary,{onError:r,fallback:s.jsx(ca,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:S(c,E,{"has-footer":l}),children:[s.jsx(on,{showNavigation:d}),s.jsxs("section",{id:"content-wrapper",children:[k&&s.jsx("div",{className:"additional-content prepended",children:k}),_.createElement(m==="bold"?ln:"div",{id:"content",children:g})]}),w&&s.jsx("div",{className:"additional-content appended",children:w}),l&&s.jsx(an,{}),s.jsx(ms,{})]})})})},Nn={default:"tags_",headerTopics:"header_topics_topics_"},Bt={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"},ua={getTagDetails:e=>{if(e.includes("topic_")){if(e=Bt.topic[e.replace("topic_","")],e){const t=qe.topics.topics[e].href;return t?{id:e,href:t,text:`${Nn.headerTopics}${e}`}:null}return null}return Bt[e]?(e=Bt[e],{id:e,text:`${Nn.default}${e}`}):null}};const da=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:i="tag-click",gtmContext:c="tags"})=>{const a=C.useIntl();if(!e||e.length<1)return null;const d=[];return e.forEach(l=>{if(!l)return;const m=ua.getTagDetails(l);m&&d.push(m)}),d.length<1?null:s.jsx("ul",{className:S("tags text-small",t,o,{"one-line":n}),children:d.map(l=>{const m=a.formatMessage({id:l.text});return s.jsx("li",{children:l.href&&r?s.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":c,children:m}):m},l.id)})})};const ma=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:o="member",gtmType:i="member-click",className:c=""})=>{const a=C.useIntl();return e.length===0?null:s.jsxs("div",{className:S("members-list",c),children:[s.jsxs("h1",{children:[a.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:t})]}),s.jsx("ul",{children:e.map((d,l)=>s.jsxs("li",{children:[s.jsx(kt,{member:d,gtmContext:o,gtmType:i}),d.isAdmin&&s.jsx(Je,{children:a.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(sn,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:o})]})};let mt=null;const fe="discussion_form_",un=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:o=5e4,minRows:i=4,forceShow:c={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:d="DiscussionForm"})=>{var $,N;const l=C.useIntl(),m=_.useContext(ke),[u,p]=_.useState(n.isEditing&&n.isEditing.text||""),[h,g]=_.useState(c.error||!1),[k,w]=_.useState(!1),E=_.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(we,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=v=>{const z=v.target.value;p(z);let j;!m||!m.id?j=ye(l.formatMessage,`${fe}error_loggedOut`,e.type,"action"):t?z.length>=o&&(j=`${fe}error_tooLong`):j=ye(l.formatMessage,`${fe}error_noPermission`,e.type,"action"),j?g(j):h&&g(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const v=e.type==="response"?(($=e.slugs)==null?void 0:$.question)||"":((N=e.slugs)==null?void 0:N.answer)||"";v&&(x=`${x}-${v.slice(-15)}`)}const T=async v=>{var j;if(v.preventDefault(),v.stopPropagation(),!m||!m.id||!t||R)return;mt&&clearTimeout(mt),w("submitting");const z=window.location.pathname;try{let I;switch(e.type){case"post":I=await a.create({content:u});break;case"question":I=await a.create({title:u,authorId:m&&m.id,...(j=a.props)==null?void 0:j.create});break;case"response":I=await a.create({question:e.slugs.question},{body:u,authorId:m&&m.id,contentPath:z});break;case"reply":I=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:u,authorId:m&&m.id,contentPath:z});break;default:break}await cr(1e3),a.callback&&await a.callback(I),mt=setTimeout(()=>{p(""),w("submitted"),D()},500)}catch(I){const G=I;let J=`${fe}error`;G.message.includes("entry already exists")&&(J=ye(l.formatMessage,`${fe}error_alreadyExists`,e.type,"action")),G.message.includes("429")?J=ye(l.formatMessage,`${fe}error_tooMany`,e.type,"action"):G.message.includes("400")&&(J=`${fe}error`),g(J),D()}},D=()=>{mt=setTimeout(()=>{g(!1),w(!1)},5e3)},R=!u||!ir(u),V=k==="submitting",F=[];return(n.isEditing&&!V||c.cancel)&&F.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!c.cancel&&(!m||!m.id||!u),children:l.formatMessage({id:`${fe}cancel`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:v=>{if(n.isEditing){w("submitting"),a.handleSaveEdit&&a.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}T(v)},className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!t||R||V||n.isEditing&&u===n.isEditing.text,children:l.formatMessage({id:`${fe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:x,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ye(l.formatMessage,`${fe}title`,e.type,"action")}),s.jsx(kt,{member:m||"community",gtmContext:d,gtmType:"profile-click"}),s.jsx(se,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:ye(l.formatMessage,`${fe}label`,e.type,"action")}),s.jsx(zs,{ref:r,id:`${x}-input`,name:e.type,placeholder:ye(l.formatMessage,`${fe}placeholder`,e.type,"action"),onChange:b,value:u,maxLength:o,"aria-invalid":!!h,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(l.formatMessage,`${fe}explainer`,e.type,"action",{a:v=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:v})})}),s.jsx(Xe,{buttons:F}),k==="submitted"&&s.jsx(gt,{className:"success","data-testid":"success",children:ye(l.formatMessage,`${fe}success`,e.type,"action")}),h&&s.jsx(gt,{id:"error-message",className:"error","data-testid":"error",children:c.error?c.error:typeof h=="string"?h.includes(" ")?h:l.formatMessage({id:h},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:o}):h})]})},jt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:o,leave:i,notMemberStateText:c}})=>r&&!n?s.jsx(et,{text:c,button:{breakpoints:{mobile:!0,901:!1},component:s.jsx(nn,{isShort:!0,functions:{join:o,leave:i}})}}):s.jsx(un,{content:{type:e,slugs:{}},functions:{create:t}}),fa={showThread:!1,showForm:!1},tt=_.createContext(fa),vs=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(tt.Provider,{value:{...t,updateConversation:n},children:e})},ha=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),pa=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ye=!1;const Ot=()=>{Ye!==!1&&(clearTimeout(Ye),Ye=!1)},Ht=5,ws=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:o=!1,content:i={type:"reply",slugs:{}},canLike:c=!0,functions:{createLike:a=()=>{},deleteLike:d=()=>{}}={}})=>{const l=C.useIntl();_.useEffect(()=>{h(o)},[o]);const[m,u]=_.useState(t),[p,h]=_.useState(o),[g,k]=_.useState(!1),[w,E]=_.useState(!1),b=_.useMemo(()=>pa(n,Ht),[n]),x=D=>{if(D.preventDefault(),D.stopPropagation(),E(!1),Ye)return Ot(),!1;if(Ot(),g||!c)return!1;Ye=setTimeout(T,350)},T=async()=>{if(Ot(),g||!c)return!1;let D=p?m-1:m+1;D<0&&(D=0),k(!0),u(D),h(!p);try{if(i&&i.slugs){const R=ha(i.slugs);p?await d(R):await a(R,{contentPath:window.location.pathname})}}catch{u(t),h(o)}finally{k(!1)}};return _.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!c}),onClick:x,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!o}),screenreaderText:c?l.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:l.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:x,disabled:!c,"aria-hidden":!c,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":m===0}),"data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})}),n&&s.jsx(Jn,{isOpen:w,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[b.map(D=>typeof D=="string"||!D.name?null:s.jsx("li",{children:s.jsx(Ze,{href:D.id?`/profiles/${D.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:R=>R==null?void 0:R.stopPropagation(),children:D.name})},D.id||window.btoa(D.name))),n.length>Ht&&s.jsx("li",{children:l.formatMessage({id:"discussion_likes_more"},{number:n.length-Ht})})]})})]})})},Pn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},dn=(e,t)=>e&&!t;const Se="discussion_",ga=280,nt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:o,functions:{content:{createContent:i,deleteContent:c,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:d,deleteLike:l}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:u={},className:p,gtmContext:h="DiscussionAnswer",children:g,isTruncated:k=!1})=>{const w=C.useIntl(),E=_.useContext(ke),b=_.useContext(tt),[x,T]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[D,R]=_.useState(!1),[V,F]=_.useState("");if(_.useEffect(()=>{T({...x,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(we,{className:"discussion-card discussion-post"});const{author:$,canLike:N,createdAt:v,id:z,likes:j=0,userLiked:I,comments:G=0}=t,J=k?Le(x.body,ga):x.body,oe=E&&E.id&&typeof $!="string"&&$.id&&$.id===E.id||!1,ie=typeof N=="boolean"?N:n?!oe:!1,le=async L=>{L||(L=""),F("");try{if(!Vs(L,x.body)){const ce=t.type==="question"?{title:L}:{body:L};await a(Pn(t.slugs),ce)}T({body:L,isEditing:!1,didEdit:!0})}catch{F(`${Se}form_error`)}},Y=()=>{b&&b.updateConversation&&b.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ce=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,he=document.getElementById(ce),ue=document.getElementById(`${ce}-input`);ue&&ue.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},te=()=>{R(!1);try{c(Pn(t.slugs))}catch{F("delete-error")}},re=[{text:w.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${Se}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&oe&&re.push({text:w.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>T({...x,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${Se}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`delete-${t.type}-click`,...xs(`delete-${t.slug}-modal`,D)}),_.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:z||t.slug,className:S("discussion-card",t.type,{editing:x.isEditing,"has-link":u.post&&!x.isEditing}),onClick:L=>{!u.post||x.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=u.post)},children:[!x.isEditing&&s.jsx(kt,{member:$,additionalContent:{createdAt:v,didEdit:x.didEdit},className:typeof $!="string"&&$.id===o?"highlighted":"",gtmContext:h,gtmType:"profile-click"}),x.isEditing?s.jsx(un,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:x.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?w.formatMessage({id:V},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:le,handleCancel:()=>{F(""),T({...x,isEditing:!1})}},gtmContext:`${h}Form`}):u.post?s.jsx("a",{href:u.post,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":"title-click",children:s.jsx(Vt,{options:{overrides:{a:ss}},children:J})}):s.jsx(Vt,{options:{wrapper:t.type==="question"?"h1":_.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!x.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(ws,{element:"li",likes:j,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:ie,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:d,deleteLike:l}}),(["question","post"].includes(t.type)||u.comments||typeof m=="function")&&s.jsxs("li",{className:"action-button",onClick:L=>{L.preventDefault(),L.stopPropagation(),u.comments&&(window.location.href=u.comments),typeof m=="function"&&m()},children:[s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:u.comments?u.comments:!1,onClick:u.comments||typeof m!="function"?!1:m,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${Se}comments_screenReader`},{count:G})}),s.jsx("span",{children:w.formatMessage({id:`${Se}comments`},{count:G})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:Y,children:w.formatMessage({id:`${Se}reply`})})}),s.jsx(cs,{element:"li",id:`more-${t.slug}`,options:re})]})]}),g,s.jsx(cn,{id:`delete-${t.slug}-modal`,isOpen:D,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:V==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:te,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(C.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>s.jsx("p",{children:L}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Qt="discussion_responses_",_a=({type:e="answer",responses:t=0})=>{const n=C.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Qt}title`},{action:n.formatMessage({id:`${Qt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Qt}empty`,e,e)})]})};const ks=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=C.useIntl(),o=_.useRef(null),i=_.useContext(tt),[c,a]=_.useState("closed");_.useEffect(()=>{const u=o.current;if(u)return u.addEventListener("transitionend",d),()=>{u.removeEventListener("transitionend",d)}},[]),De(()=>{c==="closed"&&!i.showThread||a(["opening","open"].includes(c)?"ready-to-close":"opening")},[i.showThread]),_.useEffect(()=>{c==="ready-to-close"&&a("closing")},[c]);const d=({propertyName:u})=>{u==="max-height"&&a(p=>p==="opening"?"open":p==="closing"?"closed":p)},l=["opening","open"].includes(c),m=pt(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(H,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${l?"left":"right"}`},onClick:()=>{var u;(u=i.updateConversation)==null||u.call(i,p=>({showThread:!p.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${l?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:o,className:S("thread",c),hidden:!i.showThread,children:m})]})};function xa({queryClient:e,queryKey:t}){function n(r,o,i){e.setQueryData(t,i)}return n}function ba({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return e.setQueryData(t,r),o}return n}function va(e){const{id:t="",name:n="",organization:r="",jobTitle:o="",image:i={}}=e,{thumbnail:c=""}=i;return{actor:{id:t,data:{name:n,organization:r,jobTitle:o,thumbnail:c}}}}function wa(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Dn({activity:e,user:t}){const n={...e,...va(t),...wa()};return n.id?n:{...n,id:"00000000-0000-0000-0000-000000000000",time:new Date().toISOString(),verb:"post"}}function Rn({activity:e,reaction:t}){const{latest_reactions:n,own_reactions:r,reaction_counts:o}=e;n&&t&&(n.like=[...n.like||[],t]),r&&t&&(r.like=[...r.like||[],t]),o&&(o.like=o.like+1||1)}function ka({activity:e,user:t}){const{latest_reactions:n,own_reactions:r,reaction_counts:o}=e;o&&(o.like=o.like-1||0),n&&(t!=null&&t.id)&&(n.like=n.like.filter(({user_id:i})=>i!==t.id)),r&&(t!=null&&t.id)&&(r.like=r.like.filter(({user_id:i})=>i!==t.id))}function Fn(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function vt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:o})=>o===e);if(r)return r}}function ja(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:o})=>o===e);if(r!==-1){n.splice(r,1);break}}return t}function ya(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}function Ea({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:o,user:i}){const{mutate:c}=W.useMutation({mutationFn:e,onMutate:a=>t(d=>{const l=Dn({activity:a,user:i});return Fn(l,d)}),onError:n,onSuccess:(a,d,l)=>{const m=Dn({activity:a,user:i});r.setQueryData(o,Fn(m,l,!0))}});return c}function Sa({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=W.useMutation({mutationFn:e,onMutate:({activityId:o,body:i})=>t(c=>{const a=vt(o,c);return a&&(a.content=i),c}),onError:n});return r}function $a({queryFns:{create:e,edit:t,like:n,list:r,remove:o,unlike:i},queryKey:c}){const a=W.useQueryClient(),d=Kn(),l={queryClient:a,queryKey:c},m={mutationHandlers:{error:xa(l),mutate:ba(l)},user:d,...l},u=Ea({...m,mutationFn:e}),p=Sa({...m,mutationFn:t}),h=Ma({...m,mutationFn:n}),g=Ca({...m,mutationFn:o}),k=Na({...m,mutationFn:i}),{activities:w,...E}=Ta({queryKey:c,queryFn:r});return{activities:w,mutations:{create:u,edit:p,remove:g,like:h,unlike:k},user:d,...E}}function Ma({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:o}){const{mutate:i}=W.useMutation({mutationFn:e,onMutate:({activityId:c})=>t(a=>{const d=vt(c,a);return d&&Rn({activity:d}),a}),onError:n,onSuccess:(c,{activityId:a},d)=>{const l=vt(a,d);l&&Rn({activity:l,reaction:c}),r.setQueryData(o,d)}});return i}function Ta({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:o,hasNextPage:i,fetchNextPage:c}=W.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:a=>a==null?void 0:a.next});return{activities:ya(n),error:r,isLoading:o,hasNextPage:i,fetchNextPage:c}}function Ca({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=W.useMutation({mutationFn:e,onMutate:({activityId:o})=>t(i=>ja(o,i)),onError:n});return r}function Na({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:o}=W.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(c=>{const a=vt(i,c);return a&&ka({activity:a,user:r}),c}),onError:n});return o}const Pa=({basePath:e,parentId:t,isMember:n,functions:{join:r,leave:o,...i}})=>{const c=C.useIntl(),{activities:a,error:d,fetchNextPage:l,hasNextPage:m,isLoading:u,mutations:{create:p,edit:h,remove:g,like:k,unlike:w},user:E}=$a({queryKey:[e,t],queryFns:i});return d?s.jsx(et,{variant:"error",text:d.message}):s.jsxs("section",{children:[s.jsx(jt,{contentType:"post",createPost:p,membershipRequiredToPost:{isMember:n,required:!0,join:r,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),a==null?void 0:a.map(b=>{var v,z,j,I,G,J,oe,ie,le;const{own_reactions:x,latest_reactions:T}=b,D=(((v=T==null?void 0:T.like)==null?void 0:v.length)||0)>0,R=(((z=x==null?void 0:x.like)==null?void 0:z.length)||0)>0,V=R?x==null?void 0:x.like[0].id:null,F=D?(j=T==null?void 0:T.like)==null?void 0:j.map(Y=>{var te,re,L;return{id:(te=Y==null?void 0:Y.user)==null?void 0:te.id,name:(L=(re=Y==null?void 0:Y.user)==null?void 0:re.data)==null?void 0:L.name}}):!1,$=b==null?void 0:b.actor,N=($==null?void 0:$.id)===(E==null?void 0:E.id);return s.jsxs(_.Fragment,{children:[s.jsx(nt,{content:{type:"post",body:b==null?void 0:b.content,canLike:dn(n,N),createdAt:(b==null?void 0:b.time)||"",slugs:{parentId:t,activityId:b==null?void 0:b.id},slug:b==null?void 0:b.id,author:{id:$==null?void 0:$.id,name:(I=$==null?void 0:$.data)==null?void 0:I.name,organization:(G=$==null?void 0:$.data)==null?void 0:G.organization,jobTitle:(J=$==null?void 0:$.data)==null?void 0:J.jobTitle,image:{thumbnail:((oe=$==null?void 0:$.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:R,likes:((ie=b==null?void 0:b.reaction_counts)==null?void 0:ie.like)||0,comments:((le=b==null?void 0:b.reaction_counts)==null?void 0:le.reply)||0,peopleWhoLiked:F},links:{post:`${e}/${t}/${b==null?void 0:b.id}`,comments:`${e}/${t}/${b==null?void 0:b.id}`},functions:{content:{createContent:()=>null,deleteContent:Y=>g(Y),updateContent:(Y,te)=>h({...Y,...te})},likes:{createLike:()=>k({activityId:b==null?void 0:b.id}),deleteLike:()=>w({activityId:b==null?void 0:b.id,reactionId:V})},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Te,{})]},b==null?void 0:b.id)}),!u&&s.jsx(sn,{hasNextPage:m,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})},Da=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:a=>{var l;const d=e.getQueryData(t);if(d)return(l=d==null?void 0:d.latest_reactions)!=null&&l.reply?(d.latest_reactions.reply.unshift(a),d&&(d.reaction_counts={reply:d.latest_reactions.reply.length})):(d.latest_reactions={reply:[a]},d.reaction_counts={reply:1}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ra=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:c}})=>{var l,m,u;if(c.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>(p.id===i.replySlug&&(p.data.content=c),p));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)}}),Fa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:i})=>{var d,l,m;await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);if(!c||!((d=c==null?void 0:c.latest_reactions)!=null&&d.reply))return;const a=(m=(l=c==null?void 0:c.latest_reactions)==null?void 0:l.reply)==null?void 0:m.filter(u=>u.id!==i);return e.setQueryData(t,()=>({...c,latest_reactions:{reply:a}})),{previousActivity:c}},onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)}}),Aa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c})=>{var l,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),d=(m=(l=a==null?void 0:a.latest_reactions)==null?void 0:l.reply)==null?void 0:m.map(u=>{var p;return u.id===c&&((p=u.children_counts)!=null&&p.like?u.children_counts.like+=1:u.children_counts={like:1}),u});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:c=>{var l;const a=e.getQueryData(t),d=(l=a==null?void 0:a.latest_reactions.reply)==null?void 0:l.map(m=>{var u,p;return m.id===c.id&&((u=m.own_children)!=null&&u.like?m.own_children.like.push(c):m.own_children={like:[c]},(p=m.latest_children)!=null&&p.like?m.latest_children.like.push(c):m.latest_children={like:[c]}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Ia=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d)return;const l=(m=d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a&&u.children_counts.like&&(u.children_counts.like-=1),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(a,{replyId:d})=>{var u;const l=e.getQueryData(t);if(!l)return;const m=(u=l.latest_reactions.reply)==null?void 0:u.map(p=>{var h,g,k;if(p.id===d){let w=(h=p.latest_children.reply)==null?void 0:h.filter(E=>E.user_id!==(n==null?void 0:n.id));return w=(k=(g=p==null?void 0:p.own_children)==null?void 0:g.reply)==null?void 0:k.filter(E=>E.user_id!==(n==null?void 0:n.id)),w}return p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}}}),La=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var m;const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a.parent&&(u.latest_children.reply&&u.children_counts.reply?(u.latest_children.reply.push(a),u.children_counts.reply+=1):(u.latest_children.reply=[a],u.children_counts.reply=1)),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ba=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:i,content:{body:c}})=>{var l,m,u;if(c.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h;return p.id===i.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>(g.id===i.replySlug&&(g.data.content=c),g))),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Oa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,c,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:i,replyParentId:c})=>{var l,m,u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((l=a==null?void 0:a.latest_reactions)!=null&&l.reply))return;const d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h,g;return p.id===c&&(p.latest_children.reply=(h=p.latest_children.reply)==null?void 0:h.filter(k=>k.id!==i),(g=p.children_counts)!=null&&g.reply&&(p.children_counts.reply-=1)),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),Ha=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c,replyParentId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a&&((p=u.latest_children.reply)==null||p.map(h=>{var g;return h.id===c&&((g=h.children_counts)!=null&&g.like?h.children_counts.like+=1:h.children_counts={like:1}),h})),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:(c,a)=>{var m;const d=e.getQueryData(t),l=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a.replyParentId&&((p=u.latest_children.reply)==null||p.map(h=>(h.id===a.replyId&&(h.latest_children=h.latest_children||{},h.own_children=h.own_children||{},h.latest_children.like=h.latest_children.like||[],h.own_children.like=h.own_children.like||[],h.latest_children.like.push(c),h.own_children.like.push(c)),h))),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:l}})),{previousActivity:d}}}),Qa=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:d})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),m=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d&&((h=p.latest_children.reply)==null||h.map(g=>{var k;return g.id===a&&((k=g.children_counts)!=null&&k.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(a,d)=>{var u;const l=e.getQueryData(t),m=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>{var k,w;return g.id===d.replyId&&((k=g.own_children)!=null&&k.like&&(g.own_children.like=g.own_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id))),(w=g.latest_children)!=null&&w.like&&(g.latest_children.like=g.latest_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id)))),g})),p});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}}}),Ua=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:o,replies:i,functions:{create:c,edit:a,remove:d,join:l,leave:m,like:u,unlike:p}})=>{const h=C.useIntl(),g=W.useQueryClient(),k=_.useContext(ke),w=_.useContext(tt),E=La({queryClient:g,queryKey:[e,t,r],mutationFn:async j=>c({replyId:n,content:j.body})}),{mutate:b}=W.useMutation(E),x=Ba({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:T}=W.useMutation(x),D=Oa({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:j})=>d({replyId:j})}),{mutate:R}=W.useMutation(D),V=Ha({queryClient:g,queryKey:[e,t,r],mutationFn:u}),{mutate:F}=W.useMutation(V),$=Qa({queryClient:g,queryKey:[e,t,r],user:k,mutationFn:p}),{mutate:N}=W.useMutation($),v=_.useCallback(({replyId:j,replyParentId:I})=>F({replyId:j,replyParentId:I}),[F]),z=_.useCallback(({replyId:j,replyParentId:I})=>N({replyId:j,replyParentId:I}),[N]);return s.jsx(ks,{count:o,showRepliesButton:o>0||w.showForm,children:s.jsxs(s.Fragment,{children:[w.showForm&&s.jsx(jt,{contentType:"reply",createPost:(j,I)=>b(I),membershipRequiredToPost:{isMember:!0,required:!0,join:l,leave:m,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(i==null?void 0:i.length)===0||(i==null?void 0:i.map(j=>{var I,G,J,oe,ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge;return s.jsx(nt,{content:{type:"reply",body:typeof j.data.content=="string"?(I=j==null?void 0:j.data)==null?void 0:I.content:((J=(G=j==null?void 0:j.data)==null?void 0:G.content)==null?void 0:J.text)||"",createdAt:j==null?void 0:j.created_at,slugs:{parentId:t,activityId:r,replyParentId:j==null?void 0:j.parent,reply:j==null?void 0:j.id},slug:"",author:{id:(oe=j==null?void 0:j.user)==null?void 0:oe.id,name:(le=(ie=j==null?void 0:j.user)==null?void 0:ie.data)==null?void 0:le.name,organization:(te=(Y=j==null?void 0:j.user)==null?void 0:Y.data)==null?void 0:te.organization,jobTitle:(L=(re=j==null?void 0:j.user)==null?void 0:re.data)==null?void 0:L.jobTitle,image:{thumbnail:((he=(ce=j==null?void 0:j.user)==null?void 0:ce.data)==null?void 0:he.thumbnail)||void 0}},userLiked:((ue=j==null?void 0:j.own_children)==null?void 0:ue.like)&&((xe=j==null?void 0:j.own_children)==null?void 0:xe.like.length)>0,likes:((pe=j==null?void 0:j.children_counts)==null?void 0:pe.like)||0,peopleWhoLiked:((be=j==null?void 0:j.latest_children)==null?void 0:be.like)&&((ge=j==null?void 0:j.latest_children)==null?void 0:ge.like.map(X=>{var ne,de;return{id:X==null?void 0:X.user_id,name:(de=(ne=X==null?void 0:X.user)==null?void 0:ne.data)==null?void 0:de.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:X=>{const{replySlug:ne,replyParentId:de}=X;return R({replyId:ne,replyParentId:de})},updateContent:(X,ne)=>T({replyInfo:X,content:ne})},likes:{createLike:()=>v({replyId:j==null?void 0:j.id,replyParentId:j==null?void 0:j.parent}),deleteLike:()=>{var ne,de,Z;const X=((ne=j==null?void 0:j.own_children)==null?void 0:ne.like)&&((Z=(de=j==null?void 0:j.own_children)==null?void 0:de.like[0])==null?void 0:Z.id);return z({replyId:X||""})}},comments:{}}},j==null?void 0:j.id)}))]})})},js=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:o,functions:{create:i,edit:c,remove:a,like:d,unlike:l,join:m,leave:u}})=>{const p=C.useIntl(),h=W.useQueryClient(),g=_.useContext(ke),k=Da({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>i({activityId:n,content:v.body})}),{mutate:w}=W.useMutation(k),E=Ra({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>c(v)}),{mutate:b}=W.useMutation(E),x=Fa({queryClient:h,queryKey:[e,t,n],mutationFn:async({replyId:v})=>a({replyId:v})}),{mutate:T}=W.useMutation(x),D=Aa({queryClient:h,queryKey:[e,t,n],mutationFn:d}),{mutate:R}=W.useMutation(D),V=Ia({queryClient:h,queryKey:[e,t,n],user:g,mutationFn:l}),{mutate:F}=W.useMutation(V),$=_.useCallback(({replyId:v})=>R({replyId:v}),[R]),N=_.useCallback(({replyId:v})=>F({replyId:v}),[F]);return Un(),s.jsxs(s.Fragment,{children:[s.jsx(jt,{contentType:"reply",createPost:(v,z)=>w(z),membershipRequiredToPost:{isMember:o,required:!0,join:m,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(v=>{var I,G,J,oe,ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge,X,ne,de;const z=((I=v==null?void 0:v.user)==null?void 0:I.id)===(g==null?void 0:g.id),j=dn(o,z);return s.jsx(vs,{children:s.jsx(nt,{content:{type:"reply",body:typeof v.data.content=="string"?(G=v==null?void 0:v.data)==null?void 0:G.content:((oe=(J=v==null?void 0:v.data)==null?void 0:J.content)==null?void 0:oe.text)||"",canLike:j,createdAt:v==null?void 0:v.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:v==null?void 0:v.id},slug:v==null?void 0:v.id,author:{id:(ie=v==null?void 0:v.user)==null?void 0:ie.id,name:(Y=(le=v==null?void 0:v.user)==null?void 0:le.data)==null?void 0:Y.name,organization:(re=(te=v==null?void 0:v.user)==null?void 0:te.data)==null?void 0:re.organization,jobTitle:(ce=(L=v==null?void 0:v.user)==null?void 0:L.data)==null?void 0:ce.jobTitle,image:{thumbnail:((ue=(he=v==null?void 0:v.user)==null?void 0:he.data)==null?void 0:ue.thumbnail)||void 0}},userLiked:((xe=v==null?void 0:v.own_children)==null?void 0:xe.like)&&((pe=v==null?void 0:v.own_children)==null?void 0:pe.like.length)>0,likes:((be=v==null?void 0:v.children_counts)==null?void 0:be.like)||0,peopleWhoLiked:((ge=v==null?void 0:v.latest_children)==null?void 0:ge.like)&&((X=v==null?void 0:v.latest_children)==null?void 0:X.like.map(Z=>{var ae,_e;return{id:Z==null?void 0:Z.user_id,name:(_e=(ae=Z==null?void 0:Z.user)==null?void 0:ae.data)==null?void 0:_e.name}}))},functions:{content:{createContent:()=>null,deleteContent:Z=>{const{replySlug:ae}=Z;return T({replyId:ae})},updateContent:(Z,ae)=>b({replyInfo:Z,content:ae})},likes:{createLike:()=>$({replyId:v==null?void 0:v.id}),deleteLike:()=>{var ae,_e,Ce;const Z=((ae=v==null?void 0:v.own_children)==null?void 0:ae.like)&&((Ce=(_e=v==null?void 0:v.own_children)==null?void 0:_e.like[0])==null?void 0:Ce.id);return N({replyId:Z||""})}},comments:{}},children:s.jsx(Ua,{basePath:e,parentId:t,replyParentId:v==null?void 0:v.id,activityId:n,replyCount:((ne=v==null?void 0:v.children_counts)==null?void 0:ne.reply)||0,replies:(de=v==null?void 0:v.latest_children)==null?void 0:de.reply,isMember:o,functions:{create:i,edit:c,remove:a,like:d,unlike:l,join:m,leave:u}})},v==null?void 0:v.id)},v==null?void 0:v.id)}))]})},Wa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:c,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);return d&&d.id===(c==null?void 0:c.activityId)&&(d.content=a),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onError:(c,a,d)=>{e.setQueryData(t,d.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),za=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),Va=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var d;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(d=a==null?void 0:a.reaction_counts)!=null&&d.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,d,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:a=>{const d=e.getQueryData(t);return d!=null&&d.own_reactions.like?d.own_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),d!=null&&d.latest_reactions.like?d.latest_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ya=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:o})=>({mutationFn:o,onMutate:async()=>{var m;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return(m=l==null?void 0:l.reaction_counts)!=null&&m.like&&l.reaction_counts.like>0&&(l.reaction_counts.like-=1),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(l,m,u)=>{e.setQueryData(t,u.previousActivity)},onSuccess:()=>{var u,p,h;if(!r)return;const l=(h=(p=(u=r.own_reactions)==null?void 0:u.like)==null?void 0:p.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:h.id,m=e.getQueryData(t);if(m!=null&&m.own_reactions.like&&(m.own_reactions.like=m.own_reactions.like.filter(g=>g.id!==l),!!(m!=null&&m.latest_reactions.like)))return m.latest_reactions.like=m.latest_reactions.like.filter(g=>g.id!==l),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const Ga=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:o,editActivity:i,removeActivity:c,likeActivity:a,unlikeActivity:d,createReply:l,editReply:m,removeReply:u,likeReply:p,unlikeReply:h,join:g,leave:k}})=>{var ie,le,Y,te,re,L,ce,he,ue,xe,pe,be,ge,X,ne,de,Z,ae,_e,Ce,He,Ne,st;const w=C.useIntl(),E=_.useContext(ke),b=W.useQueryClient(),{data:x,isLoading:T,isFetching:D}=W.useQuery({queryKey:[e,t,n],queryFn:o}),R=Wa({queryClient:b,queryKey:[e,t,n],mutationFn:async K=>await i(K)}),{mutate:V}=W.useMutation(R),F=za({queryClient:b,queryKey:[e,t,n],mutationFn:async({activityId:K})=>c({activityId:K}),redirectUrl:`${e}/${t}`}),{mutate:$}=W.useMutation(F),N=Va({queryClient:b,queryKey:[e,t,n],mutationFn:a}),{mutate:v}=W.useMutation(N),z=Ya({queryClient:b,queryKey:[e,t,n],user:E,mutationFn:async()=>{var je,Pe,rt;const K=(rt=(Pe=(je=x==null?void 0:x.own_reactions)==null?void 0:je.like)==null?void 0:Pe.find(at=>at.user_id===(E==null?void 0:E.id)))==null?void 0:rt.id;await d({activityId:n,reactionId:K})},activity:x}),{mutate:j}=W.useMutation(z),I=_.useCallback(({activityId:K})=>v({activityId:K}),[v]),G=_.useCallback(async({activityId:K})=>j({activityId:K}),[j]);if(T||D)return s.jsx(we,{style:{height:"400px"}});if(!x)return s.jsx(et,{variant:"error",text:w.formatMessage({id:"activitySection_notFoundError"})});const J=((ie=x==null?void 0:x.actor)==null?void 0:ie.id)===(E==null?void 0:E.id),oe=dn(r,J);return s.jsx(nt,{className:"activity-section",content:{type:"post",body:x==null?void 0:x.content,canLike:oe,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:x==null?void 0:x.id},slug:n,author:{id:(le=x==null?void 0:x.actor)==null?void 0:le.id,name:((Y=x==null?void 0:x.actor)==null?void 0:Y.data)&&((re=(te=x==null?void 0:x.actor)==null?void 0:te.data)==null?void 0:re.name),organization:((L=x==null?void 0:x.actor)==null?void 0:L.data)&&((he=(ce=x==null?void 0:x.actor)==null?void 0:ce.data)==null?void 0:he.organization),jobTitle:((ue=x==null?void 0:x.actor)==null?void 0:ue.data)&&((pe=(xe=x==null?void 0:x.actor)==null?void 0:xe.data)==null?void 0:pe.jobTitle),image:{thumbnail:((be=x==null?void 0:x.actor)==null?void 0:be.data)&&((X=(ge=x==null?void 0:x.actor)==null?void 0:ge.data)==null?void 0:X.thumbnail)||void 0}},userLiked:((ne=x==null?void 0:x.own_reactions)==null?void 0:ne.like)&&((de=x==null?void 0:x.own_reactions)==null?void 0:de.like.length)>0,likes:x&&((Z=x==null?void 0:x.reaction_counts)==null?void 0:Z.like),comments:x&&((ae=x==null?void 0:x.reaction_counts)==null?void 0:ae.reply),peopleWhoLiked:((_e=x==null?void 0:x.latest_reactions)==null?void 0:_e.like)&&((Ce=x==null?void 0:x.latest_reactions)==null?void 0:Ce.like.map(K=>{var je,Pe;return{id:K==null?void 0:K.user_id,name:(Pe=(je=K==null?void 0:K.user)==null?void 0:je.data)==null?void 0:Pe.name}}))},originalAuthorId:(He=x==null?void 0:x.actor)==null?void 0:He.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>$({activityId:n}),updateContent:(K,je)=>V({activityInfo:K,content:je})},likes:{createLike:()=>I({activityId:n}),deleteLike:()=>G({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ne=x==null?void 0:x.reaction_counts)==null?void 0:Ne.reply)||0,")"]}),s.jsx(js,{basePath:e,parentId:t,activityId:n,repliesList:(st=x==null?void 0:x.latest_reactions)==null?void 0:st.reply,isMember:r,functions:{create:l,edit:m,remove:u,like:p,unlike:h,join:g,leave:k}})]})},n)},Ja=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:o}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:o}}),An=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ft="notFoundError_",qa=()=>{const e=C.useIntl(),t=[];return An.forEach((n,r)=>{n.title=e.formatMessage({id:`${ft}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(bs,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(Ke,{children:[s.jsx(ls,{cards:An,cardTypes:t,buildCardData:n=>new Promise((r,o)=>{r(n)})}),s.jsx(H,{href:"/solution-articles/",children:e.formatMessage({id:`${ft}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${ft}title`})}),s.jsx("p",{children:e.formatMessage({id:`${ft}text`})})]})};exports.ASSETS_BUCKET=Ge;exports.ActivitiesFeed=Pa;exports.ActivitySection=Ga;exports.AddPost=jt;exports.BannerSection=gr;exports.Breadcrumbs=Wr;exports.Button=H;exports.ButtonWrapper=Xe;exports.CacheProvider=qn;exports.Card=tn;exports.CardBlock=ls;exports.Carousel=Qr;exports.CollapsibleSection=Xt;exports.Columns=ds;exports.CommunityDetails=Ur;exports.Contributors=en;exports.ConversationContext=tt;exports.CookieBanner=ms;exports.DiscussionConversation=vs;exports.DiscussionForm=un;exports.DiscussionLikes=ws;exports.DiscussionPost=nt;exports.DiscussionThread=ks;exports.Divider=Te;exports.DownloadSection=mr;exports.EMAILS=Ae;exports.EmailHelperTextBox=na;exports.EmptyStateBox=et;exports.Filters=zr;exports.FlagsProvider=Xn;exports.Footer=an;exports.FullWidthSection=Ke;exports.GlobalProviders=vr;exports.Header=on;exports.HelperTextBox=ns;exports.HiddenFromScreenReaders=Gt;exports.HideShowTextBox=kr;exports.HighlightedTextBox=Me;exports.IntlProvider=Zn;exports.InviteForm=_s;exports.InviteModal=la;exports.JoinButton=nn;exports.LanguageSwitcher=Yr;exports.Link=Ze;exports.LoadMore=sn;exports.LoadingBlock=Pr;exports.LoadingPlaceholder=we;exports.LoadingState=Zt;exports.Logo=rn;exports.LogoSection=fr;exports.MarkdownText=Vt;exports.MarketingBox=_r;exports.Member=kt;exports.MembersList=ma;exports.Modal=ln;exports.MoreMenu=cs;exports.NUMBER_OF_USERS=wr;exports.NavigationMenu=us;exports.NotFoundError=qa;exports.Overlay=cn;exports.PageHeading=rs;exports.PageLayout=bs;exports.PasswordRules=aa;exports.Pill=Je;exports.ProfilePicture=Oe;exports.ProgressBar=as;exports.Rating=oa;exports.RepliesFeed=js;exports.ResponsesHeading=_a;exports.ResponsiveImage=qt;exports.SearchForm=gs;exports.ShareLinks=Zr;exports.Span=ss;exports.StatusBanner=gt;exports.Tabs=Kr;exports.Tags=da;exports.Tooltip=Jn;exports.TopLevelPage=ta;exports.UserContext=ke;exports.UserProvider=es;exports.VisuallyHidden=se;exports.addAriaProps=xs;exports.getMember=Kt;exports.headerData=qe;exports.mapGetStreamData=Ja;exports.pageReady=Gn;exports.useCurrentPath=On;exports.useEffectAfterMount=De;exports.useElementWidth=Be;exports.useScrollListener=Qn;exports.useScrollToHash=Un;exports.useUser=Kn;
|