@apolitical/component-library 1.18.3 → 1.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +12 -12
  2. package/index.mjs +898 -898
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Xa=require("lodash.clonedeep"),er=require("lodash.set"),N=require("react-intl"),$e=require("truncate"),X=require("@tanstack/react-query"),tr=require("@tanstack/react-query-devtools"),st=require("posthog-js"),On=require("react-cookie"),pt=require("markdown-to-jsx"),nr=require("react-multi-email"),Bn=require("lodash.get"),ar=require("react-error-boundary"),rr=require("react-textarea-autosize"),sr=require("lodash.isequal");function ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qn={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Xa=require("lodash.clonedeep"),er=require("lodash.set"),N=require("react-intl"),Me=require("truncate"),J=require("@tanstack/react-query"),tr=require("@tanstack/react-query-devtools"),ot=require("posthog-js"),Bn=require("react-cookie"),gt=require("markdown-to-jsx"),nr=require("react-multi-email"),qn=require("lodash.get"),ar=require("react-error-boundary"),rr=require("react-textarea-autosize"),sr=require("lodash.isequal");function ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zn={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],s=0;s<arguments.length;s++){var i=arguments[s];if(i){var o=typeof i;if(o==="string"||o==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var c=n.apply(null,i);c&&r.push(c)}}else if(o==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var m in i)t.call(i,m)&&i[m]&&r.push(m)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(qn);var or=qn.exports;const T=ir(or),cr=({element:e="span",showOnFocus:t=!0,children:n,...r})=>p.createElement(e,{...r,className:T("hidden",{"show-on-focus":t}),children:n}),re=p.memo(cr),lr=({element:e="span",children:t=null,...n})=>p.createElement(e,{...n,"aria-hidden":!0},t),Ut=p.memo(lr);var Ot={exports:{}},Re={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],s=0;s<arguments.length;s++){var i=arguments[s];if(i){var o=typeof i;if(o==="string"||o==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var c=n.apply(null,i);c&&r.push(c)}}else if(o==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var m in i)t.call(i,m)&&i[m]&&r.push(m)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Zn);var or=Zn.exports;const T=ir(or),cr=({element:e="span",showOnFocus:t=!0,children:n,...r})=>p.createElement(e,{...r,className:T("hidden",{"show-on-focus":t}),children:n}),re=p.memo(cr),lr=({element:e="span",children:t=null,...n})=>p.createElement(e,{...n,"aria-hidden":!0},t),Wt=p.memo(lr);var qt={exports:{}},Ae={};/**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.min.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var kn;function dr(){if(kn)return Re;kn=1;var e=p,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,m,l){var f,d={},h=null,g=null;l!==void 0&&(h=""+l),m.key!==void 0&&(h=""+m.key),m.ref!==void 0&&(g=m.ref);for(f in m)r.call(m,f)&&!i.hasOwnProperty(f)&&(d[f]=m[f]);if(c&&c.defaultProps)for(f in m=c.defaultProps,m)d[f]===void 0&&(d[f]=m[f]);return{$$typeof:t,type:c,key:h,ref:g,props:d,_owner:s.current}}return Re.Fragment=n,Re.jsx=o,Re.jsxs=o,Re}var Ie={};/**
13
+ */var wn;function dr(){if(wn)return Ae;wn=1;var e=p,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,m,l){var f,d={},h=null,g=null;l!==void 0&&(h=""+l),m.key!==void 0&&(h=""+m.key),m.ref!==void 0&&(g=m.ref);for(f in m)r.call(m,f)&&!i.hasOwnProperty(f)&&(d[f]=m[f]);if(c&&c.defaultProps)for(f in m=c.defaultProps,m)d[f]===void 0&&(d[f]=m[f]);return{$$typeof:t,type:c,key:h,ref:g,props:d,_owner:s.current}}return Ae.Fragment=n,Ae.jsx=o,Ae.jsxs=o,Ae}var Le={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -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 wn;function ur(){return wn||(wn=1,process.env.NODE_ENV!=="production"&&function(){var e=p,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),_=Symbol.iterator,v="@@iterator";function w(u){if(u===null||typeof u!="object")return null;var k=_&&u[_]||u[v];return typeof k=="function"?k:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(u){{for(var k=arguments.length,E=new Array(k>1?k-1:0),R=1;R<k;R++)E[R-1]=arguments[R];x("error",u,E)}}function x(u,k,E){{var R=y.ReactDebugCurrentFrame,O=R.getStackAddendum();O!==""&&(k+="%s",E=E.concat([O]));var W=E.map(function(D){return String(D)});W.unshift("Warning: "+k),Function.prototype.apply.call(console[u],console,W)}}var j=!1,M=!1,P=!1,I=!1,L=!1,S;S=Symbol.for("react.module.reference");function C(u){return!!(typeof u=="string"||typeof u=="function"||u===r||u===i||L||u===s||u===l||u===f||I||u===g||j||M||P||typeof u=="object"&&u!==null&&(u.$$typeof===h||u.$$typeof===d||u.$$typeof===o||u.$$typeof===c||u.$$typeof===m||u.$$typeof===S||u.getModuleId!==void 0))}function $(u,k,E){var R=u.displayName;if(R)return R;var O=k.displayName||k.name||"";return O!==""?E+"("+O+")":E}function q(u){return u.displayName||"Context"}function F(u){if(u==null)return null;if(typeof u.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case s:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case c:var k=u;return q(k)+".Consumer";case o:var E=u;return q(E._context)+".Provider";case m:return $(u,u.render,"ForwardRef");case d:var R=u.displayName||null;return R!==null?R:F(u.type)||"Memo";case h:{var O=u,W=O._payload,D=O._init;try{return F(D(W))}catch{return null}}}return null}var H=Object.assign,V=0,te,G,Q,ne,K,ae,ce;function ie(){}ie.__reactDisabledLog=!0;function z(){{if(V===0){te=console.log,G=console.info,Q=console.warn,ne=console.error,K=console.group,ae=console.groupCollapsed,ce=console.groupEnd;var u={configurable:!0,enumerable:!0,value:ie,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}V++}}function le(){{if(V--,V===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},u,{value:te}),info:H({},u,{value:G}),warn:H({},u,{value:Q}),error:H({},u,{value:ne}),group:H({},u,{value:K}),groupCollapsed:H({},u,{value:ae}),groupEnd:H({},u,{value:ce})})}V<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=y.ReactCurrentDispatcher,Z;function Y(u,k,E){{if(Z===void 0)try{throw Error()}catch(O){var R=O.stack.trim().match(/\n( *(at )?)/);Z=R&&R[1]||""}return`
22
- `+Z+u}}var me=!1,de;{var Ma=typeof WeakMap=="function"?WeakMap:Map;de=new Ma}function cn(u,k){if(!u||me)return"";{var E=de.get(u);if(E!==void 0)return E}var R;me=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=ue.current,ue.current=null,z();try{if(k){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(_e){R=_e}Reflect.construct(u,[],D)}else{try{D.call()}catch(_e){R=_e}u.call(D.prototype)}}else{try{throw Error()}catch(_e){R=_e}u()}}catch(_e){if(_e&&R&&typeof _e.stack=="string"){for(var A=_e.stack.split(`
21
+ */var jn;function ur(){return jn||(jn=1,process.env.NODE_ENV!=="production"&&function(){var e=p,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),_=Symbol.iterator,v="@@iterator";function w(u){if(u===null||typeof u!="object")return null;var k=_&&u[_]||u[v];return typeof k=="function"?k:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(u){{for(var k=arguments.length,E=new Array(k>1?k-1:0),R=1;R<k;R++)E[R-1]=arguments[R];x("error",u,E)}}function x(u,k,E){{var R=y.ReactDebugCurrentFrame,O=R.getStackAddendum();O!==""&&(k+="%s",E=E.concat([O]));var W=E.map(function(L){return String(L)});W.unshift("Warning: "+k),Function.prototype.apply.call(console[u],console,W)}}var j=!1,$=!1,P=!1,I=!1,D=!1,S;S=Symbol.for("react.module.reference");function M(u){return!!(typeof u=="string"||typeof u=="function"||u===r||u===i||D||u===s||u===l||u===f||I||u===g||j||$||P||typeof u=="object"&&u!==null&&(u.$$typeof===h||u.$$typeof===d||u.$$typeof===o||u.$$typeof===c||u.$$typeof===m||u.$$typeof===S||u.getModuleId!==void 0))}function C(u,k,E){var R=u.displayName;if(R)return R;var O=k.displayName||k.name||"";return O!==""?E+"("+O+")":E}function H(u){return u.displayName||"Context"}function Z(u){if(u==null)return null;if(typeof u.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case s:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case c:var k=u;return H(k)+".Consumer";case o:var E=u;return H(E._context)+".Provider";case m:return C(u,u.render,"ForwardRef");case d:var R=u.displayName||null;return R!==null?R:Z(u.type)||"Memo";case h:{var O=u,W=O._payload,L=O._init;try{return Z(L(W))}catch{return null}}}return null}var F=Object.assign,V=0,te,X,G,ne,Q,ae,ce;function ie(){}ie.__reactDisabledLog=!0;function z(){{if(V===0){te=console.log,X=console.info,G=console.warn,ne=console.error,Q=console.group,ae=console.groupCollapsed,ce=console.groupEnd;var u={configurable:!0,enumerable:!0,value:ie,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}V++}}function le(){{if(V--,V===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},u,{value:te}),info:F({},u,{value:X}),warn:F({},u,{value:G}),error:F({},u,{value:ne}),group:F({},u,{value:Q}),groupCollapsed:F({},u,{value:ae}),groupEnd:F({},u,{value:ce})})}V<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=y.ReactCurrentDispatcher,me;function de(u,k,E){{if(me===void 0)try{throw Error()}catch(O){var R=O.stack.trim().match(/\n( *(at )?)/);me=R&&R[1]||""}return`
22
+ `+me+u}}var q=!1,Y;{var je=typeof WeakMap=="function"?WeakMap:Map;Y=new je}function ke(u,k){if(!u||q)return"";{var E=Y.get(u);if(E!==void 0)return E}var R;q=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=ue.current,ue.current=null,z();try{if(k){var L=function(){throw Error()};if(Object.defineProperty(L.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(L,[])}catch(_e){R=_e}Reflect.construct(u,[],L)}else{try{L.call()}catch(_e){R=_e}u.call(L.prototype)}}else{try{throw Error()}catch(_e){R=_e}u()}}catch(_e){if(_e&&R&&typeof _e.stack=="string"){for(var A=_e.stack.split(`
23
23
  `),se=R.stack.split(`
24
- `),J=A.length-1,ee=se.length-1;J>=1&&ee>=0&&A[J]!==se[ee];)ee--;for(;J>=1&&ee>=0;J--,ee--)if(A[J]!==se[ee]){if(J!==1||ee!==1)do if(J--,ee--,ee<0||A[J]!==se[ee]){var fe=`
25
- `+A[J].replace(" at new "," at ");return u.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",u.displayName)),typeof u=="function"&&de.set(u,fe),fe}while(J>=1&&ee>=0);break}}}finally{me=!1,ue.current=W,le(),Error.prepareStackTrace=O}var Te=u?u.displayName||u.name:"",xn=Te?Y(Te):"";return typeof u=="function"&&de.set(u,xn),xn}function Na(u,k,E){return cn(u,!1)}function Pa(u){var k=u.prototype;return!!(k&&k.isReactComponent)}function Ye(u,k,E){if(u==null)return"";if(typeof u=="function")return cn(u,Pa(u));if(typeof u=="string")return Y(u);switch(u){case l:return Y("Suspense");case f:return Y("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case m:return Na(u.render);case d:return Ye(u.type,k,E);case h:{var R=u,O=R._payload,W=R._init;try{return Ye(W(O),k,E)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,ln={},dn=y.ReactDebugCurrentFrame;function Qe(u){if(u){var k=u._owner,E=Ye(u.type,u._source,k?k.type:null);dn.setExtraStackFrame(E)}else dn.setExtraStackFrame(null)}function Fa(u,k,E,R,O){{var W=Function.call.bind(Ge);for(var D in u)if(W(u,D)){var A=void 0;try{if(typeof u[D]!="function"){var se=Error((R||"React class")+": "+E+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw se.name="Invariant Violation",se}A=u[D](k,D,R,E,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){A=J}A&&!(A instanceof Error)&&(Qe(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).",R||"React class",E,D,typeof A),Qe(null)),A instanceof Error&&!(A.message in ln)&&(ln[A.message]=!0,Qe(O),b("Failed %s type: %s",E,A.message),Qe(null))}}}var Ra=Array.isArray;function yt(u){return Ra(u)}function Ia(u){{var k=typeof Symbol=="function"&&Symbol.toStringTag,E=k&&u[Symbol.toStringTag]||u.constructor.name||"Object";return E}}function Aa(u){try{return un(u),!1}catch{return!0}}function un(u){return""+u}function mn(u){if(Aa(u))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ia(u)),un(u)}var Fe=y.ReactCurrentOwner,La={key:!0,ref:!0,__self:!0,__source:!0},fn,pn,vt;vt={};function Da(u){if(Ge.call(u,"ref")){var k=Object.getOwnPropertyDescriptor(u,"ref").get;if(k&&k.isReactWarning)return!1}return u.ref!==void 0}function Oa(u){if(Ge.call(u,"key")){var k=Object.getOwnPropertyDescriptor(u,"key").get;if(k&&k.isReactWarning)return!1}return u.key!==void 0}function Ba(u,k){if(typeof u.ref=="string"&&Fe.current&&k&&Fe.current.stateNode!==k){var E=F(Fe.current.type);vt[E]||(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',F(Fe.current.type),u.ref),vt[E]=!0)}}function qa(u,k){{var E=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)",k))};E.isReactWarning=!0,Object.defineProperty(u,"key",{get:E,configurable:!0})}}function Za(u,k){{var E=function(){pn||(pn=!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)",k))};E.isReactWarning=!0,Object.defineProperty(u,"ref",{get:E,configurable:!0})}}var Ha=function(u,k,E,R,O,W,D){var A={$$typeof:t,type:u,key:k,ref:E,props:D,_owner:W};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:R}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function Ua(u,k,E,R,O){{var W,D={},A=null,se=null;E!==void 0&&(mn(E),A=""+E),Oa(k)&&(mn(k.key),A=""+k.key),Da(k)&&(se=k.ref,Ba(k,O));for(W in k)Ge.call(k,W)&&!La.hasOwnProperty(W)&&(D[W]=k[W]);if(u&&u.defaultProps){var J=u.defaultProps;for(W in J)D[W]===void 0&&(D[W]=J[W])}if(A||se){var ee=typeof u=="function"?u.displayName||u.name||"Unknown":u;A&&qa(D,ee),se&&Za(D,ee)}return Ha(u,A,se,O,R,Fe.current,D)}}var xt=y.ReactCurrentOwner,hn=y.ReactDebugCurrentFrame;function je(u){if(u){var k=u._owner,E=Ye(u.type,u._source,k?k.type:null);hn.setExtraStackFrame(E)}else hn.setExtraStackFrame(null)}var kt;kt=!1;function wt(u){return typeof u=="object"&&u!==null&&u.$$typeof===t}function gn(){{if(xt.current){var u=F(xt.current.type);if(u)return`
24
+ `),K=A.length-1,ee=se.length-1;K>=1&&ee>=0&&A[K]!==se[ee];)ee--;for(;K>=1&&ee>=0;K--,ee--)if(A[K]!==se[ee]){if(K!==1||ee!==1)do if(K--,ee--,ee<0||A[K]!==se[ee]){var fe=`
25
+ `+A[K].replace(" at new "," at ");return u.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",u.displayName)),typeof u=="function"&&Y.set(u,fe),fe}while(K>=1&&ee>=0);break}}}finally{q=!1,ue.current=W,le(),Error.prepareStackTrace=O}var Se=u?u.displayName||u.name:"",kn=Se?de(Se):"";return typeof u=="function"&&Y.set(u,kn),kn}function Na(u,k,E){return ke(u,!1)}function Pa(u){var k=u.prototype;return!!(k&&k.isReactComponent)}function Qe(u,k,E){if(u==null)return"";if(typeof u=="function")return ke(u,Pa(u));if(typeof u=="string")return de(u);switch(u){case l:return de("Suspense");case f:return de("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case m:return Na(u.render);case d:return Qe(u.type,k,E);case h:{var R=u,O=R._payload,W=R._init;try{return Qe(W(O),k,E)}catch{}}}return""}var Ke=Object.prototype.hasOwnProperty,dn={},un=y.ReactDebugCurrentFrame;function Je(u){if(u){var k=u._owner,E=Qe(u.type,u._source,k?k.type:null);un.setExtraStackFrame(E)}else un.setExtraStackFrame(null)}function Fa(u,k,E,R,O){{var W=Function.call.bind(Ke);for(var L in u)if(W(u,L)){var A=void 0;try{if(typeof u[L]!="function"){var se=Error((R||"React class")+": "+E+" type `"+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[L]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw se.name="Invariant Violation",se}A=u[L](k,L,R,E,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(K){A=K}A&&!(A instanceof Error)&&(Je(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).",R||"React class",E,L,typeof A),Je(null)),A instanceof Error&&!(A.message in dn)&&(dn[A.message]=!0,Je(O),b("Failed %s type: %s",E,A.message),Je(null))}}}var Ra=Array.isArray;function xt(u){return Ra(u)}function Ia(u){{var k=typeof Symbol=="function"&&Symbol.toStringTag,E=k&&u[Symbol.toStringTag]||u.constructor.name||"Object";return E}}function Aa(u){try{return mn(u),!1}catch{return!0}}function mn(u){return""+u}function fn(u){if(Aa(u))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ia(u)),mn(u)}var Ie=y.ReactCurrentOwner,La={key:!0,ref:!0,__self:!0,__source:!0},pn,hn,kt;kt={};function Da(u){if(Ke.call(u,"ref")){var k=Object.getOwnPropertyDescriptor(u,"ref").get;if(k&&k.isReactWarning)return!1}return u.ref!==void 0}function Oa(u){if(Ke.call(u,"key")){var k=Object.getOwnPropertyDescriptor(u,"key").get;if(k&&k.isReactWarning)return!1}return u.key!==void 0}function Ba(u,k){if(typeof u.ref=="string"&&Ie.current&&k&&Ie.current.stateNode!==k){var E=Z(Ie.current.type);kt[E]||(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',Z(Ie.current.type),u.ref),kt[E]=!0)}}function qa(u,k){{var E=function(){pn||(pn=!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)",k))};E.isReactWarning=!0,Object.defineProperty(u,"key",{get:E,configurable:!0})}}function Za(u,k){{var E=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)",k))};E.isReactWarning=!0,Object.defineProperty(u,"ref",{get:E,configurable:!0})}}var Ha=function(u,k,E,R,O,W,L){var A={$$typeof:t,type:u,key:k,ref:E,props:L,_owner:W};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:R}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function Ua(u,k,E,R,O){{var W,L={},A=null,se=null;E!==void 0&&(fn(E),A=""+E),Oa(k)&&(fn(k.key),A=""+k.key),Da(k)&&(se=k.ref,Ba(k,O));for(W in k)Ke.call(k,W)&&!La.hasOwnProperty(W)&&(L[W]=k[W]);if(u&&u.defaultProps){var K=u.defaultProps;for(W in K)L[W]===void 0&&(L[W]=K[W])}if(A||se){var ee=typeof u=="function"?u.displayName||u.name||"Unknown":u;A&&qa(L,ee),se&&Za(L,ee)}return Ha(u,A,se,O,R,Ie.current,L)}}var wt=y.ReactCurrentOwner,gn=y.ReactDebugCurrentFrame;function Ee(u){if(u){var k=u._owner,E=Qe(u.type,u._source,k?k.type:null);gn.setExtraStackFrame(E)}else gn.setExtraStackFrame(null)}var jt;jt=!1;function Tt(u){return typeof u=="object"&&u!==null&&u.$$typeof===t}function _n(){{if(wt.current){var u=Z(wt.current.type);if(u)return`
26
26
 
27
27
  Check the render method of \``+u+"`."}return""}}function za(u){{if(u!==void 0){var k=u.fileName.replace(/^.*[\\\/]/,""),E=u.lineNumber;return`
28
28
 
29
- Check your code at `+k+":"+E+"."}return""}}var _n={};function Wa(u){{var k=gn();if(!k){var E=typeof u=="string"?u:u.displayName||u.name;E&&(k=`
29
+ Check your code at `+k+":"+E+"."}return""}}var bn={};function Wa(u){{var k=_n();if(!k){var E=typeof u=="string"?u:u.displayName||u.name;E&&(k=`
30
30
 
31
- Check the top-level render call using <`+E+">.")}return k}}function bn(u,k){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var E=Wa(k);if(_n[E])return;_n[E]=!0;var R="";u&&u._owner&&u._owner!==xt.current&&(R=" It was passed a child from "+F(u._owner.type)+"."),je(u),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,R),je(null)}}function yn(u,k){{if(typeof u!="object")return;if(yt(u))for(var E=0;E<u.length;E++){var R=u[E];wt(R)&&bn(R,k)}else if(wt(u))u._store&&(u._store.validated=!0);else if(u){var O=w(u);if(typeof O=="function"&&O!==u.entries)for(var W=O.call(u),D;!(D=W.next()).done;)wt(D.value)&&bn(D.value,k)}}}function Va(u){{var k=u.type;if(k==null||typeof k=="string")return;var E;if(typeof k=="function")E=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===m||k.$$typeof===d))E=k.propTypes;else return;if(E){var R=F(k);Fa(E,u.props,"prop",R,u)}else if(k.PropTypes!==void 0&&!kt){kt=!0;var O=F(k);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ya(u){{for(var k=Object.keys(u.props),E=0;E<k.length;E++){var R=k[E];if(R!=="children"&&R!=="key"){je(u),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",R),je(null);break}}u.ref!==null&&(je(u),b("Invalid attribute `ref` supplied to `React.Fragment`."),je(null))}}function vn(u,k,E,R,O,W){{var D=C(u);if(!D){var A="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).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 se=za(O);se?A+=se:A+=gn();var J;u===null?J="null":yt(u)?J="array":u!==void 0&&u.$$typeof===t?(J="<"+(F(u.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):J=typeof u,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",J,A)}var ee=Ua(u,k,E,O,W);if(ee==null)return ee;if(D){var fe=k.children;if(fe!==void 0)if(R)if(yt(fe)){for(var Te=0;Te<fe.length;Te++)yn(fe[Te],u);Object.freeze&&Object.freeze(fe)}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 yn(fe,u)}return u===r?Ya(ee):Va(ee),ee}}function Ga(u,k,E){return vn(u,k,E,!0)}function Qa(u,k,E){return vn(u,k,E,!1)}var Ka=Qa,Ja=Ga;Ie.Fragment=r,Ie.jsx=Ka,Ie.jsxs=Ja}()),Ie}process.env.NODE_ENV==="production"?Ot.exports=dr():Ot.exports=ur();var a=Ot.exports;const Zn=()=>{const[e,t]=p.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return p.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},we=(e,t)=>{const n=p.useRef(!1);p.useEffect(()=>{n.current?e():n.current=!0},t)};function mr(e,t,n){var r=this,s=p.useRef(null),i=p.useRef(0),o=p.useRef(null),c=p.useRef([]),m=p.useRef(),l=p.useRef(),f=p.useRef(e),d=p.useRef(!0);f.current=e;var h=typeof window<"u",g=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var _=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,w="maxWait"in n,y="debounceOnServer"in n&&!!n.debounceOnServer,b=w?Math.max(+n.maxWait||0,t):null;p.useEffect(function(){return d.current=!0,function(){d.current=!1}},[]);var x=p.useMemo(function(){var j=function(C){var $=c.current,q=m.current;return c.current=m.current=null,i.current=C,l.current=f.current.apply(q,$)},M=function(C,$){g&&cancelAnimationFrame(o.current),o.current=g?requestAnimationFrame(C):setTimeout(C,$)},P=function(C){if(!d.current)return!1;var $=C-s.current;return!s.current||$>=t||$<0||w&&C-i.current>=b},I=function(C){return o.current=null,v&&c.current?j(C):(c.current=m.current=null,l.current)},L=function C(){var $=Date.now();if(P($))return I($);if(d.current){var q=t-($-s.current),F=w?Math.min(q,b-($-i.current)):q;M(C,F)}},S=function(){if(h||y){var C=Date.now(),$=P(C);if(c.current=[].slice.call(arguments),m.current=r,s.current=C,$){if(!o.current&&d.current)return i.current=s.current,M(L,t),_?j(s.current):l.current;if(w)return M(L,t),j(s.current)}return o.current||M(L,t),l.current}};return S.cancel=function(){o.current&&(g?cancelAnimationFrame(o.current):clearTimeout(o.current)),i.current=0,c.current=s.current=m.current=o.current=null},S.isPending=function(){return!!o.current},S.flush=function(){return o.current?I(Date.now()):l.current},S},[_,w,t,b,v,g,h,y]);return x}function Hn(e,t,n){var r=n===void 0?{}:n,s=r.leading,i=r.trailing;return mr(e,t,{maxWait:t,leading:s===void 0||s,trailing:i===void 0||i})}let jt;const Ne=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,s]=p.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];p.useEffect(()=>(c(),window.addEventListener("resize",m),()=>{clearTimeout(jt),m.flush(),window.removeEventListener("resize",m)}),i);const o=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},c=()=>{s(o())},m=Hn(()=>{o()!==r&&(t&&(clearTimeout(jt),document.body.classList.add("is-resizing"),jt=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),c())},500,{leading:!0});return r},Un=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[s,i]=p.useState({current:0,past:0})||[!1,()=>{}],[o,c]=p.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];p.useEffect(()=>(m(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const m=()=>{const f=window.scrollY,d=s.current,h=f-d,g=h>0?"down":"up";if(i({current:f,past:d}),g==="down"){f>=e+t.down&&!o.scrollDown&&(!o.scrollUp||h>t.up)&&(n(),c({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!o.scrollUp&&(r(),c({scrollUp:!0,scrollDown:!1}))},l=Hn(()=>{m()},250);return s},zn=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=p.useRef(!1);we(()=>{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)},Vn=(e,t,n)=>{let r=n.mobile;for(const s in t){const i=parseInt(String(t[s]));if(e>=i)r=n[i];else if(e<i)break}return r},fr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),pr=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Yn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Bt=e=>{let i;const o=jn(),c=jn(new Date(e));try{i=o.getTime()-c.getTime()}catch{return""}const m=i/36e5,l=Math.floor(i/864e5);if(l<1)return m<1?{path:"now"}:{path:"hours",number:Math.floor(m)};if(l<7)return{path:"days",number:l};const f=Math.floor(l/7);return f<=52?{path:"weeks",number:f}:{path:"years",number:Math.floor(l/365)}},jn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},zt={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 <`+E+">.")}return k}}function yn(u,k){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var E=Wa(k);if(bn[E])return;bn[E]=!0;var R="";u&&u._owner&&u._owner!==wt.current&&(R=" It was passed a child from "+Z(u._owner.type)+"."),Ee(u),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,R),Ee(null)}}function vn(u,k){{if(typeof u!="object")return;if(xt(u))for(var E=0;E<u.length;E++){var R=u[E];Tt(R)&&yn(R,k)}else if(Tt(u))u._store&&(u._store.validated=!0);else if(u){var O=w(u);if(typeof O=="function"&&O!==u.entries)for(var W=O.call(u),L;!(L=W.next()).done;)Tt(L.value)&&yn(L.value,k)}}}function Va(u){{var k=u.type;if(k==null||typeof k=="string")return;var E;if(typeof k=="function")E=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===m||k.$$typeof===d))E=k.propTypes;else return;if(E){var R=Z(k);Fa(E,u.props,"prop",R,u)}else if(k.PropTypes!==void 0&&!jt){jt=!0;var O=Z(k);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ya(u){{for(var k=Object.keys(u.props),E=0;E<k.length;E++){var R=k[E];if(R!=="children"&&R!=="key"){Ee(u),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",R),Ee(null);break}}u.ref!==null&&(Ee(u),b("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}function xn(u,k,E,R,O,W){{var L=M(u);if(!L){var A="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).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 se=za(O);se?A+=se:A+=_n();var K;u===null?K="null":xt(u)?K="array":u!==void 0&&u.$$typeof===t?(K="<"+(Z(u.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):K=typeof u,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",K,A)}var ee=Ua(u,k,E,O,W);if(ee==null)return ee;if(L){var fe=k.children;if(fe!==void 0)if(R)if(xt(fe)){for(var Se=0;Se<fe.length;Se++)vn(fe[Se],u);Object.freeze&&Object.freeze(fe)}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 vn(fe,u)}return u===r?Ya(ee):Va(ee),ee}}function Ga(u,k,E){return xn(u,k,E,!0)}function Qa(u,k,E){return xn(u,k,E,!1)}var Ka=Qa,Ja=Ga;Le.Fragment=r,Le.jsx=Ka,Le.jsxs=Ja}()),Le}process.env.NODE_ENV==="production"?qt.exports=dr():qt.exports=ur();var a=qt.exports;const Hn=()=>{const[e,t]=p.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return p.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Te=(e,t)=>{const n=p.useRef(!1);p.useEffect(()=>{n.current?e():n.current=!0},t)};function mr(e,t,n){var r=this,s=p.useRef(null),i=p.useRef(0),o=p.useRef(null),c=p.useRef([]),m=p.useRef(),l=p.useRef(),f=p.useRef(e),d=p.useRef(!0);f.current=e;var h=typeof window<"u",g=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var _=!!(n=n||{}).leading,v=!("trailing"in n)||!!n.trailing,w="maxWait"in n,y="debounceOnServer"in n&&!!n.debounceOnServer,b=w?Math.max(+n.maxWait||0,t):null;p.useEffect(function(){return d.current=!0,function(){d.current=!1}},[]);var x=p.useMemo(function(){var j=function(M){var C=c.current,H=m.current;return c.current=m.current=null,i.current=M,l.current=f.current.apply(H,C)},$=function(M,C){g&&cancelAnimationFrame(o.current),o.current=g?requestAnimationFrame(M):setTimeout(M,C)},P=function(M){if(!d.current)return!1;var C=M-s.current;return!s.current||C>=t||C<0||w&&M-i.current>=b},I=function(M){return o.current=null,v&&c.current?j(M):(c.current=m.current=null,l.current)},D=function M(){var C=Date.now();if(P(C))return I(C);if(d.current){var H=t-(C-s.current),Z=w?Math.min(H,b-(C-i.current)):H;$(M,Z)}},S=function(){if(h||y){var M=Date.now(),C=P(M);if(c.current=[].slice.call(arguments),m.current=r,s.current=M,C){if(!o.current&&d.current)return i.current=s.current,$(D,t),_?j(s.current):l.current;if(w)return $(D,t),j(s.current)}return o.current||$(D,t),l.current}};return S.cancel=function(){o.current&&(g?cancelAnimationFrame(o.current):clearTimeout(o.current)),i.current=0,c.current=s.current=m.current=o.current=null},S.isPending=function(){return!!o.current},S.flush=function(){return o.current?I(Date.now()):l.current},S},[_,w,t,b,v,g,h,y]);return x}function Un(e,t,n){var r=n===void 0?{}:n,s=r.leading,i=r.trailing;return mr(e,t,{maxWait:t,leading:s===void 0||s,trailing:i===void 0||i})}let Et;const Fe=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,s]=p.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];p.useEffect(()=>(c(),window.addEventListener("resize",m),()=>{clearTimeout(Et),m.flush(),window.removeEventListener("resize",m)}),i);const o=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},c=()=>{s(o())},m=Un(()=>{o()!==r&&(t&&(clearTimeout(Et),document.body.classList.add("is-resizing"),Et=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),c())},500,{leading:!0});return r},zn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[s,i]=p.useState({current:0,past:0})||[!1,()=>{}],[o,c]=p.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];p.useEffect(()=>(m(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const m=()=>{const f=window.scrollY,d=s.current,h=f-d,g=h>0?"down":"up";if(i({current:f,past:d}),g==="down"){f>=e+t.down&&!o.scrollDown&&(!o.scrollUp||h>t.up)&&(n(),c({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!o.scrollUp&&(r(),c({scrollUp:!0,scrollDown:!1}))},l=Un(()=>{m()},250);return s},Wn=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=p.useRef(!1);Te(()=>{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)},Vn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Yn=(e,t,n)=>{let r=n.mobile;for(const s in t){const i=parseInt(String(t[s]));if(e>=i)r=n[i];else if(e<i)break}return r},fr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),pr=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Gn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Zt=e=>{let i;const o=Tn(),c=Tn(new Date(e));try{i=o.getTime()-c.getTime()}catch{return""}const m=i/36e5,l=Math.floor(i/864e5);if(l<1)return m<1?{path:"now"}:{path:"hours",number:Math.floor(m)};if(l<7)return{path:"days",number:l};const f=Math.floor(l/7);return f<=52?{path:"weeks",number:f}:{path:"years",number:Math.floor(l/365)}},Tn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Vt={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} {count, select, 1 {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..."},hr={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>"},gr={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>"},_r={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>"},br=Object.freeze(Object.defineProperty({__proto__:null,en:zt,es:hr,fr:gr,pt:_r},Symbol.toStringTag,{value:"Module"})),Gn=e=>e in zt,he=(e,t,n,r,s={})=>{let i="";return Gn(`${t}_${n}`)?i=e({id:`${t}_${n}`},s):i=e({id:t},{[r]:n,...s}),i},yr=(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 s=n.length-1;s>=0;s--){const i=Math.pow(10,(s+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&s<n.length-1&&(e=1,s++),r=`${e}${n[s]}`;break}}return r},Qn=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},vr=e=>e.replace(/\s+/g,"").length>0,xr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Xa(e);return t.forEach(({type:r,value:s})=>{er(n,r,s)}),n},kr=e=>new Promise(t=>setTimeout(t,e)),it=(e,t)=>p.Children.map(e,n=>p.cloneElement(n,{...t})),B=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:s=!1,element:i="button",onClick:o=!1,className:c="",disabled:m=!1,screenreaderText:l=!1,children:f=!1,...d})=>{const g=Ne(typeof t=="object");if(typeof t=="object"&&typeof g=="number"){const w=Object.assign({},t),y=Wn(Object.keys(w));t=Vn(g,y,w)}const _=[];typeof t=="string"&&_.push(t),r&&(_.push("icon"),typeof r=="object"?(_.push(r.icon),r.position?_.push(r.position):_.push("left"),r.hover&&_.push(`hover_${r.hover}`),r.animate&&(_.push("animate"),typeof r.animate=="string"&&_.push(r.animate))):(_.push(r),!r.includes("right")&&!r.includes("left")&&_.push("left"))),n.muted&&_.push("muted"),n.fullWidth&&_.push("full-width");const v={...d,className:T(e,c,_,{"no-text":!f,disabled:m,button:s}),onClick:w=>{(!s||s[0]==="#")&&o&&(w.preventDefault(),w.stopPropagation()),o&&o(w)},disabled:typeof m=="object"&&"isClickable"in m?!m.isClickable:m};return s&&(i="a",v.href=s),p.createElement(i,v,f||(l?a.jsx(re,{showOnFocus:!1,children:l}):null))},qe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",s=e.map((i,o)=>r==="p"?a.jsx(B,{...i},o):a.jsx("li",{children:a.jsx(B,{...i})},o));return p.createElement(r,{className:T("button-wrapper",t),...n,children:s})};const xe=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return a.jsx("hr",{className:T(e,{"has-max-width":t}),style:n})},Ze=({href:e,children:t,fallbackElement:n,className:r="",onClick:s,gtmContext:i,gtmType:o,...c})=>{if(e){const m={...c};return s&&(m.onClick=s),i&&(m["data-gtm-event-context"]=i),o&&(m["data-gtm-event-type"]=o),a.jsx("a",{href:e,className:T("gtm-trackable",r),...m,children:t})}return n?p.createElement(n,{children:t,className:r,...c}):t},Tn={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"}},wr=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:s}=e?Tn[e]:Tn.fallback;return{range:t&&t.length>0?t:r,sizes:n||s}},jr=({format:e,height:t,query:n,width:r})=>{let s=`w=${r}&h=${t}`;return s=e?`${s}&fm=${e}`:s,s=n?`${s}&${n}`:s,s},Tt=({format:e,range:t,url:n,query:r})=>t.map(({height:s,width:i})=>`${n}?${jr({format:e,height:s,query:r,width:i})} ${i}w`).join(", ");const Wt=({image:e,className:t,testId:n})=>{const{description:r,height:s,type:i,query:o,url:c,width:m,loading:l,decoding:f,fetchPriority:d}=e,{range:h,sizes:g}=wr(e),_=Tt({format:"avif",query:o,range:h,url:c}),v=Tt({format:"webp",query:o,range:h,url:c}),w=Tt({format:"",query:o,range:h,url:c});return a.jsxs("picture",{className:t,children:[i!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:_,sizes:g,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:v,sizes:g,"data-testid":"source"}),a.jsx("img",{srcSet:w,sizes:g,src:c,alt:r,loading:l||"lazy",decoding:f||"async",fetchpriority:d||"auto",width:m,height:s,"data-testid":n||"image"})]})};let Ae=!1;const Kn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=N.useIntl(),s=p.useRef(null),[i,o]=p.useState("hidden");p.useEffect(()=>{const m=s.current;if(m)return m.addEventListener("transitionend",c),()=>{m.removeEventListener("transitionend",c)}},[]);const c=({propertyName:m})=>{m==="opacity"&&(Ae!==!1&&clearTimeout(Ae),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return we(()=>{Ae!==!1&&clearTimeout(Ae);let m="open";e?o("opening"):(o("closing"),m="hidden"),Ae=setTimeout(()=>{o(m)},300)},[e]),a.jsx("aside",{ref:s,className:T("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const He=({children:e,className:t="",...n})=>a.jsx("section",{className:T("full-width-section",t),...n,children:e});const Tr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(s=>{r.push({href:s.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":s.eventContext||"Download",target:"_blank",children:s.text})}),a.jsx(He,{className:T("download-section",n),children:a.jsxs(a.Fragment,{children:[p.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),a.jsx(qe,{buttons:r})]})})};const Er=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return a.jsxs("div",{className:T("logos",n),children:[e&&p.createElement(s.element,{className:"title"},s.text),a.jsx("ul",{className:T({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:o,link:c=!1,description:m=!1},l)=>{if(!i||!i.url)return null;const f=a.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:o});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:c?a.jsx("a",{href:c,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&a.jsx("small",{children:m})]},window.btoa(`${i.url}_${l}`))})})]})};const Sr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],$r=({className:e="",content:t,image:n,variant:r="default",spacing:s="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const m=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},f={};return m.forEach(d=>{if(!t[d]){f[d]=!1;return}if(!i[d]){if(typeof t[d]=="object"){f[d]=t[d];const{text:h,element:g}=t[d];if(g&&Sr.includes(g.toLowerCase()))return;f[d]={text:h,element:l[d]};return}f[d]={text:t[d],element:l[d]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=d=>{d.preventDefault(),d.stopPropagation();const h=document.getElementById(o.link.substring(1));h&&h.scrollIntoView({behavior:"smooth"})}),a.jsx(He,{className:T("banner-section",r,s,e,{"has-image":n,"has-extra-spacing":s==="normal"&&f.eyebrow&&f.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[m.map(d=>{if(f[d]&&typeof f[d]=="object"){const{text:h,element:g=""}=f[d];return p.createElement(g.toLowerCase(),{key:d,className:d},h)}return null}),c,o&&o.text&&o.link&&a.jsx(B,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(Wt,{image:{...n,aspect:"banner"}})]})})},Cr=p.memo($r);const Mr=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:s})=>!n&&!r?null:a.jsxs("aside",{className:T("marketing-block",e),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),t&&a.jsx(B,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":s,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Jn=({showDevTools:e=!0,children:t})=>{const n=new X.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(X.QueryClientProvider,{client:n,children:[t,e&&a.jsx(tr.ReactQueryDevtools,{initialIsOpen:!1})]})};var Nr=p.createContext({client:st});function Pr(e){var t=e.children,n=e.client,r=e.apiKey,s=e.options,i=p.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&&s&&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&&(st.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),st.init(r,s)),st)},[n,r]);return p.createElement(Nr.Provider,{value:{client:i}},t)}const Xn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(Pr,{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,ea=({children:e,locale:t,messages:n})=>{const r=t||"en",s={...br[r],...n||{}};return a.jsx(N.IntlProvider,{locale:r,messages:s,children:e})},ge=p.createContext({isLoading:!0});function ht(){return p.useContext(ge)}const ta=({children:e,user:t})=>a.jsx(ge.Provider,{value:t,children:e}),Fr=({bootstrap:e,children:t,intl:n})=>{const[r,s]=p.useState({isLoading:!0});return p.useEffect(()=>{e().then(i=>{s({...i,isLoading:!1}),Qn(5e3)}).catch(()=>s({isLoading:!1}))},[]),a.jsx(ea,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(On.CookiesProvider,{children:a.jsx(ta,{user:r,children:a.jsx(Jn,{children:a.jsx(Xn,{user:r,children:t})})})})})},Ce="https://storage.googleapis.com/apolitical-assets/",Ee={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Rr="200,000+";const Vt=({label:e=!1,className:t="",children:n})=>{const r=N.useIntl();return a.jsxs("details",{className:T("collapsible-section",t),children:[a.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})};const ve=({variant:e="primary",icon:t,className:n="",children:r,...s})=>{const i=t?{"--icon":`url(${Ce}icons/${t}.svg)`}:{};return a.jsx("div",{className:T("highlighted-text-box",e,n,{"has-icon":t}),style:i,...s,children:r})};const Ue=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let s=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,o=Ne(i);if(i&&typeof n=="object"&&typeof o=="number"){const d=Object.assign({},n.breakpoints),h=Wn(Object.keys(d));s=Vn(o,h,d)}const{breakpoints:c,text:m="",component:l,...f}=n;return a.jsx(ve,{variant:"subtle",className:T("empty-state-box",e,r),children:a.jsxs(a.Fragment,{children:[t&&a.jsx(pt,{options:{forceBlock:!0},children:t}),s&&typeof n=="object"&&(l||a.jsx(B,{...f,variant:n.variant?n.variant:"secondary",children:m}))]})})};const qt=({children:e,...t})=>a.jsx("p",{...t,children:e}),na={q:qt,blockquote:qt};for(let e=1;e<=6;e++)na[`h${e}`]={component:qt,props:{className:"title"}};const aa=({type:e="default",className:t="",heading:n=!1,children:r})=>a.jsxs("div",{className:T("helper-text-box text-small",e,t),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(pt,{options:{wrapper:p.Fragment,forceBlock:!0,overrides:na},children:r}):a.jsx("p",{children:r})]});const Ir=({className:e="",show:t=!1,hide:n=!1,text:r,children:s})=>{const i=N.useIntl(),o=p.useRef(null),[c,m]=p.useState(""),[l,f]=p.useState("closed");p.useEffect(()=>{const g=o.current;if(g)return g.addEventListener("transitionend",d),()=>{g.removeEventListener("transitionend",d)}},[]),p.useEffect(()=>{if(!r||typeof r!="string")return;const g=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} {count, select, 1 {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..."},hr={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>"},gr={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>"},_r={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>"},br=Object.freeze(Object.defineProperty({__proto__:null,en:Vt,es:hr,fr:gr,pt:_r},Symbol.toStringTag,{value:"Module"})),Qn=e=>e in Vt,he=(e,t,n,r,s={})=>{let i="";return Qn(`${t}_${n}`)?i=e({id:`${t}_${n}`},s):i=e({id:t},{[r]:n,...s}),i},yr=(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 s=n.length-1;s>=0;s--){const i=Math.pow(10,(s+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&s<n.length-1&&(e=1,s++),r=`${e}${n[s]}`;break}}return r},Kn=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},vr=e=>e.replace(/\s+/g,"").length>0,xr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Xa(e);return t.forEach(({type:r,value:s})=>{er(n,r,s)}),n},kr=e=>new Promise(t=>setTimeout(t,e)),ct=(e,t)=>p.Children.map(e,n=>p.cloneElement(n,{...t})),B=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:s=!1,element:i="button",onClick:o=!1,className:c="",disabled:m=!1,screenreaderText:l=!1,children:f=!1,...d})=>{const g=Fe(typeof t=="object");if(typeof t=="object"&&typeof g=="number"){const w=Object.assign({},t),y=Vn(Object.keys(w));t=Yn(g,y,w)}const _=[];typeof t=="string"&&_.push(t),r&&(_.push("icon"),typeof r=="object"?(_.push(r.icon),r.position?_.push(r.position):_.push("left"),r.hover&&_.push(`hover_${r.hover}`),r.animate&&(_.push("animate"),typeof r.animate=="string"&&_.push(r.animate))):(_.push(r),!r.includes("right")&&!r.includes("left")&&_.push("left"))),n.muted&&_.push("muted"),n.fullWidth&&_.push("full-width");const v={...d,className:T(e,c,_,{"no-text":!f,disabled:m,button:s}),onClick:w=>{(!s||s[0]==="#")&&o&&(w.preventDefault(),w.stopPropagation()),o&&o(w)},disabled:typeof m=="object"&&"isClickable"in m?!m.isClickable:m};return s&&(i="a",v.href=s),p.createElement(i,v,f||(l?a.jsx(re,{showOnFocus:!1,children:l}):null))},He=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",s=e.map((i,o)=>r==="p"?a.jsx(B,{...i},o):a.jsx("li",{children:a.jsx(B,{...i})},o));return p.createElement(r,{className:T("button-wrapper",t),...n,children:s})};const xe=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return a.jsx("hr",{className:T(e,{"has-max-width":t}),style:n})},Ue=({href:e,children:t,fallbackElement:n,className:r="",onClick:s,gtmContext:i,gtmType:o,...c})=>{if(e){const m={...c};return s&&(m.onClick=s),i&&(m["data-gtm-event-context"]=i),o&&(m["data-gtm-event-type"]=o),a.jsx("a",{href:e,className:T("gtm-trackable",r),...m,children:t})}return n?p.createElement(n,{children:t,className:r,...c}):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"}},wr=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:s}=e?En[e]:En.fallback;return{range:t&&t.length>0?t:r,sizes:n||s}},jr=({format:e,height:t,query:n,width:r})=>{let s=`w=${r}&h=${t}`;return s=e?`${s}&fm=${e}`:s,s=n?`${s}&${n}`:s,s},St=({format:e,range:t,url:n,query:r})=>t.map(({height:s,width:i})=>`${n}?${jr({format:e,height:s,query:r,width:i})} ${i}w`).join(", ");const Yt=({image:e,className:t,testId:n})=>{const{description:r,height:s,type:i,query:o,url:c,width:m,loading:l,decoding:f,fetchPriority:d}=e,{range:h,sizes:g}=wr(e),_=St({format:"avif",query:o,range:h,url:c}),v=St({format:"webp",query:o,range:h,url:c}),w=St({format:"",query:o,range:h,url:c});return a.jsxs("picture",{className:t,children:[i!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:_,sizes:g,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:v,sizes:g,"data-testid":"source"}),a.jsx("img",{srcSet:w,sizes:g,src:c,alt:r,loading:l||"lazy",decoding:f||"async",fetchpriority:d||"auto",width:m,height:s,"data-testid":n||"image"})]})};let De=!1;const Jn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=N.useIntl(),s=p.useRef(null),[i,o]=p.useState("hidden");p.useEffect(()=>{const m=s.current;if(m)return m.addEventListener("transitionend",c),()=>{m.removeEventListener("transitionend",c)}},[]);const c=({propertyName:m})=>{m==="opacity"&&(De!==!1&&clearTimeout(De),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Te(()=>{De!==!1&&clearTimeout(De);let m="open";e?o("opening"):(o("closing"),m="hidden"),De=setTimeout(()=>{o(m)},300)},[e]),a.jsx("aside",{ref:s,className:T("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const ze=({children:e,className:t="",...n})=>a.jsx("section",{className:T("full-width-section",t),...n,children:e});const Tr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(s=>{r.push({href:s.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":s.eventContext||"Download",target:"_blank",children:s.text})}),a.jsx(ze,{className:T("download-section",n),children:a.jsxs(a.Fragment,{children:[p.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),a.jsx(He,{buttons:r})]})})};const Er=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return a.jsxs("div",{className:T("logos",n),children:[e&&p.createElement(s.element,{className:"title"},s.text),a.jsx("ul",{className:T({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:o,link:c=!1,description:m=!1},l)=>{if(!i||!i.url)return null;const f=a.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:o});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:c?a.jsx("a",{href:c,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&a.jsx("small",{children:m})]},window.btoa(`${i.url}_${l}`))})})]})};const Sr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],$r=({className:e="",content:t,image:n,variant:r="default",spacing:s="normal",hideElements:i={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const m=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},f={};return m.forEach(d=>{if(!t[d]){f[d]=!1;return}if(!i[d]){if(typeof t[d]=="object"){f[d]=t[d];const{text:h,element:g}=t[d];if(g&&Sr.includes(g.toLowerCase()))return;f[d]={text:h,element:l[d]};return}f[d]={text:t[d],element:l[d]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=d=>{d.preventDefault(),d.stopPropagation();const h=document.getElementById(o.link.substring(1));h&&h.scrollIntoView({behavior:"smooth"})}),a.jsx(ze,{className:T("banner-section",r,s,e,{"has-image":n,"has-extra-spacing":s==="normal"&&f.eyebrow&&f.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[m.map(d=>{if(f[d]&&typeof f[d]=="object"){const{text:h,element:g=""}=f[d];return p.createElement(g.toLowerCase(),{key:d,className:d},h)}return null}),c,o&&o.text&&o.link&&a.jsx(B,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(Yt,{image:{...n,aspect:"banner"}})]})})},Cr=p.memo($r);const Mr=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:s})=>!n&&!r?null:a.jsxs("aside",{className:T("marketing-block",e),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),t&&a.jsx(B,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":s,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Xn=({showDevTools:e=!0,children:t})=>{const n=new J.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(J.QueryClientProvider,{client:n,children:[t,e&&a.jsx(tr.ReactQueryDevtools,{initialIsOpen:!1})]})};var Nr=p.createContext({client:ot});function Pr(e){var t=e.children,n=e.client,r=e.apiKey,s=e.options,i=p.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&&s&&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&&(ot.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ot.init(r,s)),ot)},[n,r]);return p.createElement(Nr.Provider,{value:{client:i}},t)}const ea=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(Pr,{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,ta=({children:e,locale:t,messages:n})=>{const r=t||"en",s={...br[r],...n||{}};return a.jsx(N.IntlProvider,{locale:r,messages:s,children:e})},ge=p.createContext({isLoading:!0});function _t(){return p.useContext(ge)}const na=({children:e,user:t})=>a.jsx(ge.Provider,{value:t,children:e}),Fr=({bootstrap:e,children:t,intl:n})=>{const[r,s]=p.useState({isLoading:!0});return p.useEffect(()=>{e().then(i=>{s({...i,isLoading:!1}),Kn(5e3)}).catch(()=>s({isLoading:!1}))},[]),a.jsx(ta,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(Bn.CookiesProvider,{children:a.jsx(na,{user:r,children:a.jsx(Xn,{children:a.jsx(ea,{user:r,children:t})})})})})},Ne="https://storage.googleapis.com/apolitical-assets/",$e={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Rr="200,000+";const Gt=({label:e=!1,className:t="",children:n})=>{const r=N.useIntl();return a.jsxs("details",{className:T("collapsible-section",t),children:[a.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})};const ve=({variant:e="primary",icon:t,className:n="",children:r,...s})=>{const i=t?{"--icon":`url(${Ne}icons/${t}.svg)`}:{};return a.jsx("div",{className:T("highlighted-text-box",e,n,{"has-icon":t}),style:i,...s,children:r})};const We=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let s=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,o=Fe(i);if(i&&typeof n=="object"&&typeof o=="number"){const d=Object.assign({},n.breakpoints),h=Vn(Object.keys(d));s=Yn(o,h,d)}const{breakpoints:c,text:m="",component:l,...f}=n;return a.jsx(ve,{variant:"subtle",className:T("empty-state-box",e,r),children:a.jsxs(a.Fragment,{children:[t&&a.jsx(gt,{options:{forceBlock:!0},children:t}),s&&typeof n=="object"&&(l||a.jsx(B,{...f,variant:n.variant?n.variant:"secondary",children:m}))]})})};const Ht=({children:e,...t})=>a.jsx("p",{...t,children:e}),aa={q:Ht,blockquote:Ht};for(let e=1;e<=6;e++)aa[`h${e}`]={component:Ht,props:{className:"title"}};const ra=({type:e="default",className:t="",heading:n=!1,children:r})=>a.jsxs("div",{className:T("helper-text-box text-small",e,t),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(gt,{options:{wrapper:p.Fragment,forceBlock:!0,overrides:aa},children:r}):a.jsx("p",{children:r})]});const Ir=({className:e="",show:t=!1,hide:n=!1,text:r,children:s})=>{const i=N.useIntl(),o=p.useRef(null),[c,m]=p.useState(""),[l,f]=p.useState("closed");p.useEffect(()=>{const g=o.current;if(g)return g.addEventListener("transitionend",d),()=>{g.removeEventListener("transitionend",d)}},[]),p.useEffect(()=>{if(!r||typeof r!="string")return;const g=r.split(`
36
36
  `);m(g.length<3?`${r.substring(0,400)}...`:g.slice(0,3).join(`
37
- `))},[r]),p.useEffect(()=>{l==="ready-to-close"&&f("closing")},[l]);const d=({propertyName:g})=>{g==="max-height"&&f(_=>_==="opening"?"open":_==="closing"?"closed":_)};if(!r)return null;const h=["opening","open"].includes(l);return a.jsxs(ve,{variant:"subtle",className:T("hide-show-text-box",e),children:[a.jsxs("div",{ref:o,className:T("content",l),children:[a.jsx(pt,{options:{forceBlock:!0},children:l==="closed"?c:r}),l!=="closed"&&s]}),a.jsx("p",{className:"cta",children:a.jsx(B,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:T({"rotate-180":h}),onClick:()=>{f(h?"ready-to-close":"opening")},children:h?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},Ar=()=>p.Fragment,Lr=({children:e})=>a.jsx(ve,{variant:"secondary",children:e}),Dr=["span","strong","h1","h2","h3","h4","h5","h6","p"],Or=({children:e})=>{const t=N.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of p.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(p.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of p.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&p.isValidElement(o)){const c=o.type;if(Dr.includes(c)){for(n=o.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 s=n?n.toString():"";return a.jsx(Vt,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},Br=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return a.jsx(ve,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return a.jsx(ve,{variant:"primary",children:e});case"pink-textbox":return a.jsx(ve,{variant:"tertiary",children:e});default:return a.jsx("div",{...t,children:e})}return a.jsx("div",{...t,children:e})},qr=e=>{const t=N.useIntl(),n=Date.now().toString();let r="default";const s=e.src;return s.includes("youtube")||s.includes("vimeo")?r="video":s.includes("riddle")||s.includes("sli.do")?r="poll":s.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(re,{children:a.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),a.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},En=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Zr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,s=!1;for(const i of p.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&p.isValidElement(i)){const o=i.type;if(["button","center","span","strong"].includes(o)&&i.props&&i.props.children&&i.props.children[0])for((o==="button"||En(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!p.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&En(r)==="button"&&(s=!0);else break}return s?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(B,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},ra=({children:e})=>a.jsx("span",{children:e});const Zt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:p.Fragment,forceBlock:!0,overrides:{a:Zr,CollapsibleSection:Vt,TextBox:ve,CaseStudy:Lr,style:Ar,details:Or,div:Br,iframe:qr}};return a.jsx("div",{className:T("markdown-text",e),children:a.jsx(pt,{options:{...r,...t},children:n})})};const sa=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:s=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return a.jsxs("section",{className:T("page-heading",s),children:[a.jsxs("div",{className:T("content",{"has-max-width":e}),style:i,children:[t&&t.text&&p.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&p.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Oe=({size:e="medium",variant:t="default",className:n="",children:r,...s})=>a.jsx("span",{className:T("pill",e,t,n),...s,children:r});const ot=({element:e="p",children:t=null,className:n="",...r})=>p.createElement(e,{...r,className:T("status-banner text-small",n),"aria-live":"assertive"},t);const Hr=({progress:e=0,text:t=!1,className:n=""})=>{const r=N.useIntl(),s=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return a.jsx("span",{className:T(`progress-bar section-${s}`,n),style:i,children:a.jsx(re,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},ia=p.memo(Hr);const Et="loadingBlock_",Ur=({progress:e=0,steps:t=!1,className:n=""})=>{const r=N.useIntl();t||(t={0:{text:r.formatMessage({id:`${Et}loading`})},75:{text:r.formatMessage({id:`${Et}almostDone`})},100:{text:r.formatMessage({id:`${Et}complete`})}});let s=null;const i=Object.keys(t);for(let c=0;c<i.length&&!(e<parseInt(i[c]));c++)s=i[c];const o=s&&t[s].icon?{"--icon":`url(${Ce}icons/${t[s].icon}.svg)`}:{};return a.jsxs(ve,{className:T("loading-block",n,{"has-icon":s&&t[s].icon}),variant:"subtle",style:o,children:[s&&a.jsx("span",{className:"step",children:t[s].text}),a.jsx(ia,{progress:e})]})},zr=p.memo(Ur);const pe=({element:e="div",className:t="",...n})=>a.jsx(Ut,{element:e,className:T("loading-placeholder",t),...n});const Ht={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"]},oa=(e,t)=>e in Ht?a.jsx("div",{className:e,children:Ht[e].map((n,r)=>oa(n,r))},t):a.jsx(pe,{className:e},t),Yt=({layout:e="overview-page",...t})=>a.jsx("div",{className:T("loading-state",e),...t,children:Ht[e].map((n,r)=>oa(n,r))}),ca=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):""},Ke=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Wr=e=>{const t=Math.ceil(26/Ke.length),n=ca(e).toLowerCase();if(n==="")return Ke[0];const r=n.charCodeAt(0)-96;for(let s=0;s<Ke.length;s++)if(r<=t*(s+1))return Ke[s]};const Sn=256,Pe=({className:e="",src:t="",name:n,alt:r,width:s=Sn,height:i=Sn,...o})=>{const[c,m]=p.useState(!1),l=p.useRef(null);p.useEffect(()=>{const d=l.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const g=s,_=i;typeof window<"u"&&window.devicePixelRatio&&(d.width=g*window.devicePixelRatio,d.height=_*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=Wr(n),h.fillRect(0,0,g,_),h.font=`${g/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(ca(n),g/2,_/1.6)},[n]);let f=!1;return t&&t!==""&&!c&&(t.includes("http")||t.includes("//"))&&(f=!0),a.jsx("figure",{className:T("profile-picture",e,{error:c}),...o,children:f?a.jsx("img",{src:t,alt:r||n,onError:()=>{m(!0)},width:s,height:i}):a.jsx("canvas",{ref:l})})},Gt=e=>e==="apolitical"?{image:`${Ce}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ce}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},Vr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const s=e!=="",i=t!=="",o=n!=="";if(!s&&!i&&!o)return"";const c=`${e}${s&&i?` — ${t}`:t}`;let m=`${c}${(s||i)&&o?`, ${n}`:n}`;return m.length>r&&(m=c),m.length>r&&(m=$e(m,r)),m};const gt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=N.useIntl(),c=Gt(t);c.name||(c.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:m,url:l,image:f}=c,d=Vr(c),h=n&&n.createdAt?Bt(n.createdAt):!1,g=n&&n.createdAt?Yn(n.createdAt):"";return p.createElement(e,{className:T("member text-medium",i),children:a.jsxs(Ze,{href:l,gtmType:s,gtmContext:r,onClick:_=>{_==null||_.stopPropagation()},children:[a.jsx(Pe,{name:m,src:f}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:m}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&a.jsx("span",{className:"date",title:g,"aria-label":g,children:o.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&a.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),d&&a.jsx("small",{children:d})]})]})})};const $n={small:24,medium:48},Qt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:s,showGap:i,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,className:m="",...l})=>{const f=N.useIntl();return!n||n.length===0?null:p.createElement(e,{...l,className:T("contributors",m,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((d,h)=>{let g,_="";if(h<c){const{name:v="",image:w=""}=Gt(d);if(o)return a.jsx(pe,{element:"li",className:"contributor"},h);g=a.jsx(Pe,{name:v,src:w,width:$n[s||"medium"],height:$n[s||"medium"]})}else if(h===c){const v=(t||n.length)-c;g=a.jsxs("small",{className:T({"large-number":v>99}),children:["+",yr(v,0)]}),_="number-left"}return g?a.jsx("li",{className:T("contributor",_),children:g},h):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):$e(n[0].name||"",20):null})]})})},Yr=({type:e,data:t})=>{const n=N.useIntl(),{answers:r,createdAt:s,dateHasPassed:i,isOngoingEvent:o,pill:c,readingTime:m,publishedDate:l,startDate:f}=t;if(e==="question"){const d=s&&Bt(s);return a.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),s&&a.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(f&&!i||o)return a.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Yn(f)});if(c)return a.jsx(Oe,{variant:c==="free"?"subtle":"highlighted",className:c,"data-testid":"course-type",children:c});if(m||l){const d=l&&Bt(l);return a.jsxs("ul",{className:"details",children:[m&&a.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:m})}),l&&a.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},ct={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"}},Gr=({data:e,cta:t,link:n,gtmContext:r})=>{var _;const s=N.useIntl(),[i,o]=p.useState({loading:!1,registered:e.registered||!1});p.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{startDate:c,dateHasPassed:m,pill:l,slug:f}=e,d=e.contentType;let h="";if((_=ct[d])!=null&&_.gtmEvent&&(h=ct[d].gtmEvent),c&&m)return a.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s.formatMessage({id:"card_watch"})});if(d==="people")return a.jsx(B,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s.formatMessage({id:"card_cta_people"})});const g=["microcourse","event"];if(t&&t.onClick&&g.includes(d)&&l!=="premium"){const v=i.loading||i.registered,w=async y=>{if(y.preventDefault(),y.stopPropagation(),!(v||!t||!t.onClick)){o(b=>({...b,loading:!0}));try{const b=await t.onClick(e);o(b==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return a.jsx(B,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${d}: ${f}`,"data-gtm-event-type":`${r}-${d}-register-click`,"data-testid":"in-card-button",children:s.formatMessage({id:`card_cta_${d}${v?`_${i.loading?"loading":"done"}`:""}`})})}return null},Cn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Qr=e=>{let t=e;return Object.keys(Cn).includes(e)&&(t=Cn[e]),`url(${Ce}icons/${t}.svg)`};const Kr={title:66,text:3e3,secondaryText:1e3,partner:25},Kt=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:s="Carousel",className:i=""})=>{const o=N.useIntl(),c=p.useContext(ge),m=c&&typeof c.id=="string",[l,f]=p.useState({data:null,isLoading:!0}),{data:d,isLoading:h}=l,g=p.useCallback(()=>{n(t,m).then(L=>{f(()=>({data:L,isLoading:!1}))}).catch(()=>f(L=>({...L,isLoading:!1})))},[e]);if(p.useEffect(()=>{g()},[]),h||!d)return a.jsx(pe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:_}=d;if(!_||!ct[_])return a.jsx(pe,{element:"li",className:"card-wrapper"});const{basePath:v="",className:w,length:y,gtmEvent:b}=ct[_],x=Gn(`card_label_${_}`)?o.formatMessage({id:`card_label_${_}`}):!1,j=d.slug?`${v}${d.slug}`:!1,M={...Kr,...y};let P={className:"card"};j&&(P={href:j,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${b}-click`,"data-testid":"link"},d.openInNewTab&&(P.target="_blank"));const I=d.customIcon?{"--custom-icon":Qr(d.customIcon)}:{};return a.jsx("li",{className:T("card-wrapper text-medium",w,i,{"has-link":j,"no-link":!j,"has-custom-icon":d.customIcon,"has-image":d.banner}),style:I,"data-testid":`${_}-card`,children:p.createElement(j?"a":"div",P,a.jsxs(a.Fragment,{children:[(d.customLabel||x)&&a.jsx("small",{className:T("card-label text-small",w),children:d.customLabel||x}),d.startDate&&!d.isOngoingEvent&&a.jsx(Oe,{size:"small",variant:d.dateHasPassed?"default":"information","data-testid":"date",children:d.dateHasPassed?o.formatMessage({id:"card_ended"}):pr(d.startDate)}),d.banner?a.jsxs("p",{className:"img",children:[d.registered&&a.jsx(Oe,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),a.jsx(Wt,{image:d.banner})]}):w==="people"?a.jsx(Pe,{name:d.title||"",src:d.profile,"data-testid":"people-profile-picture"}):null,d.contributors&&a.jsx(Qt,{contributors:{data:d.contributors},styling:{size:"small",showGap:w!=="question",showText:!0},"data-testid":"contributors"}),d.partner&&a.jsx("p",{className:"partners","data-testid":"partners",children:$e(d.partner.title,M.partner)}),["title","text","secondaryText"].map(L=>{const S=d[L];if(!S)return null;const C=fr(L);return a.jsx("p",{className:C,"data-testid":C,children:$e(S,M[L])},L)}),a.jsx(Yr,{type:w||"",data:d}),a.jsx(Gr,{data:d,cta:r,link:j||"",gtmContext:s})]}))})};const la=({cards:e,cardTypes:t,className:n="",...r})=>a.jsx("ul",{className:T("card-block",n),children:e.map((s,i)=>{const o=s.slug?`${s.slug}-${t[i]}`:`${t[i]}-${i}`;return a.jsx(Kt,{id:o,card:{...s,contentType:t[i]},...r},o)})}),Jr=(e,t,n,r)=>{const s=t*n<=e,i=e<t*(n+1),o=r.includes(Math.floor(e/t));return s&&i||o},Xr=({id:e,title:t})=>{const n=N.useIntl();if(!t||!t.text)return null;const{text:r,element:s="h2",variant:i="default",size:o="medium",link:c}=t;return p.createElement(s,{className:T("title",i,o,{"highlighted-title":i==="highlighted"}),children:a.jsxs(a.Fragment,{children:[r,c&&a.jsx("a",{href:c,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 St={fourCards:1024,threeCards:769,twoCards:480};let Je=null;const es=({id:e,cards:t,cardTypes:n,buildCardData:r,title:s,className:i,gtmContext:o})=>{var L;const c=N.useIntl(),[m,l]=p.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:d}=m,[h,g]=p.useState({currentPage:0,loadedPages:[0]}),{currentPage:_,loadedPages:v}=h,w=t.length,y=Math.ceil(w/f),b=p.useRef(null),x=Ne(!0,!0,b==null?void 0:b.current);p.useEffect(()=>{let S=1;x&&(x>=St.fourCards?S=4:x>=St.threeCards?S=3:x>=St.twoCards&&(S=2),S>w&&(S=w)),l(C=>({...C,cardsPerPage:S,isLoading:!1}))},[x,w]);const j=(S="next")=>{let C=_;if(typeof S=="string")if(S==="next")if(_<y-1)C=_+1;else return;else if(_>0)C=_-1;else return;else C=S;g($=>({...$,currentPage:C,loadedPages:[...new Set([...v,C])]}))},M=S=>{Je=S.touches[0].clientX},P=S=>{if(Je===null)return;const C=S.touches[0].clientX,$=Je-C;$>5?j("next"):$<-5&&j("previous"),Je=null},I={"--width":`${((L=b==null?void 0:b.current)==null?void 0:L.offsetWidth)||0}px`,"--total-cards":w,"--cards-per-page":f,"--page":_};return d?a.jsx(Yt,{layout:`carousel${s?"-with-title":""}`}):a.jsxs("section",{ref:b,className:T("carousel-wrapper",i),"data-testid":"carousel",children:[a.jsx(Xr,{id:e,title:s}),a.jsx("ul",{className:"carousel",onTouchStart:M,onTouchMove:P,style:I,"data-testid":"carousel-list",children:t.map((S,C)=>{let $=S&&S.sys&&S.sys.id?`${e}-card-${S.sys.id}`:null;return $&&Jr(C,f,_,v)?a.jsx(Kt,{id:$,card:{...S,contentType:n[C]},buildCardData:r,gtmContext:o},$):($=$||`${e}-card-${C}`,a.jsx(pe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},$))})}),y<=1?null:a.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[a.jsx("li",{className:"arrow previous",children:a.jsx(B,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:S=>{S.preventDefault(),S.stopPropagation(),j("previous")},screenreaderText:c.formatMessage({id:"carousel_pagination_previous"}),disabled:_<=0})}),[...Array(y)].map((S,C)=>a.jsx("li",{"data-testid":"carousel-controls-button",children:a.jsx("button",{className:T("page-indicator",{selected:C===_}),onClick:$=>{$.preventDefault(),$.stopPropagation(),j(C)},children:a.jsx(re,{showOnFocus:!1,children:c.formatMessage({id:"carousel_pagination_page"},{number:C+1,total:y})})})},`page-indicator-${C}`)),a.jsx("li",{className:"arrow next",children:a.jsx(B,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:S=>{S.preventDefault(),S.stopPropagation(),j("next")},screenreaderText:c.formatMessage({id:"carousel_pagination_next"}),disabled:_>=y-1})})]})]})},ts=({carousels:e=[],isLoading:t,title:n,className:r="",...s})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:o,cards:c,cardsTypes:m},l)=>{const f=i?window.btoa(i):`carousel-${l}`,d=l===e.length-1;return t?a.jsxs(p.Fragment,{children:[a.jsx(Yt,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:a.jsx(xe,{})]},`placeholder-${f}`):a.jsxs(p.Fragment,{children:[a.jsx(es,{cards:c,cardTypes:m,title:{...n,text:i,link:o},...s}),d?null:a.jsx(xe,{})]},`carousel-${f}`)});const $t="joinCommunityButton",Jt=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const s=N.useIntl(),i=p.useContext(ge),o=i&&typeof i.id=="string",[c,m]=p.useState(e),[l,f]=p.useState(e?"joined":"notJoined");p.useEffect(()=>{l==="joining"?f("joined"):l==="leaving"&&f("notJoined")},[c]);const d={},h={};return c&&l!=="leaving"&&(d["data-hover-text"]=s.formatMessage({id:`${$t}_leave`}),d["aria-label"]=s.formatMessage({id:`${$t}_member_aria`}),h["aria-hidden"]="true"),a.jsx(B,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&l!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async g=>{o&&(g.currentTarget.blur(),c?(f("leaving"),typeof r=="function"&&await r()):(f("joining"),typeof n=="function"&&await n()),m(!c))},className:T("join-community-button",l,{active:l==="joining"}),disabled:!o,...d,children:a.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${$t}${["joining","leaving"].includes(l)?`_${l}`:c?"_member":t?"_short":""}`})})})};const Ct="communityDetails_",ns=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:s=[]}={number:0,data:[]},functions:{invite:i,...o}})=>{const c=N.useIntl(),m=5,l=r||s.length,f=s.length?s:Array(m).fill({}),d=`/communities/${n}/members`===window.location.pathname;return a.jsxs("div",{className:T("community-details",e),children:[a.jsx(xe,{}),a.jsxs("div",{className:"member-details",children:[a.jsxs("div",{className:"top",children:[a.jsxs("h3",{children:[c.formatMessage({id:`${Ct}members`}),a.jsx("span",{className:"count",children:l})]}),!d&&a.jsx("p",{className:"text-small",children:a.jsx("a",{href:`/communities/${n}/members`,children:c.formatMessage({id:`${Ct}viewAll`})})})]}),a.jsx(Qt,{contributors:{total:r,data:f},styling:{size:"medium",showGap:!0,showPlaceholders:l===0},cutoff:m})]}),a.jsx(Jt,{isMember:t,functions:{...o}}),t&&a.jsx(B,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:c.formatMessage({id:`${Ct}invite`})})]})};const as=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=N.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(re,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),a.jsx("ul",{className:T("breadcrumbs text-small",n),children:e.map(({text:s,href:i,current:o=!1},c)=>a.jsxs("li",{children:[o&&a.jsx(re,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),a.jsx(Ze,{href:o?void 0:i,children:$e(s,t)})]},`${window.btoa(s)}_${c}`))})]})};const rs=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:s=""})=>{const i=N.useIntl(),o=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[c,m]=p.useState(t?["all"]:[]),l=(f,d)=>{let h=[];c.includes(f)?h=c.filter(g=>g!==f):f==="all"?h=["all"]:n?h=[...c.filter(g=>g!=="all"),f]:h=[f],m(g=>(r&&typeof r=="function"&&r({current:h,previous:g}),h)),d&&typeof d=="function"&&d()};return a.jsx("ul",{className:T("filters",s),children:o.map(({id:f,text:d,disabled:h=!1,callback:g=()=>{}})=>{let _={};return h&&(_={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:d})}),a.jsx("li",{children:a.jsx("button",{className:T(f,{selected:c.includes(f)}),onClick:v=>{v.preventDefault(),v.stopPropagation(),l(f,g)},..._,children:d})},f)})})},ss=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:s,position:i})=>{i==="before-lang"?r+=`/${s}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${s}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Mt={en:"English",es:"Español",fr:"Français",pt:"Português"},Xe="languageSwitcher_",is=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:s=()=>{},urlParts:i,variant:o="default",label:c,className:m=""})=>{const l=N.useIntl(),[f,d]=p.useState(e);if(p.useEffect(()=>{e!==f&&d(e)},[e]),!r||!Object.values(r).some(v=>v&&v.post_name))return null;const g=Object.keys(r),_=f!==e;return a.jsxs("div",{className:T("language-switcher text-small",o,m),children:[a.jsxs("nav",{children:[o!=="short"&&a.jsx("p",{children:c||l.formatMessage({id:`${Xe}label`})}),a.jsx("ul",{children:g.map(v=>{if(!Mt[v])return null;let w={className:v};return f===v?w["aria-label"]=l.formatMessage({id:`${Xe}selected`},{language:Mt[v]}):w={...w,href:ss(v,i),onClick:y=>{y.preventDefault(),y.stopPropagation(),d(v),s(v)}},a.jsx("li",{children:a.jsx(Ze,{...w,fallbackElement:"span",children:Mt[v]})},v)})}),o!=="short"&&!_&&a.jsx("p",{children:l.formatMessage({id:`${Xe}translation_${t?"original":n?"human":"machine"}`})})]}),o!=="short"&&!_&&!t&&!n&&a.jsx("small",{children:l.formatMessage({id:`${Xe}disclaimer`},{email:Ee.support,link:v=>{const w=`mailto:${v}`;return a.jsx("a",{href:w,children:v})}})})]})};const Nt=N.createIntl({locale:"en",messages:zt}),ze=({hasNextPage:e=!0,loadNextPage:t=()=>{},icon:n=!1,messages:r={button:Nt.formatMessage({id:"loadMore_button"}),endOfFeed:Nt.formatMessage({id:"loadMore_endOfFeed"}),error:Nt.formatMessage({id:"loadMore_error"})},className:s="",gtmContext:i="LoadMore"})=>{const[o,c]=p.useState(""),m=async l=>{try{await t(l)}catch(f){f instanceof Error?c(f.message):c("Unknown error")}};return a.jsx("footer",{className:T("load-more",s),children:!o&&e?a.jsx(B,{variant:"secondary",icon:n,onClick:m,"data-gtm-event-context":i,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):r.endOfFeed&&(!o||o!=null&&o.includes("Cannot read items"))?a.jsx("p",{children:r.endOfFeed}):o&&a.jsx("p",{className:"error",children:r.error})})};const Xt=({variant:e="default",version:t="default",className:n="",...r})=>a.jsx("p",{className:"logo-wrapper",children:a.jsx("a",{href:"/home/",className:T("logo",e,t,n),...r,children:a.jsx(re,{children:a.jsx(N.FormattedMessage,{id:"apolitical"})})})});let et=!1;const da=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const s=N.useIntl(),i=p.useRef(null),[o,c]=p.useState(!1),m=l=>{i.current&&l.target instanceof HTMLElement&&!i.current.contains(l.target)&&c(!1)};return p.useEffect(()=>(document.addEventListener("click",m,!0),()=>{document.removeEventListener("click",m,!0)})),p.createElement(e,{ref:i,className:T("more-menu text-medium",r),children:a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>c(!o),"aria-haspopup":"true","aria-expanded":o,"aria-controls":t,screenreaderText:s.formatMessage({id:"moreMenu"})}),a.jsx("ul",{id:t,hidden:!o,children:n.map(({href:l,onClick:f,text:d,icon:h,...g},_)=>{const v={...g,onClick:w=>{c(!1),typeof f=="function"&&f(w)},onFocus:()=>{et&&(clearTimeout(et),et=!1)},onBlur:()=>{et=setTimeout(()=>{c(!1)},100)}};return l&&(v.href=l),a.jsx("li",{children:a.jsx(B,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...v,children:d})},`${window.btoa(d)}_${_}`)})})]})})},os=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const cs=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"}],ua=({activeLink:e})=>{const t=N.useIntl(),n=p.useContext(ge),r=n&&typeof n.id=="string";return a.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[cs.map(({key:s,href:i})=>a.jsx("li",{className:T(s,{active:os(i,e)}),children:a.jsx("a",{href:i,"data-gtm-event-type":`${s}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${s}`})})},s)),r&&a.jsx("li",{className:"profile","data-testid":"profile-link",children:a.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[a.jsx(Pe,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),a.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},Le=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,ls=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Le(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(`${Le(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(`${Le(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
37
+ `))},[r]),p.useEffect(()=>{l==="ready-to-close"&&f("closing")},[l]);const d=({propertyName:g})=>{g==="max-height"&&f(_=>_==="opening"?"open":_==="closing"?"closed":_)};if(!r)return null;const h=["opening","open"].includes(l);return a.jsxs(ve,{variant:"subtle",className:T("hide-show-text-box",e),children:[a.jsxs("div",{ref:o,className:T("content",l),children:[a.jsx(gt,{options:{forceBlock:!0},children:l==="closed"?c:r}),l!=="closed"&&s]}),a.jsx("p",{className:"cta",children:a.jsx(B,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:T({"rotate-180":h}),onClick:()=>{f(h?"ready-to-close":"opening")},children:h?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},Ar=()=>p.Fragment,Lr=({children:e})=>a.jsx(ve,{variant:"secondary",children:e}),Dr=["span","strong","h1","h2","h3","h4","h5","h6","p"],Or=({children:e})=>{const t=N.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of p.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(p.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of p.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&p.isValidElement(o)){const c=o.type;if(Dr.includes(c)){for(n=o.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 s=n?n.toString():"";return a.jsx(Gt,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},Br=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return a.jsx(ve,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return a.jsx(ve,{variant:"primary",children:e});case"pink-textbox":return a.jsx(ve,{variant:"tertiary",children:e});default:return a.jsx("div",{...t,children:e})}return a.jsx("div",{...t,children:e})},qr=e=>{const t=N.useIntl(),n=Date.now().toString();let r="default";const s=e.src;return s.includes("youtube")||s.includes("vimeo")?r="video":s.includes("riddle")||s.includes("sli.do")?r="poll":s.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(re,{children:a.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),a.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.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},Zr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,s=!1;for(const i of p.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&p.isValidElement(i)){const o=i.type;if(["button","center","span","strong"].includes(o)&&i.props&&i.props.children&&i.props.children[0])for((o==="button"||Sn(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!p.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Sn(r)==="button"&&(s=!0);else break}return s?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(B,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},sa=({children:e})=>a.jsx("span",{children:e});const Ut=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:p.Fragment,forceBlock:!0,overrides:{a:Zr,CollapsibleSection:Gt,TextBox:ve,CaseStudy:Lr,style:Ar,details:Or,div:Br,iframe:qr}};return a.jsx("div",{className:T("markdown-text",e),children:a.jsx(gt,{options:{...r,...t},children:n})})};const ia=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:s=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return a.jsxs("section",{className:T("page-heading",s),children:[a.jsxs("div",{className:T("content",{"has-max-width":e}),style:i,children:[t&&t.text&&p.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&p.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const qe=({size:e="medium",variant:t="default",className:n="",children:r,...s})=>a.jsx("span",{className:T("pill",e,t,n),...s,children:r});const lt=({element:e="p",children:t=null,className:n="",...r})=>p.createElement(e,{...r,className:T("status-banner text-small",n),"aria-live":"assertive"},t);const Hr=({progress:e=0,text:t=!1,className:n=""})=>{const r=N.useIntl(),s=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return a.jsx("span",{className:T(`progress-bar section-${s}`,n),style:i,children:a.jsx(re,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},oa=p.memo(Hr);const $t="loadingBlock_",Ur=({progress:e=0,steps:t=!1,className:n=""})=>{const r=N.useIntl();t||(t={0:{text:r.formatMessage({id:`${$t}loading`})},75:{text:r.formatMessage({id:`${$t}almostDone`})},100:{text:r.formatMessage({id:`${$t}complete`})}});let s=null;const i=Object.keys(t);for(let c=0;c<i.length&&!(e<parseInt(i[c]));c++)s=i[c];const o=s&&t[s].icon?{"--icon":`url(${Ne}icons/${t[s].icon}.svg)`}:{};return a.jsxs(ve,{className:T("loading-block",n,{"has-icon":s&&t[s].icon}),variant:"subtle",style:o,children:[s&&a.jsx("span",{className:"step",children:t[s].text}),a.jsx(oa,{progress:e})]})},zr=p.memo(Ur);const pe=({element:e="div",className:t="",...n})=>a.jsx(Wt,{element:e,className:T("loading-placeholder",t),...n});const zt={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"]},ca=(e,t)=>e in zt?a.jsx("div",{className:e,children:zt[e].map((n,r)=>ca(n,r))},t):a.jsx(pe,{className:e},t),Qt=({layout:e="overview-page",...t})=>a.jsx("div",{className:T("loading-state",e),...t,children:zt[e].map((n,r)=>ca(n,r))}),la=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):""},Xe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Wr=e=>{const t=Math.ceil(26/Xe.length),n=la(e).toLowerCase();if(n==="")return Xe[0];const r=n.charCodeAt(0)-96;for(let s=0;s<Xe.length;s++)if(r<=t*(s+1))return Xe[s]};const $n=256,Re=({className:e="",src:t="",name:n,alt:r,width:s=$n,height:i=$n,...o})=>{const[c,m]=p.useState(!1),l=p.useRef(null);p.useEffect(()=>{const d=l.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const g=s,_=i;typeof window<"u"&&window.devicePixelRatio&&(d.width=g*window.devicePixelRatio,d.height=_*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=Wr(n),h.fillRect(0,0,g,_),h.font=`${g/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(la(n),g/2,_/1.6)},[n]);let f=!1;return t&&t!==""&&!c&&(t.includes("http")||t.includes("//"))&&(f=!0),a.jsx("figure",{className:T("profile-picture",e,{error:c}),...o,children:f?a.jsx("img",{src:t,alt:r||n,onError:()=>{m(!0)},width:s,height:i}):a.jsx("canvas",{ref:l})})},Kt=e=>e==="apolitical"?{image:`${Ne}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ne}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},Vr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const s=e!=="",i=t!=="",o=n!=="";if(!s&&!i&&!o)return"";const c=`${e}${s&&i?` — ${t}`:t}`;let m=`${c}${(s||i)&&o?`, ${n}`:n}`;return m.length>r&&(m=c),m.length>r&&(m=Me(m,r)),m};const bt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:s="member-click",className:i=""})=>{const o=N.useIntl(),c=Kt(t);c.name||(c.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:m,url:l,image:f}=c,d=Vr(c),h=n&&n.createdAt?Zt(n.createdAt):!1,g=n&&n.createdAt?Gn(n.createdAt):"";return p.createElement(e,{className:T("member text-medium",i),children:a.jsxs(Ue,{href:l,gtmType:s,gtmContext:r,onClick:_=>{_==null||_.stopPropagation()},children:[a.jsx(Re,{name:m,src:f}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:m}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&a.jsx("span",{className:"date",title:g,"aria-label":g,children:o.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&a.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),d&&a.jsx("small",{children:d})]})]})})};const Cn={small:24,medium:48},Jt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:s,showGap:i,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,className:m="",...l})=>{const f=N.useIntl();return!n||n.length===0?null:p.createElement(e,{...l,className:T("contributors",m,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((d,h)=>{let g,_="";if(h<c){const{name:v="",image:w=""}=Kt(d);if(o)return a.jsx(pe,{element:"li",className:"contributor"},h);g=a.jsx(Re,{name:v,src:w,width:Cn[s||"medium"],height:Cn[s||"medium"]})}else if(h===c){const v=(t||n.length)-c;g=a.jsxs("small",{className:T({"large-number":v>99}),children:["+",yr(v,0)]}),_="number-left"}return g?a.jsx("li",{className:T("contributor",_),children:g},h):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Me(n[0].name||"",20):null})]})})},Yr=({type:e,data:t})=>{const n=N.useIntl(),{answers:r,createdAt:s,dateHasPassed:i,isOngoingEvent:o,pill:c,readingTime:m,publishedDate:l,startDate:f}=t;if(e==="question"){const d=s&&Zt(s);return a.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),s&&a.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(f&&!i||o)return a.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Gn(f)});if(c)return a.jsx(qe,{variant:c==="free"?"subtle":"highlighted",className:c,"data-testid":"course-type",children:c});if(m||l){const d=l&&Zt(l);return a.jsxs("ul",{className:"details",children:[m&&a.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:m})}),l&&a.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},dt={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"}},Gr=({data:e,cta:t,link:n,gtmContext:r})=>{var _;const s=N.useIntl(),[i,o]=p.useState({loading:!1,registered:e.registered||!1});p.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{startDate:c,dateHasPassed:m,pill:l,slug:f}=e,d=e.contentType;let h="";if((_=dt[d])!=null&&_.gtmEvent&&(h=dt[d].gtmEvent),c&&m)return a.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s.formatMessage({id:"card_watch"})});if(d==="people")return a.jsx(B,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s.formatMessage({id:"card_cta_people"})});const g=["microcourse","event"];if(t&&t.onClick&&g.includes(d)&&l!=="premium"){const v=i.loading||i.registered,w=async y=>{if(y.preventDefault(),y.stopPropagation(),!(v||!t||!t.onClick)){o(b=>({...b,loading:!0}));try{const b=await t.onClick(e);o(b==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return a.jsx(B,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${d}: ${f}`,"data-gtm-event-type":`${r}-${d}-register-click`,"data-testid":"in-card-button",children:s.formatMessage({id:`card_cta_${d}${v?`_${i.loading?"loading":"done"}`:""}`})})}return null},Mn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Qr=e=>{let t=e;return Object.keys(Mn).includes(e)&&(t=Mn[e]),`url(${Ne}icons/${t}.svg)`};const Kr={title:66,text:3e3,secondaryText:1e3,partner:25},Xt=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:s="Carousel",className:i=""})=>{const o=N.useIntl(),c=p.useContext(ge),m=c&&typeof c.id=="string",[l,f]=p.useState({data:null,isLoading:!0}),{data:d,isLoading:h}=l,g=p.useCallback(()=>{n(t,m).then(D=>{f(()=>({data:D,isLoading:!1}))}).catch(()=>f(D=>({...D,isLoading:!1})))},[e]);if(p.useEffect(()=>{g()},[]),h||!d)return a.jsx(pe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:_}=d;if(!_||!dt[_])return a.jsx(pe,{element:"li",className:"card-wrapper"});const{basePath:v="",className:w,length:y,gtmEvent:b}=dt[_],x=Qn(`card_label_${_}`)?o.formatMessage({id:`card_label_${_}`}):!1,j=d.slug?`${v}${d.slug}`:!1,$={...Kr,...y};let P={className:"card"};j&&(P={href:j,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${b}-click`,"data-testid":"link"},d.openInNewTab&&(P.target="_blank"));const I=d.customIcon?{"--custom-icon":Qr(d.customIcon)}:{};return a.jsx("li",{className:T("card-wrapper text-medium",w,i,{"has-link":j,"no-link":!j,"has-custom-icon":d.customIcon,"has-image":d.banner}),style:I,"data-testid":`${_}-card`,children:p.createElement(j?"a":"div",P,a.jsxs(a.Fragment,{children:[(d.customLabel||x)&&a.jsx("small",{className:T("card-label text-small",w),children:d.customLabel||x}),d.startDate&&!d.isOngoingEvent&&a.jsx(qe,{size:"small",variant:d.dateHasPassed?"default":"information","data-testid":"date",children:d.dateHasPassed?o.formatMessage({id:"card_ended"}):pr(d.startDate)}),d.banner?a.jsxs("p",{className:"img",children:[d.registered&&a.jsx(qe,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),a.jsx(Yt,{image:d.banner})]}):w==="people"?a.jsx(Re,{name:d.title||"",src:d.profile,"data-testid":"people-profile-picture"}):null,d.contributors&&a.jsx(Jt,{contributors:{data:d.contributors},styling:{size:"small",showGap:w!=="question",showText:!0},"data-testid":"contributors"}),d.partner&&a.jsx("p",{className:"partners","data-testid":"partners",children:Me(d.partner.title,$.partner)}),["title","text","secondaryText"].map(D=>{const S=d[D];if(!S)return null;const M=fr(D);return a.jsx("p",{className:M,"data-testid":M,children:Me(S,$[D])},D)}),a.jsx(Yr,{type:w||"",data:d}),a.jsx(Gr,{data:d,cta:r,link:j||"",gtmContext:s})]}))})};const da=({cards:e,cardTypes:t,className:n="",...r})=>a.jsx("ul",{className:T("card-block",n),children:e.map((s,i)=>{const o=s.slug?`${s.slug}-${t[i]}`:`${t[i]}-${i}`;return a.jsx(Xt,{id:o,card:{...s,contentType:t[i]},...r},o)})}),Jr=(e,t,n,r)=>{const s=t*n<=e,i=e<t*(n+1),o=r.includes(Math.floor(e/t));return s&&i||o},Xr=({id:e,title:t})=>{const n=N.useIntl();if(!t||!t.text)return null;const{text:r,element:s="h2",variant:i="default",size:o="medium",link:c}=t;return p.createElement(s,{className:T("title",i,o,{"highlighted-title":i==="highlighted"}),children:a.jsxs(a.Fragment,{children:[r,c&&a.jsx("a",{href:c,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 Ct={fourCards:1024,threeCards:769,twoCards:480};let et=null;const es=({id:e,cards:t,cardTypes:n,buildCardData:r,title:s,className:i,gtmContext:o})=>{var D;const c=N.useIntl(),[m,l]=p.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:d}=m,[h,g]=p.useState({currentPage:0,loadedPages:[0]}),{currentPage:_,loadedPages:v}=h,w=t.length,y=Math.ceil(w/f),b=p.useRef(null),x=Fe(!0,!0,b==null?void 0:b.current);p.useEffect(()=>{let S=1;x&&(x>=Ct.fourCards?S=4:x>=Ct.threeCards?S=3:x>=Ct.twoCards&&(S=2),S>w&&(S=w)),l(M=>({...M,cardsPerPage:S,isLoading:!1}))},[x,w]);const j=(S="next")=>{let M=_;if(typeof S=="string")if(S==="next")if(_<y-1)M=_+1;else return;else if(_>0)M=_-1;else return;else M=S;g(C=>({...C,currentPage:M,loadedPages:[...new Set([...v,M])]}))},$=S=>{et=S.touches[0].clientX},P=S=>{if(et===null)return;const M=S.touches[0].clientX,C=et-M;C>5?j("next"):C<-5&&j("previous"),et=null},I={"--width":`${((D=b==null?void 0:b.current)==null?void 0:D.offsetWidth)||0}px`,"--total-cards":w,"--cards-per-page":f,"--page":_};return d?a.jsx(Qt,{layout:`carousel${s?"-with-title":""}`}):a.jsxs("section",{ref:b,className:T("carousel-wrapper",i),"data-testid":"carousel",children:[a.jsx(Xr,{id:e,title:s}),a.jsx("ul",{className:"carousel",onTouchStart:$,onTouchMove:P,style:I,"data-testid":"carousel-list",children:t.map((S,M)=>{let C=S&&S.sys&&S.sys.id?`${e}-card-${S.sys.id}`:null;return C&&Jr(M,f,_,v)?a.jsx(Xt,{id:C,card:{...S,contentType:n[M]},buildCardData:r,gtmContext:o},C):(C=C||`${e}-card-${M}`,a.jsx(pe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},C))})}),y<=1?null:a.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[a.jsx("li",{className:"arrow previous",children:a.jsx(B,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:S=>{S.preventDefault(),S.stopPropagation(),j("previous")},screenreaderText:c.formatMessage({id:"carousel_pagination_previous"}),disabled:_<=0})}),[...Array(y)].map((S,M)=>a.jsx("li",{"data-testid":"carousel-controls-button",children:a.jsx("button",{className:T("page-indicator",{selected:M===_}),onClick:C=>{C.preventDefault(),C.stopPropagation(),j(M)},children:a.jsx(re,{showOnFocus:!1,children:c.formatMessage({id:"carousel_pagination_page"},{number:M+1,total:y})})})},`page-indicator-${M}`)),a.jsx("li",{className:"arrow next",children:a.jsx(B,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:S=>{S.preventDefault(),S.stopPropagation(),j("next")},screenreaderText:c.formatMessage({id:"carousel_pagination_next"}),disabled:_>=y-1})})]})]})},ts=({carousels:e=[],isLoading:t,title:n,className:r="",...s})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:o,cards:c,cardsTypes:m},l)=>{const f=i?window.btoa(i):`carousel-${l}`,d=l===e.length-1;return t?a.jsxs(p.Fragment,{children:[a.jsx(Qt,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:a.jsx(xe,{})]},`placeholder-${f}`):a.jsxs(p.Fragment,{children:[a.jsx(es,{cards:c,cardTypes:m,title:{...n,text:i,link:o},...s}),d?null:a.jsx(xe,{})]},`carousel-${f}`)});const Mt="joinCommunityButton",en=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const s=N.useIntl(),i=p.useContext(ge),o=i&&typeof i.id=="string",[c,m]=p.useState(e),[l,f]=p.useState(e?"joined":"notJoined");p.useEffect(()=>{l==="joining"?f("joined"):l==="leaving"&&f("notJoined")},[c]);const d={},h={};return c&&l!=="leaving"&&(d["data-hover-text"]=s.formatMessage({id:`${Mt}_leave`}),d["aria-label"]=s.formatMessage({id:`${Mt}_member_aria`}),h["aria-hidden"]="true"),a.jsx(B,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&l!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async g=>{o&&(g.currentTarget.blur(),c?(f("leaving"),typeof r=="function"&&await r()):(f("joining"),typeof n=="function"&&await n()),m(!c))},className:T("join-community-button",l,{active:l==="joining"}),disabled:!o,...d,children:a.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${Mt}${["joining","leaving"].includes(l)?`_${l}`:c?"_member":t?"_short":""}`})})})};const Nt="communityDetails_",ns=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:s=[]}={number:0,data:[]},functions:{invite:i,...o}})=>{const c=N.useIntl(),m=5,l=r||s.length,f=s.length?s:Array(m).fill({}),d=`/communities/${n}/members`===window.location.pathname;return a.jsxs("div",{className:T("community-details",e),children:[a.jsx(xe,{}),a.jsxs("div",{className:"member-details",children:[a.jsxs("div",{className:"top",children:[a.jsxs("h3",{children:[c.formatMessage({id:`${Nt}members`}),a.jsx("span",{className:"count",children:l})]}),!d&&a.jsx("p",{className:"text-small",children:a.jsx("a",{href:`/communities/${n}/members`,children:c.formatMessage({id:`${Nt}viewAll`})})})]}),a.jsx(Jt,{contributors:{total:r,data:f},styling:{size:"medium",showGap:!0,showPlaceholders:l===0},cutoff:m})]}),a.jsx(en,{isMember:t,functions:{...o}}),t&&a.jsx(B,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:c.formatMessage({id:`${Nt}invite`})})]})};const as=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=N.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(re,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),a.jsx("ul",{className:T("breadcrumbs text-small",n),children:e.map(({text:s,href:i,current:o=!1},c)=>a.jsxs("li",{children:[o&&a.jsx(re,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),a.jsx(Ue,{href:o?void 0:i,children:Me(s,t)})]},`${window.btoa(s)}_${c}`))})]})};const rs=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:s=""})=>{const i=N.useIntl(),o=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[c,m]=p.useState(t?["all"]:[]),l=(f,d)=>{let h=[];c.includes(f)?h=c.filter(g=>g!==f):f==="all"?h=["all"]:n?h=[...c.filter(g=>g!=="all"),f]:h=[f],m(g=>(r&&typeof r=="function"&&r({current:h,previous:g}),h)),d&&typeof d=="function"&&d()};return a.jsx("ul",{className:T("filters",s),children:o.map(({id:f,text:d,disabled:h=!1,callback:g=()=>{}})=>{let _={};return h&&(_={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:d})}),a.jsx("li",{children:a.jsx("button",{className:T(f,{selected:c.includes(f)}),onClick:v=>{v.preventDefault(),v.stopPropagation(),l(f,g)},..._,children:d})},f)})})},ss=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:s,position:i})=>{i==="before-lang"?r+=`/${s}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${s}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Pt={en:"English",es:"Español",fr:"Français",pt:"Português"},tt="languageSwitcher_",is=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:s=()=>{},urlParts:i,variant:o="default",label:c,className:m=""})=>{const l=N.useIntl(),[f,d]=p.useState(e);if(p.useEffect(()=>{e!==f&&d(e)},[e]),!r||!Object.values(r).some(v=>v&&v.post_name))return null;const g=Object.keys(r),_=f!==e;return a.jsxs("div",{className:T("language-switcher text-small",o,m),children:[a.jsxs("nav",{children:[o!=="short"&&a.jsx("p",{children:c||l.formatMessage({id:`${tt}label`})}),a.jsx("ul",{children:g.map(v=>{if(!Pt[v])return null;let w={className:v};return f===v?w["aria-label"]=l.formatMessage({id:`${tt}selected`},{language:Pt[v]}):w={...w,href:ss(v,i),onClick:y=>{y.preventDefault(),y.stopPropagation(),d(v),s(v)}},a.jsx("li",{children:a.jsx(Ue,{...w,fallbackElement:"span",children:Pt[v]})},v)})}),o!=="short"&&!_&&a.jsx("p",{children:l.formatMessage({id:`${tt}translation_${t?"original":n?"human":"machine"}`})})]}),o!=="short"&&!_&&!t&&!n&&a.jsx("small",{children:l.formatMessage({id:`${tt}disclaimer`},{email:$e.support,link:v=>{const w=`mailto:${v}`;return a.jsx("a",{href:w,children:v})}})})]})};const Ft=N.createIntl({locale:"en",messages:Vt}),Ve=({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:s="",gtmContext:i="LoadMore"})=>{const[o,c]=p.useState(""),m=async l=>{try{await t(l)}catch(f){f instanceof Error?c(f.message):c("Unknown error")}};return a.jsx("footer",{className:T("load-more",s),children:!o&&e?a.jsx(B,{variant:"secondary",icon:n,onClick:m,"data-gtm-event-context":i,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):r.endOfFeed&&(!o||o!=null&&o.includes("Cannot read items"))?a.jsx("p",{children:r.endOfFeed}):o&&a.jsx("p",{className:"error",children:r.error})})};const tn=({variant:e="default",version:t="default",className:n="",...r})=>a.jsx("p",{className:"logo-wrapper",children:a.jsx("a",{href:"/home/",className:T("logo",e,t,n),...r,children:a.jsx(re,{children:a.jsx(N.FormattedMessage,{id:"apolitical"})})})});let nt=!1;const ua=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const s=N.useIntl(),i=p.useRef(null),[o,c]=p.useState(!1),m=l=>{i.current&&l.target instanceof HTMLElement&&!i.current.contains(l.target)&&c(!1)};return p.useEffect(()=>(document.addEventListener("click",m,!0),()=>{document.removeEventListener("click",m,!0)})),p.createElement(e,{ref:i,className:T("more-menu text-medium",r),children:a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>c(!o),"aria-haspopup":"true","aria-expanded":o,"aria-controls":t,screenreaderText:s.formatMessage({id:"moreMenu"})}),a.jsx("ul",{id:t,hidden:!o,children:n.map(({href:l,onClick:f,text:d,icon:h,...g},_)=>{const v={...g,onClick:w=>{c(!1),typeof f=="function"&&f(w)},onFocus:()=>{nt&&(clearTimeout(nt),nt=!1)},onBlur:()=>{nt=setTimeout(()=>{c(!1)},100)}};return l&&(v.href=l),a.jsx("li",{children:a.jsx(B,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...v,children:d})},`${window.btoa(d)}_${_}`)})})]})})},os=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const cs=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"}],ma=({activeLink:e})=>{const t=N.useIntl(),n=p.useContext(ge),r=n&&typeof n.id=="string";return a.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[cs.map(({key:s,href:i})=>a.jsx("li",{className:T(s,{active:os(i,e)}),children:a.jsx("a",{href:i,"data-gtm-event-type":`${s}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${s}`})})},s)),r&&a.jsx("li",{className:"profile","data-testid":"profile-link",children:a.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[a.jsx(Re,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),a.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},Oe=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,ls=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Oe(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(`${Oe(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(`${Oe(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
38
38
 
39
- ${Le(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Le(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,s)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s))}];const ds="shareLinks_",us=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:s="large",variant:i="default",className:o=""})=>{const c=N.useIntl(),m=ls({title:e,link:t,referrer:n});return a.jsxs("aside",{className:T("share-links",s,i,o),children:[a.jsx("p",{className:"text-small",children:c.formatMessage({id:"shareLinks_label"})}),a.jsx("ul",{children:m.map(({key:l,icon:f,url:d,shouldRender:h=!0,onClick:g})=>{if(typeof h=="function"&&!h())return null;const _={};return g&&(_.onClick=v=>g(v,d)),a.jsx("li",{children:a.jsx(B,{size:s,variant:"tertiary",icon:{icon:f||l},href:d,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:c.formatMessage({id:`${ds}link_${l}`}),..._})},l)})})]})};const ms=({tabs:e,className:t=""})=>{var m;const n=(l,f,d)=>(l||(l=`panel-${window.btoa(f)}-${d}`),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(d=>d.id===l)){for(let d=0;d<e.length;d++)if(n(e[d].id,e[d].text,d)===l){r=d;break}}}const[s,i]=p.useState((m=e[r])!=null&&m.id?e[r].id:n(e[r].id,e[r].text,r)),o=[],c=[];return e.forEach(({id:l,text:f,content:d,href:h},g)=>{l=n(l,f,g);const _=s===l,v={};h||(v["aria-controls"]=l,v.onClick=w=>{w.preventDefault(),w.stopPropagation(),i(l),window.location.hash=`#${l}`},c.push(a.jsx("section",{id:l,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${l}`,"aria-live":_?"assertive":"off",children:typeof d=="string"?a.jsx("p",{children:d}):d},`section-${l}`))),o.push(a.jsx("li",{children:a.jsx("a",{href:h||`#${l}`,id:`tab-${l}`,className:T({selected:_}),role:"tab","aria-selected":_,...v,children:f})},`tab-${l}`))}),a.jsxs("div",{className:T("tabs-wrapper",t),children:[a.jsx("ul",{className:"tabs",role:"tablist",children:o}),a.jsx("div",{className:"tab-content",children:c})]})};const fs={"2-1":901,"1-3":769},ma=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const s=Ne(!0);let i=r;return p.Children.count(r)===1&&(i=p.Children.toArray(r)[0],i.props&&(i=i.props.children)),a.jsx("section",{className:T("columns",`layout-${e}`,n),children:p.Children.map(i,(o,c)=>t!==!1&&c===t&&s&&s<fs[e]?null:o)})},ps=({activeLink:e,...t})=>a.jsx(He,{children:a.jsx(ma,{layout:"1-3",children:a.jsxs(a.Fragment,{children:[a.jsx(ua,{activeLink:e}),a.jsx(sa,{...t})]})})});const Pt="cookieBanner_",Ft=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Rt=new Date(Date.now()+12*30*24*60*60*1e3),fa=()=>{const e=N.useIntl(),[t,n,r]=On.useCookies(Ft),[s,i]=p.useState(!t["apol-cookie-banner"]),o=()=>{Ft.forEach(f=>{n(f,!0,{path:"/",expires:Rt,domain:f==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},c=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Rt}),Ft.forEach(f=>{if(f==="apol-cookie-banner"){n(f,!0,{path:"/",expires:Rt});return}r(f)}),i(!1)};if(!s)return null;const m=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:c,gtmType:"reject-all"},{id:"accept",onClick:o,gtmType:"accepted-all"}],l=[];return m.forEach(f=>{l.push({variant:f.href?"tertiary":"primary",href:f.href,onClick:f.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${f.gtmType}-click`,children:e.formatMessage({id:`${Pt}buttons_${f.id}`})})}),a.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[a.jsx("h6",{children:e.formatMessage({id:`${Pt}title`})}),a.jsx("p",{children:e.formatMessage({id:`${Pt}text`})}),a.jsx(qe,{buttons:l})]})},ye={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:Ee["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ee["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:Ee.support,gtmType:"concierge-email-click"},business:{email:Ee.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 Se="footer_",lt="SiteFooter",Mn=({group:e})=>{const t=ye[e].order||[];let n=!1;return"text"in ye[e]&&(n=ye[e].text),a.jsxs(p.Fragment,{children:[a.jsx("p",{className:"pre-title",children:a.jsx(N.FormattedMessage,{id:`${Se}${e}`})}),Array.isArray(t)&&t.length>0&&a.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:s,gtmType:i}=ye[e][r],o={};return["legal"].includes(e)&&(o.target="_blank",o.rel="noopener"),a.jsx("li",{children:a.jsx("a",{href:s,className:"gtm-trackable","data-gtm-event-context":lt,"data-gtm-event-type":i,...o,children:a.jsx(N.FormattedMessage,{id:`${Se}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&a.jsx("dl",{className:"text-medium",children:n.order.map(r=>a.jsxs(p.Fragment,{children:[a.jsx("dt",{children:a.jsx(N.FormattedMessage,{id:`${Se}${e}_${r}`})}),a.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&a.jsx("address",{children:a.jsx(N.FormattedMessage,{id:`${Se}${e}_${r}_address`,values:{br:a.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&a.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":lt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},en=()=>a.jsx("div",{id:"footer",children:a.jsxs("div",{className:"wrapper",children:[a.jsx(Ut,{element:"hr"}),a.jsx(Xt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":lt,"data-gtm-event-type":"logo-homepage-link"}),a.jsx("footer",{children:["platform","community","company","contact"].map(e=>a.jsxs("div",{className:"group",children:[a.jsx(Mn,{group:e}),Object.keys(ye[e]).includes("child")&&a.jsx(Mn,{group:ye[e].child})]},e))}),a.jsx("hr",{}),a.jsxs("div",{className:"sub-footer",children:[a.jsx("ul",{children:Array.isArray(ye.social.order)&&ye.social.order.map(e=>{const t=ye.social[e];return a.jsx("li",{className:e,children:a.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":lt,"data-gtm-event-type":"social-click",children:a.jsx("span",{className:"hidden",children:a.jsx(N.FormattedMessage,{id:`${Se}social_${e}`})})})},e)})}),a.jsx("small",{children:a.jsx(N.FormattedMessage,{id:`${Se}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const tt="emailHelperTextBox_",hs=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const s=N.useIntl(),[i,o]=p.useState({path:`${tt}default`,type:"default",link:{},mail:{},error:""}),[c,m]=p.useState(!1),l=p.useCallback(g=>{g.preventDefault(),g.stopPropagation();const _=v=>{o({path:`${tt}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:v})};if(typeof r!="function"){_(s.formatMessage({id:`${tt}error_noFunction`}));return}m(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(v=>{_(v.message)}).finally(()=>{m(!1)})},[t,n,r]);p.useEffect(()=>{let g=tt,_="default",v={},w={};switch(e){case"gov":g+="autoApproved",_="success";break;case"nonGov":g+="unrecognisedEmail",_="error",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",_="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":g+="emailUnverified",_="error",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>l(y),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",_="error",v={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:g+="default",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...i,path:g,type:_,link:v,mail:w})},[e]);const f={};return["link","mail"].forEach(g=>{f[g]=Object.keys(i[g]).length?_=>a.jsx("a",{...i[g],children:_}):_=>_}),a.jsx(aa,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(pe,{element:"span"}),a.jsx(pe,{element:"span"})]}):s.formatMessage({id:`${i.path}_text`},{...f,strong:g=>a.jsx("strong",{children:g}),em:g=>a.jsx("em",{children:g}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:i.error})})};const nt="passwordRules_",pa="isMoreThanEightCharacters",ha="includesNumberAndSymbol",ga="includesLowerAndUppercase",gs={[pa]:"8Characters",[ha]:"numberSymbol",[ga]:"lowercaseUppercase"},_s=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=N.useIntl();return a.jsxs("aside",{className:T("password-rules",t),children:[a.jsx("small",{children:n.formatMessage({id:`${nt}intro`})}),a.jsx("ul",{children:[pa,ha,ga].map(r=>a.jsxs("li",{className:T({matches:e[r]}),children:[a.jsxs(re,{children:[n.formatMessage({id:`${nt}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${nt}rule_${gs[r]}`})}),!e[r]&&a.jsxs(re,{element:"strong",children:[" "," ",n.formatMessage({id:`${nt}notMet`})]})]},`rule-${r}`))})]})},bs=p.memo(_s);const ys=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=N.useIntl(),[m,l]=p.useState({setUp:!1,id:null,rating:null,disabled:!0}),f=async()=>{try{const y=await n();l(b=>({...b,setUp:!0,id:y&&y.id,disabled:!1}))}catch(y){l(b=>({...b,setUp:!0,disabled:!0})),s(y)}};if(p.useEffect(()=>{o&&!m.setUp&&f()},[o]),!o)return a.jsx(pe,{className:"rating-placeholder"});const{id:d,rating:h,disabled:g}=m,_="ratings_",v={text:c.formatMessage({id:`${_}text`}),low:c.formatMessage({id:`${_}low`}),high:c.formatMessage({id:`${_}high`}),success:c.formatMessage({id:`${_}success`}),...e},w=async y=>{if(!(!d||g))try{l(b=>({...b,rating:y,disabled:!0})),await r({id:d,value:y})}catch(b){l(x=>({...x,rating:null})),s(b)}finally{l(b=>({...b,disabled:!1}))}};return a.jsxs("div",{className:T("rating",i),children:[a.jsx("span",{className:"label",children:v[h?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(t).keys()).map(y=>{const b=y+1;return a.jsx("li",{className:T({selected:h&&b<=h}),children:a.jsx(B,{variant:"tertiary",size:"small",icon:{icon:`star${!h||b>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${_}stars`},{number:b,total:t})}${b===1||b===t?` - ${v[b===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),w(b)},disabled:g})},`rating-${b}`)})})]})};const _a=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:s="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},m=N.useIntl(),l=p.useRef(null);we(()=>{!n||c||!o||l.current&&l.current.focus()},[o]);const f=d=>{d.preventDefault(),d.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return a.jsx("form",{onSubmit:f,className:T("search-form gtm-trackable",t),"data-gtm-event-context":s,"data-gtm-event-type":i,children:a.jsx("fieldset",{id:`${e}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(re,{element:"label",htmlFor:e,children:m.formatMessage({id:"search_label"})}),a.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:m.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&f(d)}}),a.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:a.jsx(re,{children:m.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:f,children:a.jsx(re,{children:m.formatMessage({id:"search_cta"})})})]})})})};const ba=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:s,backgroundColor:i,onClose:o,reportError:c,sendInvites:m,initialFormStatus:l="NOT_SUBMITTED"})=>{const[f,d]=p.useState([]),[h,g]=p.useState(!0),[_,v]=p.useState(l),{formatMessage:w}=N.useIntl(),y=async j=>{j.preventDefault();try{await m(f),d([]),v("SUCCESS")}catch(M){v("ERROR"),c(M)}},b=j=>{j.preventDefault(),v("NOT_SUBMITTED"),g(!0),d([])},x=j=>{j.preventDefault(),o(),v("CLOSED")};return _==="CLOSED"?null:_==="ERROR"||_==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:_==="SUCCESS"?a.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),a.jsx(xe,{}),a.jsx("div",{className:"footer",children:_==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"secondary",onClick:b,children:w({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(B,{onClick:x,children:w({id:"inviteForm_ctaDone"})})]}):a.jsx(B,{onClick:b,children:w({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:i},onSubmit:y,className:T("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:e}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:s},children:t}),a.jsx(nr.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:f,onChange:j=>{d(j),g(!j.length)},autoFocus:!1,getLabel:(j,M,P)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:j}),a.jsx(B,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{P(M),g(!f.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},M)})]}),a.jsx(xe,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(B,{className:"sendEmailsButton",disabled:h,children:n})})]})})},U={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const o=`logged${e?"In":"Out"}`;return t>=n[i][o]};let s={};return["navigation","search"].forEach(i=>{s[i]=r(i)}),s},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(s=>s===!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 s=Date.now();if(!t&&U.handlerCalled[e]&&s-U.handlerCalled[e]<500)return;U.handlerCalled[e]=s;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(o=>{o===e||n[o]===!1||i.push({type:`menus.${o}`,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 s=Bn(e[r],t);if(!(typeof s>"u")&&(!n||s[t]&&s[t].includes(n)||s.value&&s.value.includes(n)||s.toString().includes(n)))return e[r]}return e[0].children?U.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:s})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let o,c;switch(e){case"navigation":if(n){const m=U.findFirstChild(t.current.children,"attributes.aria-controls","navigation");o=U.findFirstChild(m.children,"href")}else o=U.findFirstChild(t.current.children,"href");o||(o=t.current);break;case"account":if(c=U.findFirstChild(t.current.children,"className","account"),!c||!c.children)return;o=U.findFirstChild(c.children,"href");break;default:return}o&&(s([{type:`focusElements.${e}.${i}`,value:o}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(U.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(U.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(U.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{U.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Be={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"}}}},dt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:s=()=>{},doTrack:i=null})=>{const o=N.useIntl(),c=Bn(Be,e);if(!c||c.onlyShow&&(c.onlyShow==="logged-in"&&!t||c.onlyShow==="logged-out"&&t))return null;const m="doTrack"in c,l=i===null?m?c.doTrack:!0:i,f=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;c.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let h=!1;if(c.href){let b=c.gtmType||`${e}-click`;if(b.includes(".")){const x=b.split("."),j=x[x.length-2];b=`${j==="topics"?`${j}-`:""}${x[x.length-1]}`}h={href:c.href,role:"menuitem"},l&&(h={...h,className:"gtm-trackable","data-gtm-event-type":b,"data-gtm-event-context":"HeaderButtons"}),f&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...c.props||{}})}const g=c.order&&c.order[0]&&c[c.order[0]],_=g&&c[c.order[0]].order,v=h&&window.location.pathname===c.href;let w={},y={};if(g){const b=c.menuId||e,x={onClick:j=>U.events.onClick(j,{id:b,callback:s,isOpen:r[b]}),onFocus:()=>U.events.onFocus({id:b}),onBlur:()=>U.events.onBlur({id:b,callback:s}),onMouseLeave:()=>U.events.onBlur({id:b,callback:s}),onMouseEnter:()=>U.events.onMouseEnter({id:b,callback:s})};n&&(_&&(w={...x,onKeyPress:j=>{j.key==="Enter"&&U.events.onClick(j,{id:b,callback:s,isOpen:r[b]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[b],"aria-controls":b}),y={hidden:b in r?!r[b]:!0}),_||(y={...y,...x})}return a.jsxs("li",{className:T({[c.className]:c.className,"has-submenu":g,parent:_,active:v}),role:"none",...w,children:[h?p.createElement(f?B:"a",h,o.formatMessage({id:d})):o.formatMessage({id:d}),c.order&&a.jsx("ul",{...y,children:c.order.map(b=>{if(!c[b])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:s,doTrack:m?l:null};return c[b].order?a.jsxs("li",{className:T({[c[b].className]:c[b].className}),children:[o.formatMessage({id:`${d}_${b}`}),a.jsx("ul",{children:c[b].order.map(j=>a.jsx(dt,{id:`${e}.${b}.${j}`,...x},j))})]},b):a.jsx(dt,{id:`${e}.${b}`,...x},b)})})]},e)};const vs={height:67,height_desktop:83},tn=({showNavigation:e=!0})=>{const t=N.useIntl(),n=p.useContext(ge),r=Ne(!0,!0),s=n&&typeof n.id=="string",i=p.useMemo(()=>U.getIsDesktopVersion(s,r),[s,r]),[o,c]=p.useReducer(xr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:m,menus:l,focusElements:f}=o;Un({scrollPosition:vs[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&l.navigation||U.shouldChangeHeaderIsVisible(!0,l,c)},scrollDown:()=>{!i&&l.navigation||U.shouldChangeHeaderIsVisible(!1,l,c)}}});const d=(g,_)=>{U.handleMenus({id:g,value:_,menus:l,dispatch:c})},h=p.useRef(null);return we(()=>{l.navigation&&U.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:f,dispatch:c})},[l.navigation]),we(()=>{l.account&&U.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:f,dispatch:c})},[l.account]),n&&n.isLoading?null:a.jsxs(a.Fragment,{children:[a.jsxs("nav",{id:"header",className:T({"logged-in":s,"logged-out":!s,visible:m}),children:[a.jsx(re,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),a.jsx(Xt,{}),e&&a.jsxs(a.Fragment,{children:[!i.navigation&&a.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),d("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:a.jsx(re,{children:t.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),a.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!i.navigation&&l.account?"account":"default",children:Be.order.map(g=>a.jsx(dt,{id:g,isLoggedIn:s,isDesktopVersion:i.navigation,menus:{navigation:l.navigation,account:l.account},callback:d},g))}),!i.search&&a.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),d("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:a.jsx(re,{children:t.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),a.jsx(_a,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),s?a.jsxs("button",{className:"account-button",onClick:g=>U.events.onClick(g,{id:"account",callback:d,isOpen:l.account}),onMouseEnter:()=>U.events.onMouseEnter({id:"account",callback:d}),onMouseLeave:()=>U.events.onBlur({id:"account",callback:d}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[a.jsx(re,{children:t.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),a.jsx(Pe,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):a.jsx("ul",{className:"sign-in-buttons",children:Be.buttons.order.map(g=>a.jsx(dt,{id:`buttons.${g}`},g))})]})]}),a.jsx("hr",{id:"content-of-page"}),a.jsx("div",{className:T("overlay",{open:l.navigation||l.account||!i.search&&l.search})})]})};const nn=({element:e="section",children:t,className:n,...r})=>p.createElement(e,{className:T("modal",n),children:typeof t=="string"?a.jsx("p",{children:t}):t,...r});const an=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:s=()=>{},onClose:i=()=>{}}={},forceShow:{error:o=!1}={},title:c,children:m,buttons:l,className:f="",gtmContext:d="Modal"})=>{const h=N.useIntl(),[g,_]=p.useState(t),v=y=>{_(y),y?(s(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};p.useEffect(()=>{v(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return a.jsx("div",{className:T("overlay",{open:g}),children:a.jsx(nn,{id:e,className:T("overlay-modal",f,{"has-max-width":r}),hidden:!g,style:w,children:t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"top",children:[c&&a.jsx("h2",{className:"modal-title",children:c}),a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>v(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":d,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&a.jsx(xe,{}),m,l&&a.jsxs("div",{className:"bottom",children:[a.jsx(xe,{}),a.jsx(qe,{buttons:l})]}),o&&a.jsx(ot,{className:"error",children:o})]})})})},ya=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const xs=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:s="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:o,onClose:c,reportError:m=()=>{},sendInvites:l})=>a.jsx(an,{title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:c},className:T("invite-modal",e,{success:!!n}),children:a.jsx(ba,{title:r,label:s,ctaMessage:i,onClose:c,sendInvites:l,reportError:m})});const ks=()=>{const e=N.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(tn,{}),a.jsx("div",{id:"content",children:a.jsx(Ue,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),a.jsx(en,{})]})},va=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:s={},styling:i={},className:o="",locale:c="en"})=>{const{navigation:m=!0,footer:l=!0}=s,{background:f="default",variant:d="default",circle:h="default"}=i,g=Zn();p.useEffect(()=>{window.scrollTo(0,0)},[g]);const _=it(e,{locale:c}),v=it(t,{locale:c}),w=it(n,{locale:c}),y={};return f!=="default"&&(y[f]=!0),d!=="default"&&(y[d]=!0),h!=="default"&&(y[h]=!0),a.jsx(ar.ErrorBoundary,{onError:r,fallback:a.jsx(ks,{}),children:a.jsx(p.Suspense,{fallback:null,children:a.jsxs("div",{id:"wrapper",className:T(o,y,{"has-footer":l}),children:[a.jsx(tn,{showNavigation:m}),a.jsxs("section",{id:"content-wrapper",children:[v&&a.jsx("div",{className:"additional-content prepended",children:v}),p.createElement(f==="bold"?nn:"div",{id:"content",children:_})]}),w&&a.jsx("div",{className:"additional-content appended",children:w}),l&&a.jsx(en,{}),a.jsx(fa,{})]})})})},Nn={default:"tags_",headerTopics:"header_topics_topics_"},It={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"},ws={getTagDetails:e=>{if(e.includes("topic_")){if(e=It.topic[e.replace("topic_","")],e){const t=Be.topics.topics[e].href;return t?{id:e,href:t,text:`${Nn.headerTopics}${e}`}:null}return null}return It[e]?(e=It[e],{id:e,text:`${Nn.default}${e}`}):null}};const js=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:s="",gtmType:i="tag-click",gtmContext:o="tags"})=>{const c=N.useIntl();if(!e||e.length<1)return null;const m=[];return e.forEach(l=>{if(!l)return;const f=ws.getTagDetails(l);f&&m.push(f)}),m.length<1?null:a.jsx("ul",{className:T("tags text-small",t,s,{"one-line":n}),children:m.map(l=>{const f=c.formatMessage({id:l.text});return a.jsx("li",{children:l.href&&r?a.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":o,children:f}):f},l.id)})})};const Ts=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:s="member",gtmType:i="member-click",className:o=""})=>{const c=N.useIntl();return e.length===0?null:a.jsxs("div",{className:T("members-list",o),children:[a.jsxs("h1",{children:[c.formatMessage({id:"membersList"}),a.jsx("span",{className:"count",children:t})]}),a.jsx("ul",{children:e.map((m,l)=>a.jsxs("li",{children:[a.jsx(gt,{member:m,gtmContext:s,gtmType:i}),m.isAdmin&&a.jsx(Oe,{children:c.formatMessage({id:"membersList_admin"})})]},l))}),n&&a.jsx(ze,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:s})]})};let at=null;const oe="discussion_form_",_t=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:s=5e4,minRows:i=4,forceShow:o={cancel:!1,error:!1},functions:c={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:m="DiscussionForm"})=>{var S,C,$;const l=N.useIntl(),f=p.useContext(ge),[d,h]=p.useState(n.isEditing&&n.isEditing.text||""),[g,_]=p.useState(o.error||!1),[v,w]=p.useState(!1),y=p.useRef(null);if(r||(r=y),n.isLoading)return a.jsx(pe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=q=>{const F=q.target.value;h(F);let H;!f||!f.id?H=he(l.formatMessage,`${oe}error_loggedOut`,e.type,"action"):t?F.length>=s&&(H=`${oe}error_tooLong`):H=he(l.formatMessage,`${oe}error_noPermission`,e.type,"action"),H?_(H):g&&_(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const q=((S=e.slugs)==null?void 0:S.reply)||((C=e.slugs)==null?void 0:C.answer)||(($=e.slugs)==null?void 0:$.question)||"";q&&(x=`${x}-${q.slice(-15)}`)}const j=async q=>{var H;if(q.preventDefault(),q.stopPropagation(),!f||!f.id||!t||P)return;at&&clearTimeout(at),w("submitting");const F=window.location.pathname;try{let V;switch(e.type){case"post":V=await c.create({content:d});break;case"question":V=await c.create({title:d,authorId:f&&f.id,...(H=c.props)==null?void 0:H.create});break;case"response":V=await c.create({question:e.slugs.question},{body:d,authorId:f&&f.id,contentPath:F});break;case"reply":V=await c.create({question:e.slugs.question,answer:e.slugs.answer},{body:d,authorId:f&&f.id,contentPath:F});break;default:break}await kr(1e3),c.callback&&await c.callback(V),at=setTimeout(()=>{h(""),w("submitted"),M()},500)}catch(V){const te=V;let G=`${oe}error`;te.message.includes("entry already exists")&&(G=he(l.formatMessage,`${oe}error_alreadyExists`,e.type,"action")),te.message.includes("429")?G=he(l.formatMessage,`${oe}error_tooMany`,e.type,"action"):te.message.includes("400")&&(G=`${oe}error`),_(G),M()}},M=()=>{at=setTimeout(()=>{_(!1),w(!1)},5e3)},P=!d||!vr(d),I=v==="submitting",L=[];return(n.isEditing&&!I||o.cancel)&&L.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:c.handleCancel,className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!o.cancel&&(!f||!f.id||!d),children:l.formatMessage({id:`${oe}cancel`})}),L.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:q=>{if(n.isEditing){w("submitting"),c.handleSaveEdit&&c.handleSaveEdit(y.current&&"value"in y.current?y.current.value:"");return}j(q)},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!f||!f.id||!t||P||I||n.isEditing&&d===n.isEditing.text,children:l.formatMessage({id:`${oe}${I?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),a.jsxs("form",{id:x,className:T("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)&&a.jsx("h2",{children:he(l.formatMessage,`${oe}title`,e.type,"action")}),a.jsx(gt,{member:f||"community",gtmContext:m,gtmType:"profile-click"}),a.jsx(re,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:he(l.formatMessage,`${oe}label`,e.type,"action")}),a.jsx(rr,{ref:r,id:`${x}-input`,name:e.type,placeholder:he(l.formatMessage,`${oe}placeholder`,e.type,"action"),onChange:b,value:d,maxLength:s,"aria-invalid":!!g,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),a.jsx("small",{children:he(l.formatMessage,`${oe}explainer`,e.type,"action",{a:q=>a.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:q})})}),a.jsx(qe,{buttons:L}),v==="submitted"&&a.jsx(ot,{className:"success","data-testid":"success",children:he(l.formatMessage,`${oe}success`,e.type,"action")}),g&&a.jsx(ot,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof g=="string"?g.includes(" ")?g:l.formatMessage({id:g},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:s}):g})]})},rn=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:s,leave:i,notMemberStateText:o}})=>r&&!n?a.jsx(Ue,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:a.jsx(Jt,{isShort:!0,functions:{join:s,leave:i}})}}):a.jsx(_t,{content:{type:e,slugs:{}},functions:{create:t}}),Es={showThread:!0,showForm:!1},We=p.createContext(Es),xa=({children:e})=>{const[t,n]=p.useState({showThread:!0,showForm:!1});return a.jsx(We.Provider,{value:{...t,updateConversation:n},children:e})},Ss=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),$s=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let De=!1;const At=()=>{De!==!1&&(clearTimeout(De),De=!1)},Lt=5,ka=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:s=!1,content:i={type:"reply",slugs:{}},canLike:o=!0,functions:{createLike:c=()=>{},deleteLike:m=()=>{}}={}})=>{const l=N.useIntl();p.useEffect(()=>{g(s)},[s]);const[f,d]=p.useState(t),[h,g]=p.useState(s),[_,v]=p.useState(!1),[w,y]=p.useState(!1),b=p.useMemo(()=>$s(n,Lt),[n]),x=M=>{if(M.preventDefault(),M.stopPropagation(),y(!1),De)return At(),!1;if(At(),_||!o)return!1;De=setTimeout(j,350)},j=async()=>{if(At(),_||!o)return!1;let M=h?f-1:f+1;M<0&&(M=0),v(!0),d(M),g(!h);try{if(i&&i.slugs){const P=Ss(i.slugs);h?await m(P):await c(P,{contentPath:window.location.pathname})}}catch{d(t),g(s)}finally{v(!1)}};return p.createElement(e,{className:T("likes-wrapper text-medium action-button",{"show-spinner":_,"is-liked":h,disabled:!o}),onClick:x,onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},onFocus:()=>{y(!0)},onBlur:()=>{y(!1)},children:a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:T({"do-animation":h&&!s}),screenreaderText:o?l.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:l.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:x,disabled:!o,"aria-hidden":!o,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),a.jsx("span",{className:T("number-of-likes",{"no-likes":f===0}),"data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:f})}),n&&a.jsx(Kn,{isOpen:w,isLoading:n.length===0,children:n.length&&a.jsxs("ul",{children:[b.map(M=>typeof M=="string"||!M.name?null:a.jsx("li",{children:a.jsx(Ze,{href:M.id?`/profiles/${M.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:P=>P==null?void 0:P.stopPropagation(),children:M.name})},M.id||window.btoa(M.name))),n.length>Lt&&a.jsx("li",{children:l.formatMessage({id:"discussion_likes_more"},{number:n.length-Lt})})]})})]})})},Pn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},bt=(e,t)=>e&&!t;const be="discussion_",Cs=280,Ve=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:s,forceHide:i={comments:!1},functions:{content:{createContent:o,deleteContent:c,updateContent:m}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:f}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:d}={openComments:()=>{}}},links:h={},className:g,gtmContext:_="DiscussionAnswer",children:v,isTruncated:w=!1})=>{const y=N.useIntl(),b=p.useContext(ge),x=p.useContext(We),[j,M]=p.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[P,I]=p.useState(!1),[L,S]=p.useState("");if(p.useEffect(()=>{M({...j,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return a.jsx(pe,{className:"discussion-card discussion-post"});const{author:C,canLike:$,createdAt:q,id:F,likes:H=0,userLiked:V,comments:te=0}=t,G=w?$e(j.body,Cs):j.body,Q=b&&b.id&&typeof C!="string"&&C.id&&C.id===b.id||!1,ne=typeof $=="boolean"?$:n?!Q:!1,K=async z=>{z||(z=""),S("");try{if(!sr(z,j.body)){const le=t.type==="question"?{title:z}:{body:z};await m(Pn(t.slugs),le)}M({body:z,isEditing:!1,didEdit:!0})}catch{S(`${be}form_error`)}},ae=()=>{x&&x.updateConversation&&x.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{var Y,me,de;const le=`reply-form-${(t.type==="answer"?t.slug:((Y=t.slugs)==null?void 0:Y.reply)||((me=t.slugs)==null?void 0:me.answer)||((de=t.slugs)==null?void 0:de.question)||"").toLowerCase().slice(-15)}`,ue=document.getElementById(le),Z=document.getElementById(`${le}-input`);Z&&Z.focus(),ue&&ue.scrollIntoView({behavior:"smooth"})},0)},ce=()=>{I(!1);try{c(Pn(t.slugs))}catch{S("delete-error")}},ie=[{text:y.formatMessage({id:`${be}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(y.formatMessage({id:`${be}report_subject`}))}&body=${encodeURI(y.formatMessage({id:`${be}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&&Q&&ie.push({text:y.formatMessage({id:`${be}moreMenu_edit`}),onClick:()=>M({...j,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`edit-${t.type}-click`},{text:y.formatMessage({id:`${be}moreMenu_delete`}),onClick:z=>{z.preventDefault(),z.stopPropagation(),I(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`delete-${t.type}-click`,...ya(`delete-${t.slug}-modal`,P)}),p.createElement(e,{className:T("discussion-post",g),"data-testid":`discussion-${t.type}-thread`,children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{id:F||t.slug,className:T("discussion-card",t.type,{editing:j.isEditing,"has-link":h.post&&!j.isEditing}),onClick:z=>{!h.post||j.isEditing||(z.preventDefault(),z.stopPropagation(),window.location.href=h.post)},children:[!j.isEditing&&a.jsx(gt,{member:C,additionalContent:{createdAt:q,didEdit:j.didEdit},className:typeof C!="string"&&C.id===s?"highlighted":"",gtmContext:_,gtmType:"profile-click"}),j.isEditing?a.jsx(_t,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:j.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:L!==""&&L!=="delete-error"?y.formatMessage({id:L},{action:y.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:o,handleSaveEdit:K,handleCancel:()=>{S(""),M({...j,isEditing:!1})}},gtmContext:`${_}Form`}):h.post?a.jsx("a",{href:h.post,className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":"title-click",children:a.jsx(Zt,{options:{overrides:{a:ra}},children:G})}):a.jsx(Zt,{options:{wrapper:t.type==="question"?"h1":p.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:G}),!j.isEditing&&a.jsxs("ul",{className:T("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[a.jsx(ka,{element:"li",likes:H,isShort:!1,userLiked:V,content:{type:t.type,slugs:t.slugs},canLike:ne,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:f}}),!i.comments&&(["question","post"].includes(t.type)||h.comments||typeof d=="function")&&a.jsxs("li",{className:"action-button",onClick:z=>{z.preventDefault(),z.stopPropagation(),h.comments&&(window.location.href=h.comments),typeof d=="function"&&d()},children:[a.jsx(B,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:h.comments?h.comments:!1,onClick:h.comments||typeof d!="function"?!1:d,className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:y.formatMessage({id:`${be}comments_screenReader`},{count:te})}),a.jsx("span",{children:y.formatMessage({id:`${be}comments`},{count:te})})]}),(t.type==="answer"||t.type==="reply")&&a.jsx("li",{children:a.jsx(B,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:ae,children:y.formatMessage({id:`${be}reply`})})}),a.jsx(da,{element:"li",id:`more-${t.slug}`,options:ie})]})]}),v,a.jsx(an,{id:`delete-${t.slug}-modal`,isOpen:P,functions:{onOpen:()=>{},onClose:()=>I(!1)},forceShow:{error:L==="delete-error"?y.formatMessage({id:"discussion_delete_error"},{action:y.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:y.formatMessage({id:"discussion_delete_title"},{action:y.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>I(!1),children:y.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ce,children:y.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:a.jsx(N.FormattedMessage,{id:"discussion_delete_text",values:{p:z=>a.jsx("p",{children:z}),action:y.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Dt="discussion_responses_",Ms=({type:e="answer",responses:t=0})=>{const n=N.useIntl();return a.jsxs("div",{className:"responses-heading",children:[a.jsx("h3",{children:n.formatMessage({id:`${Dt}title`},{action:n.formatMessage({id:`${Dt}${e}`}),count:t})}),t===0&&a.jsx("p",{children:he(n.formatMessage,`${Dt}empty`,e,e)})]})};const wa=({count:e="",showRepliesButton:t=!0,children:n})=>{const r=N.useIntl(),s=p.useRef(null),i=p.useContext(We),[o,c]=p.useState("open");p.useEffect(()=>{const d=s.current;if(d)return d.addEventListener("transitionend",m),()=>{d.removeEventListener("transitionend",m)}},[]),we(()=>{o==="closed"&&!i.showThread||c(["opening","open"].includes(o)?"ready-to-close":"opening")},[i.showThread]),p.useEffect(()=>{o==="ready-to-close"&&c("closing")},[o]);const m=({propertyName:d})=>{d==="max-height"&&c(h=>h==="opening"?"open":h==="closing"?"closed":h)},l=["opening","open"].includes(o),f=it(n,{element:"li"});return a.jsxs("div",{className:"thread-wrapper",children:[t&&a.jsx(B,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${l?"left":"right"}`},onClick:()=>{var d;(d=i.updateConversation)==null||d.call(i,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${l?"hide":"show"}`},{count:e})}),a.jsx("ul",{ref:s,className:T("thread",o),hidden:!i.showThread,children:f})]})},Ns="post",Ps="reply",ja="00000000-0000-0000-0000-000000000000";function sn({queryClient:e,queryKey:t}){function n(r,s,i){e.setQueryData(t,i)}return n}function on({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const s=e.getQueryData(t);return e.setQueryData(t,r),s}return n}function Fs(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Rs(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Ta(e){const{id:t="",name:n="",organization:r="",jobTitle:s="",image:i={}}=e,{thumbnail:o=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:s,thumbnail:o}}}function Is({content:e}){return{content:e,id:ja,time:new Date().toISOString(),verb:Ns}}function Fn({activity:e,user:t}){return{...e,actor:Ta(t),...Fs()}}function ut({activity:e,reaction:t}){var n,r,s;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((s=e.own_reactions)==null?void 0:s.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Ea({activity:e,user:t}){var n,r,s;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((s=e.own_reactions)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==t.id)})}function As({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:ja,kind:Ps,parent:t||""}}function Rn({reply:e,user:t}){const n=Ta(t);return{...e,user_id:n.id,user:n,...Rs()}}function In({reply:e,reaction:t}){var n,r,s;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((s=e.own_children)==null?void 0:s.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function Ls({reply:e,user:t}){var n,r,s;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((s=e.own_children)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Me=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),ke=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Sa=Object.freeze({actor:`SU:${Me.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Ds=Object.freeze({actor:`SU:${ke.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Os=Object.freeze({actor:`SU:${Me.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),Bs=Object.freeze({actor:`SU:${ke.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Sa.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:ke.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:ke.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:ke.id,user:{id:ke.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Sa.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Me.id,user:{id:Me.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ds.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:ke.id,user:{id:ke.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Os.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Me.id,user:{id:Me.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Bs.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function qs({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=X.useMutation({mutationFn:e,onMutate:c=>t(m=>{const l=Fn({activity:Is(c),user:i});return An(l,m)}),onError:n,onSuccess:(c,m,l)=>{const f=Fn({activity:c,user:i});r.setQueryData(s,An(f,l,!0))}});return o}function Zs({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=X.useMutation({mutationFn:e,onMutate:({activityId:s,content:i})=>t(o=>{const c=mt(s,o);return c&&(c.content=i),o}),onError:n});return r}function Hs({queryFns:{create:e,edit:t,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=X.useQueryClient(),m=ht(),l={queryClient:c,queryKey:o},f={mutationHandlers:{error:sn(l),mutate:on(l)},user:m,...l},d=qs({...f,mutationFn:e}),h=Zs({...f,mutationFn:t}),g=Us({...f,mutationFn:n}),_=Ws({...f,mutationFn:s}),v=Vs({...f,mutationFn:i}),{activities:w,...y}=zs({queryKey:o,queryFn:r});return{activities:w,mutations:{create:d,edit:h,remove:_,like:g,unlike:v},user:m,...y}}function Us({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=X.useMutation({mutationFn:e,onMutate:({activityId:o})=>t(c=>{const m=mt(o,c);return m&&ut({activity:m}),c}),onError:n,onSuccess:(o,{activityId:c},m)=>{const l=mt(c,m);l&&ut({activity:l,reaction:o}),r.setQueryData(s,m)}});return i}function zs({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=X.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:c=>(c==null?void 0:c.next)||null});return{activities:Gs(n),error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function Ws({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=X.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(i=>Ys(s,i)),onError:n});return r}function Vs({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=X.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(o=>{const c=mt(i,o);return c&&Ea({activity:c,user:r}),o}),onError:n});return s}function An(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 mt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:s})=>s===e);if(r)return r}}function Ys(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:s})=>s===e);if(r!==-1){n.splice(r,1);break}}return t}function Gs(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Qs=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:s,leave:i}})=>{const o=N.useIntl(),{activities:c,error:m,fetchNextPage:l,hasNextPage:f,isLoading:d,mutations:{create:h,edit:g,remove:_,like:v,unlike:w},user:y}=Hs({queryKey:[e,t,"activities"],queryFns:r});return m?a.jsx(Ue,{variant:"error",text:m.message}):a.jsxs("section",{children:[a.jsx(rn,{contentType:"post",createPost:h,membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:i,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map(b=>{var F,H,V,te,G,Q,ne;const{id:x,own_reactions:j,latest_reactions:M,reaction_counts:P}=b,I=(((F=M==null?void 0:M.like)==null?void 0:F.length)||0)>0,L=(((H=j==null?void 0:j.like)==null?void 0:H.length)||0)>0,S=L?j==null?void 0:j.like[0].id:"",C=I?(V=M==null?void 0:M.like)==null?void 0:V.map(K=>{var ae,ce,ie;return{id:(ae=K==null?void 0:K.user)==null?void 0:ae.id,name:(ie=(ce=K==null?void 0:K.user)==null?void 0:ce.data)==null?void 0:ie.name}}):!1,$=b==null?void 0:b.actor,q=($==null?void 0:$.id)===(y==null?void 0:y.id);return a.jsxs(p.Fragment,{children:[a.jsx(Ve,{content:{type:"post",body:b==null?void 0:b.content,canLike:bt(n,q),createdAt:(b==null?void 0:b.time)||"",slugs:{question:`${e}/${t}`,answer:x},slug:x,author:{id:$==null?void 0:$.id,name:(te=$==null?void 0:$.data)==null?void 0:te.name,organization:(G=$==null?void 0:$.data)==null?void 0:G.organization,jobTitle:(Q=$==null?void 0:$.data)==null?void 0:Q.jobTitle,image:{thumbnail:((ne=$==null?void 0:$.data)==null?void 0:ne.thumbnail)||void 0}},userLiked:L,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:C},links:{post:`${e}/${t}/${x}`,comments:`${e}/${t}/${x}`},functions:{content:{createContent:()=>null,deleteContent:()=>_({activityId:x}),updateContent:(K,{body:ae})=>g({activityId:x,content:ae})},likes:{createLike:()=>v({activityId:x}),deleteLike:()=>w({activityId:x,reactionId:S})},comments:{openComments:()=>null}},isTruncated:!0}),a.jsx(xe,{})]},x)}),!d&&a.jsx(ze,{hasNextPage:f,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})},Ks={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Js({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=X.useMutation({mutationFn:e,onMutate:c=>t(m=>{const l=Rn({reply:As(c),user:i});return Ln(l,m,{replace:!1,append:(c==null?void 0:c.replyId)!==void 0})}),onError:n,onSuccess:(c,m,l)=>{const f=Rn({reply:c,user:i});r.setQueryData(s,Ln(f,l,{replace:!0,append:(m==null?void 0:m.replyId)!==void 0}))}});return o}function Xs({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=X.useMutation({mutationFn:e,onMutate:({replyId:s,content:i})=>t(o=>{const c=ft(s,o);return c&&(c.data.content=i),o}),onError:n});return r}function $a({queryFns:{create:e,edit:t,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=X.useQueryClient(),m=ht(),l={queryClient:c,queryKey:o},f={mutationHandlers:{error:sn(l),mutate:on(l)},user:m,...l},d=Js({...f,mutationFn:e}),h=Xs({...f,mutationFn:t}),g=ei({...f,mutationFn:n}),_=ni({...f,mutationFn:s}),v=ai({...f,mutationFn:i}),{replies:w,...y}=ti({queryKey:o,queryFn:r});return{replies:w,mutations:{create:d,edit:h,remove:_,like:g,unlike:v},user:m,...y}}function ei({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=X.useMutation({mutationFn:e,onMutate:({replyId:o})=>t(c=>{const m=ft(o,c);return m&&In({reply:m}),c}),onError:n,onSuccess:(o,{replyId:c},m)=>{const l=ft(c,m);l&&In({reply:l,reaction:o}),r.setQueryData(s,m)}});return i}function ti({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=X.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:l=>(l==null?void 0:l.next)||null}),c=ci(n),m=`${c.length||0}${i?"+":""}`;return{replies:c,repliesCount:m,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function ni({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=X.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(i=>oi(s,i)),onError:n});return r}function ai({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=X.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(o=>{const c=ft(i,o);return c&&Ls({reply:c,user:r}),o}),onError:n});return s}function ri(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function si(e,t,n){const r=t.pages.length-1,s=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[s]=e:t.pages[r].results.push(e),t}function ii(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function Ln(e,t,n){return t?n!=null&&n.append?si(e,t,n):ii(e,t,n):ri(e)}function ft(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:s})=>s===e);if(r)return r}}function oi(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:s})=>s===e);if(r!==-1){n.splice(r,1);break}}return t}function ci(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const li=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:s,functions:i})=>{const o=N.useIntl(),{replies:c,repliesCount:m,fetchNextPage:l,hasNextPage:f,isLoading:d,mutations:{create:h,edit:g,like:_,remove:v,unlike:w},user:y}=$a({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}}),b=p.useContext(We);return a.jsx(wa,{count:m,showRepliesButton:!1,children:a.jsxs("section",{children:[c==null?void 0:c.map(x=>{var G,Q,ne,K,ae,ce,ie,z,le,ue;const{id:j,own_children:M,latest_children:P,children_counts:I}=x,L=(((G=P==null?void 0:P.like)==null?void 0:G.length)||0)>0,S=(Q=M==null?void 0:M.like)==null?void 0:Q.find(Z=>{var Y;return((Y=Z==null?void 0:Z.user)==null?void 0:Y.id)===(y==null?void 0:y.id)}),C=S?S==null?void 0:S.id:"",$=!!S,q=L?(ne=P==null?void 0:P.like)==null?void 0:ne.map(Z=>{var Y,me,de;return{id:(Y=Z==null?void 0:Z.user)==null?void 0:Y.id,name:(de=(me=Z==null?void 0:Z.user)==null?void 0:me.data)==null?void 0:de.name}}):!1,F=x==null?void 0:x.user,H=(F==null?void 0:F.id)===(y==null?void 0:y.id),V=bt(s,H),te=typeof x.data.content=="string"?(K=x==null?void 0:x.data)==null?void 0:K.content:((ce=(ae=x==null?void 0:x.data)==null?void 0:ae.content)==null?void 0:ce.text)||"";return a.jsx(Ve,{content:{type:"reply",body:te,canLike:V,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:F==null?void 0:F.id,name:(ie=F.data)==null?void 0:ie.name,organization:(z=F.data)==null?void 0:z.organization,jobTitle:(le=F.data)==null?void 0:le.jobTitle,image:{thumbnail:((ue=F.data)==null?void 0:ue.thumbnail)||void 0}},userLiked:$,likes:(I==null?void 0:I.like)||0,peopleWhoLiked:q},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:j}),updateContent:(Z,{body:Y})=>g({replyId:j,content:Y})},likes:{createLike:()=>_({replyId:j}),deleteLike:()=>w({replyId:j,reactionId:C})},comments:{}}},j)}),!d&&a.jsx(ze,{hasNextPage:f,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}}),b.showForm&&a.jsx(_t,{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:j})=>h({activityId:n,replyId:r,content:j})}})]})})},Ca=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:i,leave:o}})=>{const c=N.useIntl(),{replies:m,repliesCount:l,fetchNextPage:f,hasNextPage:d,isLoading:h,mutations:{create:g,edit:_,like:v,remove:w,unlike:y},user:b}=$a({queryKey:[e,t,n,"replies"],queryFns:s});return zn(),a.jsxs("section",{children:[a.jsxs("h3",{children:[c.formatMessage({id:"discussion_responses_comment"})," (",l,")"]}),a.jsx(rn,{contentType:"reply",createPost:(x,{body:j})=>g({activityId:n,content:j}),membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),m==null?void 0:m.map(x=>{var G,Q,ne,K,ae,ce,ie,z,le,ue;const{id:j,own_children:M,latest_children:P,children_counts:I}=x,L=(((G=P==null?void 0:P.like)==null?void 0:G.length)||0)>0,S=(Q=M==null?void 0:M.like)==null?void 0:Q.find(Z=>{var Y;return((Y=Z==null?void 0:Z.user)==null?void 0:Y.id)===(b==null?void 0:b.id)}),C=S?S==null?void 0:S.id:"",$=!!S,q=L?(ne=P==null?void 0:P.like)==null?void 0:ne.map(Z=>{var Y,me,de;return{id:(Y=Z==null?void 0:Z.user)==null?void 0:Y.id,name:(de=(me=Z==null?void 0:Z.user)==null?void 0:me.data)==null?void 0:de.name}}):!1,F=x==null?void 0:x.user,H=(F==null?void 0:F.id)===(b==null?void 0:b.id),V=bt(r,H),te=typeof x.data.content=="string"?(K=x==null?void 0:x.data)==null?void 0:K.content:((ce=(ae=x==null?void 0:x.data)==null?void 0:ae.content)==null?void 0:ce.text)||"";return a.jsx(xa,{children:a.jsx(Ve,{content:{type:"reply",body:te,canLike:V,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:j},slug:j,author:{id:F==null?void 0:F.id,name:(ie=F.data)==null?void 0:ie.name,organization:(z=F.data)==null?void 0:z.organization,jobTitle:(le=F.data)==null?void 0:le.jobTitle,image:{thumbnail:((ue=F.data)==null?void 0:ue.thumbnail)||void 0}},userLiked:$,likes:(I==null?void 0:I.like)||0,peopleWhoLiked:q},functions:{content:{createContent:()=>null,deleteContent:()=>w({replyId:j}),updateContent:(Z,{body:Y})=>_({replyId:j,content:Y})},likes:{createLike:()=>v({replyId:j}),deleteLike:()=>y({replyId:j,reactionId:C})},comments:{}},children:a.jsx(li,{basePath:e,parentId:t,activityId:n,replyId:j,isMember:r,functions:{...s}})},j)},j)}),!h&&a.jsx(ze,{hasNextPage:d,loadNextPage:()=>f(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})};function di({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=X.useMutation({mutationFn:e,onMutate:({content:s})=>t(i=>(i&&(i.content=s),i)),onError:n});return r}function ui({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,isFetching:i}=X.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:s,isFetching:i}}function mi({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:s}){const i=X.useQueryClient(),o=ht(),c={queryClient:i,queryKey:s},m={mutationHandlers:{error:sn(c),mutate:on(c)},user:o,...c},l=di({...m,mutationFn:t}),f=fi({...m,mutationFn:n}),d=pi({...m,mutationFn:r}),{activity:h,...g}=ui({queryKey:s,queryFn:e});return{activity:h,mutations:{edit:l,like:f,unlike:d},user:o,...g}}function fi({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=X.useMutation({mutationFn:e,onMutate:o=>t(c=>(c&&ut({activity:c}),c)),onError:n,onSuccess:(o,c,m)=>{m&&ut({activity:m,reaction:o}),r.setQueryData(s,m)}});return i}function pi({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=X.useMutation({mutationFn:e,onMutate:i=>t(o=>(o&&Ea({activity:o,user:r}),o)),onError:n});return s}const hi=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:s,...i},reactions:o,join:c,leave:m}})=>{var S,C,$,q,F,H,V,te,G;const l=N.useIntl(),f=p.useContext(ge),{activity:d,error:h,isLoading:g,mutations:{edit:_,like:v,unlike:w}}=mi({queryFns:i,queryKey:[e,t,n]});if(g)return a.jsx(pe,{style:{height:"400px"}});if(h||!d)return a.jsx(Ue,{variant:"error",text:l.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:y,latest_reactions:b}=d,x=(((S=b==null?void 0:b.like)==null?void 0:S.length)||0)>0,j=(((C=y==null?void 0:y.like)==null?void 0:C.length)||0)>0,M=j?y==null?void 0:y.like[0].id:"",P=x?($=b==null?void 0:b.like)==null?void 0:$.map(Q=>{var ne,K,ae;return{id:(ne=Q==null?void 0:Q.user)==null?void 0:ne.id,name:(ae=(K=Q==null?void 0:Q.user)==null?void 0:K.data)==null?void 0:ae.name}}):!1,I=d==null?void 0:d.actor,L=(I==null?void 0:I.id)===(f==null?void 0:f.id);return a.jsx(Ve,{className:"activity-section",content:{type:"post",body:d==null?void 0:d.content,canLike:bt(r,L),createdAt:(d==null?void 0:d.time)||"",slugs:{question:`${e}/${t}`,answer:d==null?void 0:d.id},slug:n,author:{id:I.id,name:(q=I.data)==null?void 0:q.name,organization:(F=I.data)==null?void 0:F.organization,jobTitle:(H=I.data)==null?void 0:H.jobTitle,image:{thumbnail:((V=I.data)==null?void 0:V.thumbnail)||void 0}},userLiked:j,likes:((te=d==null?void 0:d.reaction_counts)==null?void 0:te.like)||0,comments:((G=d==null?void 0:d.reaction_counts)==null?void 0:G.reply)||0,peopleWhoLiked:P},originalAuthorId:I==null?void 0:I.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:s,updateContent:(Q,{body:ne})=>_({content:ne})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>w({activityId:n,reactionId:M})},comments:{openComments:()=>{}}},children:a.jsx(Ca,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,join:c,leave:m}})},n)},gi=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:s}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:s}}),Dn=[{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 rt="notFoundError_",_i=()=>{const e=N.useIntl(),t=[];return Dn.forEach((n,r)=>{n.title=e.formatMessage({id:`${rt}post_${r+1}`}),t.push("solutionArticle")}),a.jsxs(va,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:a.jsxs(He,{children:[a.jsx(la,{cards:Dn,cardTypes:t,buildCardData:n=>new Promise((r,s)=>{r(n)})}),a.jsx(B,{href:"/solution-articles/",children:e.formatMessage({id:`${rt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[a.jsx("h1",{children:e.formatMessage({id:`${rt}title`})}),a.jsx("p",{children:e.formatMessage({id:`${rt}text`})})]})};exports.ASSETS_BUCKET=Ce;exports.ActivitiesFeed=Qs;exports.ActivitySection=hi;exports.AddPost=rn;exports.BannerSection=Cr;exports.Breadcrumbs=as;exports.Button=B;exports.ButtonWrapper=qe;exports.CacheProvider=Jn;exports.Card=Kt;exports.CardBlock=la;exports.Carousel=ts;exports.CollapsibleSection=Vt;exports.Columns=ma;exports.CommunityDetails=ns;exports.Contributors=Qt;exports.ConversationContext=We;exports.CookieBanner=fa;exports.DiscussionConversation=xa;exports.DiscussionForm=_t;exports.DiscussionLikes=ka;exports.DiscussionPost=Ve;exports.DiscussionThread=wa;exports.Divider=xe;exports.DownloadSection=Tr;exports.EMAILS=Ee;exports.EmailHelperTextBox=hs;exports.EmptyStateBox=Ue;exports.Filters=rs;exports.FlagsProvider=Xn;exports.Footer=en;exports.FullWidthSection=He;exports.GlobalProviders=Fr;exports.Header=tn;exports.HelperTextBox=aa;exports.HiddenFromScreenReaders=Ut;exports.HideShowTextBox=Ir;exports.HighlightedTextBox=ve;exports.IntlProvider=ea;exports.InviteForm=ba;exports.InviteModal=xs;exports.JoinButton=Jt;exports.LanguageSwitcher=is;exports.Link=Ze;exports.LoadMore=ze;exports.LoadingBlock=zr;exports.LoadingPlaceholder=pe;exports.LoadingState=Yt;exports.Logo=Xt;exports.LogoSection=Er;exports.MarkdownText=Zt;exports.MarketingBox=Mr;exports.Member=gt;exports.MembersList=Ts;exports.Modal=nn;exports.MoreMenu=da;exports.NUMBER_OF_USERS=Rr;exports.NavigationMenu=ua;exports.NotFoundError=_i;exports.Overlay=an;exports.PageHeading=sa;exports.PageLayout=va;exports.PasswordRules=bs;exports.Pill=Oe;exports.ProfilePicture=Pe;exports.ProgressBar=ia;exports.Rating=ys;exports.RepliesFeed=Ca;exports.ResponsesHeading=Ms;exports.ResponsiveImage=Wt;exports.SearchForm=_a;exports.ShareLinks=us;exports.Span=ra;exports.StatusBanner=ot;exports.Tabs=ms;exports.Tags=js;exports.Tooltip=Kn;exports.TopLevelPage=ps;exports.UserContext=ge;exports.UserProvider=ta;exports.VisuallyHidden=re;exports.addAriaProps=ya;exports.getMember=Gt;exports.headerData=Be;exports.mapGetStreamData=gi;exports.pageReady=Qn;exports.repliesFeedMock=Ks;exports.useCurrentPath=Zn;exports.useEffectAfterMount=we;exports.useElementWidth=Ne;exports.useScrollListener=Un;exports.useScrollToHash=zn;exports.useUser=ht;
39
+ ${Oe(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Oe(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,s)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s))}];const ds="shareLinks_",us=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:s="large",variant:i="default",className:o=""})=>{const c=N.useIntl(),m=ls({title:e,link:t,referrer:n});return a.jsxs("aside",{className:T("share-links",s,i,o),children:[a.jsx("p",{className:"text-small",children:c.formatMessage({id:"shareLinks_label"})}),a.jsx("ul",{children:m.map(({key:l,icon:f,url:d,shouldRender:h=!0,onClick:g})=>{if(typeof h=="function"&&!h())return null;const _={};return g&&(_.onClick=v=>g(v,d)),a.jsx("li",{children:a.jsx(B,{size:s,variant:"tertiary",icon:{icon:f||l},href:d,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:c.formatMessage({id:`${ds}link_${l}`}),..._})},l)})})]})};const ms=({tabs:e,className:t=""})=>{var m;const n=(l,f,d)=>(l||(l=`panel-${window.btoa(f)}-${d}`),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(d=>d.id===l)){for(let d=0;d<e.length;d++)if(n(e[d].id,e[d].text,d)===l){r=d;break}}}const[s,i]=p.useState((m=e[r])!=null&&m.id?e[r].id:n(e[r].id,e[r].text,r)),o=[],c=[];return e.forEach(({id:l,text:f,content:d,href:h},g)=>{l=n(l,f,g);const _=s===l,v={};h||(v["aria-controls"]=l,v.onClick=w=>{w.preventDefault(),w.stopPropagation(),i(l),window.location.hash=`#${l}`},c.push(a.jsx("section",{id:l,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${l}`,"aria-live":_?"assertive":"off",children:typeof d=="string"?a.jsx("p",{children:d}):d},`section-${l}`))),o.push(a.jsx("li",{children:a.jsx("a",{href:h||`#${l}`,id:`tab-${l}`,className:T({selected:_}),role:"tab","aria-selected":_,...v,children:f})},`tab-${l}`))}),a.jsxs("div",{className:T("tabs-wrapper",t),children:[a.jsx("ul",{className:"tabs",role:"tablist",children:o}),a.jsx("div",{className:"tab-content",children:c})]})};const fs={"2-1":901,"1-3":769},fa=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const s=Fe(!0);let i=r;return p.Children.count(r)===1&&(i=p.Children.toArray(r)[0],i.props&&(i=i.props.children)),a.jsx("section",{className:T("columns",`layout-${e}`,n),children:p.Children.map(i,(o,c)=>t!==!1&&c===t&&s&&s<fs[e]?null:o)})},ps=({activeLink:e,...t})=>a.jsx(ze,{children:a.jsx(fa,{layout:"1-3",children:a.jsxs(a.Fragment,{children:[a.jsx(ma,{activeLink:e}),a.jsx(ia,{...t})]})})});const Rt="cookieBanner_",It=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],At=new Date(Date.now()+12*30*24*60*60*1e3),pa=()=>{const e=N.useIntl(),[t,n,r]=Bn.useCookies(It),[s,i]=p.useState(!t["apol-cookie-banner"]),o=()=>{It.forEach(f=>{n(f,!0,{path:"/",expires:At,domain:f==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},c=()=>{n("apol-cookie-banner",!0,{path:"/",expires:At}),It.forEach(f=>{if(f==="apol-cookie-banner"){n(f,!0,{path:"/",expires:At});return}r(f)}),i(!1)};if(!s)return null;const m=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:c,gtmType:"reject-all"},{id:"accept",onClick:o,gtmType:"accepted-all"}],l=[];return m.forEach(f=>{l.push({variant:f.href?"tertiary":"primary",href:f.href,onClick:f.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${f.gtmType}-click`,children:e.formatMessage({id:`${Rt}buttons_${f.id}`})})}),a.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[a.jsx("h6",{children:e.formatMessage({id:`${Rt}title`})}),a.jsx("p",{children:e.formatMessage({id:`${Rt}text`})}),a.jsx(He,{buttons:l})]})},ye={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:$e["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:$e["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:$e.support,gtmType:"concierge-email-click"},business:{email:$e.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 Ce="footer_",ut="SiteFooter",Nn=({group:e})=>{const t=ye[e].order||[];let n=!1;return"text"in ye[e]&&(n=ye[e].text),a.jsxs(p.Fragment,{children:[a.jsx("p",{className:"pre-title",children:a.jsx(N.FormattedMessage,{id:`${Ce}${e}`})}),Array.isArray(t)&&t.length>0&&a.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:s,gtmType:i}=ye[e][r],o={};return["legal"].includes(e)&&(o.target="_blank",o.rel="noopener"),a.jsx("li",{children:a.jsx("a",{href:s,className:"gtm-trackable","data-gtm-event-context":ut,"data-gtm-event-type":i,...o,children:a.jsx(N.FormattedMessage,{id:`${Ce}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&a.jsx("dl",{className:"text-medium",children:n.order.map(r=>a.jsxs(p.Fragment,{children:[a.jsx("dt",{children:a.jsx(N.FormattedMessage,{id:`${Ce}${e}_${r}`})}),a.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&a.jsx("address",{children:a.jsx(N.FormattedMessage,{id:`${Ce}${e}_${r}_address`,values:{br:a.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&a.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":ut,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},nn=()=>a.jsx("div",{id:"footer",children:a.jsxs("div",{className:"wrapper",children:[a.jsx(Wt,{element:"hr"}),a.jsx(tn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ut,"data-gtm-event-type":"logo-homepage-link"}),a.jsx("footer",{children:["platform","community","company","contact"].map(e=>a.jsxs("div",{className:"group",children:[a.jsx(Nn,{group:e}),Object.keys(ye[e]).includes("child")&&a.jsx(Nn,{group:ye[e].child})]},e))}),a.jsx("hr",{}),a.jsxs("div",{className:"sub-footer",children:[a.jsx("ul",{children:Array.isArray(ye.social.order)&&ye.social.order.map(e=>{const t=ye.social[e];return a.jsx("li",{className:e,children:a.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":ut,"data-gtm-event-type":"social-click",children:a.jsx("span",{className:"hidden",children:a.jsx(N.FormattedMessage,{id:`${Ce}social_${e}`})})})},e)})}),a.jsx("small",{children:a.jsx(N.FormattedMessage,{id:`${Ce}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const at="emailHelperTextBox_",hs=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const s=N.useIntl(),[i,o]=p.useState({path:`${at}default`,type:"default",link:{},mail:{},error:""}),[c,m]=p.useState(!1),l=p.useCallback(g=>{g.preventDefault(),g.stopPropagation();const _=v=>{o({path:`${at}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:v})};if(typeof r!="function"){_(s.formatMessage({id:`${at}error_noFunction`}));return}m(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(v=>{_(v.message)}).finally(()=>{m(!1)})},[t,n,r]);p.useEffect(()=>{let g=at,_="default",v={},w={};switch(e){case"gov":g+="autoApproved",_="success";break;case"nonGov":g+="unrecognisedEmail",_="error",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",_="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":g+="emailUnverified",_="error",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>l(y),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",_="error",v={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:g+="default",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...i,path:g,type:_,link:v,mail:w})},[e]);const f={};return["link","mail"].forEach(g=>{f[g]=Object.keys(i[g]).length?_=>a.jsx("a",{...i[g],children:_}):_=>_}),a.jsx(ra,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(pe,{element:"span"}),a.jsx(pe,{element:"span"})]}):s.formatMessage({id:`${i.path}_text`},{...f,strong:g=>a.jsx("strong",{children:g}),em:g=>a.jsx("em",{children:g}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:i.error})})};const rt="passwordRules_",ha="isMoreThanEightCharacters",ga="includesNumberAndSymbol",_a="includesLowerAndUppercase",gs={[ha]:"8Characters",[ga]:"numberSymbol",[_a]:"lowercaseUppercase"},_s=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=N.useIntl();return a.jsxs("aside",{className:T("password-rules",t),children:[a.jsx("small",{children:n.formatMessage({id:`${rt}intro`})}),a.jsx("ul",{children:[ha,ga,_a].map(r=>a.jsxs("li",{className:T({matches:e[r]}),children:[a.jsxs(re,{children:[n.formatMessage({id:`${rt}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${rt}rule_${gs[r]}`})}),!e[r]&&a.jsxs(re,{element:"strong",children:[" "," ",n.formatMessage({id:`${rt}notMet`})]})]},`rule-${r}`))})]})},bs=p.memo(_s);const ys=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=N.useIntl(),[m,l]=p.useState({setUp:!1,id:null,rating:null,disabled:!0}),f=async()=>{try{const y=await n();l(b=>({...b,setUp:!0,id:y&&y.id,disabled:!1}))}catch(y){l(b=>({...b,setUp:!0,disabled:!0})),s(y)}};if(p.useEffect(()=>{o&&!m.setUp&&f()},[o]),!o)return a.jsx(pe,{className:"rating-placeholder"});const{id:d,rating:h,disabled:g}=m,_="ratings_",v={text:c.formatMessage({id:`${_}text`}),low:c.formatMessage({id:`${_}low`}),high:c.formatMessage({id:`${_}high`}),success:c.formatMessage({id:`${_}success`}),...e},w=async y=>{if(!(!d||g))try{l(b=>({...b,rating:y,disabled:!0})),await r({id:d,value:y})}catch(b){l(x=>({...x,rating:null})),s(b)}finally{l(b=>({...b,disabled:!1}))}};return a.jsxs("div",{className:T("rating",i),children:[a.jsx("span",{className:"label",children:v[h?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(t).keys()).map(y=>{const b=y+1;return a.jsx("li",{className:T({selected:h&&b<=h}),children:a.jsx(B,{variant:"tertiary",size:"small",icon:{icon:`star${!h||b>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${_}stars`},{number:b,total:t})}${b===1||b===t?` - ${v[b===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),w(b)},disabled:g})},`rating-${b}`)})})]})};const ba=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:s="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},m=N.useIntl(),l=p.useRef(null);Te(()=>{!n||c||!o||l.current&&l.current.focus()},[o]);const f=d=>{d.preventDefault(),d.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return a.jsx("form",{onSubmit:f,className:T("search-form gtm-trackable",t),"data-gtm-event-context":s,"data-gtm-event-type":i,children:a.jsx("fieldset",{id:`${e}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(re,{element:"label",htmlFor:e,children:m.formatMessage({id:"search_label"})}),a.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:m.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&f(d)}}),a.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:a.jsx(re,{children:m.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:f,children:a.jsx(re,{children:m.formatMessage({id:"search_cta"})})})]})})})};const ya=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:s,backgroundColor:i,onClose:o,reportError:c,sendInvites:m,initialFormStatus:l="NOT_SUBMITTED"})=>{const[f,d]=p.useState([]),[h,g]=p.useState(!0),[_,v]=p.useState(l),{formatMessage:w}=N.useIntl(),y=async j=>{j.preventDefault();try{await m(f),d([]),v("SUCCESS")}catch($){v("ERROR"),c($)}},b=j=>{j.preventDefault(),v("NOT_SUBMITTED"),g(!0),d([])},x=j=>{j.preventDefault(),o(),v("CLOSED")};return _==="CLOSED"?null:_==="ERROR"||_==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:_==="SUCCESS"?a.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),a.jsx(xe,{}),a.jsx("div",{className:"footer",children:_==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"secondary",onClick:b,children:w({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(B,{onClick:x,children:w({id:"inviteForm_ctaDone"})})]}):a.jsx(B,{onClick:b,children:w({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:i},onSubmit:y,className:T("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:e}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:s},children:t}),a.jsx(nr.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:f,onChange:j=>{d(j),g(!j.length)},autoFocus:!1,getLabel:(j,$,P)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:j}),a.jsx(B,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{P($),g(!f.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},$)})]}),a.jsx(xe,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(B,{className:"sendEmailsButton",disabled:h,children:n})})]})})},U={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const o=`logged${e?"In":"Out"}`;return t>=n[i][o]};let s={};return["navigation","search"].forEach(i=>{s[i]=r(i)}),s},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(s=>s===!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 s=Date.now();if(!t&&U.handlerCalled[e]&&s-U.handlerCalled[e]<500)return;U.handlerCalled[e]=s;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(o=>{o===e||n[o]===!1||i.push({type:`menus.${o}`,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 s=qn(e[r],t);if(!(typeof s>"u")&&(!n||s[t]&&s[t].includes(n)||s.value&&s.value.includes(n)||s.toString().includes(n)))return e[r]}return e[0].children?U.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:s})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let o,c;switch(e){case"navigation":if(n){const m=U.findFirstChild(t.current.children,"attributes.aria-controls","navigation");o=U.findFirstChild(m.children,"href")}else o=U.findFirstChild(t.current.children,"href");o||(o=t.current);break;case"account":if(c=U.findFirstChild(t.current.children,"className","account"),!c||!c.children)return;o=U.findFirstChild(c.children,"href");break;default:return}o&&(s([{type:`focusElements.${e}.${i}`,value:o}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(U.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(U.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(U.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{U.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ze={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"}}}},mt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:s=()=>{},doTrack:i=null})=>{const o=N.useIntl(),c=qn(Ze,e);if(!c||c.onlyShow&&(c.onlyShow==="logged-in"&&!t||c.onlyShow==="logged-out"&&t))return null;const m="doTrack"in c,l=i===null?m?c.doTrack:!0:i,f=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;c.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let h=!1;if(c.href){let b=c.gtmType||`${e}-click`;if(b.includes(".")){const x=b.split("."),j=x[x.length-2];b=`${j==="topics"?`${j}-`:""}${x[x.length-1]}`}h={href:c.href,role:"menuitem"},l&&(h={...h,className:"gtm-trackable","data-gtm-event-type":b,"data-gtm-event-context":"HeaderButtons"}),f&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...c.props||{}})}const g=c.order&&c.order[0]&&c[c.order[0]],_=g&&c[c.order[0]].order,v=h&&window.location.pathname===c.href;let w={},y={};if(g){const b=c.menuId||e,x={onClick:j=>U.events.onClick(j,{id:b,callback:s,isOpen:r[b]}),onFocus:()=>U.events.onFocus({id:b}),onBlur:()=>U.events.onBlur({id:b,callback:s}),onMouseLeave:()=>U.events.onBlur({id:b,callback:s}),onMouseEnter:()=>U.events.onMouseEnter({id:b,callback:s})};n&&(_&&(w={...x,onKeyPress:j=>{j.key==="Enter"&&U.events.onClick(j,{id:b,callback:s,isOpen:r[b]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[b],"aria-controls":b}),y={hidden:b in r?!r[b]:!0}),_||(y={...y,...x})}return a.jsxs("li",{className:T({[c.className]:c.className,"has-submenu":g,parent:_,active:v}),role:"none",...w,children:[h?p.createElement(f?B:"a",h,o.formatMessage({id:d})):o.formatMessage({id:d}),c.order&&a.jsx("ul",{...y,children:c.order.map(b=>{if(!c[b])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:s,doTrack:m?l:null};return c[b].order?a.jsxs("li",{className:T({[c[b].className]:c[b].className}),children:[o.formatMessage({id:`${d}_${b}`}),a.jsx("ul",{children:c[b].order.map(j=>a.jsx(mt,{id:`${e}.${b}.${j}`,...x},j))})]},b):a.jsx(mt,{id:`${e}.${b}`,...x},b)})})]},e)};const vs={height:67,height_desktop:83},an=({showNavigation:e=!0})=>{const t=N.useIntl(),n=p.useContext(ge),r=Fe(!0,!0),s=n&&typeof n.id=="string",i=p.useMemo(()=>U.getIsDesktopVersion(s,r),[s,r]),[o,c]=p.useReducer(xr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:m,menus:l,focusElements:f}=o;zn({scrollPosition:vs[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&l.navigation||U.shouldChangeHeaderIsVisible(!0,l,c)},scrollDown:()=>{!i&&l.navigation||U.shouldChangeHeaderIsVisible(!1,l,c)}}});const d=(g,_)=>{U.handleMenus({id:g,value:_,menus:l,dispatch:c})},h=p.useRef(null);return Te(()=>{l.navigation&&U.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:f,dispatch:c})},[l.navigation]),Te(()=>{l.account&&U.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:f,dispatch:c})},[l.account]),n&&n.isLoading?null:a.jsxs(a.Fragment,{children:[a.jsxs("nav",{id:"header",className:T({"logged-in":s,"logged-out":!s,visible:m}),children:[a.jsx(re,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),a.jsx(tn,{}),e&&a.jsxs(a.Fragment,{children:[!i.navigation&&a.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),d("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:a.jsx(re,{children:t.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),a.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!i.navigation&&l.account?"account":"default",children:Ze.order.map(g=>a.jsx(mt,{id:g,isLoggedIn:s,isDesktopVersion:i.navigation,menus:{navigation:l.navigation,account:l.account},callback:d},g))}),!i.search&&a.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),d("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:a.jsx(re,{children:t.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),a.jsx(ba,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),s?a.jsxs("button",{className:"account-button",onClick:g=>U.events.onClick(g,{id:"account",callback:d,isOpen:l.account}),onMouseEnter:()=>U.events.onMouseEnter({id:"account",callback:d}),onMouseLeave:()=>U.events.onBlur({id:"account",callback:d}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[a.jsx(re,{children:t.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),a.jsx(Re,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):a.jsx("ul",{className:"sign-in-buttons",children:Ze.buttons.order.map(g=>a.jsx(mt,{id:`buttons.${g}`},g))})]})]}),a.jsx("hr",{id:"content-of-page"}),a.jsx("div",{className:T("overlay",{open:l.navigation||l.account||!i.search&&l.search})})]})};const rn=({element:e="section",children:t,className:n,...r})=>p.createElement(e,{className:T("modal",n),children:typeof t=="string"?a.jsx("p",{children:t}):t,...r});const sn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:s=()=>{},onClose:i=()=>{}}={},forceShow:{error:o=!1}={},title:c,children:m,buttons:l,className:f="",gtmContext:d="Modal"})=>{const h=N.useIntl(),[g,_]=p.useState(t),v=y=>{_(y),y?(s(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};p.useEffect(()=>{v(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return a.jsx("div",{className:T("overlay",{open:g}),children:a.jsx(rn,{id:e,className:T("overlay-modal",f,{"has-max-width":r}),hidden:!g,style:w,children:t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"top",children:[c&&a.jsx("h2",{className:"modal-title",children:c}),a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>v(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":d,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&a.jsx(xe,{}),m,l&&a.jsxs("div",{className:"bottom",children:[a.jsx(xe,{}),a.jsx(He,{buttons:l})]}),o&&a.jsx(lt,{className:"error",children:o})]})})})},va=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const xs=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:s="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:o,onClose:c,reportError:m=()=>{},sendInvites:l})=>a.jsx(sn,{title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:c},className:T("invite-modal",e,{success:!!n}),children:a.jsx(ya,{title:r,label:s,ctaMessage:i,onClose:c,sendInvites:l,reportError:m})});const ks=()=>{const e=N.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(an,{}),a.jsx("div",{id:"content",children:a.jsx(We,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),a.jsx(nn,{})]})},xa=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:s={},styling:i={},className:o="",locale:c="en"})=>{const{navigation:m=!0,footer:l=!0}=s,{background:f="default",variant:d="default",circle:h="default"}=i,g=Hn();p.useEffect(()=>{window.scrollTo(0,0)},[g]);const _=ct(e,{locale:c}),v=ct(t,{locale:c}),w=ct(n,{locale:c}),y={};return f!=="default"&&(y[f]=!0),d!=="default"&&(y[d]=!0),h!=="default"&&(y[h]=!0),a.jsx(ar.ErrorBoundary,{onError:r,fallback:a.jsx(ks,{}),children:a.jsx(p.Suspense,{fallback:null,children:a.jsxs("div",{id:"wrapper",className:T(o,y,{"has-footer":l}),children:[a.jsx(an,{showNavigation:m}),a.jsxs("section",{id:"content-wrapper",children:[v&&a.jsx("div",{className:"additional-content prepended",children:v}),p.createElement(f==="bold"?rn:"div",{id:"content",children:_})]}),w&&a.jsx("div",{className:"additional-content appended",children:w}),l&&a.jsx(nn,{}),a.jsx(pa,{})]})})})},Pn={default:"tags_",headerTopics:"header_topics_topics_"},Lt={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"},ws={getTagDetails:e=>{if(e.includes("topic_")){if(e=Lt.topic[e.replace("topic_","")],e){const t=Ze.topics.topics[e].href;return t?{id:e,href:t,text:`${Pn.headerTopics}${e}`}:null}return null}return Lt[e]?(e=Lt[e],{id:e,text:`${Pn.default}${e}`}):null}};const js=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:s="",gtmType:i="tag-click",gtmContext:o="tags"})=>{const c=N.useIntl();if(!e||e.length<1)return null;const m=[];return e.forEach(l=>{if(!l)return;const f=ws.getTagDetails(l);f&&m.push(f)}),m.length<1?null:a.jsx("ul",{className:T("tags text-small",t,s,{"one-line":n}),children:m.map(l=>{const f=c.formatMessage({id:l.text});return a.jsx("li",{children:l.href&&r?a.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":o,children:f}):f},l.id)})})};const Ts=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:s="member",gtmType:i="member-click",className:o=""})=>{const c=N.useIntl();return e.length===0?null:a.jsxs("div",{className:T("members-list",o),children:[a.jsxs("h1",{children:[c.formatMessage({id:"membersList"}),a.jsx("span",{className:"count",children:t})]}),a.jsx("ul",{children:e.map((m,l)=>a.jsxs("li",{children:[a.jsx(bt,{member:m,gtmContext:s,gtmType:i}),m.isAdmin&&a.jsx(qe,{children:c.formatMessage({id:"membersList_admin"})})]},l))}),n&&a.jsx(Ve,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:s})]})};let st=null;const oe="discussion_form_",yt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:s=5e4,minRows:i=4,forceShow:o={cancel:!1,error:!1},functions:c={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:m="DiscussionForm"})=>{var S,M,C;const l=N.useIntl(),f=p.useContext(ge),[d,h]=p.useState(n.isEditing&&n.isEditing.text||""),[g,_]=p.useState(o.error||!1),[v,w]=p.useState(!1),y=p.useRef(null);if(r||(r=y),n.isLoading)return a.jsx(pe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=H=>{const Z=H.target.value;h(Z);let F;!f||!f.id?F=he(l.formatMessage,`${oe}error_loggedOut`,e.type,"action"):t?Z.length>=s&&(F=`${oe}error_tooLong`):F=he(l.formatMessage,`${oe}error_noPermission`,e.type,"action"),F?_(F):g&&_(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const H=((S=e.slugs)==null?void 0:S.reply)||((M=e.slugs)==null?void 0:M.answer)||((C=e.slugs)==null?void 0:C.question)||"";H&&(x=`${x}-${H.slice(-15)}`)}const j=async H=>{var F;if(H.preventDefault(),H.stopPropagation(),!f||!f.id||!t||P)return;st&&clearTimeout(st),w("submitting");const Z=window.location.pathname;try{let V;switch(e.type){case"post":V=await c.create({content:d});break;case"question":V=await c.create({title:d,authorId:f&&f.id,...(F=c.props)==null?void 0:F.create});break;case"response":V=await c.create({question:e.slugs.question},{body:d,authorId:f&&f.id,contentPath:Z});break;case"reply":V=await c.create({question:e.slugs.question,answer:e.slugs.answer},{body:d,authorId:f&&f.id,contentPath:Z});break;default:break}await kr(1e3),c.callback&&await c.callback(V),st=setTimeout(()=>{h(""),w("submitted"),$()},500)}catch(V){const te=V;let X=`${oe}error`;te.message.includes("entry already exists")&&(X=he(l.formatMessage,`${oe}error_alreadyExists`,e.type,"action")),te.message.includes("429")?X=he(l.formatMessage,`${oe}error_tooMany`,e.type,"action"):te.message.includes("400")&&(X=`${oe}error`),_(X),$()}},$=()=>{st=setTimeout(()=>{_(!1),w(!1)},5e3)},P=!d||!vr(d),I=v==="submitting",D=[];return(n.isEditing&&!I||o.cancel)&&D.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:c.handleCancel,className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!o.cancel&&(!f||!f.id||!d),children:l.formatMessage({id:`${oe}cancel`})}),D.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:H=>{if(n.isEditing){w("submitting"),c.handleSaveEdit&&c.handleSaveEdit(y.current&&"value"in y.current?y.current.value:"");return}j(H)},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!f||!f.id||!t||P||I||n.isEditing&&d===n.isEditing.text,children:l.formatMessage({id:`${oe}${I?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),a.jsxs("form",{id:x,className:T("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)&&a.jsx("h2",{children:he(l.formatMessage,`${oe}title`,e.type,"action")}),a.jsx(bt,{member:f||"community",gtmContext:m,gtmType:"profile-click"}),a.jsx(re,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:he(l.formatMessage,`${oe}label`,e.type,"action")}),a.jsx(rr,{ref:r,id:`${x}-input`,name:e.type,placeholder:he(l.formatMessage,`${oe}placeholder`,e.type,"action"),onChange:b,value:d,maxLength:s,"aria-invalid":!!g,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),a.jsx("small",{children:he(l.formatMessage,`${oe}explainer`,e.type,"action",{a:H=>a.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:H})})}),a.jsx(He,{buttons:D}),v==="submitted"&&a.jsx(lt,{className:"success","data-testid":"success",children:he(l.formatMessage,`${oe}success`,e.type,"action")}),g&&a.jsx(lt,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof g=="string"?g.includes(" ")?g:l.formatMessage({id:g},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:s}):g})]})},on=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:s,leave:i,notMemberStateText:o}})=>r&&!n?a.jsx(We,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:a.jsx(en,{isShort:!0,functions:{join:s,leave:i}})}}):a.jsx(yt,{content:{type:e,slugs:{}},functions:{create:t}}),Es={showThread:!0,showForm:!1},Ye=p.createContext(Es),ka=({children:e})=>{const[t,n]=p.useState({showThread:!0,showForm:!1});return a.jsx(Ye.Provider,{value:{...t,updateConversation:n},children:e})},Ss=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),$s=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Be=!1;const Dt=()=>{Be!==!1&&(clearTimeout(Be),Be=!1)},Ot=5,wa=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:s=!1,content:i={type:"reply",slugs:{}},canLike:o=!0,functions:{createLike:c=()=>{},deleteLike:m=()=>{}}={}})=>{const l=N.useIntl();p.useEffect(()=>{g(s)},[s]);const[f,d]=p.useState(t),[h,g]=p.useState(s),[_,v]=p.useState(!1),[w,y]=p.useState(!1),b=p.useMemo(()=>$s(n,Ot),[n]),x=$=>{if($.preventDefault(),$.stopPropagation(),y(!1),Be)return Dt(),!1;if(Dt(),_||!o)return!1;Be=setTimeout(j,350)},j=async()=>{if(Dt(),_||!o)return!1;let $=h?f-1:f+1;$<0&&($=0),v(!0),d($),g(!h);try{if(i&&i.slugs){const P=Ss(i.slugs);h?await m(P):await c(P,{contentPath:window.location.pathname})}}catch{d(t),g(s)}finally{v(!1)}};return p.createElement(e,{className:T("likes-wrapper text-medium action-button",{"show-spinner":_,"is-liked":h,disabled:!o}),onClick:x,onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},onFocus:()=>{y(!0)},onBlur:()=>{y(!1)},children:a.jsxs(a.Fragment,{children:[a.jsx(B,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:T({"do-animation":h&&!s}),screenreaderText:o?l.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:l.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:x,disabled:!o,"aria-hidden":!o,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),a.jsx("span",{className:T("number-of-likes",{"no-likes":f===0}),"data-testid":"number-of-likes",children:l.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:f})}),n&&a.jsx(Jn,{isOpen:w,isLoading:n.length===0,children:n.length&&a.jsxs("ul",{children:[b.map($=>typeof $=="string"||!$.name?null:a.jsx("li",{children:a.jsx(Ue,{href:$.id?`/profiles/${$.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:P=>P==null?void 0:P.stopPropagation(),children:$.name})},$.id||window.btoa($.name))),n.length>Ot&&a.jsx("li",{children:l.formatMessage({id:"discussion_likes_more"},{number:n.length-Ot})})]})})]})})},Fn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},vt=(e,t)=>e&&!t;const be="discussion_",Cs=280,Ge=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:s,forceHide:i={comments:!1},functions:{content:{createContent:o,deleteContent:c,updateContent:m}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:f}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:d}={openComments:()=>{}}},links:h={},className:g,gtmContext:_="DiscussionAnswer",children:v,isTruncated:w=!1})=>{const y=N.useIntl(),b=p.useContext(ge),x=p.useContext(Ye),[j,$]=p.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[P,I]=p.useState(!1),[D,S]=p.useState("");if(p.useEffect(()=>{$({...j,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return a.jsx(pe,{className:"discussion-card discussion-post"});const{author:M,canLike:C,createdAt:H,id:Z,likes:F=0,userLiked:V,comments:te=0}=t,X=w?Me(j.body,Cs):j.body,G=b&&b.id&&typeof M!="string"&&M.id&&M.id===b.id||!1,ne=typeof C=="boolean"?C:n?!G:!1,Q=async z=>{z||(z=""),S("");try{if(!sr(z,j.body)){const le=t.type==="question"?{title:z}:{body:z};await m(Fn(t.slugs),le)}$({body:z,isEditing:!1,didEdit:!0})}catch{S(`${be}form_error`)}},ae=()=>{x&&x.updateConversation&&x.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{var de,q,Y;const le=`reply-form-${(t.type==="answer"?t.slug:((de=t.slugs)==null?void 0:de.reply)||((q=t.slugs)==null?void 0:q.answer)||((Y=t.slugs)==null?void 0:Y.question)||"").toLowerCase().slice(-15)}`,ue=document.getElementById(le),me=document.getElementById(`${le}-input`);me&&me.focus(),ue&&ue.scrollIntoView({behavior:"smooth"})},0)},ce=()=>{I(!1);try{c(Fn(t.slugs))}catch{S("delete-error")}},ie=[{text:y.formatMessage({id:`${be}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(y.formatMessage({id:`${be}report_subject`}))}&body=${encodeURI(y.formatMessage({id:`${be}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&&G&&ie.push({text:y.formatMessage({id:`${be}moreMenu_edit`}),onClick:()=>$({...j,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`edit-${t.type}-click`},{text:y.formatMessage({id:`${be}moreMenu_delete`}),onClick:z=>{z.preventDefault(),z.stopPropagation(),I(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`delete-${t.type}-click`,...va(`delete-${t.slug}-modal`,P)}),p.createElement(e,{className:T("discussion-post",g),"data-testid":`discussion-${t.type}-thread`,children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{id:Z||t.slug,className:T("discussion-card",t.type,{editing:j.isEditing,"has-link":h.post&&!j.isEditing}),onClick:z=>{!h.post||j.isEditing||(z.preventDefault(),z.stopPropagation(),window.location.href=h.post)},children:[!j.isEditing&&a.jsx(bt,{member:M,additionalContent:{createdAt:H,didEdit:j.didEdit},className:typeof M!="string"&&M.id===s?"highlighted":"",gtmContext:_,gtmType:"profile-click"}),j.isEditing?a.jsx(yt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:j.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:D!==""&&D!=="delete-error"?y.formatMessage({id:D},{action:y.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:o,handleSaveEdit:Q,handleCancel:()=>{S(""),$({...j,isEditing:!1})}},gtmContext:`${_}Form`}):h.post?a.jsx("a",{href:h.post,className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":"title-click",children:a.jsx(Ut,{options:{overrides:{a:sa}},children:X})}):a.jsx(Ut,{options:{wrapper:t.type==="question"?"h1":p.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:X}),!j.isEditing&&a.jsxs("ul",{className:T("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[a.jsx(wa,{element:"li",likes:F,isShort:!1,userLiked:V,content:{type:t.type,slugs:t.slugs},canLike:ne,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:f}}),!i.comments&&(["question","post"].includes(t.type)||h.comments||typeof d=="function")&&a.jsxs("li",{className:"action-button",onClick:z=>{z.preventDefault(),z.stopPropagation(),h.comments&&(window.location.href=h.comments),typeof d=="function"&&d()},children:[a.jsx(B,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:h.comments?h.comments:!1,onClick:h.comments||typeof d!="function"?!1:d,className:"gtm-trackable","data-gtm-event-context":_,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:y.formatMessage({id:`${be}comments_screenReader`},{count:te})}),a.jsx("span",{children:y.formatMessage({id:`${be}comments`},{count:te})})]}),(t.type==="answer"||t.type==="reply")&&a.jsx("li",{children:a.jsx(B,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:ae,children:y.formatMessage({id:`${be}reply`})})}),a.jsx(ua,{element:"li",id:`more-${t.slug}`,options:ie})]})]}),v,a.jsx(sn,{id:`delete-${t.slug}-modal`,isOpen:P,functions:{onOpen:()=>{},onClose:()=>I(!1)},forceShow:{error:D==="delete-error"?y.formatMessage({id:"discussion_delete_error"},{action:y.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:y.formatMessage({id:"discussion_delete_title"},{action:y.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>I(!1),children:y.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ce,children:y.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:a.jsx(N.FormattedMessage,{id:"discussion_delete_text",values:{p:z=>a.jsx("p",{children:z}),action:y.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Bt="discussion_responses_",Ms=({type:e="answer",responses:t=0})=>{const n=N.useIntl();return a.jsxs("div",{className:"responses-heading",children:[a.jsx("h3",{children:n.formatMessage({id:`${Bt}title`},{action:n.formatMessage({id:`${Bt}${e}`}),count:t})}),t===0&&a.jsx("p",{children:he(n.formatMessage,`${Bt}empty`,e,e)})]})};const ja=({count:e="",showRepliesButton:t=!0,children:n})=>{const r=N.useIntl(),s=p.useRef(null),i=p.useContext(Ye),[o,c]=p.useState("open");p.useEffect(()=>{const d=s.current;if(d)return d.addEventListener("transitionend",m),()=>{d.removeEventListener("transitionend",m)}},[]),Te(()=>{o==="closed"&&!i.showThread||c(["opening","open"].includes(o)?"ready-to-close":"opening")},[i.showThread]),p.useEffect(()=>{o==="ready-to-close"&&c("closing")},[o]);const m=({propertyName:d})=>{d==="max-height"&&c(h=>h==="opening"?"open":h==="closing"?"closed":h)},l=["opening","open"].includes(o),f=ct(n,{element:"li"});return a.jsxs("div",{className:"thread-wrapper",children:[t&&a.jsx(B,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${l?"left":"right"}`},onClick:()=>{var d;(d=i.updateConversation)==null||d.call(i,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${l?"hide":"show"}`},{count:e})}),a.jsx("ul",{ref:s,className:T("thread",o),hidden:!i.showThread,children:f})]})},Ns="post",Ps="reply",Ta="00000000-0000-0000-0000-000000000000";function cn({queryClient:e,queryKey:t}){function n(r,s,i){e.setQueryData(t,i)}return n}function ln({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const s=e.getQueryData(t);return e.setQueryData(t,r),s}return n}function Fs(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Rs(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Ea(e){const{id:t="",name:n="",organization:r="",jobTitle:s="",image:i={}}=e,{thumbnail:o=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:s,thumbnail:o}}}function Is({content:e}){return{content:e,id:Ta,time:new Date().toISOString(),verb:Ns}}function Rn({activity:e,user:t}){return{...e,actor:Ea(t),...Fs()}}function ft({activity:e,reaction:t}){var n,r,s;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((s=e.own_reactions)==null?void 0:s.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Sa({activity:e,user:t}){var n,r,s;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((s=e.own_reactions)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==t.id)})}function As({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Ta,kind:Ps,parent:t||""}}function In({reply:e,user:t}){const n=Ea(t);return{...e,user_id:n.id,user:n,...Rs()}}function An({reply:e,reaction:t}){var n,r,s;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((s=e.own_children)==null?void 0:s.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function Ls({reply:e,user:t}){var n,r,s;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((s=e.own_children)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Pe=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),we=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),$a=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Ds=Object.freeze({actor:`SU:${we.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Os=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),Bs=Object.freeze({actor:`SU:${we.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:$a.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:we.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:we.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:we.id,user:{id:we.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:$a.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ds.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:we.id,user:{id:we.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Os.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Bs.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function qs({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=J.useMutation({mutationFn:e,onMutate:c=>t(m=>{const l=Rn({activity:Is(c),user:i});return Ln(l,m)}),onError:n,onSuccess:(c,m,l)=>{const f=Rn({activity:c,user:i});r.setQueryData(s,Ln(f,l,!0))}});return o}function Zs({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=J.useMutation({mutationFn:e,onMutate:({activityId:s,content:i})=>t(o=>{const c=pt(s,o);return c&&(c.content=i),o}),onError:n});return r}function Hs({queryFns:{create:e,edit:t,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=J.useQueryClient(),m=_t(),l={queryClient:c,queryKey:o},f={mutationHandlers:{error:cn(l),mutate:ln(l)},user:m,...l},d=qs({...f,mutationFn:e}),h=Zs({...f,mutationFn:t}),g=Us({...f,mutationFn:n}),_=Ws({...f,mutationFn:s}),v=Vs({...f,mutationFn:i}),{activities:w,...y}=zs({queryKey:o,queryFn:r});return{activities:w,mutations:{create:d,edit:h,remove:_,like:g,unlike:v},user:m,...y}}function Us({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=J.useMutation({mutationFn:e,onMutate:({activityId:o})=>t(c=>{const m=pt(o,c);return m&&ft({activity:m}),c}),onError:n,onSuccess:(o,{activityId:c},m)=>{const l=pt(c,m);l&&ft({activity:l,reaction:o}),r.setQueryData(s,m)}});return i}function zs({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=J.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:c=>(c==null?void 0:c.next)||null});return{activities:Gs(n),error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function Ws({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=J.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(i=>Ys(s,i)),onError:n});return r}function Vs({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=J.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(o=>{const c=pt(i,o);return c&&Sa({activity:c,user:r}),o}),onError:n});return s}function Ln(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 pt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:s})=>s===e);if(r)return r}}function Ys(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:s})=>s===e);if(r!==-1){n.splice(r,1);break}}return t}function Gs(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Qs=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:s,leave:i}})=>{const o=N.useIntl(),{activities:c,error:m,fetchNextPage:l,hasNextPage:f,isLoading:d,mutations:{create:h,edit:g,remove:_,like:v,unlike:w},user:y}=Hs({queryKey:[e,t,"activities"],queryFns:r});return m?a.jsx(We,{variant:"error",text:m.message}):a.jsxs("section",{children:[a.jsx(on,{contentType:"post",createPost:h,membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:i,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map(b=>{var Z,F,V,te,X,G,ne;const{id:x,own_reactions:j,latest_reactions:$,reaction_counts:P}=b,I=(((Z=$==null?void 0:$.like)==null?void 0:Z.length)||0)>0,D=(((F=j==null?void 0:j.like)==null?void 0:F.length)||0)>0,S=D?j==null?void 0:j.like[0].id:"",M=I?(V=$==null?void 0:$.like)==null?void 0:V.map(Q=>{var ae,ce,ie;return{id:(ae=Q==null?void 0:Q.user)==null?void 0:ae.id,name:(ie=(ce=Q==null?void 0:Q.user)==null?void 0:ce.data)==null?void 0:ie.name}}):!1,C=b==null?void 0:b.actor,H=(C==null?void 0:C.id)===(y==null?void 0:y.id);return a.jsxs(p.Fragment,{children:[a.jsx(Ge,{content:{type:"post",body:b==null?void 0:b.content,canLike:vt(n,H),createdAt:(b==null?void 0:b.time)||"",slugs:{question:`${e}/${t}`,answer:x},slug:x,author:{id:C==null?void 0:C.id,name:(te=C==null?void 0:C.data)==null?void 0:te.name,organization:(X=C==null?void 0:C.data)==null?void 0:X.organization,jobTitle:(G=C==null?void 0:C.data)==null?void 0:G.jobTitle,image:{thumbnail:((ne=C==null?void 0:C.data)==null?void 0:ne.thumbnail)||void 0}},userLiked:D,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:M},links:{post:`${e}/${t}/${x}`,comments:`${e}/${t}/${x}`},functions:{content:{createContent:()=>null,deleteContent:()=>_({activityId:x}),updateContent:(Q,{body:ae})=>g({activityId:x,content:ae})},likes:{createLike:()=>v({activityId:x}),deleteLike:()=>w({activityId:x,reactionId:S})},comments:{openComments:()=>null}},isTruncated:!0}),a.jsx(xe,{})]},x)}),!d&&a.jsx(Ve,{hasNextPage:f,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})},Ks={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Js({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=J.useMutation({mutationFn:e,onMutate:c=>t(m=>{const l=In({reply:As(c),user:i});return Dn(l,m,{replace:!1,append:(c==null?void 0:c.replyId)!==void 0})}),onError:n,onSuccess:(c,m,l)=>{const f=In({reply:c,user:i});r.setQueryData(s,Dn(f,l,{replace:!0,append:(m==null?void 0:m.replyId)!==void 0}))}});return o}function Xs({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=J.useMutation({mutationFn:e,onMutate:({replyId:s,content:i})=>t(o=>{const c=ht(s,o);return c&&(c.data.content=i),o}),onError:n});return r}function Ca({queryFns:{create:e,edit:t,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=J.useQueryClient(),m=_t(),l={queryClient:c,queryKey:o},f={mutationHandlers:{error:cn(l),mutate:ln(l)},user:m,...l},d=Js({...f,mutationFn:e}),h=Xs({...f,mutationFn:t}),g=ei({...f,mutationFn:n}),_=ni({...f,mutationFn:s}),v=ai({...f,mutationFn:i}),{replies:w,...y}=ti({queryKey:o,queryFn:r});return{replies:w,mutations:{create:d,edit:h,remove:_,like:g,unlike:v},user:m,...y}}function ei({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=J.useMutation({mutationFn:e,onMutate:({replyId:o})=>t(c=>{const m=ht(o,c);return m&&An({reply:m}),c}),onError:n,onSuccess:(o,{replyId:c},m)=>{const l=ht(c,m);l&&An({reply:l,reaction:o}),r.setQueryData(s,m)}});return i}function ti({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=J.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:l=>(l==null?void 0:l.next)||null}),c=ci(n),m=`${c.length||0}${i?"+":""}`;return{replies:c,repliesCount:m,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function ni({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=J.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(i=>oi(s,i)),onError:n});return r}function ai({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=J.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(o=>{const c=ht(i,o);return c&&Ls({reply:c,user:r}),o}),onError:n});return s}function ri(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function si(e,t,n){const r=t.pages.length-1,s=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[s]=e:t.pages[r].results.push(e),t}function ii(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function Dn(e,t,n){return t?n!=null&&n.append?si(e,t,n):ii(e,t,n):ri(e)}function ht(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:s})=>s===e);if(r)return r}}function oi(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:s})=>s===e);if(r!==-1){n.splice(r,1);break}}return t}function ci(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const li=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:s,functions:i})=>{const o=N.useIntl(),{replies:c,repliesCount:m,fetchNextPage:l,hasNextPage:f,isLoading:d,mutations:{create:h,edit:g,like:_,remove:v,unlike:w},user:y}=Ca({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}}),b=p.useContext(Ye);return a.jsx(ja,{count:m,showRepliesButton:!1,children:a.jsxs("section",{children:[c==null?void 0:c.map(x=>{var G,ne,Q,ae,ce,ie,z,le,ue,me,de;const{id:j,own_children:$,latest_children:P,children_counts:I}=x,S=(((G=$==null?void 0:$.like)==null?void 0:G.length)||0)>0?(ne=$==null?void 0:$.like)==null?void 0:ne.find(q=>{var Y;return((Y=q==null?void 0:q.user)==null?void 0:Y.id)===(y==null?void 0:y.id)}):!1,M=S?S==null?void 0:S.id:"",C=!!S,Z=(((Q=P==null?void 0:P.like)==null?void 0:Q.length)||0)>0?(ae=P==null?void 0:P.like)==null?void 0:ae.map(q=>{var Y,je,ke;return{id:(Y=q==null?void 0:q.user)==null?void 0:Y.id,name:(ke=(je=q==null?void 0:q.user)==null?void 0:je.data)==null?void 0:ke.name}}):!1,F=x==null?void 0:x.user,V=(F==null?void 0:F.id)===(y==null?void 0:y.id),te=vt(s,V),X=typeof x.data.content=="string"?(ce=x==null?void 0:x.data)==null?void 0:ce.content:((z=(ie=x==null?void 0:x.data)==null?void 0:ie.content)==null?void 0:z.text)||"";return a.jsx(Ge,{content:{type:"reply",body:X,canLike:te,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:F==null?void 0:F.id,name:(le=F.data)==null?void 0:le.name,organization:(ue=F.data)==null?void 0:ue.organization,jobTitle:(me=F.data)==null?void 0:me.jobTitle,image:{thumbnail:((de=F.data)==null?void 0:de.thumbnail)||void 0}},userLiked:C,likes:(I==null?void 0:I.like)||0,peopleWhoLiked:Z},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:j}),updateContent:(q,{body:Y})=>g({replyId:j,content:Y})},likes:{createLike:()=>_({replyId:j}),deleteLike:()=>w({replyId:j,reactionId:M})},comments:{}}},j)}),!d&&a.jsx(Ve,{hasNextPage:f,loadNextPage:()=>l(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}}),b.showForm&&a.jsx(yt,{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:j})=>h({activityId:n,replyId:r,content:j})}})]})})},Ma=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:i,leave:o}})=>{const c=N.useIntl(),{replies:m,repliesCount:l,fetchNextPage:f,hasNextPage:d,isLoading:h,mutations:{create:g,edit:_,like:v,remove:w,unlike:y},user:b}=Ca({queryKey:[e,t,n,"replies"],queryFns:s});return Wn(),a.jsxs("section",{children:[a.jsxs("h3",{children:[c.formatMessage({id:"discussion_responses_comment"})," (",l,")"]}),a.jsx(on,{contentType:"reply",createPost:(x,{body:j})=>g({activityId:n,content:j}),membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),m==null?void 0:m.map(x=>{var G,ne,Q,ae,ce,ie,z,le,ue,me,de;const{id:j,own_children:$,latest_children:P,children_counts:I}=x,S=(((G=$==null?void 0:$.like)==null?void 0:G.length)||0)>0?(ne=$==null?void 0:$.like)==null?void 0:ne.find(q=>{var Y;return((Y=q==null?void 0:q.user)==null?void 0:Y.id)===(b==null?void 0:b.id)}):!1,M=S?S==null?void 0:S.id:"",C=!!S,Z=(((Q=P==null?void 0:P.like)==null?void 0:Q.length)||0)>0?(ae=P==null?void 0:P.like)==null?void 0:ae.map(q=>{var Y,je,ke;return{id:(Y=q==null?void 0:q.user)==null?void 0:Y.id,name:(ke=(je=q==null?void 0:q.user)==null?void 0:je.data)==null?void 0:ke.name}}):!1,F=x==null?void 0:x.user,V=(F==null?void 0:F.id)===(b==null?void 0:b.id),te=vt(r,V),X=typeof x.data.content=="string"?(ce=x==null?void 0:x.data)==null?void 0:ce.content:((z=(ie=x==null?void 0:x.data)==null?void 0:ie.content)==null?void 0:z.text)||"";return a.jsx(ka,{children:a.jsx(Ge,{content:{type:"reply",body:X,canLike:te,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:j},slug:j,author:{id:F==null?void 0:F.id,name:(le=F.data)==null?void 0:le.name,organization:(ue=F.data)==null?void 0:ue.organization,jobTitle:(me=F.data)==null?void 0:me.jobTitle,image:{thumbnail:((de=F.data)==null?void 0:de.thumbnail)||void 0}},userLiked:C,likes:(I==null?void 0:I.like)||0,peopleWhoLiked:Z},functions:{content:{createContent:()=>null,deleteContent:()=>w({replyId:j}),updateContent:(q,{body:Y})=>_({replyId:j,content:Y})},likes:{createLike:()=>v({replyId:j}),deleteLike:()=>y({replyId:j,reactionId:M})},comments:{}},children:a.jsx(li,{basePath:e,parentId:t,activityId:n,replyId:j,isMember:r,functions:{...s}})},j)},j)}),!h&&a.jsx(Ve,{hasNextPage:d,loadNextPage:()=>f(),gtmContext:"LoadMore",icon:{icon:"arrow-down",position:"right"}})]})};function di({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=J.useMutation({mutationFn:e,onMutate:({content:s})=>t(i=>(i&&(i.content=s),i)),onError:n});return r}function ui({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:s,isFetching:i}=J.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:s,isFetching:i}}function mi({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:s}){const i=J.useQueryClient(),o=_t(),c={queryClient:i,queryKey:s},m={mutationHandlers:{error:cn(c),mutate:ln(c)},user:o,...c},l=di({...m,mutationFn:t}),f=fi({...m,mutationFn:n}),d=pi({...m,mutationFn:r}),{activity:h,...g}=ui({queryKey:s,queryFn:e});return{activity:h,mutations:{edit:l,like:f,unlike:d},user:o,...g}}function fi({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:s}){const{mutate:i}=J.useMutation({mutationFn:e,onMutate:o=>t(c=>(c&&ft({activity:c}),c)),onError:n,onSuccess:(o,c,m)=>{m&&ft({activity:m,reaction:o}),r.setQueryData(s,m)}});return i}function pi({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:s}=J.useMutation({mutationFn:e,onMutate:i=>t(o=>(o&&Sa({activity:o,user:r}),o)),onError:n});return s}const hi=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:s,...i},reactions:o,join:c,leave:m}})=>{var S,M,C,H,Z,F,V,te,X;const l=N.useIntl(),f=p.useContext(ge),{activity:d,error:h,isLoading:g,mutations:{edit:_,like:v,unlike:w}}=mi({queryFns:i,queryKey:[e,t,n]});if(g)return a.jsx(pe,{style:{height:"400px"}});if(h||!d)return a.jsx(We,{variant:"error",text:l.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:y,latest_reactions:b}=d,x=(((S=b==null?void 0:b.like)==null?void 0:S.length)||0)>0,j=(((M=y==null?void 0:y.like)==null?void 0:M.length)||0)>0,$=j?y==null?void 0:y.like[0].id:"",P=x?(C=b==null?void 0:b.like)==null?void 0:C.map(G=>{var ne,Q,ae;return{id:(ne=G==null?void 0:G.user)==null?void 0:ne.id,name:(ae=(Q=G==null?void 0:G.user)==null?void 0:Q.data)==null?void 0:ae.name}}):!1,I=d==null?void 0:d.actor,D=(I==null?void 0:I.id)===(f==null?void 0:f.id);return a.jsx(Ge,{className:"activity-section",content:{type:"post",body:d==null?void 0:d.content,canLike:vt(r,D),createdAt:(d==null?void 0:d.time)||"",slugs:{question:`${e}/${t}`,answer:d==null?void 0:d.id},slug:n,author:{id:I.id,name:(H=I.data)==null?void 0:H.name,organization:(Z=I.data)==null?void 0:Z.organization,jobTitle:(F=I.data)==null?void 0:F.jobTitle,image:{thumbnail:((V=I.data)==null?void 0:V.thumbnail)||void 0}},userLiked:j,likes:((te=d==null?void 0:d.reaction_counts)==null?void 0:te.like)||0,comments:((X=d==null?void 0:d.reaction_counts)==null?void 0:X.reply)||0,peopleWhoLiked:P},originalAuthorId:I==null?void 0:I.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:s,updateContent:(G,{body:ne})=>_({content:ne})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>w({activityId:n,reactionId:$})},comments:{openComments:()=>{}}},children:a.jsx(Ma,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,join:c,leave:m}})},n)},gi=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:s}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:s}}),On=[{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 it="notFoundError_",_i=()=>{const e=N.useIntl(),t=[];return On.forEach((n,r)=>{n.title=e.formatMessage({id:`${it}post_${r+1}`}),t.push("solutionArticle")}),a.jsxs(xa,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:a.jsxs(ze,{children:[a.jsx(da,{cards:On,cardTypes:t,buildCardData:n=>new Promise((r,s)=>{r(n)})}),a.jsx(B,{href:"/solution-articles/",children:e.formatMessage({id:`${it}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[a.jsx("h1",{children:e.formatMessage({id:`${it}title`})}),a.jsx("p",{children:e.formatMessage({id:`${it}text`})})]})};exports.ASSETS_BUCKET=Ne;exports.ActivitiesFeed=Qs;exports.ActivitySection=hi;exports.AddPost=on;exports.BannerSection=Cr;exports.Breadcrumbs=as;exports.Button=B;exports.ButtonWrapper=He;exports.CacheProvider=Xn;exports.Card=Xt;exports.CardBlock=da;exports.Carousel=ts;exports.CollapsibleSection=Gt;exports.Columns=fa;exports.CommunityDetails=ns;exports.Contributors=Jt;exports.ConversationContext=Ye;exports.CookieBanner=pa;exports.DiscussionConversation=ka;exports.DiscussionForm=yt;exports.DiscussionLikes=wa;exports.DiscussionPost=Ge;exports.DiscussionThread=ja;exports.Divider=xe;exports.DownloadSection=Tr;exports.EMAILS=$e;exports.EmailHelperTextBox=hs;exports.EmptyStateBox=We;exports.Filters=rs;exports.FlagsProvider=ea;exports.Footer=nn;exports.FullWidthSection=ze;exports.GlobalProviders=Fr;exports.Header=an;exports.HelperTextBox=ra;exports.HiddenFromScreenReaders=Wt;exports.HideShowTextBox=Ir;exports.HighlightedTextBox=ve;exports.IntlProvider=ta;exports.InviteForm=ya;exports.InviteModal=xs;exports.JoinButton=en;exports.LanguageSwitcher=is;exports.Link=Ue;exports.LoadMore=Ve;exports.LoadingBlock=zr;exports.LoadingPlaceholder=pe;exports.LoadingState=Qt;exports.Logo=tn;exports.LogoSection=Er;exports.MarkdownText=Ut;exports.MarketingBox=Mr;exports.Member=bt;exports.MembersList=Ts;exports.Modal=rn;exports.MoreMenu=ua;exports.NUMBER_OF_USERS=Rr;exports.NavigationMenu=ma;exports.NotFoundError=_i;exports.Overlay=sn;exports.PageHeading=ia;exports.PageLayout=xa;exports.PasswordRules=bs;exports.Pill=qe;exports.ProfilePicture=Re;exports.ProgressBar=oa;exports.Rating=ys;exports.RepliesFeed=Ma;exports.ResponsesHeading=Ms;exports.ResponsiveImage=Yt;exports.SearchForm=ba;exports.ShareLinks=us;exports.Span=sa;exports.StatusBanner=lt;exports.Tabs=ms;exports.Tags=js;exports.Tooltip=Jn;exports.TopLevelPage=ps;exports.UserContext=ge;exports.UserProvider=na;exports.VisuallyHidden=re;exports.addAriaProps=va;exports.getMember=Kt;exports.headerData=Ze;exports.mapGetStreamData=gi;exports.pageReady=Kn;exports.repliesFeedMock=Ks;exports.useCurrentPath=Hn;exports.useEffectAfterMount=Te;exports.useElementWidth=Fe;exports.useScrollListener=zn;exports.useScrollToHash=Wn;exports.useUser=_t;