@apolitical/component-library 1.13.3-beta.4 → 1.13.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/banners/banner-section/banner-section.d.ts +3 -5
- package/discussion/components/post/post.d.ts +1 -1
- package/discussion/components/thread/thread.d.ts +3 -3
- package/discussion/feeds/replies-feed/replies-feed.d.ts +7 -2
- package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +6 -2
- package/discussion/feeds/replies-to-replies-feed/index.d.ts +1 -0
- package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.d.ts +35 -0
- package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +134 -0
- package/general/divider/divider.d.ts +1 -3
- package/index.js +14 -14
- package/index.mjs +2271 -2068
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/base/_index.scss +1 -1
- package/styles/variables/sizes/_common.scss +0 -3
- package/styles/base/_layout.scss +0 -10
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),_s=require("lodash.clonedeep"),xs=require("lodash.set"),C=require("react-intl"),Ke=require("truncate"),et=require("markdown-to-jsx"),G=require("@tanstack/react-query"),bs=require("@tanstack/react-query-devtools"),Ge=require("posthog-js"),un=require("react-cookie"),vs=require("react-multi-email"),dn=require("lodash.get"),ws=require("react-error-boundary"),ks=require("react-textarea-autosize"),js=require("lodash.isequal");function ys(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mn={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=[],a=0;a<arguments.length;a++){var
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var l=arguments[a];if(l){var u=typeof l;if(u==="string"||u==="number")r.push(l);else if(Array.isArray(l)){if(l.length){var o=n.apply(null,l);o&&r.push(o)}}else if(u==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){r.push(l.toString());continue}for(var i in l)t.call(l,i)&&l[i]&&r.push(i)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(mn);var Ss=mn.exports;const E=ys(Ss),Es=({element:e="span",showOnFocus:t=!0,children:n,...r})=>g.createElement(e,{...r,className:E("hidden",{"show-on-focus":t}),children:n}),te=g.memo(Es),Ts=({element:e="span",children:t=null,...n})=>g.createElement(e,{...n,"aria-hidden":!0},t),Tt=g.memo(Ts);var jt={exports:{}},$e={};/**
|
|
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 Kt;function
|
|
13
|
+
*/var Kt;function $s(){if(Kt)return $e;Kt=1;var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(o,i,c){var d,f={},h=null,p=null;c!==void 0&&(h=""+c),i.key!==void 0&&(h=""+i.key),i.ref!==void 0&&(p=i.ref);for(d in i)r.call(i,d)&&!l.hasOwnProperty(d)&&(f[d]=i[d]);if(o&&o.defaultProps)for(d in i=o.defaultProps,i)f[d]===void 0&&(f[d]=i[d]);return{$$typeof:t,type:o,key:h,ref:p,props:f,_owner:a.current}}return $e.Fragment=n,$e.jsx=u,$e.jsxs=u,$e}var Me={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,20 +18,20 @@
|
|
|
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 en;function
|
|
22
|
-
`+ue+
|
|
23
|
-
`),
|
|
24
|
-
`),
|
|
25
|
-
`+
|
|
21
|
+
*/var en;function Ms(){return en||(en=1,process.env.NODE_ENV!=="production"&&function(){var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),o=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),x=Symbol.iterator,y="@@iterator";function _(m){if(m===null||typeof m!="object")return null;var v=x&&m[x]||m[y];return typeof v=="function"?v:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(m){{for(var v=arguments.length,S=new Array(v>1?v-1:0),M=1;M<v;M++)S[M-1]=arguments[M];$("error",m,S)}}function $(m,v,S){{var M=T.ReactDebugCurrentFrame,L=M.getStackAddendum();L!==""&&(v+="%s",S=S.concat([L]));var U=S.map(function(P){return String(P)});U.unshift("Warning: "+v),Function.prototype.apply.call(console[m],console,U)}}var R=!1,A=!1,B=!1,V=!1,b=!1,w;w=Symbol.for("react.module.reference");function H(m){return!!(typeof m=="string"||typeof m=="function"||m===r||m===l||b||m===a||m===c||m===d||V||m===p||R||A||B||typeof m=="object"&&m!==null&&(m.$$typeof===h||m.$$typeof===f||m.$$typeof===u||m.$$typeof===o||m.$$typeof===i||m.$$typeof===w||m.getModuleId!==void 0))}function k(m,v,S){var M=m.displayName;if(M)return M;var L=v.displayName||v.name||"";return L!==""?S+"("+L+")":S}function Y(m){return m.displayName||"Context"}function N(m){if(m==null)return null;if(typeof m.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case r:return"Fragment";case n:return"Portal";case l:return"Profiler";case a:return"StrictMode";case c:return"Suspense";case d:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case o:var v=m;return Y(v)+".Consumer";case u:var S=m;return Y(S._context)+".Provider";case i:return k(m,m.render,"ForwardRef");case f:var M=m.displayName||null;return M!==null?M:N(m.type)||"Memo";case h:{var L=m,U=L._payload,P=L._init;try{return N(P(U))}catch{return null}}}return null}var I=Object.assign,Q=0,W,X,ne,se,re,oe,ee;function F(){}F.__reactDisabledLog=!0;function K(){{if(Q===0){W=console.log,X=console.info,ne=console.warn,se=console.error,re=console.group,oe=console.groupCollapsed,ee=console.groupEnd;var m={configurable:!0,enumerable:!0,value:F,writable:!0};Object.defineProperties(console,{info:m,log:m,warn:m,error:m,group:m,groupCollapsed:m,groupEnd:m})}Q++}}function J(){{if(Q--,Q===0){var m={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},m,{value:W}),info:I({},m,{value:X}),warn:I({},m,{value:ne}),error:I({},m,{value:se}),group:I({},m,{value:re}),groupCollapsed:I({},m,{value:oe}),groupEnd:I({},m,{value:ee})})}Q<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=T.ReactCurrentDispatcher,ue;function de(m,v,S){{if(ue===void 0)try{throw Error()}catch(L){var M=L.stack.trim().match(/\n( *(at )?)/);ue=M&&M[1]||""}return`
|
|
22
|
+
`+ue+m}}var be=!1,ke;{var Gn=typeof WeakMap=="function"?WeakMap:Map;ke=new Gn}function Bt(m,v){if(!m||be)return"";{var S=ke.get(m);if(S!==void 0)return S}var M;be=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=ae.current,ae.current=null,K();try{if(v){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(he){M=he}Reflect.construct(m,[],P)}else{try{P.call()}catch(he){M=he}m.call(P.prototype)}}else{try{throw Error()}catch(he){M=he}m()}}catch(he){if(he&&M&&typeof he.stack=="string"){for(var D=he.stack.split(`
|
|
23
|
+
`),ie=M.stack.split(`
|
|
24
|
+
`),Z=D.length-1,q=ie.length-1;Z>=1&&q>=0&&D[Z]!==ie[q];)q--;for(;Z>=1&&q>=0;Z--,q--)if(D[Z]!==ie[q]){if(Z!==1||q!==1)do if(Z--,q--,q<0||D[Z]!==ie[q]){var ce=`
|
|
25
|
+
`+D[Z].replace(" at new "," at ");return m.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",m.displayName)),typeof m=="function"&&ke.set(m,ce),ce}while(Z>=1&&q>=0);break}}}finally{be=!1,ae.current=U,J(),Error.prepareStackTrace=L}var ye=m?m.displayName||m.name:"",qt=ye?de(ye):"";return typeof m=="function"&&ke.set(m,qt),qt}function Jn(m,v,S){return Bt(m,!1)}function Xn(m){var v=m.prototype;return!!(v&&v.isReactComponent)}function Be(m,v,S){if(m==null)return"";if(typeof m=="function")return Bt(m,Xn(m));if(typeof m=="string")return de(m);switch(m){case c:return de("Suspense");case d:return de("SuspenseList")}if(typeof m=="object")switch(m.$$typeof){case i:return Jn(m.render);case f:return Be(m.type,v,S);case h:{var M=m,L=M._payload,U=M._init;try{return Be(U(L),v,S)}catch{}}}return""}var Oe=Object.prototype.hasOwnProperty,Ot={},Ht=T.ReactDebugCurrentFrame;function He(m){if(m){var v=m._owner,S=Be(m.type,m._source,v?v.type:null);Ht.setExtraStackFrame(S)}else Ht.setExtraStackFrame(null)}function Zn(m,v,S,M,L){{var U=Function.call.bind(Oe);for(var P in m)if(U(m,P)){var D=void 0;try{if(typeof m[P]!="function"){var ie=Error((M||"React class")+": "+S+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof m[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ie.name="Invariant Violation",ie}D=m[P](v,P,M,S,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Z){D=Z}D&&!(D instanceof Error)&&(He(L),j("%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).",M||"React class",S,P,typeof D),He(null)),D instanceof Error&&!(D.message in Ot)&&(Ot[D.message]=!0,He(L),j("Failed %s type: %s",S,D.message),He(null))}}}var qn=Array.isArray;function rt(m){return qn(m)}function Kn(m){{var v=typeof Symbol=="function"&&Symbol.toStringTag,S=v&&m[Symbol.toStringTag]||m.constructor.name||"Object";return S}}function es(m){try{return Qt(m),!1}catch{return!0}}function Qt(m){return""+m}function Ut(m){if(es(m))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Kn(m)),Qt(m)}var Te=T.ReactCurrentOwner,ts={key:!0,ref:!0,__self:!0,__source:!0},Wt,zt,ot;ot={};function ns(m){if(Oe.call(m,"ref")){var v=Object.getOwnPropertyDescriptor(m,"ref").get;if(v&&v.isReactWarning)return!1}return m.ref!==void 0}function ss(m){if(Oe.call(m,"key")){var v=Object.getOwnPropertyDescriptor(m,"key").get;if(v&&v.isReactWarning)return!1}return m.key!==void 0}function rs(m,v){if(typeof m.ref=="string"&&Te.current&&v&&Te.current.stateNode!==v){var S=N(Te.current.type);ot[S]||(j('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',N(Te.current.type),m.ref),ot[S]=!0)}}function os(m,v){{var S=function(){Wt||(Wt=!0,j("%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)",v))};S.isReactWarning=!0,Object.defineProperty(m,"key",{get:S,configurable:!0})}}function as(m,v){{var S=function(){zt||(zt=!0,j("%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)",v))};S.isReactWarning=!0,Object.defineProperty(m,"ref",{get:S,configurable:!0})}}var is=function(m,v,S,M,L,U,P){var D={$$typeof:t,type:m,key:v,ref:S,props:P,_owner:U};return D._store={},Object.defineProperty(D._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(D,"_self",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.defineProperty(D,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(D.props),Object.freeze(D)),D};function ls(m,v,S,M,L){{var U,P={},D=null,ie=null;S!==void 0&&(Ut(S),D=""+S),ss(v)&&(Ut(v.key),D=""+v.key),ns(v)&&(ie=v.ref,rs(v,L));for(U in v)Oe.call(v,U)&&!ts.hasOwnProperty(U)&&(P[U]=v[U]);if(m&&m.defaultProps){var Z=m.defaultProps;for(U in Z)P[U]===void 0&&(P[U]=Z[U])}if(D||ie){var q=typeof m=="function"?m.displayName||m.name||"Unknown":m;D&&os(P,q),ie&&as(P,q)}return is(m,D,ie,L,M,Te.current,P)}}var at=T.ReactCurrentOwner,Vt=T.ReactDebugCurrentFrame;function je(m){if(m){var v=m._owner,S=Be(m.type,m._source,v?v.type:null);Vt.setExtraStackFrame(S)}else Vt.setExtraStackFrame(null)}var it;it=!1;function lt(m){return typeof m=="object"&&m!==null&&m.$$typeof===t}function Yt(){{if(at.current){var m=N(at.current.type);if(m)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+m+"`."}return""}}function cs(m){{if(m!==void 0){var v=m.fileName.replace(/^.*[\\\/]/,""),S=m.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+v+":"+
|
|
29
|
+
Check your code at `+v+":"+S+"."}return""}}var Gt={};function us(m){{var v=Yt();if(!v){var S=typeof m=="string"?m:m.displayName||m.name;S&&(v=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+
|
|
31
|
+
Check the top-level render call using <`+S+">.")}return v}}function Jt(m,v){{if(!m._store||m._store.validated||m.key!=null)return;m._store.validated=!0;var S=us(v);if(Gt[S])return;Gt[S]=!0;var M="";m&&m._owner&&m._owner!==at.current&&(M=" It was passed a child from "+N(m._owner.type)+"."),je(m),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',S,M),je(null)}}function Xt(m,v){{if(typeof m!="object")return;if(rt(m))for(var S=0;S<m.length;S++){var M=m[S];lt(M)&&Jt(M,v)}else if(lt(m))m._store&&(m._store.validated=!0);else if(m){var L=_(m);if(typeof L=="function"&&L!==m.entries)for(var U=L.call(m),P;!(P=U.next()).done;)lt(P.value)&&Jt(P.value,v)}}}function ds(m){{var v=m.type;if(v==null||typeof v=="string")return;var S;if(typeof v=="function")S=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===i||v.$$typeof===f))S=v.propTypes;else return;if(S){var M=N(v);Zn(S,m.props,"prop",M,m)}else if(v.PropTypes!==void 0&&!it){it=!0;var L=N(v);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ms(m){{for(var v=Object.keys(m.props),S=0;S<v.length;S++){var M=v[S];if(M!=="children"&&M!=="key"){je(m),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",M),je(null);break}}m.ref!==null&&(je(m),j("Invalid attribute `ref` supplied to `React.Fragment`."),je(null))}}function Zt(m,v,S,M,L,U){{var P=H(m);if(!P){var D="";(m===void 0||typeof m=="object"&&m!==null&&Object.keys(m).length===0)&&(D+=" 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 ie=cs(L);ie?D+=ie:D+=Yt();var Z;m===null?Z="null":rt(m)?Z="array":m!==void 0&&m.$$typeof===t?(Z="<"+(N(m.type)||"Unknown")+" />",D=" Did you accidentally export a JSX literal instead of a component?"):Z=typeof m,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Z,D)}var q=ls(m,v,S,L,U);if(q==null)return q;if(P){var ce=v.children;if(ce!==void 0)if(M)if(rt(ce)){for(var ye=0;ye<ce.length;ye++)Xt(ce[ye],m);Object.freeze&&Object.freeze(ce)}else j("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 Xt(ce,m)}return m===r?ms(q):ds(q),q}}function fs(m,v,S){return Zt(m,v,S,!0)}function hs(m,v,S){return Zt(m,v,S,!1)}var ps=hs,gs=fs;Me.Fragment=r,Me.jsx=ps,Me.jsxs=gs}()),Me}process.env.NODE_ENV==="production"?jt.exports=$s():jt.exports=Ms();var s=jt.exports;const fn=()=>{const[e,t]=g.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return g.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},ve=(e,t)=>{const n=g.useRef(!1);g.useEffect(()=>{n.current?e():n.current=!0},t)};function Cs(e,t,n){var r=this,a=g.useRef(null),l=g.useRef(0),u=g.useRef(null),o=g.useRef([]),i=g.useRef(),c=g.useRef(),d=g.useRef(e),f=g.useRef(!0);g.useEffect(function(){d.current=e},[e]);var h=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,y="maxWait"in n,_=y?Math.max(+n.maxWait||0,t):null;g.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var T=g.useMemo(function(){var j=function(b){var w=o.current,H=i.current;return o.current=i.current=null,l.current=b,c.current=d.current.apply(H,w)},$=function(b,w){h&&cancelAnimationFrame(u.current),u.current=h?requestAnimationFrame(b):setTimeout(b,w)},R=function(b){if(!f.current)return!1;var w=b-a.current;return!a.current||w>=t||w<0||y&&b-l.current>=_},A=function(b){return u.current=null,x&&o.current?j(b):(o.current=i.current=null,c.current)},B=function b(){var w=Date.now();if(R(w))return A(w);if(f.current){var H=t-(w-a.current),k=y?Math.min(H,_-(w-l.current)):H;$(b,k)}},V=function(){var b=Date.now(),w=R(b);if(o.current=[].slice.call(arguments),i.current=r,a.current=b,w){if(!u.current&&f.current)return l.current=a.current,$(B,t),p?j(a.current):c.current;if(y)return $(B,t),j(a.current)}return u.current||$(B,t),c.current};return V.cancel=function(){u.current&&(h?cancelAnimationFrame(u.current):clearTimeout(u.current)),l.current=0,o.current=a.current=i.current=u.current=null},V.isPending=function(){return!!u.current},V.flush=function(){return u.current?A(Date.now()):c.current},V},[p,y,t,_,x,h]);return T}function hn(e,t,n){var r=n===void 0?{}:n,a=r.leading,l=r.trailing;return Cs(e,t,{maxWait:t,leading:a===void 0||a,trailing:l===void 0||l})}let ct;const De=(e=!0,t=!1)=>{if(!e)return;const[n,r]=g.useState(0)||[!1,()=>{}];g.useEffect(()=>(l(),window.addEventListener("resize",u),()=>{clearTimeout(ct),u.flush(),window.removeEventListener("resize",u)}),[]);const a=()=>window.innerWidth,l=()=>{r(a())},u=hn(()=>{a()!==n&&(t&&(clearTimeout(ct),document.body.classList.add("is-resizing"),ct=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),l())},500,{leading:!0});return n},pn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,l]=g.useState({current:0,past:0})||[!1,()=>{}],[u,o]=g.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];g.useEffect(()=>(i(),window.addEventListener("scroll",c),()=>{c.flush(),window.removeEventListener("scroll",c)}),[]);const i=()=>{const d=window.scrollY,f=a.current,h=d-f,p=h>0?"down":"up";if(l({current:d,past:f}),p==="down"){d>=e+t.down&&!u.scrollDown&&(!u.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!u.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},c=hn(()=>{i()},250);return a},Rs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=g.useRef(!1);ve(()=>{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)},As=(e,t)=>{Array.isArray(t)||(t=[t]);const n=_s(e);return t.forEach(({type:r,value:a})=>{xs(n,r,a)}),n},gn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_n=(e,t,n)=>{let r=n.mobile;for(const a in t){const l=parseInt(String(t[a]));if(e>=l)r=n[l];else if(e<l)break}return r},Ds=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Fs=e=>{let l;try{l=new Date().getTime()-new Date(e).getTime()}catch{return""}const u=l/36e5,o=Math.floor(l/864e5);if(o<1)return u<1?{path:"now"}:{path:"hours",number:Math.floor(u)};if(o<7)return{path:"days",number:o};const i=Math.floor(o/7);return i<=52?{path:"weeks",number:i}:{path:"years",number:Math.floor(o/365)}},Ps=e=>new Promise(t=>setTimeout(t,e)),$t={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",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",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",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",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>",sharedLinks_copy_text:"Copy link",tags_community:"From the community",tooltip_loading:"Loading..."},Fs={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>"},Ps={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>"},Rs={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>"},Ds=Object.freeze(Object.defineProperty({__proto__:null,en:Et,es:Fs,fr:Ps,pt:Rs},Symbol.toStringTag,{value:"Module"})),me=(e,t,n,r,a={})=>{let i="";return`${t}_${n}`in Et?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Is=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},_n=(e,t)=>h.Children.map(e,n=>h.cloneElement(n,{...t})),Ls=e=>e.replace(/\s+/g,"").length>0,Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:d=!1,className:o="",disabled:l=!1,screenreaderText:m=!1,children:c=!1,...f})=>{const g=Fe(typeof t=="object");if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),E=hn(Object.keys(_));t=gn(g,E,_)}const x=[];typeof t=="string"&&x.push(t),r&&(x.push("icon"),typeof r=="object"?(x.push(r.icon),r.position?x.push(r.position):x.push("left"),r.hover&&x.push(`hover_${r.hover}`),r.animate&&(x.push("animate"),typeof r.animate=="string"&&x.push(r.animate))):(x.push(r),!r.includes("right")&&!r.includes("left")&&x.push("left"))),n.muted&&x.push("muted"),n.fullWidth&&x.push("full-width");const y={...f,className:S(e,o,x,{"no-text":!c,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&d&&(_.preventDefault(),_.stopPropagation()),d&&d(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return a&&(i="a",y.href=a),h.createElement(i,y,c||(m?s.jsx(K,{showOnFocus:!1,children:m}):null))},Pe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",a=e.map((i,d)=>r==="p"?s.jsx(Q,{...i},d):s.jsx("li",{children:s.jsx(Q,{...i})},d));return h.createElement(r,{className:S("button-wrapper",t),...n,children:a})};const we=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:S(e,{"has-max-width":t}),style:n})},Re=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:d,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),d&&(l["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:S("gtm-trackable",r),...l,children:t})}return n?h.createElement(n,{children:t,className:r,...o}):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"}},Bs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?tn[e]:tn.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Os=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},lt=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Os({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const xn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:d,url:o,width:l,loading:m,decoding:c,fetchPriority:f}=e,{range:p,sizes:g}=Bs(e),x=lt({format:"avif",query:d,range:p,url:o}),y=lt({format:"webp",query:d,range:p,url:o}),_=lt({format:"",query:d,range:p,url:o});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:x,sizes:g,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:y,sizes:g,"data-testid":"source"}),s.jsx("img",{srcSet:_,sizes:g,src:o,alt:r,loading:m||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};let Ce=!1;const vn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=M.useIntl(),a=h.useRef(null),[i,d]=h.useState("hidden");h.useEffect(()=>{const l=a.current;if(l)return l.addEventListener("transitionend",o),()=>{l.removeEventListener("transitionend",o)}},[]);const o=({propertyName:l})=>{l==="opacity"&&(Ce!==!1&&clearTimeout(Ce),d(m=>m==="opening"?"open":m==="closing"?"closed":m==="closed"?"hidden":m))};return be(()=>{Ce!==!1&&clearTimeout(Ce);let l="open";e?d("opening"):(d("closing"),l="hidden"),Ce=setTimeout(()=>{d(l)},300)},[e]),s.jsx("aside",{ref:a,className:S("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Tt=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const Hs=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),s.jsx(Tt,{className:S("download-section",n),children:s.jsxs(s.Fragment,{children:[h.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Pe,{buttons:r})]})})};const Qs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const a={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&h.createElement(a.element,{className:"title"},a.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:d,link:o=!1,description:l=!1},m)=>{if(!i||!i.url)return null;const c=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:d});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:o?s.jsx("a",{href:o,target:"_blank",rel:"nofollow noreferrer noopener",children:c}):c}),l&&s.jsx("small",{children:l})]},window.btoa(`${i.url}_${m}`))})})]})};const Us=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ws=({className:e="",content:t,image:n,variant:r="default",spacing:a="normal",cta:i,children:d})=>{const o=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},m={};return o.forEach(c=>{if(!t[c]){m[c]=!1;return}if(typeof t[c]=="object"){m[c]=t[c];const{text:f,element:p}=t[c];if(p&&Us.includes(p.toLowerCase()))return;m[c]={text:f,element:l[c]};return}m[c]={text:t[c],element:l[c]}}),i&&i.link&&i.link[0]==="#"&&(i.props||(i.props={}),i.props.onClick=c=>{c.preventDefault(),c.stopPropagation();const f=document.getElementById(i.link.substring(1));f&&f.scrollIntoView({behavior:"smooth"})}),s.jsx(Tt,{className:S("banner-section",r,a,e,{"has-image":n,"has-extra-spacing":a==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[o.map(c=>{if(m[c]&&typeof m[c]=="object"){const{text:f,element:p=""}=m[c];return h.createElement(p.toLowerCase(),{key:c,className:c},f)}return null}),d,i&&i.text&&i.link&&s.jsx(Q,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:i.link,...i.props,children:i.text})]}),n&&s.jsx(xn,{image:{...n,aspect:"banner"}})]})})},zs=h.memo(Ws);const Vs=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",Se={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ys="200,000+";const $t=({label:e=!1,className:t="",children:n})=>{const r=M.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const xe=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const De=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,d=Fe(i);if(i&&typeof n=="object"&&typeof d=="number"){const f=Object.assign({},n.breakpoints),p=hn(Object.keys(f));a=gn(d,p,f)}const{breakpoints:o,text:l="",component:m,...c}=n;return s.jsx(xe,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(Ze,{options:{forceBlock:!0},children:t}),a&&typeof n=="object"&&(m||s.jsx(Q,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const kt=({children:e,...t})=>s.jsx("p",{...t,children:e}),bn={q:kt,blockquote:kt};for(let e=1;e<=6;e++)bn[`h${e}`]={component:kt,props:{className:"title"}};const wn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(Ze,{options:{wrapper:h.Fragment,forceBlock:!0,overrides:bn},children:r}):s.jsx("p",{children:r})]});const Gs=({className:e="",show:t=!1,hide:n=!1,text:r,children:a})=>{const i=M.useIntl(),d=h.useRef(null),[o,l]=h.useState(""),[m,c]=h.useState("closed");h.useEffect(()=>{const g=d.current;if(g)return g.addEventListener("transitionend",f),()=>{g.removeEventListener("transitionend",f)}},[]),h.useEffect(()=>{if(!r||typeof r!="string")return;const g=r.split(`
|
|
36
|
-
`);
|
|
37
|
-
`))},[r]),h.useEffect(()=>{m==="ready-to-close"&&c("closing")},[m]);const f=({propertyName:g})=>{g==="max-height"&&c(x=>x==="opening"?"open":x==="closing"?"closed":x)};if(!r)return null;const p=["opening","open"].includes(m);return s.jsxs(xe,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:S("content",m),children:[s.jsx(Ze,{options:{forceBlock:!0},children:m==="closed"?o:r}),m!=="closed"&&a]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{c(p?"ready-to-close":"opening")},children:p?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},Js=()=>h.Fragment,qs=({children:e})=>s.jsx(xe,{variant:"secondary",children:e}),Xs=["span","strong","h1","h2","h3","h4","h5","h6","p"],Zs=({children:e})=>{const t=M.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of h.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(h.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const d of h.Children.toArray(i.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&h.isValidElement(d)){const o=d.type;if(Xs.includes(o)){for(n=d.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return s.jsx($t,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Ks=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(xe,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(xe,{variant:"primary",children:e});case"pink-textbox":return s.jsx(xe,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},er=e=>{const t=M.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(K,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},nn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},tr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of h.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&h.isValidElement(i)){const d=i.type;if(["button","center","span","strong"].includes(d)&&i.props&&i.props.children&&i.props.children[0])for((d==="button"||nn(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!h.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&nn(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},kn=({children:e})=>s.jsx("span",{children:e});const yt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:h.Fragment,forceBlock:!0,overrides:{a:tr,CollapsibleSection:$t,TextBox:xe,CaseStudy:qs,style:Js,details:Zs,div:Ks,iframe:er}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(Ze,{options:{...r,...t},children:n})})};const yn=({size:e="medium",variant:t="default",className:n="",children:r})=>s.jsx("span",{className:S("pill",e,t,n),children:r});const Ge=({element:e="p",children:t=null,className:n="",...r})=>h.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const nr=({progress:e=0,text:t=!1,className:n=""})=>{const r=M.useIntl(),a=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${a}`,n),style:i,children:s.jsx(K,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},jn=h.memo(nr);const ct="loadingBlock_",sr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=M.useIntl();t||(t={0:{text:r.formatMessage({id:`${ct}loading`})},75:{text:r.formatMessage({id:`${ct}almostDone`})},100:{text:r.formatMessage({id:`${ct}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const d=a&&t[a].icon?{"--icon":`url(${Ye}icons/${t[a].icon}.svg)`}:{};return s.jsxs(xe,{className:S("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:d,children:[a&&s.jsx("span",{className:"step",children:t[a].text}),s.jsx(jn,{progress:e})]})},rr=h.memo(sr);const fe=({element:e="div",className:t="",...n})=>s.jsx(St,{element:e,className:S("loading-placeholder",t),...n});const jt={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Sn=(e,t)=>e in jt?s.jsx("div",{className:e,children:jt[e].map((n,r)=>Sn(n,r))},t):s.jsx(fe,{className:e},t),En=({layout:e="overview-page"})=>s.jsx("div",{className:S("loading-state",e),children:jt[e].map((t,n)=>Sn(t,n))}),Tn=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):""},Oe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],or=e=>{const t=Math.ceil(26/Oe.length),n=Tn(e).toLowerCase();if(n==="")return Oe[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Oe.length;a++)if(r<=t*(a+1))return Oe[a]};const sn=256,Ke=({className:e="",src:t="",name:n,alt:r,width:a=sn,height:i=sn,...d})=>{const[o,l]=h.useState(!1),m=h.useRef(null);h.useEffect(()=>{const f=m.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const g=a,x=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=g*window.devicePixelRatio,f.height=x*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=or(n),p.fillRect(0,0,g,x),p.font=`${g/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(Tn(n),g/2,x/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),s.jsx("figure",{className:S("profile-picture",e,{error:o}),...d,children:c?s.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):s.jsx("canvas",{ref:m})})},Mt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}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},ar=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",d=n!=="";if(!a&&!i&&!d)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&d?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Xe(l,r)),l};const et=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:a="member-click",className:i=""})=>{const d=M.useIntl(),o=Mt(t);o.name||(o.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:l,url:m,image:c}=o,f=ar(o),p=n&&n.createdAt?As(n.createdAt):!1,g=n&&n.createdAt?Cs(n.createdAt):"";return h.createElement(e,{className:S("member text-medium",i),children:s.jsxs(Re,{href:m,gtmType:a,gtmContext:r,onClick:x=>{x==null||x.stopPropagation()},children:[s.jsx(Ke,{name:l,src:c}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:l}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:g,"aria-label":g,children:d.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const rn={small:24,medium:48},$n=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,className:l=""})=>{const m=M.useIntl();return!n||n.length===0?null:h.createElement(e,{className:S("contributors",l,a,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((c,f)=>{let p,g="";if(f<o){const{name:x="",image:y=""}=Mt(c);if(d)return s.jsx(fe,{element:"li",className:"contributor"},f);p=s.jsx(Ke,{name:x,src:y,width:rn[a||"medium"],height:rn[a||"medium"]})}else if(f===o){const x=(t||n.length)-o;p=s.jsxs("small",{className:S({"large-number":x>99}),children:["+",Is(x,0)]}),g="number-left"}return p?s.jsx("li",{className:S("contributor",g),children:p},f):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Xe(n[0].name||"",20):null})]})})},Mn=({showDevTools:e=!0,children:t})=>{const n=new Z.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(Z.QueryClientProvider,{client:n,children:[t,e&&s.jsx(gs.ReactQueryDevtools,{initialIsOpen:!1})]})};var ir=h.createContext({client:Ve});function lr(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=h.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Ve.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ve.init(r,a)),Ve)},[n,r]);return h.createElement(ir.Provider,{value:{client:i}},t)}const Cn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(lr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,An=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ds[r],...n||{}};return s.jsx(M.IntlProvider,{locale:r,messages:a,children:e})},ve=h.createContext(null),Nn=({children:e,user:t})=>s.jsx(ve.Provider,{value:t,children:e}),cr=({bootstrap:e,children:t,intl:n})=>{const[r,a]=h.useState({isLoading:!0});return h.useEffect(()=>{e().then(i=>a({...i,isLoading:!1})).catch(()=>a({isLoading:!1}))},[]),s.jsx(An,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Nn,{user:r,children:s.jsx(Mn,{children:s.jsx(Cn,{user:r,children:t})})})})};const ut="joinCommunityButton",Ct=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=M.useIntl(),i=h.useContext(ve),d=i&&typeof i.id=="string",[o,l]=h.useState(e),[m,c]=h.useState(e?"joined":"notJoined");h.useEffect(()=>{m==="joining"?c("joined"):m==="leaving"&&c("notJoined")},[o]);const f={},p={};return o&&m!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${ut}_leave`}),f["aria-label"]=a.formatMessage({id:`${ut}_member_aria`}),p["aria-hidden"]="true"),s.jsx(Q,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&m!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async g=>{d&&(g.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:S("join-community-button",m,{active:m==="joining"}),disabled:!d,...f,children:s.jsx("span",{className:"text",...p,children:a.formatMessage({id:`${ut}${["joining","leaving"].includes(m)?`_${m}`:o?"_member":t?"_short":""}`})})})};const dt="communityDetails_",ur=({isMember:e=!1,slug:t,members:{number:n,data:r}={number:void 0,data:[]},className:a="",...i})=>{const d=M.useIntl(),o=n||(r==null?void 0:r.length)||0;return s.jsxs("div",{className:S("community-details",a),children:[s.jsx(we,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[d.formatMessage({id:`${dt}members`}),s.jsx("span",{className:"count",children:o})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${t}/members`,children:d.formatMessage({id:`${dt}viewAll`})})})]}),s.jsx($n,{contributors:{total:n,data:r!=null&&r.length?r:[{},{},{},{},{}]},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:5})]}),s.jsx(Ct,{isMember:e,...i}),e&&s.jsx(Q,{variant:"primary",icon:{icon:"plus"},styling:{fullWidth:!0},children:d.formatMessage({id:`${dt}invite`})})]})};const dr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(K,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:d=!1},o)=>s.jsxs("li",{children:[d&&s.jsx(K,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Re,{href:d?void 0:i,children:Xe(a,t)})]},`${window.btoa(a)}_${o}`))})]})};const mr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=M.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=h.useState(t?["all"]:[]),m=(c,f)=>{let p=[];o.includes(c)?p=o.filter(g=>g!==c):c==="all"?p=["all"]:n?p=[...o.filter(g=>g!=="all"),c]:p=[c],l(g=>(r&&typeof r=="function"&&r({current:p,previous:g}),p)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:S("filters",a),children:d.map(({id:c,text:f,disabled:p=!1,callback:g=()=>{}})=>{let x={};return p&&(x={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:S(c,{selected:o.includes(c)}),onClick:y=>{y.preventDefault(),y.stopPropagation(),m(c,g)},...x,children:f})},c)})})},fr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:a,position:i})=>{i==="before-lang"?r+=`/${a}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${a}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const mt={en:"English",es:"Español",fr:"Français",pt:"Português"},He="languageSwitcher_",pr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a=()=>{},urlParts:i,variant:d="default",label:o,className:l=""})=>{const m=M.useIntl(),[c,f]=h.useState(e);if(h.useEffect(()=>{e!==c&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),x=c!==e;return s.jsxs("div",{className:S("language-switcher text-small",d,l),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:o||m.formatMessage({id:`${He}label`})}),s.jsx("ul",{children:g.map(y=>{if(!mt[y])return null;let _={className:y};return c===y?_["aria-label"]=m.formatMessage({id:`${He}selected`},{language:mt[y]}):_={..._,href:fr(y,i),onClick:E=>{E.preventDefault(),E.stopPropagation(),f(y),a(y)}},s.jsx("li",{children:s.jsx(Re,{..._,fallbackElement:"span",children:mt[y]})},y)})}),d!=="short"&&!x&&s.jsx("p",{children:m.formatMessage({id:`${He}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!x&&!t&&!n&&s.jsx("small",{children:m.formatMessage({id:`${He}disclaimer`},{email:Se.support,link:y=>{const _=`mailto:${y}`;return s.jsx("a",{href:_,children:y})}})})]})};const ft=M.createIntl({locale:"en",messages:Et}),Fn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:a=!1,messages:i={button:ft.formatMessage({id:"loadMore_button"}),endOfFeed:ft.formatMessage({id:"loadMore_endOfFeed"}),error:ft.formatMessage({id:"loadMore_error"})},className:d="",gtmContext:o="LoadMore"})=>{const[l,m]=h.useState(!1),[c,f]=h.useState(!1);if(t<=0||t<n*e)return null;const p=async g=>{try{await r(g)}catch(x){x instanceof Error&&x.message&&x.message.includes("Cannot read items")?f(!0):m(!0)}};return s.jsxs("footer",{className:S("load-more",d),children:[l&&s.jsx("p",{className:"error",children:i.error}),c?s.jsx("p",{children:i.endOfFeed}):s.jsx(Q,{variant:"secondary",icon:a,onClick:p,"data-gtm-event-context":o,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};let Qe=!1;const Pn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=M.useIntl(),i=h.useRef(null),[d,o]=h.useState(!1),l=m=>{i.current&&m.target instanceof HTMLElement&&!i.current.contains(m.target)&&o(!1)};return h.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),h.createElement(e,{ref:i,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:m,onClick:c,text:f,icon:p,...g},x)=>{const y={...g,onClick:_=>{o(!1),typeof c=="function"&&c(_)},onFocus:()=>{Qe&&(clearTimeout(Qe),Qe=!1)},onBlur:()=>{Qe=setTimeout(()=>{o(!1)},100)}};return m&&(y.href=m),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...y,children:f})},`${window.btoa(f)}_${x}`)})})]})})};const At=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(K,{children:s.jsx(M.FormattedMessage,{id:"apolitical"})})})});const hr={"2-1":901},gr=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const a=Fe(!0);let i=r;return h.Children.count(r)===1&&(i=h.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:h.Children.map(i,(d,o)=>t!==!1&&o===t&&a&&a<hr[e]?null:d)})};const pt="cookieBanner_",ht=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],gt=new Date(Date.now()+12*30*24*60*60*1e3),Rn=()=>{const e=M.useIntl(),[t,n,r]=cn.useCookies(ht),[a,i]=h.useState(!t["apol-cookie-banner"]),d=()=>{ht.forEach(c=>{n(c,!0,{path:"/",expires:gt,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:gt}),ht.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:gt});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:d,gtmType:"accepted-all"}],m=[];return l.forEach(c=>{m.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${pt}buttons_${c.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${pt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${pt}text`})}),s.jsx(Pe,{buttons:m})]})},_e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Se["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Se["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:Se.support,gtmType:"concierge-email-click"},business:{email:Se.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 Ee="footer_",Je="SiteFooter",on=({group:e})=>{const t=_e[e].order||[];let n=!1;return"text"in _e[e]&&(n=_e[e].text),s.jsxs(h.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(M.FormattedMessage,{id:`${Ee}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=_e[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":i,...d,children:s.jsx(M.FormattedMessage,{id:`${Ee}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(h.Fragment,{children:[s.jsx("dt",{children:s.jsx(M.FormattedMessage,{id:`${Ee}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(M.FormattedMessage,{id:`${Ee}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Nt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(St,{element:"hr"}),s.jsx(At,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(on,{group:e}),Object.keys(_e[e]).includes("child")&&s.jsx(on,{group:_e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(_e.social.order)&&_e.social.order.map(e=>{const t=_e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(M.FormattedMessage,{id:`${Ee}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(M.FormattedMessage,{id:`${Ee}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const Ue="emailHelperTextBox_",_r=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=M.useIntl(),[i,d]=h.useState({path:`${Ue}default`,type:"default",link:{},mail:{},error:""}),[o,l]=h.useState(!1),m=h.useCallback(g=>{g.preventDefault(),g.stopPropagation();const x=y=>{d({path:`${Ue}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>m(_),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:y})};if(typeof r!="function"){x(a.formatMessage({id:`${Ue}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(y=>{x(y.message)}).finally(()=>{l(!1)})},[t,n,r]);h.useEffect(()=>{let g=Ue,x="default",y={},_={};switch(e){case"gov":g+="autoApproved",x="success";break;case"nonGov":g+="unrecognisedEmail",x="error",y={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",x="error",_={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",x="error",y={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>m(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",x="error",y={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...i,path:g,type:x,link:y,mail:_})},[e]);const c={};return["link","mail"].forEach(g=>{c[g]=Object.keys(i[g]).length?x=>s.jsx("a",{...i[g],children:x}):x=>x}),s.jsx(wn,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?s.jsxs(s.Fragment,{children:[s.jsx(fe,{element:"span"}),s.jsx(fe,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:g=>s.jsx("strong",{children:g}),em:g=>s.jsx("em",{children:g}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const We="passwordRules_",Dn="isMoreThanEightCharacters",In="includesNumberAndSymbol",Ln="includesLowerAndUppercase",xr={[Dn]:"8Characters",[In]:"numberSymbol",[Ln]:"lowercaseUppercase"},vr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=M.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${We}intro`})}),s.jsx("ul",{children:[Dn,In,Ln].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(K,{children:[n.formatMessage({id:`${We}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${We}rule_${xr[r]}`})}),!e[r]&&s.jsxs(K,{element:"strong",children:[" "," ",n.formatMessage({id:`${We}notMet`})]})]},`rule-${r}`))})]})},br=h.memo(vr);const wr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:d=!1})=>{const o=M.useIntl(),[l,m]=h.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const E=await n();m(w=>({...w,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){m(w=>({...w,setUp:!0,disabled:!0})),a(E)}};if(h.useEffect(()=>{d&&!l.setUp&&c()},[d]),!d)return s.jsx(fe,{className:"rating-placeholder"});const{id:f,rating:p,disabled:g}=l,x="ratings_",y={text:o.formatMessage({id:`${x}text`}),low:o.formatMessage({id:`${x}low`}),high:o.formatMessage({id:`${x}high`}),success:o.formatMessage({id:`${x}success`}),...e},_=async E=>{if(!(!f||g))try{m(w=>({...w,rating:E,disabled:!0})),await r({id:f,value:E})}catch(w){m(T=>({...T,rating:null})),a(w)}finally{m(w=>({...w,disabled:!1}))}};return s.jsxs("div",{className:S("rating",i),children:[s.jsx("span",{className:"label",children:y[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const w=E+1;return s.jsx("li",{className:S({selected:p&&w<=p}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${x}stars`},{number:w,total:t})}${w===1||w===t?` - ${y[w===1?"low":"high"]}`:""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),_(w)},disabled:g})},`rating-${w}`)})})]})};const Bn=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:o=!1}=n||{},l=M.useIntl(),m=h.useRef(null);be(()=>{!n||o||!d||m.current&&m.current.focus()},[d]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!m.current||!m.current.value||m.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(m.current.value)}`)};return s.jsx("form",{onSubmit:c,className:S("search-form gtm-trackable",t),"data-gtm-event-context":a,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(K,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),s.jsx("input",{ref:m,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),m.current&&m.current.value&&(m.current.value="")},children:s.jsx(K,{children:l.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:c,children:s.jsx(K,{children:l.formatMessage({id:"search_cta"})})})]})})})};const On=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:d,reportError:o,sendInvites:l,initialFormStatus:m="NOT_SUBMITTED"})=>{const[c,f]=h.useState([]),[p,g]=h.useState(!0),[x,y]=h.useState(m),{formatMessage:_}=M.useIntl(),E=async C=>{C.preventDefault();try{await l(c),f([]),y("SUCCESS")}catch(A){y("ERROR"),o(A)}},w=C=>{C.preventDefault(),y("NOT_SUBMITTED"),g(!0),f([])},T=C=>{C.preventDefault(),d(),y("CLOSED")};return x==="CLOSED"?null:x==="ERROR"||x==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:x==="SUCCESS"?s.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),s.jsx(we,{}),s.jsx("div",{className:"footer",children:x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:w,children:_({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:T,children:_({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:w,children:_({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),s.jsx(_s.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:c,onChange:C=>{f(C),g(!C.length)},autoFocus:!1,getLabel:(C,A,H)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:C}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{H(A),g(!c.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},A)})]}),s.jsx(we,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:p,children:n})})]})})},B={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const d=`logged${e?"In":"Out"}`;return t>=n[i][d]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const a=Date.now();if(!t&&B.handlerCalled[e]&&a-B.handlerCalled[e]<500)return;B.handlerCalled[e]=a;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||i.push({type:`menus.${d}`,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 a=un(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?B.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let d,o;switch(e){case"navigation":if(n){const l=B.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=B.findFirstChild(l.children,"href")}else d=B.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(o=B.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;d=B.findFirstChild(o.children,"href");break;default:return}d&&(a([{type:`focusElements.${e}.${i}`,value:d}]),d.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(B.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(B.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(B.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{B.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ne={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},qe=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const d=M.useIntl(),o=un(Ne,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,m=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const T=w.split("."),C=T[T.length-2];w=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}p={href:o.href,role:"menuitem"},m&&(p={...p,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const g=o.order&&o.order[0]&&o[o.order[0]],x=g&&o[o.order[0]].order,y=p&&window.location.pathname===o.href;let _={},E={};if(g){const w=o.menuId||e,T={onClick:C=>B.events.onClick(C,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>B.events.onFocus({id:w}),onBlur:()=>B.events.onBlur({id:w,callback:a}),onMouseLeave:()=>B.events.onBlur({id:w,callback:a}),onMouseEnter:()=>B.events.onMouseEnter({id:w,callback:a})};n&&(x&&(_={...T,onKeyPress:C=>{C.key==="Enter"&&B.events.onClick(C,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),E={hidden:w in r?!r[w]:!0}),x||(E={...E,...T})}return s.jsxs("li",{className:S({[o.className]:o.className,"has-submenu":g,parent:x,active:y}),role:"none",..._,children:[p?h.createElement(c?Q:"a",p,d.formatMessage({id:f})):d.formatMessage({id:f}),o.order&&s.jsx("ul",{...E,children:o.order.map(w=>{if(!o[w])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?m:null};return o[w].order?s.jsxs("li",{className:S({[o[w].className]:o[w].className}),children:[d.formatMessage({id:`${f}_${w}`}),s.jsx("ul",{children:o[w].order.map(C=>s.jsx(qe,{id:`${e}.${w}.${C}`,...T},C))})]},w):s.jsx(qe,{id:`${e}.${w}`,...T},w)})})]},e)};const kr={height:67,height_desktop:83},Ft=()=>{const e=M.useIntl(),t=h.useContext(ve),n=Fe(!0,!0),r=t&&typeof t.id=="string",a=h.useMemo(()=>B.getIsDesktopVersion(r,n),[r,n]),[i,d]=h.useReducer(Ms,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:o,menus:l,focusElements:m}=i;pn({scrollPosition:kr[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!a&&l.navigation||B.shouldChangeHeaderIsVisible(!0,l,d)},scrollDown:()=>{!a&&l.navigation||B.shouldChangeHeaderIsVisible(!1,l,d)}}});const c=(p,g)=>{B.handleMenus({id:p,value:g,menus:l,dispatch:d})},f=h.useRef(null);return be(()=>{l.navigation&&B.autoFocus({menu:"navigation",navigationRef:f,isDesktopVersion:a.navigation,focusElements:m,dispatch:d})},[l.navigation]),be(()=>{l.account&&B.autoFocus({menu:"account",navigationRef:f,isDesktopVersion:a.navigation,focusElements:m,dispatch:d})},[l.account]),t&&t.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":r,"logged-out":!r,visible:o}),children:[s.jsx(K,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),s.jsx(At,{}),!a.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),c("navigation",!l.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":l.navigation,"aria-controls":"navigation",children:s.jsx(K,{children:e.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:f,id:"navigation",hidden:a.navigation||l.account?!1:!l.navigation,role:"menu","data-showing":!a.navigation&&l.account?"account":"default",children:Ne.order.map(p=>s.jsx(qe,{id:p,isLoggedIn:r,isDesktopVersion:a.navigation,menus:{navigation:l.navigation,account:l.account},callback:c},p))}),!a.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),c("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:s.jsx(K,{children:e.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),s.jsx(Bn,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?s.jsxs("button",{className:"account-button",onClick:p=>B.events.onClick(p,{id:"account",callback:c,isOpen:l.account}),onMouseEnter:()=>B.events.onMouseEnter({id:"account",callback:c}),onMouseLeave:()=>B.events.onBlur({id:"account",callback:c}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[s.jsx(K,{children:e.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),s.jsx(Ke,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Ne.buttons.order.map(p=>s.jsx(qe,{id:`buttons.${p}`},p))})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:l.navigation||l.account||!a.search&&l.search})})]})};const yr=()=>{const e=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{}),s.jsx("div",{className:"content",children:s.jsx(De,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Nt,{})]})},jr=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:a="",locale:i="en"})=>{const d=mn();h.useEffect(()=>{window.scrollTo(0,0)},[d]);const o=_n(e,{locale:i});return s.jsx(xs.ErrorBoundary,{onError:t,fallback:s.jsx(yr,{}),children:s.jsx(h.Suspense,{fallback:s.jsx(En,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:S(a,{[r]:r!=="default"}),children:s.jsxs(cn.CookiesProvider,{children:[s.jsx(Ft,{}),s.jsx("div",{className:"content",children:o}),n&&s.jsx(Nt,{}),s.jsx(Rn,{})]})})})})},an={default:"tags_",headerTopics:"header_topics_topics_"},_t={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"},Sr={getTagDetails:e=>{if(e.includes("topic_")){if(e=_t.topic[e.replace("topic_","")],e){const t=Ne.topics.topics[e].href;return t?{id:e,href:t,text:`${an.headerTopics}${e}`}:null}return null}return _t[e]?(e=_t[e],{id:e,text:`${an.default}${e}`}):null}};const Er=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:d="tags"})=>{const o=M.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(m=>{if(!m)return;const c=Sr.getTagDetails(m);c&&l.push(c)}),l.length<1?null:s.jsx("ul",{className:S("tags text-small",t,a,{"one-line":n}),children:l.map(m=>{const c=o.formatMessage({id:m.text});return s.jsx("li",{children:m.href&&r?s.jsx("a",{href:m.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":d,children:c}):c},m.id)})})};const Tr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:a="member-click",className:i=""})=>{const d=M.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:S("members-list",i),children:[s.jsxs("h1",{children:[d.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((o,l)=>s.jsxs("li",{children:[s.jsx(et,{member:o,gtmContext:r,gtmType:a}),o.isAdmin&&s.jsx(yn,{children:d.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(Fn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ze=null;const re="discussion_form_",Pt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:a=5e4,minRows:i=4,forceShow:d={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var F,q;const m=M.useIntl(),c=h.useContext(ve),[f,p]=h.useState(n.isEditing&&n.isEditing.text||""),[g,x]=h.useState(d.error||!1),[y,_]=h.useState(!1),E=h.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(fe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const w=k=>{const V=k.target.value;p(V);let I;!c||!c.id?I=me(m.formatMessage,`${re}error_loggedOut`,e.type,"action"):t?V.length>=a&&(I=`${re}error_tooLong`):I=me(m.formatMessage,`${re}error_noPermission`,e.type,"action"),I?x(I):g&&x(!1)};let T=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const k=e.type==="response"?((F=e.slugs)==null?void 0:F.question)||"":((q=e.slugs)==null?void 0:q.answer)||"";k&&(T=`${T}-${k.slice(-15)}`)}const C=async k=>{var I;if(k.preventDefault(),k.stopPropagation(),!c||!c.id||!t||H)return;ze&&clearTimeout(ze),_("submitting");const V=window.location.pathname;try{let L;switch(e.type){case"post":L=await o.create({content:f});break;case"question":L=await o.create({title:f,authorId:c&&c.id,...(I=o.props)==null?void 0:I.create});break;case"response":L=await o.create({question:e.slugs.question},{body:f,authorId:c&&c.id,contentPath:V});break;case"reply":L=await o.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:c&&c.id,contentPath:V});break;default:break}await Ns(1e3),o.callback&&await o.callback(L),ze=setTimeout(()=>{p(""),_("submitted"),A()},500)}catch(L){const U=L;let z=`${re}error`;U.message.includes("entry already exists")&&(z=me(m.formatMessage,`${re}error_alreadyExists`,e.type,"action")),U.message.includes("429")?z=me(m.formatMessage,`${re}error_tooMany`,e.type,"action"):U.message.includes("400")&&(z=`${re}error`),x(z),A()}},A=()=>{ze=setTimeout(()=>{x(!1),_(!1)},5e3)},H=!f||!Ls(f),W=y==="submitting",b=[];return(n.isEditing&&!W||d.cancel)&&b.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!c||!c.id||!f),children:m.formatMessage({id:`${re}cancel`})}),b.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:k=>{if(n.isEditing){_("submitting"),o.handleSaveEdit&&o.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}C(k)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!t||H||W||n.isEditing&&f===n.isEditing.text,children:m.formatMessage({id:`${re}${W?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:T,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:me(m.formatMessage,`${re}title`,e.type,"action")}),s.jsx(et,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),s.jsx(K,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:me(m.formatMessage,`${re}label`,e.type,"action")}),s.jsx(vs,{ref:r,id:`${T}-input`,name:e.type,placeholder:me(m.formatMessage,`${re}placeholder`,e.type,"action"),onChange:w,value:f,maxLength:a,"aria-invalid":!!g,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:me(m.formatMessage,`${re}explainer`,e.type,"action",{a:k=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:k})})}),s.jsx(Pe,{buttons:b}),y==="submitted"&&s.jsx(Ge,{className:"success","data-testid":"success",children:me(m.formatMessage,`${re}success`,e.type,"action")}),g&&s.jsx(Ge,{id:"error-message",className:"error","data-testid":"error",children:d.error?d.error:typeof g=="string"?g.includes(" ")?g:m.formatMessage({id:g},{action:m.formatMessage({id:`discussion_action_${e.type}`}),maxLength:a}):g})]})},Rt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:d}})=>r&&!n?s.jsx(De,{text:d,button:{component:s.jsx(Ct,{functions:{join:a,leave:i}})}}):s.jsx(Pt,{content:{type:e,slugs:{}},functions:{create:t}}),$r={showThread:!1,showForm:!1},Dt=h.createContext($r),Mr=({children:e})=>{const[t,n]=h.useState({showThread:!1,showForm:!1});return s.jsx(Dt.Provider,{value:{...t,updateConversation:n},children:e})},Cr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Ar=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ae=!1;const xt=()=>{Ae!==!1&&(clearTimeout(Ae),Ae=!1)},vt=10,Hn=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const m=M.useIntl();h.useEffect(()=>{g(a)},[a]);const[c,f]=h.useState(t),[p,g]=h.useState(a),[x,y]=h.useState(!1),[_,E]=h.useState(!1),w=h.useMemo(()=>Ar(n,vt),[n]),T=A=>{if(A.preventDefault(),A.stopPropagation(),E(!1),Ae)return xt(),!1;if(xt(),x||!d)return!1;Ae=setTimeout(C,350)},C=async()=>{if(xt(),x||!d)return!1;let A=p?c-1:c+1;A<0&&(A=0),y(!0),f(A),g(!p);try{if(i&&i.slugs){const H=Cr(i.slugs);p?await l(H):await o(H,{contentPath:window.location.pathname})}}catch{f(t),g(a)}finally{y(!1)}};return h.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":x,"is-liked":p,disabled:!d}),onClick:T,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!a}),screenreaderText:d?m.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:m.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:T,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":c===0}),"data-testid":"number-of-likes",children:m.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:c})}),n&&s.jsx(vn,{isOpen:_,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[w.map(A=>typeof A=="string"||!A.name?null:s.jsx("li",{children:s.jsx(Re,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",children:A.name})},A.id||window.btoa(A.name))),n.length>vt&&s.jsx("li",{children:m.formatMessage({id:"discussion_likes_more"},{number:n.length-vt})})]})})]})})};const Qn=({element:e="section",children:t,className:n,...r})=>h.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const It=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:d=!1}={},title:o,children:l,buttons:m,className:c="",gtmContext:f="Modal"})=>{const p=M.useIntl(),[g,x]=h.useState(t),y=E=>{x(E),E?(a(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};h.useEffect(()=>{y(t)},[t]);const _=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:g}),children:s.jsx(Qn,{id:e,className:S("overlay-modal",c,{"has-max-width":r}),hidden:!g,style:_,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[o&&s.jsx("h2",{className:"modal-title",children:o}),s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>y(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(we,{}),l,m&&s.jsxs("div",{className:"bottom",children:[s.jsx(we,{}),s.jsx(Pe,{buttons:m})]}),d&&s.jsx(Ge,{className:"error",children:d})]})})})},Un=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Nr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:a="Send an invitation to your colleagues below",ctaMessage:i="Send invites",showIcon:d,onClose:o,reportError:l=()=>{},sendInvites:m})=>s.jsx(It,{title:n,isOpen:t,showDivider:!1,showIcon:d,className:S("invite-modal",e,{success:!!n}),children:s.jsx(On,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:m,reportError:l})}),ln=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Lt=(e,t)=>e&&!t;const ge="discussion_",Fr=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,functions:{content:{createContent:i,deleteContent:d,updateContent:o}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:m}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:c}={openComments:()=>{}}},links:f={},className:p,gtmContext:g="DiscussionAnswer",children:x,isTruncated:y=!1})=>{const _=M.useIntl(),E=h.useContext(ve),w=h.useContext(Dt),[T,C]=h.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[A,H]=h.useState(!1),[W,b]=h.useState("");if(h.useEffect(()=>{C({...T,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(fe,{className:"discussion-card discussion-post"});const{author:F,canLike:q,createdAt:k,id:V,likes:I=0,userLiked:L,comments:U=0}=t,z=y?Xe(T.body,Fr):T.body,X=E&&E.id&&typeof F!="string"&&F.id&&F.id===E.id||!1,oe=typeof q=="boolean"?q:n?!X:!1,ae=async R=>{R||(R=""),b("");try{if(!bs(R,T.body)){const ee=t.type==="question"?{title:R}:{body:R};await o(ln(t.slugs),ee)}C({body:R,isEditing:!1,didEdit:!0})}catch{b(`${ge}form_error`)}},ie=()=>{w&&w.updateConversation&&w.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ee=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,G=document.getElementById(ee),te=document.getElementById(`${ee}-input`);te&&te.focus(),G&&G.scrollIntoView({behavior:"smooth"})},0)},le=()=>{try{d(ln(t.slugs))}catch{b("delete-error")}},se=[{text:_.formatMessage({id:`${ge}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(_.formatMessage({id:`${ge}report_subject`}))}&body=${encodeURI(_.formatMessage({id:`${ge}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&&X&&se.push({text:_.formatMessage({id:`${ge}moreMenu_edit`}),onClick:()=>C({...T,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:_.formatMessage({id:`${ge}moreMenu_delete`}),onClick:R=>{R.preventDefault(),R.stopPropagation(),H(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Un(`delete-${t.slug}-modal`,A)}),h.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:V||t.slug,className:S("discussion-card",t.type,{editing:T.isEditing,"has-link":f.post&&!T.isEditing}),onClick:R=>{!f.post||T.isEditing||(R.preventDefault(),R.stopPropagation(),window.location.href=f.post)},children:[!T.isEditing&&s.jsx(et,{member:F,additionalContent:{createdAt:k,didEdit:T.didEdit},className:typeof F!="string"&&F.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),T.isEditing?s.jsx(Pt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:T.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:W!==""&&W!=="delete-error"?_.formatMessage({id:W},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:ae,handleCancel:()=>{b(""),C({...T,isEditing:!1})}},gtmContext:`${g}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":"title-click",children:s.jsx(yt,{options:{overrides:{a:kn}},children:z})}):s.jsx(yt,{options:{wrapper:t.type==="question"?"h1":h.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:z}),!T.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(Hn,{element:"li",likes:I,isShort:!1,userLiked:L,content:{type:t.type,slugs:t.slugs},canLike:oe,functions:{createLike:l,deleteLike:m}}),(["question","post"].includes(t.type)||f.comments||typeof c=="function")&&s.jsxs("li",{className:"action-button",onClick:R=>{R.preventDefault(),R.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof c=="function"&&c()},children:[s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:f.comments?f.comments:!1,onClick:f.comments||typeof c!="function"?!1:c,className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:_.formatMessage({id:`${ge}comments_screenReader`},{count:U})}),s.jsx("span",{children:_.formatMessage({id:`${ge}comments`},{count:U})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:ie,children:_.formatMessage({id:`${ge}reply`})})}),s.jsx(Pn,{element:"li",id:`more-${t.slug}`,options:se})]})]}),x,s.jsx(It,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>H(!1)},forceShow:{error:W==="delete-error"?_.formatMessage({id:"discussion_delete_error"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:_.formatMessage({id:"discussion_delete_title"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>H(!1),children:_.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:le,children:_.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(M.FormattedMessage,{id:"discussion_delete_text",values:{p:R=>s.jsx("p",{children:R}),action:_.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const bt="discussion_responses_",Pr=({type:e="answer",responses:t=0})=>{const n=M.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${bt}title`},{action:n.formatMessage({id:`${bt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:me(n.formatMessage,`${bt}empty`,e,e)})]})};const Rr=({isOpen:e=!1,count:t=0,children:n})=>{const r=M.useIntl(),a=h.useRef(null),[i,d]=h.useState(e),[o,l]=h.useState("closed");h.useEffect(()=>{const p=a.current;if(p)return p.addEventListener("transitionend",m),()=>{p.removeEventListener("transitionend",m)}},[]),be(()=>{o==="closed"&&!i||l(["opening","open"].includes(o)?"ready-to-close":"opening")},[i]),h.useEffect(()=>{o==="ready-to-close"&&l("closing")},[o]);const m=({propertyName:p})=>{p==="max-height"&&l(g=>g==="opening"?"open":g==="closing"?"closed":g)},c=["opening","open"].includes(o),f=_n(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${c?"left":"right"}`},onClick:()=>{d(!i)},children:r.formatMessage({id:`discussion_thread_${c?"hide":"show"}`},{count:t})}),s.jsx("ul",{ref:a,className:S("thread",o),hidden:!i,children:f})]})},Dr=({user:e,content:t,verb:n="post"})=>({actor:{id:e.id,data:{name:e.name,organization:e==null?void 0:e.organization,jobTitle:e==null?void 0:e.jobTitle}},content:t,latest_reactions:{like:[]},reaction_counts:{like:0},verb:n}),Ir=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:o})=>{if(!n)return;const l=Dr({user:n,content:o,verb:"post"});await e.cancelQueries({queryKey:t});const m=e.getQueryData(t);return e.setQueryData(t,c=>[...c,l]),{previousActivities:m}},onError:(o,l,m)=>{e.setQueryData(t,m.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Lr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),m=l==null?void 0:l.map(c=>((c==null?void 0:c.id)===(d==null?void 0:d.activityId)&&(c.content=o),c));return e.setQueryData(t,()=>m&&[...m]),{previousActivities:m}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Br=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:o})=>{await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),m=l==null?void 0:l.map(c=>{var f;return(c==null?void 0:c.id)===o&&((f=c.reaction_counts)!=null&&f.like?c.reaction_counts.like+=1:c.reaction_counts.like=1),c});return e.setQueryData(t,()=>m&&[...m]),{previousActivities:m}},onError:(o,l,m)=>{e.setQueryData(t,m.previousActivities)},onSuccess:o=>{const l=e.getQueryData(t),m=l==null?void 0:l.map(c=>((c==null?void 0:c.id)===(o==null?void 0:o.activity_id)&&(c.latest_reactions.like?c.latest_reactions.like.push(o):c.latest_reactions.like=[o]),c));return e.setQueryData(t,()=>m&&[...m]),{previousActivities:l}},onSettled:(o,l,m)=>{e.invalidateQueries({queryKey:[...t,m.activityId]})}}),Or=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:l})=>{await e.cancelQueries({queryKey:t});const m=e.getQueryData(t),c=m==null?void 0:m.map(f=>{var p;return(f==null?void 0:f.id)===l&&(p=f.reaction_counts)!=null&&p.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(l,m,c)=>{e.setQueryData(t,c.previousActivities)},onSuccess:(l,{activityId:m})=>{const c=e.getQueryData(t),f=c==null?void 0:c.map(p=>{var g,x,y,_;if(p.id===m){const E=(y=(x=(g=p.latest_reactions)==null?void 0:g.like)==null?void 0:x.find(w=>w.user_id===(n==null?void 0:n.id)))==null?void 0:y.id;return p.latest_reactions.like=(_=p.latest_reactions.like)==null?void 0:_.filter(w=>w.id!==E),p}else return p});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:c}},onSettled:(l,m,c)=>{e.invalidateQueries({queryKey:[...t,c.activityId]})}}),Hr=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:a,edit:i,like:d,unlike:o,join:l,leave:m}})=>{const c=M.useIntl(),f=Z.useQueryClient(),p=h.useContext(ve),{data:g,error:x,isLoading:y,isFetching:_}=Z.useQuery({queryKey:[e,t],queryFn:r}),E=Ir({queryClient:f,queryKey:[e,t],user:p,mutationFn:a}),{mutate:w}=Z.useMutation(E),T=Lr({queryClient:f,queryKey:[e,t],mutationFn:async k=>await i(k)}),{mutate:C}=Z.useMutation(T),A=Br({queryClient:f,queryKey:[e,t],mutationFn:d}),{mutate:H}=Z.useMutation(A),W=Or({queryClient:f,queryKey:[e,t],user:p,mutationFn:async({activityId:k})=>{var L,U,z;const V=g&&(g==null?void 0:g.find(X=>X.id===k)),I=(z=(U=(L=V==null?void 0:V.latest_reactions)==null?void 0:L.like)==null?void 0:U.find(X=>X.user_id===(p==null?void 0:p.id)))==null?void 0:z.id;await o({reactionId:I||"",activityId:k})}}),{mutate:b}=Z.useMutation(W),F=h.useCallback(({activityId:k})=>H({activityId:k}),[H]),q=h.useCallback(({activityId:k})=>b({activityId:k}),[b]);return x?s.jsx(De,{variant:"error",text:x.message}):y?s.jsx(fe,{style:{height:"400px"}}):s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:w,membershipRequiredToPost:{isMember:n,required:!0,join:l,leave:m,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),!_&&Array.isArray(g)&&(g==null?void 0:g.map(k=>{var L,U,z,X,oe,ae,ie,le,se,R,ee,G;const V=((L=k==null?void 0:k.actor)==null?void 0:L.id)===(p==null?void 0:p.id),I=Lt(n,V);return s.jsxs(h.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:k==null?void 0:k.content,canLike:I,createdAt:(k==null?void 0:k.time)||"",slugs:{parentId:t,activityId:k==null?void 0:k.id},slug:k==null?void 0:k.id,author:{id:(U=k==null?void 0:k.actor)==null?void 0:U.id,name:`${(X=(z=k==null?void 0:k.actor)==null?void 0:z.data)==null?void 0:X.name}`,organization:(ae=(oe=k==null?void 0:k.actor)==null?void 0:oe.data)==null?void 0:ae.organization,jobTitle:(le=(ie=k==null?void 0:k.actor)==null?void 0:ie.data)==null?void 0:le.jobTitle,image:{thumbnail:((R=(se=k==null?void 0:k.actor)==null?void 0:se.data)==null?void 0:R.thumbnail)||void 0}},userLiked:((ee=k==null?void 0:k.own_reactions)==null?void 0:ee.like)&&((G=k==null?void 0:k.own_reactions)==null?void 0:G.like.length)>0,likes:(k==null?void 0:k.reaction_counts.like)||0,comments:(k==null?void 0:k.reaction_counts.reply)||0},links:{post:`${e}/${t}/${k==null?void 0:k.id}`,comments:`${e}/${t}/${k==null?void 0:k.id}`},functions:{content:{createContent:()=>null,deleteContent:()=>null,updateContent:(te,ue)=>C({activityInfo:te,content:ue})},likes:{createLike:()=>{F({activityId:k==null?void 0:k.id})},deleteLike:()=>{q({activityId:k==null?void 0:k.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(we,{})]},k==null?void 0:k.id)}))]})},Qr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(o,l,m)=>{e.setQueryData(t,m.previousActivity)},onSuccess:o=>{var m;const l=e.getQueryData(t);if(l)return(m=l==null?void 0:l.latest_reactions)!=null&&m.reply?(l.latest_reactions.reply.unshift(o),l&&(l.reaction_counts={reply:l.latest_reactions.reply.length})):(l.latest_reactions={reply:[o]},l.reaction_counts={reply:1}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ur=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:d}})=>{var m,c,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((m=o==null?void 0:o.latest_reactions)!=null&&m.reply))return;const l=(f=(c=o==null?void 0:o.latest_reactions)==null?void 0:c.reply)==null?void 0:f.map(p=>(p.id===i.replySlug&&(p.data.content=d),p));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)}}),Wr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var m,c;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),l=(c=(m=o==null?void 0:o.latest_reactions)==null?void 0:m.reply)==null?void 0:c.map(f=>{var p;return f.id===d&&((p=f.children_counts)!=null&&p.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:d=>{var m;const o=e.getQueryData(t),l=(m=o==null?void 0:o.latest_reactions.reply)==null?void 0:m.map(c=>(c.id===d.id&&(c.latest_children.like?c.latest_children.like.push(d):c.latest_children.like=[d]),c));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),zr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:o})=>{var c;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l)return;const m=(c=l.latest_reactions.reply)==null?void 0:c.map(f=>(f.id===o&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:m}})),{previousActivity:l}},onError:(o,l,m)=>{e.setQueryData(t,m.previousActivity)},onSuccess:(o,{replyId:l})=>{var f;const m=e.getQueryData(t);if(!m)return;const c=(f=m.latest_reactions.reply)==null?void 0:f.map(p=>{var g;return p.id===l?(g=p.latest_children.reply)==null?void 0:g.filter(y=>y.user_id!==(n==null?void 0:n.id)):p});return e.setQueryData(t,()=>({...m,latest_reactions:{reply:c}})),{previousActivity:m}}}),Wn=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:a,functions:{createReply:i,editReply:d,like:o,unlike:l,join:m,leave:c}})=>{const f=M.useIntl(),p=Z.useQueryClient(),g=h.useContext(ve),x=Qr({queryClient:p,queryKey:[e,t,n],mutationFn:i}),{mutate:y}=Z.useMutation(x),_=Ur({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:E}=Z.useMutation(_),w=Wr({queryClient:p,queryKey:[e,t,n],mutationFn:o}),{mutate:T}=Z.useMutation(w),C=zr({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:l}),{mutate:A}=Z.useMutation(C),H=h.useCallback(({replyId:b})=>T({replyId:b}),[T]),W=h.useCallback(({replyId:b})=>A({replyId:b}),[A]);return s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:y,membershipRequiredToPost:{isMember:a,required:!0,join:m,leave:c,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var V,I,L,U,z,X,oe,ae,ie,le,se,R,ee,G,te,ue,de;const F=((V=b==null?void 0:b.latest_children)==null?void 0:V.like)&&((I=b==null?void 0:b.latest_children)==null?void 0:I.like.filter(pe=>pe.user_id===(g==null?void 0:g.id))),q=((L=b==null?void 0:b.user)==null?void 0:L.id)===(g==null?void 0:g.id),k=Lt(a,q);return s.jsx(tt,{content:{type:"post",body:typeof b.data.content=="string"?(U=b==null?void 0:b.data)==null?void 0:U.content:((X=(z=b==null?void 0:b.data)==null?void 0:z.content)==null?void 0:X.text)||"",canLike:k,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(oe=b==null?void 0:b.user)==null?void 0:oe.id,name:(ie=(ae=b==null?void 0:b.user)==null?void 0:ae.data)==null?void 0:ie.name,organization:(se=(le=b==null?void 0:b.user)==null?void 0:le.data)==null?void 0:se.organization,jobTitle:(ee=(R=b==null?void 0:b.user)==null?void 0:R.data)==null?void 0:ee.jobTitle,image:{thumbnail:((te=(G=b==null?void 0:b.user)==null?void 0:G.data)==null?void 0:te.thumbnail)||void 0}},userLiked:!!(F!=null&&F.length),likes:((ue=b==null?void 0:b.children_counts)==null?void 0:ue.like)||0,comments:((de=b==null?void 0:b.children_counts)==null?void 0:de.reply)||0},functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(pe,ke)=>E({replyInfo:pe,content:ke})},likes:{createLike:()=>H({replyId:b==null?void 0:b.id}),deleteLike:()=>W({replyId:b==null?void 0:b.id})},comments:{openComments:()=>{}}}},b==null?void 0:b.id)}))]})},Vr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return l&&l.id===(d==null?void 0:d.activityId)&&(l.content=o),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Yr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var l;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(l=o==null?void 0:o.reaction_counts)!=null&&l.like?o.reaction_counts.like+=1:o&&(o.reaction_counts={like:1}),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,l,m)=>{e.setQueryData(t,m.previousActivity)},onSuccess:o=>{const l=e.getQueryData(t);return l!=null&&l.latest_reactions.like?l.latest_reactions.like.push(o):l&&(l.latest_reactions={like:[o]}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Gr=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:a})=>({mutationFn:a,onMutate:async()=>{var c;await e.cancelQueries({queryKey:t});const m=e.getQueryData(t);return(c=m==null?void 0:m.reaction_counts)!=null&&c.like&&m.reaction_counts.like>0&&(m.reaction_counts.like-=1),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onError:(m,c,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,p,g;if(!r)return;const m=(g=(p=(f=r.latest_reactions)==null?void 0:f.like)==null?void 0:p.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:g.id,c=e.getQueryData(t);if(c!=null&&c.latest_reactions.like)return c.latest_reactions.like=c.latest_reactions.like.filter(x=>x.id!==m),e.setQueryData(t,()=>({...c})),{previousActivity:c}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const Jr=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:a,editActivity:i,likeActivity:d,unlikeActivity:o,createReply:l,editReply:m,likeReply:c,unlikeReply:f,join:p,leave:g}})=>{var L,U,z,X,oe,ae,ie,le,se,R,ee;const x=h.useContext(ve),y=Z.useQueryClient(),{data:_,error:E,isLoading:w,isFetching:T}=Z.useQuery({queryKey:[e,t,n],queryFn:a}),C=Vr({queryClient:y,queryKey:[e,t,n],mutationFn:async G=>await i(G)}),{mutate:A}=Z.useMutation(C),H=Yr({queryClient:y,queryKey:[e,t,n],mutationFn:d}),{mutate:W}=Z.useMutation(H),b=Gr({queryClient:y,queryKey:[e,t,n],user:x,mutationFn:async()=>{var te,ue,de;const G=(de=(ue=(te=_==null?void 0:_.latest_reactions)==null?void 0:te.like)==null?void 0:ue.find(pe=>pe.user_id===(x==null?void 0:x.id)))==null?void 0:de.id;await o({activityId:n,reactionId:G})},activity:_}),{mutate:F}=Z.useMutation(b),q=h.useCallback(({activityId:G})=>W({activityId:G}),[W]),k=h.useCallback(async({activityId:G})=>F({activityId:G}),[F]);if(E)return s.jsx(De,{variant:"error",text:E.message});if(w||T)return s.jsx(fe,{style:{height:"400px"}});const V=((L=_==null?void 0:_.actor)==null?void 0:L.id)===(x==null?void 0:x.id),I=Lt(r,V);return s.jsx(tt,{className:"activity-section",content:{type:"post",body:_==null?void 0:_.content,canLike:I,createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:_==null?void 0:_.id},slug:n,author:{id:(U=_==null?void 0:_.actor)==null?void 0:U.id,name:(z=_==null?void 0:_.actor)==null?void 0:z.data.name,organization:(X=_==null?void 0:_.actor)==null?void 0:X.data.organization,jobTitle:(oe=_==null?void 0:_.actor)==null?void 0:oe.data.jobTitle,image:{thumbnail:((ae=_==null?void 0:_.actor)==null?void 0:ae.data.thumbnail)||void 0}},userLiked:((ie=_==null?void 0:_.own_reactions)==null?void 0:ie.like)&&((le=_==null?void 0:_.own_reactions)==null?void 0:le.like.length)>0,likes:_&&(_==null?void 0:_.reaction_counts.like),comments:_&&(_==null?void 0:_.reaction_counts.reply)},originalAuthorId:(se=_==null?void 0:_.actor)==null?void 0:se.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(G,te)=>A({activityInfo:G,content:te})},likes:{createLike:()=>q({activityId:n}),deleteLike:()=>k({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((R=_==null?void 0:_.reaction_counts)==null?void 0:R.reply)||0,")"]}),s.jsx(Wn,{basePath:e,parentId:t,activityId:n,repliesList:(ee=_==null?void 0:_.latest_reactions)==null?void 0:ee.reply,isMember:r,functions:{createReply:l,like:c,unlike:f,editReply:m,join:p,leave:g}})]})},n)},qr=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}});exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=Hr;exports.ActivitySection=Jr;exports.AddPost=Rt;exports.BannerSection=zs;exports.Breadcrumbs=dr;exports.Button=Q;exports.ButtonWrapper=Pe;exports.CacheProvider=Mn;exports.CollapsibleSection=$t;exports.Columns=gr;exports.CommunityDetails=ur;exports.Contributors=$n;exports.ConversationContext=Dt;exports.CookieBanner=Rn;exports.DiscussionConversation=Mr;exports.DiscussionForm=Pt;exports.DiscussionLikes=Hn;exports.DiscussionPost=tt;exports.DiscussionThread=Rr;exports.Divider=we;exports.DownloadSection=Hs;exports.EMAILS=Se;exports.EmailHelperTextBox=_r;exports.EmptyStateBox=De;exports.Filters=mr;exports.FlagsProvider=Cn;exports.Footer=Nt;exports.FullWidthSection=Tt;exports.GlobalProviders=cr;exports.Header=Ft;exports.HelperTextBox=wn;exports.HiddenFromScreenReaders=St;exports.HideShowTextBox=Gs;exports.HighlightedTextBox=xe;exports.IntlProvider=An;exports.InviteForm=On;exports.InviteModal=Nr;exports.JoinButton=Ct;exports.LanguageSwitcher=pr;exports.Link=Re;exports.LoadMore=Fn;exports.LoadingBlock=rr;exports.LoadingPlaceholder=fe;exports.LoadingState=En;exports.Logo=At;exports.LogoSection=Qs;exports.MarkdownText=yt;exports.MarketingBox=Vs;exports.Member=et;exports.MembersList=Tr;exports.Modal=Qn;exports.MoreMenu=Pn;exports.NUMBER_OF_USERS=Ys;exports.Overlay=It;exports.PageLayout=jr;exports.PasswordRules=br;exports.Pill=yn;exports.ProfilePicture=Ke;exports.ProgressBar=jn;exports.Rating=wr;exports.RepliesFeed=Wn;exports.ResponsesHeading=Pr;exports.ResponsiveImage=xn;exports.SearchForm=Bn;exports.Span=kn;exports.StatusBanner=Ge;exports.Tags=Er;exports.Tooltip=vn;exports.UserContext=ve;exports.UserProvider=Nn;exports.VisuallyHidden=K;exports.addAriaProps=Un;exports.getMember=Mt;exports.headerData=Ne;exports.mapGetStreamData=qr;exports.useCurrentPath=mn;exports.useEffectAfterMount=be;exports.useScreenWidth=Fe;exports.useScrollListener=pn;exports.useScrollToHash=$s;
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",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",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>",sharedLinks_copy_text:"Copy link",tags_community:"From the community",tooltip_loading:"Loading..."},Ns={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>"},Is={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>"},Ls={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>"},Bs=Object.freeze(Object.defineProperty({__proto__:null,en:$t,es:Ns,fr:Is,pt:Ls},Symbol.toStringTag,{value:"Module"})),me=(e,t,n,r,a={})=>{let l="";return`${t}_${n}`in $t?l=e({id:`${t}_${n}`},a):l=e({id:t},{[r]:n,...a}),l},Os=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const l=Math.pow(10,(a+1)*3);if(l<=e){e=Math.round(e*t/l)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},xn=(e,t)=>g.Children.map(e,n=>g.cloneElement(n,{...t})),Hs=e=>e.replace(/\s+/g,"").length>0,z=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:l="button",onClick:u=!1,className:o="",disabled:i=!1,screenreaderText:c=!1,children:d=!1,...f})=>{const p=De(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const _=Object.assign({},t),T=gn(Object.keys(_));t=_n(p,T,_)}const x=[];typeof t=="string"&&x.push(t),r&&(x.push("icon"),typeof r=="object"?(x.push(r.icon),r.position?x.push(r.position):x.push("left"),r.hover&&x.push(`hover_${r.hover}`),r.animate&&(x.push("animate"),typeof r.animate=="string"&&x.push(r.animate))):(x.push(r),!r.includes("right")&&!r.includes("left")&&x.push("left"))),n.muted&&x.push("muted"),n.fullWidth&&x.push("full-width");const y={...f,className:E(e,o,x,{"no-text":!d,disabled:i,button:a}),onClick:_=>{(!a||a[0]==="#")&&u&&(_.preventDefault(),_.stopPropagation()),u&&u(_)},disabled:typeof i=="object"&&"isClickable"in i?!i.isClickable:i};return a&&(l="a",y.href=a),g.createElement(l,y,d||(c?s.jsx(te,{showOnFocus:!1,children:c}):null))},Fe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",a=e.map((l,u)=>r==="p"?s.jsx(z,{...l},u):s.jsx("li",{children:s.jsx(z,{...l})},u));return g.createElement(r,{className:E("button-wrapper",t),...n,children:a})};const we=({maxWidth:e=!1})=>{const t=e?{"--max-width":`${e/16}rem`}:{};return s.jsx("hr",{className:E({"has-max-width":e}),style:t})},Pe=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:l,gtmType:u,...o})=>{if(e){const i={...o};return a&&(i.onClick=a),l&&(i["data-gtm-event-context"]=l),u&&(i["data-gtm-event-type"]=u),s.jsx("a",{href:e,className:E("gtm-trackable",r),...i,children:t})}return n?g.createElement(n,{children:t,className:r,...o}):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"}},Qs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?tn[e]:tn.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Us=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ut=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:l})=>`${n}?${Us({format:e,height:a,query:r,width:l})} ${l}w`).join(", ");const bn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:l,query:u,url:o,width:i,loading:c,decoding:d,fetchPriority:f}=e,{range:h,sizes:p}=Qs(e),x=ut({format:"avif",query:u,range:h,url:o}),y=ut({format:"webp",query:u,range:h,url:o}),_=ut({format:"",query:u,range:h,url:o});return s.jsxs("picture",{className:t,children:[l!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:x,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:y,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:_,sizes:p,src:o,alt:r,loading:c||"lazy",decoding:d||"async",fetchpriority:f||"auto",width:i,height:a,"data-testid":n||"image"})]})};let Ce=!1;const vn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=C.useIntl(),a=g.useRef(null),[l,u]=g.useState("hidden");g.useEffect(()=>{const i=a.current;if(i)return i.addEventListener("transitionend",o),()=>{i.removeEventListener("transitionend",o)}},[]);const o=({propertyName:i})=>{i==="opacity"&&(Ce!==!1&&clearTimeout(Ce),u(c=>c==="opening"?"open":c==="closing"?"closed":c==="closed"?"hidden":c))};return ve(()=>{Ce!==!1&&clearTimeout(Ce);let i="open";e?u("opening"):(u("closing"),i="hidden"),Ce=setTimeout(()=>{u(i)},300)},[e]),s.jsx("aside",{ref:a,className:E("tooltip text-medium",l,{loading:t}),hidden:l==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Mt=({children:e,className:t="",...n})=>s.jsx("section",{className:E("full-width-section",t),...n,children:e});const Ws=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),s.jsx(Mt,{className:E("download-section",n),children:s.jsxs(s.Fragment,{children:[g.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Fe,{buttons:r})]})})};const zs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const a={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:E("logos",n),children:[e&&g.createElement(a.element,{className:"title"},a.text),s.jsx("ul",{className:E({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:l,nameOfBusiness:u,link:o=!1,description:i=!1},c)=>{if(!l||!l.url)return null;const d=s.jsx("img",{src:l.url,width:l.width||"auto",height:l.height||"auto",alt:u});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:o?s.jsx("a",{href:o,target:"_blank",rel:"nofollow noreferrer noopener",children:d}):d}),i&&s.jsx("small",{children:i})]},window.btoa(`${l.url}_${c}`))})})]})};const Vs=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ys=({content:e,image:t,variant:n="default",spacing:r="normal",cta:a,children:l})=>{const u=["eyebrow","title","text"],o={eyebrow:"small",title:"h1",text:"p"},i={};return u.forEach(c=>{if(!e[c]){i[c]=!1;return}if(typeof e[c]=="object"){i[c]=e[c];const{text:d,element:f}=e[c];if(f&&Vs.includes(f.toLowerCase()))return;i[c]={text:d,element:o[c]};return}i[c]={text:e[c],element:o[c]}}),a&&a.link&&a.link[0]==="#"&&(a.props||(a.props={}),a.props.onClick=c=>{c.preventDefault(),c.stopPropagation();const d=document.getElementById(a.link.substring(1));d&&d.scrollIntoView({behavior:"smooth"})}),s.jsx(Mt,{className:E("banner-section",n,r,{"has-image":t,"has-extra-spacing":r==="normal"&&i.eyebrow&&i.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[u.map(c=>{if(i[c]&&typeof i[c]=="object"){const{text:d,element:f=""}=i[c];return g.createElement(f.toLowerCase(),{key:c,className:c},d)}return null}),l,a&&a.text&&a.link&&s.jsx(z,{variant:t||n==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:a.link,...a.props,children:a.text})]}),t&&s.jsx(bn,{image:{...t,aspect:"banner"}})]})})},Gs=g.memo(Ys);const Js=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:s.jsxs("aside",{className:E("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(z,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Je="https://storage.googleapis.com/apolitical-assets/",Se={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Xs="200,000+";const Ct=({label:e=!1,className:t="",children:n})=>{const r=C.useIntl();return s.jsxs("details",{className:E("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const _e=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:E("highlighted-text-box",e,t),...r,children:n});const Ne=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const l=typeof n=="object"&&"breakpoints"in n,u=De(l);if(l&&typeof n=="object"&&typeof u=="number"){const f=Object.assign({},n.breakpoints),h=gn(Object.keys(f));a=_n(u,h,f)}const{breakpoints:o,text:i="",component:c,...d}=n;return s.jsx(_e,{variant:"subtle",className:E("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(et,{options:{forceBlock:!0},children:t}),a&&typeof n=="object"&&(c||s.jsx(z,{...d,variant:n.variant?n.variant:"secondary",children:i}))]})})};const yt=({children:e,...t})=>s.jsx("p",{...t,children:e}),wn={q:yt,blockquote:yt};for(let e=1;e<=6;e++)wn[`h${e}`]={component:yt,props:{className:"title"}};const kn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:E("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(et,{options:{wrapper:g.Fragment,forceBlock:!0,overrides:wn},children:r}):s.jsx("p",{children:r})]});const Zs=({className:e="",show:t=!1,hide:n=!1,text:r,children:a})=>{const l=C.useIntl(),u=g.useRef(null),[o,i]=g.useState(""),[c,d]=g.useState("closed");g.useEffect(()=>{const p=u.current;if(p)return p.addEventListener("transitionend",f),()=>{p.removeEventListener("transitionend",f)}},[]),g.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
|
|
36
|
+
`);i(p.length<3?`${r.substring(0,400)}...`:p.slice(0,3).join(`
|
|
37
|
+
`))},[r]),g.useEffect(()=>{c==="ready-to-close"&&d("closing")},[c]);const f=({propertyName:p})=>{p==="max-height"&&d(x=>x==="opening"?"open":x==="closing"?"closed":x)};if(!r)return null;const h=["opening","open"].includes(c);return s.jsxs(_e,{variant:"subtle",className:E("hide-show-text-box",e),children:[s.jsxs("div",{ref:u,className:E("content",c),children:[s.jsx(et,{options:{forceBlock:!0},children:c==="closed"?o:r}),c!=="closed"&&a]}),s.jsx("p",{className:"cta",children:s.jsx(z,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:E({"rotate-180":h}),onClick:()=>{d(h?"ready-to-close":"opening")},children:h?n||l.formatMessage({id:"hideShowTextBox_hide"}):t||l.formatMessage({id:"hideShowTextBox_show"})})})]})},qs=()=>g.Fragment,Ks=({children:e})=>s.jsx(_e,{variant:"secondary",children:e}),er=["span","strong","h1","h2","h3","h4","h5","h6","p"],tr=({children:e})=>{const t=C.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const l of g.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number"))if(g.isValidElement(l)&&l.type==="summary"){if(l.props&&l.props.children){for(const u of g.Children.toArray(l.props.children))if(!(!u||typeof u=="string"||typeof u=="number")&&g.isValidElement(u)){const o=u.type;if(er.includes(o)){for(n=u.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(l);const a=n?n.toString():"";return s.jsx(Ct,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(l=>l)})},nr=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(_e,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(_e,{variant:"primary",children:e});case"pink-textbox":return s.jsx(_e,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},sr=e=>{const t=C.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(te,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},nn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const l of g.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number")&&g.isValidElement(l)){const u=l.type;if(["button","center","span","strong"].includes(u)&&l.props&&l.props.children&&l.props.children[0])for((u==="button"||nn(l.props.children[0])==="button")&&(a=!0),r=l.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!g.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&nn(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(z,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},jn=({children:e})=>s.jsx("span",{children:e});const St=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:g.Fragment,forceBlock:!0,overrides:{a:rr,CollapsibleSection:Ct,TextBox:_e,CaseStudy:Ks,style:qs,details:tr,div:nr,iframe:sr}};return s.jsx("div",{className:E("markdown-text",e),children:s.jsx(et,{options:{...r,...t},children:n})})};const yn=({size:e="medium",variant:t="default",className:n="",children:r})=>s.jsx("span",{className:E("pill",e,t,n),children:r});const Xe=({element:e="p",children:t=null,className:n="",...r})=>g.createElement(e,{...r,className:E("status-banner text-small",n),"aria-live":"assertive"},t);const or=({progress:e=0,text:t=!1,className:n=""})=>{const r=C.useIntl(),a=e>75?100:e>50?75:e>25?50:e>5?25:0,l={"--progress":`${e}%`};return s.jsx("span",{className:E(`progress-bar section-${a}`,n),style:l,children:s.jsx(te,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Sn=g.memo(or);const dt="loadingBlock_",ar=({progress:e=0,steps:t=!1,className:n=""})=>{const r=C.useIntl();t||(t={0:{text:r.formatMessage({id:`${dt}loading`})},75:{text:r.formatMessage({id:`${dt}almostDone`})},100:{text:r.formatMessage({id:`${dt}complete`})}});let a=null;const l=Object.keys(t);for(let o=0;o<l.length&&!(e<parseInt(l[o]));o++)a=l[o];const u=a&&t[a].icon?{"--icon":`url(${Je}icons/${t[a].icon}.svg)`}:{};return s.jsxs(_e,{className:E("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:u,children:[a&&s.jsx("span",{className:"step",children:t[a].text}),s.jsx(Sn,{progress:e})]})},ir=g.memo(ar);const fe=({element:e="div",className:t="",...n})=>s.jsx(Tt,{element:e,className:E("loading-placeholder",t),...n});const Et={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},En=(e,t)=>e in Et?s.jsx("div",{className:e,children:Et[e].map((n,r)=>En(n,r))},t):s.jsx(fe,{className:e},t),Tn=({layout:e="overview-page"})=>s.jsx("div",{className:E("loading-state",e),children:Et[e].map((t,n)=>En(t,n))}),$n=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):""},Qe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],lr=e=>{const t=Math.ceil(26/Qe.length),n=$n(e).toLowerCase();if(n==="")return Qe[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Qe.length;a++)if(r<=t*(a+1))return Qe[a]};const sn=256,tt=({className:e="",src:t="",name:n,alt:r,width:a=sn,height:l=sn,...u})=>{const[o,i]=g.useState(!1),c=g.useRef(null);g.useEffect(()=>{const f=c.current;if(!f)return;const h=f.getContext("2d");if(!h)return;const p=a,x=l;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=x*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=lr(n),h.fillRect(0,0,p,x),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText($n(n),p/2,x/1.6)},[n]);let d=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(d=!0),s.jsx("figure",{className:E("profile-picture",e,{error:o}),...u,children:d?s.jsx("img",{src:t,alt:r||n,onError:()=>{i(!0)},width:a,height:l}):s.jsx("canvas",{ref:c})})},Rt=e=>e==="apolitical"?{image:`${Je}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Je}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},cr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",l=t!=="",u=n!=="";if(!a&&!l&&!u)return"";const o=`${e}${a&&l?` — ${t}`:t}`;let i=`${o}${(a||l)&&u?`, ${n}`:n}`;return i.length>r&&(i=o),i.length>r&&(i=Ke(i,r)),i};const nt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:a="member-click",className:l=""})=>{const u=C.useIntl(),o=Rt(t);o.name||(o.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:i,url:c,image:d}=o,f=cr(o),h=n&&n.createdAt?Fs(n.createdAt):!1,p=n&&n.createdAt?Ds(n.createdAt):"";return g.createElement(e,{className:E("member text-medium",l),children:s.jsxs(Pe,{href:c,gtmType:a,gtmContext:r,onClick:x=>{x==null||x.stopPropagation()},children:[s.jsx(tt,{name:i,src:d}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:i}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&s.jsx("span",{className:"date",title:p,"aria-label":p,children:u.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&s.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const rn={small:24,medium:48},Mn=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:l,showPlaceholders:u}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,className:i=""})=>{const c=C.useIntl();return!n||n.length===0?null:g.createElement(e,{className:E("contributors",i,a,{"has-gap":l}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((d,f)=>{let h,p="";if(f<o){const{name:x="",image:y=""}=Rt(d);if(u)return s.jsx(fe,{element:"li",className:"contributor"},f);h=s.jsx(tt,{name:x,src:y,width:rn[a||"medium"],height:rn[a||"medium"]})}else if(f===o){const x=(t||n.length)-o;h=s.jsxs("small",{className:E({"large-number":x>99}),children:["+",Os(x,0)]}),p="number-left"}return h?s.jsx("li",{className:E("contributor",p),children:h},f):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?c.formatMessage({id:`member_${n[0]}`}):Ke(n[0].name||"",20):null})]})})},Cn=({showDevTools:e=!0,children:t})=>{const n=new G.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(G.QueryClientProvider,{client:n,children:[t,e&&s.jsx(bs.ReactQueryDevtools,{initialIsOpen:!1})]})};var ur=g.createContext({client:Ge});function dr(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,l=g.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Ge.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ge.init(r,a)),Ge)},[n,r]);return g.createElement(ur.Provider,{value:{client:l}},t)}const Rn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(dr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,An=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Bs[r],...n||{}};return s.jsx(C.IntlProvider,{locale:r,messages:a,children:e})},xe=g.createContext(null),Dn=({children:e,user:t})=>s.jsx(xe.Provider,{value:t,children:e}),mr=({bootstrap:e,children:t,intl:n})=>{const[r,a]=g.useState({isLoading:!0});return g.useEffect(()=>{e().then(l=>a({...l,isLoading:!1})).catch(()=>a({isLoading:!1}))},[]),s.jsx(An,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Dn,{user:r,children:s.jsx(Cn,{children:s.jsx(Rn,{user:r,children:t})})})})};const mt="joinCommunityButton",At=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=C.useIntl(),l=g.useContext(xe),u=l&&typeof l.id=="string",[o,i]=g.useState(e),[c,d]=g.useState(e?"joined":"notJoined");g.useEffect(()=>{c==="joining"?d("joined"):c==="leaving"&&d("notJoined")},[o]);const f={},h={};return o&&c!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${mt}_leave`}),f["aria-label"]=a.formatMessage({id:`${mt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(z,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&c!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{u&&(p.currentTarget.blur(),o?(d("leaving"),typeof r=="function"&&await r()):(d("joining"),typeof n=="function"&&await n()),i(!o))},className:E("join-community-button",c,{active:c==="joining"}),disabled:!u,...f,children:s.jsx("span",{className:"text",...h,children:a.formatMessage({id:`${mt}${["joining","leaving"].includes(c)?`_${c}`:o?"_member":t?"_short":""}`})})})};const ft="communityDetails_",fr=({isMember:e=!1,slug:t,members:{number:n,data:r}={number:void 0,data:[]},className:a="",...l})=>{const u=C.useIntl(),o=n||(r==null?void 0:r.length)||0;return s.jsxs("div",{className:E("community-details",a),children:[s.jsx(we,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[u.formatMessage({id:`${ft}members`}),s.jsx("span",{className:"count",children:o})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${t}/members`,children:u.formatMessage({id:`${ft}viewAll`})})})]}),s.jsx(Mn,{contributors:{total:n,data:r!=null&&r.length?r:[{},{},{},{},{}]},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:5})]}),s.jsx(At,{isMember:e,...l}),e&&s.jsx(z,{variant:"primary",icon:{icon:"plus"},styling:{fullWidth:!0},children:u.formatMessage({id:`${ft}invite`})})]})};const hr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(te,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:E("breadcrumbs text-small",n),children:e.map(({text:a,href:l,current:u=!1},o)=>s.jsxs("li",{children:[u&&s.jsx(te,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Pe,{href:u?void 0:l,children:Ke(a,t)})]},`${window.btoa(a)}_${o}`))})]})};const pr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const l=C.useIntl(),u=t?[{id:"all",text:typeof t!="boolean"&&t.text||l.formatMessage({id:"filters_all"})},...e]:e,[o,i]=g.useState(t?["all"]:[]),c=(d,f)=>{let h=[];o.includes(d)?h=o.filter(p=>p!==d):d==="all"?h=["all"]:n?h=[...o.filter(p=>p!=="all"),d]:h=[d],i(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:E("filters",a),children:u.map(({id:d,text:f,disabled:h=!1,callback:p=()=>{}})=>{let x={};return h&&(x={disabled:!0,"aria-label":l.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:E(d,{selected:o.includes(d)}),onClick:y=>{y.preventDefault(),y.stopPropagation(),c(d,p)},...x,children:f})},d)})})},gr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:a,position:l})=>{l==="before-lang"?r+=`/${a}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${a}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const ht={en:"English",es:"Español",fr:"Français",pt:"Português"},Ue="languageSwitcher_",_r=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a=()=>{},urlParts:l,variant:u="default",label:o,className:i=""})=>{const c=C.useIntl(),[d,f]=g.useState(e);if(g.useEffect(()=>{e!==d&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const p=Object.keys(r),x=d!==e;return s.jsxs("div",{className:E("language-switcher text-small",u,i),children:[s.jsxs("nav",{children:[u!=="short"&&s.jsx("p",{children:o||c.formatMessage({id:`${Ue}label`})}),s.jsx("ul",{children:p.map(y=>{if(!ht[y])return null;let _={className:y};return d===y?_["aria-label"]=c.formatMessage({id:`${Ue}selected`},{language:ht[y]}):_={..._,href:gr(y,l),onClick:T=>{T.preventDefault(),T.stopPropagation(),f(y),a(y)}},s.jsx("li",{children:s.jsx(Pe,{..._,fallbackElement:"span",children:ht[y]})},y)})}),u!=="short"&&!x&&s.jsx("p",{children:c.formatMessage({id:`${Ue}translation_${t?"original":n?"human":"machine"}`})})]}),u!=="short"&&!x&&!t&&!n&&s.jsx("small",{children:c.formatMessage({id:`${Ue}disclaimer`},{email:Se.support,link:y=>{const _=`mailto:${y}`;return s.jsx("a",{href:_,children:y})}})})]})};const pt=C.createIntl({locale:"en",messages:$t}),Fn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:a=!1,messages:l={button:pt.formatMessage({id:"loadMore_button"}),endOfFeed:pt.formatMessage({id:"loadMore_endOfFeed"}),error:pt.formatMessage({id:"loadMore_error"})},className:u="",gtmContext:o="LoadMore"})=>{const[i,c]=g.useState(!1),[d,f]=g.useState(!1);if(t<=0||t<n*e)return null;const h=async p=>{try{await r(p)}catch(x){x instanceof Error&&x.message&&x.message.includes("Cannot read items")?f(!0):c(!0)}};return s.jsxs("footer",{className:E("load-more",u),children:[i&&s.jsx("p",{className:"error",children:l.error}),d?s.jsx("p",{children:l.endOfFeed}):s.jsx(z,{variant:"secondary",icon:a,onClick:h,"data-gtm-event-context":o,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:l.button})]})};let We=!1;const Pn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=C.useIntl(),l=g.useRef(null),[u,o]=g.useState(!1),i=c=>{l.current&&c.target instanceof HTMLElement&&!l.current.contains(c.target)&&o(!1)};return g.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)})),g.createElement(e,{ref:l,className:E("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!u),"aria-haspopup":"true","aria-expanded":u,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!u,children:n.map(({href:c,onClick:d,text:f,icon:h,...p},x)=>{const y={...p,onClick:_=>{o(!1),typeof d=="function"&&d(_)},onFocus:()=>{We&&(clearTimeout(We),We=!1)},onBlur:()=>{We=setTimeout(()=>{o(!1)},100)}};return c&&(y.href=c),s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...y,children:f})},`${window.btoa(f)}_${x}`)})})]})})};const Dt=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:E("logo",e,t,n),...r,children:s.jsx(te,{children:s.jsx(C.FormattedMessage,{id:"apolitical"})})})});const xr={"2-1":901},br=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const a=De(!0);let l=r;return g.Children.count(r)===1&&(l=g.Children.toArray(r)[0],l.props&&(l=l.props.children)),s.jsx("section",{className:E("columns",`layout-${e}`,n),children:g.Children.map(l,(u,o)=>t!==!1&&o===t&&a&&a<xr[e]?null:u)})};const gt="cookieBanner_",_t=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],xt=new Date(Date.now()+12*30*24*60*60*1e3),Nn=()=>{const e=C.useIntl(),[t,n,r]=un.useCookies(_t),[a,l]=g.useState(!t["apol-cookie-banner"]),u=()=>{_t.forEach(d=>{n(d,!0,{path:"/",expires:xt,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),l(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:xt}),_t.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:xt});return}r(d)}),l(!1)};if(!a)return null;const i=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:u,gtmType:"accepted-all"}],c=[];return i.forEach(d=>{c.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${gt}buttons_${d.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${gt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${gt}text`})}),s.jsx(Fe,{buttons:c})]})},ge={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Se["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Se["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:Se.support,gtmType:"concierge-email-click"},business:{email:Se.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 Ee="footer_",Ze="SiteFooter",on=({group:e})=>{const t=ge[e].order||[];let n=!1;return"text"in ge[e]&&(n=ge[e].text),s.jsxs(g.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(C.FormattedMessage,{id:`${Ee}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:l}=ge[e][r],u={};return["legal"].includes(e)&&(u.target="_blank",u.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ze,"data-gtm-event-type":l,...u,children:s.jsx(C.FormattedMessage,{id:`${Ee}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(g.Fragment,{children:[s.jsx("dt",{children:s.jsx(C.FormattedMessage,{id:`${Ee}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(C.FormattedMessage,{id:`${Ee}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ze,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Ft=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(Tt,{element:"hr"}),s.jsx(Dt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ze,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(on,{group:e}),Object.keys(ge[e]).includes("child")&&s.jsx(on,{group:ge[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(ge.social.order)&&ge.social.order.map(e=>{const t=ge.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ze,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(C.FormattedMessage,{id:`${Ee}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(C.FormattedMessage,{id:`${Ee}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ze="emailHelperTextBox_",vr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=C.useIntl(),[l,u]=g.useState({path:`${ze}default`,type:"default",link:{},mail:{},error:""}),[o,i]=g.useState(!1),c=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const x=y=>{u({path:`${ze}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>c(_),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:y})};if(typeof r!="function"){x(a.formatMessage({id:`${ze}error_noFunction`}));return}i(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(y=>{x(y.message)}).finally(()=>{i(!1)})},[t,n,r]);g.useEffect(()=>{let p=ze,x="default",y={},_={};switch(e){case"gov":p+="autoApproved",x="success";break;case"nonGov":p+="unrecognisedEmail",x="error",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",x="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",x="error",y={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:T=>c(T),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",x="error",y={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}u({...l,path:p,type:x,link:y,mail:_})},[e]);const d={};return["link","mail"].forEach(p=>{d[p]=Object.keys(l[p]).length?x=>s.jsx("a",{...l[p],children:x}):x=>x}),s.jsx(kn,{type:l.type,heading:o?!1:a.formatMessage({id:`${l.path}_title`}),children:o?s.jsxs(s.Fragment,{children:[s.jsx(fe,{element:"span"}),s.jsx(fe,{element:"span"})]}):a.formatMessage({id:`${l.path}_text`},{...d,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:l.error})})};const Ve="passwordRules_",In="isMoreThanEightCharacters",Ln="includesNumberAndSymbol",Bn="includesLowerAndUppercase",wr={[In]:"8Characters",[Ln]:"numberSymbol",[Bn]:"lowercaseUppercase"},kr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=C.useIntl();return s.jsxs("aside",{className:E("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${Ve}intro`})}),s.jsx("ul",{children:[In,Ln,Bn].map(r=>s.jsxs("li",{className:E({matches:e[r]}),children:[s.jsxs(te,{children:[n.formatMessage({id:`${Ve}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${Ve}rule_${wr[r]}`})}),!e[r]&&s.jsxs(te,{element:"strong",children:[" "," ",n.formatMessage({id:`${Ve}notMet`})]})]},`rule-${r}`))})]})},jr=g.memo(kr);const yr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:l="",hasLoaded:u=!1})=>{const o=C.useIntl(),[i,c]=g.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const T=await n();c(j=>({...j,setUp:!0,id:T&&T.id,disabled:!1}))}catch(T){c(j=>({...j,setUp:!0,disabled:!0})),a(T)}};if(g.useEffect(()=>{u&&!i.setUp&&d()},[u]),!u)return s.jsx(fe,{className:"rating-placeholder"});const{id:f,rating:h,disabled:p}=i,x="ratings_",y={text:o.formatMessage({id:`${x}text`}),low:o.formatMessage({id:`${x}low`}),high:o.formatMessage({id:`${x}high`}),success:o.formatMessage({id:`${x}success`}),...e},_=async T=>{if(!(!f||p))try{c(j=>({...j,rating:T,disabled:!0})),await r({id:f,value:T})}catch(j){c($=>({...$,rating:null})),a(j)}finally{c(j=>({...j,disabled:!1}))}};return s.jsxs("div",{className:E("rating",l),children:[s.jsx("span",{className:"label",children:y[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(T=>{const j=T+1;return s.jsx("li",{className:E({selected:h&&j<=h}),children:s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:`star${!h||j>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${x}stars`},{number:j,total:t})}${j===1||j===t?` - ${y[j===1?"low":"high"]}`:""}`,onClick:$=>{$.preventDefault(),$.stopPropagation(),_(j)},disabled:p})},`rating-${j}`)})})]})};const On=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:l="form-submission"})=>{const{searchIsOpen:u=!0,isDesktopVersion:o=!1}=n||{},i=C.useIntl(),c=g.useRef(null);ve(()=>{!n||o||!u||c.current&&c.current.focus()},[u]);const d=f=>{f.preventDefault(),f.stopPropagation(),!(!c.current||!c.current.value||c.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(c.current.value)}`)};return s.jsx("form",{onSubmit:d,className:E("search-form gtm-trackable",t),"data-gtm-event-context":a,"data-gtm-event-type":l,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!u:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(te,{element:"label",htmlFor:e,children:i.formatMessage({id:"search_label"})}),s.jsx("input",{ref:c,type:"search",id:e,name:e,defaultValue:r,placeholder:i.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&d(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),c.current&&c.current.value&&(c.current.value="")},children:s.jsx(te,{children:i.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:d,children:s.jsx(te,{children:i.formatMessage({id:"search_cta"})})})]})})})};const Hn=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:l,onClose:u,reportError:o,sendInvites:i,initialFormStatus:c="NOT_SUBMITTED"})=>{const[d,f]=g.useState([]),[h,p]=g.useState(!0),[x,y]=g.useState(c),{formatMessage:_}=C.useIntl(),T=async R=>{R.preventDefault();try{await i(d),f([]),y("SUCCESS")}catch(A){y("ERROR"),o(A)}},j=R=>{R.preventDefault(),y("NOT_SUBMITTED"),p(!0),f([])},$=R=>{R.preventDefault(),u(),y("CLOSED")};return x==="CLOSED"?null:x==="ERROR"||x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"content centred",children:x==="SUCCESS"?s.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),s.jsx(we,{}),s.jsx("div",{className:"footer",children:x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"secondary",onClick:j,children:_({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(z,{onClick:$,children:_({id:"inviteForm_ctaDone"})})]}):s.jsx(z,{onClick:j,children:_({id:"inviteForm_ctaTryAgain"})})})]}):s.jsxs("form",{style:{backgroundColor:l},onSubmit:T,className:E("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),s.jsx(vs.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:d,onChange:R=>{f(R),p(!R.length)},autoFocus:!1,getLabel:(R,A,B)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:R}),s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(A),p(!d.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},A)})]}),s.jsx(we,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(z,{className:"sendEmailsButton",disabled:h,children:n})})]})},O={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=l=>{const u=`logged${e?"In":"Out"}`;return t>=n[l][u]};let a={};return["navigation","search"].forEach(l=>{a[l]=r(l)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const a=Date.now();if(!t&&O.handlerCalled[e]&&a-O.handlerCalled[e]<500)return;O.handlerCalled[e]=a;let l=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(u=>{u===e||n[u]===!1||l.push({type:`menus.${u}`,value:!1})}),r(l)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=dn(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?O.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{if(!t.current||!t.current.children)return;const l=n?"desktop":"default";if(r[e][l]){r[e][l].focus();return}let u,o;switch(e){case"navigation":if(n){const i=O.findFirstChild(t.current.children,"attributes.aria-controls","navigation");u=O.findFirstChild(i.children,"href")}else u=O.findFirstChild(t.current.children,"href");u||(u=t.current);break;case"account":if(o=O.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;u=O.findFirstChild(o.children,"href");break;default:return}u&&(a([{type:`focusElements.${e}.${l}`,value:u}]),u.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(O.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(O.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(O.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{O.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ae={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},qe=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:l=null})=>{const u=C.useIntl(),o=dn(Ae,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const i="doTrack"in o,c=l===null?i?o.doTrack:!0:l,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let j=o.gtmType||`${e}-click`;if(j.includes(".")){const $=j.split("."),R=$[$.length-2];j=`${R==="topics"?`${R}-`:""}${$[$.length-1]}`}h={href:o.href,role:"menuitem"},c&&(h={...h,className:"gtm-trackable","data-gtm-event-type":j,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],x=p&&o[o.order[0]].order,y=h&&window.location.pathname===o.href;let _={},T={};if(p){const j=o.menuId||e,$={onClick:R=>O.events.onClick(R,{id:j,callback:a,isOpen:r[j]}),onFocus:()=>O.events.onFocus({id:j}),onBlur:()=>O.events.onBlur({id:j,callback:a}),onMouseLeave:()=>O.events.onBlur({id:j,callback:a}),onMouseEnter:()=>O.events.onMouseEnter({id:j,callback:a})};n&&(x&&(_={...$,onKeyPress:R=>{R.key==="Enter"&&O.events.onClick(R,{id:j,callback:a,isOpen:r[j]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[j],"aria-controls":j}),T={hidden:j in r?!r[j]:!0}),x||(T={...T,...$})}return s.jsxs("li",{className:E({[o.className]:o.className,"has-submenu":p,parent:x,active:y}),role:"none",..._,children:[h?g.createElement(d?z:"a",h,u.formatMessage({id:f})):u.formatMessage({id:f}),o.order&&s.jsx("ul",{...T,children:o.order.map(j=>{if(!o[j])return null;const $={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:i?c:null};return o[j].order?s.jsxs("li",{className:E({[o[j].className]:o[j].className}),children:[u.formatMessage({id:`${f}_${j}`}),s.jsx("ul",{children:o[j].order.map(R=>s.jsx(qe,{id:`${e}.${j}.${R}`,...$},R))})]},j):s.jsx(qe,{id:`${e}.${j}`,...$},j)})})]},e)};const Sr={height:67,height_desktop:83},Pt=()=>{const e=C.useIntl(),t=g.useContext(xe),n=De(!0,!0),r=t&&typeof t.id=="string",a=g.useMemo(()=>O.getIsDesktopVersion(r,n),[r,n]),[l,u]=g.useReducer(As,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:o,menus:i,focusElements:c}=l;pn({scrollPosition:Sr[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!a&&i.navigation||O.shouldChangeHeaderIsVisible(!0,i,u)},scrollDown:()=>{!a&&i.navigation||O.shouldChangeHeaderIsVisible(!1,i,u)}}});const d=(h,p)=>{O.handleMenus({id:h,value:p,menus:i,dispatch:u})},f=g.useRef(null);return ve(()=>{i.navigation&&O.autoFocus({menu:"navigation",navigationRef:f,isDesktopVersion:a.navigation,focusElements:c,dispatch:u})},[i.navigation]),ve(()=>{i.account&&O.autoFocus({menu:"account",navigationRef:f,isDesktopVersion:a.navigation,focusElements:c,dispatch:u})},[i.account]),t&&t.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:E({"logged-in":r,"logged-out":!r,visible:o}),children:[s.jsx(te,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),s.jsx(Dt,{}),!a.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),d("navigation",!i.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":i.navigation,"aria-controls":"navigation",children:s.jsx(te,{children:e.formatMessage({id:`header_menu_${i.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:f,id:"navigation",hidden:a.navigation||i.account?!1:!i.navigation,role:"menu","data-showing":!a.navigation&&i.account?"account":"default",children:Ae.order.map(h=>s.jsx(qe,{id:h,isLoggedIn:r,isDesktopVersion:a.navigation,menus:{navigation:i.navigation,account:i.account},callback:d},h))}),!a.search&&s.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),d("search",!i.search)},"aria-haspopup":"true","aria-expanded":i.search,"aria-controls":"search-form",children:s.jsx(te,{children:e.formatMessage({id:`header_search_${i.search?"hide":"show"}`})})}),s.jsx(On,{id:"global-search",handleToggle:{searchIsOpen:i.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?s.jsxs("button",{className:"account-button",onClick:h=>O.events.onClick(h,{id:"account",callback:d,isOpen:i.account}),onMouseEnter:()=>O.events.onMouseEnter({id:"account",callback:d}),onMouseLeave:()=>O.events.onBlur({id:"account",callback:d}),"aria-haspopup":"true","aria-expanded":i.account,"aria-controls":"navigation",children:[s.jsx(te,{children:e.formatMessage({id:`header_account_${i.account?"hide":"show"}`})}),s.jsx(tt,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Ae.buttons.order.map(h=>s.jsx(qe,{id:`buttons.${h}`},h))})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:E("overlay",{open:i.navigation||i.account||!a.search&&i.search})})]})};const Er=()=>{const e=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(Pt,{}),s.jsx("div",{className:"content",children:s.jsx(Ne,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Ft,{})]})},Tr=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:a="",locale:l="en"})=>{const u=fn();g.useEffect(()=>{window.scrollTo(0,0)},[u]);const o=xn(e,{locale:l});return s.jsx(ws.ErrorBoundary,{onError:t,fallback:s.jsx(Er,{}),children:s.jsx(g.Suspense,{fallback:s.jsx(Tn,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:E(a,{[r]:r!=="default"}),children:s.jsxs(un.CookiesProvider,{children:[s.jsx(Pt,{}),s.jsx("div",{className:"content",children:o}),n&&s.jsx(Ft,{}),s.jsx(Nn,{})]})})})})},an={default:"tags_",headerTopics:"header_topics_topics_"},bt={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},$r={getTagDetails:e=>{if(e.includes("topic_")){if(e=bt.topic[e.replace("topic_","")],e){const t=Ae.topics.topics[e].href;return t?{id:e,href:t,text:`${an.headerTopics}${e}`}:null}return null}return bt[e]?(e=bt[e],{id:e,text:`${an.default}${e}`}):null}};const Mr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:l="tag-click",gtmContext:u="tags"})=>{const o=C.useIntl();if(!e||e.length<1)return null;const i=[];return e.forEach(c=>{if(!c)return;const d=$r.getTagDetails(c);d&&i.push(d)}),i.length<1?null:s.jsx("ul",{className:E("tags text-small",t,a,{"one-line":n}),children:i.map(c=>{const d=o.formatMessage({id:c.text});return s.jsx("li",{children:c.href&&r?s.jsx("a",{href:c.href,className:"gtm-trackable","data-gtm-event-type":l,"data-gtm-event-context":u,children:d}):d},c.id)})})};const Cr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:a="member-click",className:l=""})=>{const u=C.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:E("members-list",l),children:[s.jsxs("h1",{children:[u.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((o,i)=>s.jsxs("li",{children:[s.jsx(nt,{member:o,gtmContext:r,gtmType:a}),o.isAdmin&&s.jsx(yn,{children:u.formatMessage({id:"membersList_admin"})})]},i))}),n&&s.jsx(Fn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let Ye=null;const le="discussion_form_",Nt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:a=5e4,minRows:l=4,forceShow:u={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:i="DiscussionForm"})=>{var w,H;const c=C.useIntl(),d=g.useContext(xe),[f,h]=g.useState(n.isEditing&&n.isEditing.text||""),[p,x]=g.useState(u.error||!1),[y,_]=g.useState(!1),T=g.useRef(null);if(r||(r=T),n.isLoading)return s.jsx(fe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const j=k=>{const Y=k.target.value;h(Y);let N;!d||!d.id?N=me(c.formatMessage,`${le}error_loggedOut`,e.type,"action"):t?Y.length>=a&&(N=`${le}error_tooLong`):N=me(c.formatMessage,`${le}error_noPermission`,e.type,"action"),N?x(N):p&&x(!1)};let $=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const k=e.type==="response"?((w=e.slugs)==null?void 0:w.question)||"":((H=e.slugs)==null?void 0:H.answer)||"";k&&($=`${$}-${k.slice(-15)}`)}const R=async k=>{var N;if(k.preventDefault(),k.stopPropagation(),!d||!d.id||!t||B)return;Ye&&clearTimeout(Ye),_("submitting");const Y=window.location.pathname;try{let I;switch(e.type){case"post":I=await o.create({content:f});break;case"question":I=await o.create({title:f,authorId:d&&d.id,...(N=o.props)==null?void 0:N.create});break;case"response":I=await o.create({question:e.slugs.question},{body:f,authorId:d&&d.id,contentPath:Y});break;case"reply":I=await o.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:d&&d.id,contentPath:Y});break;default:break}await Ps(1e3),o.callback&&await o.callback(I),Ye=setTimeout(()=>{h(""),_("submitted"),A()},500)}catch(I){const Q=I;let W=`${le}error`;Q.message.includes("entry already exists")&&(W=me(c.formatMessage,`${le}error_alreadyExists`,e.type,"action")),Q.message.includes("429")?W=me(c.formatMessage,`${le}error_tooMany`,e.type,"action"):Q.message.includes("400")&&(W=`${le}error`),x(W),A()}},A=()=>{Ye=setTimeout(()=>{x(!1),_(!1)},5e3)},B=!f||!Hs(f),V=y==="submitting",b=[];return(n.isEditing&&!V||u.cancel)&&b.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!u.cancel&&(!d||!d.id||!f),children:c.formatMessage({id:`${le}cancel`})}),b.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:k=>{if(n.isEditing){_("submitting"),o.handleSaveEdit&&o.handleSaveEdit(T.current&&"value"in T.current?T.current.value:"");return}R(k)},className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!d||!d.id||!t||B||V||n.isEditing&&f===n.isEditing.text,children:c.formatMessage({id:`${le}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:$,className:E("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:me(c.formatMessage,`${le}title`,e.type,"action")}),s.jsx(nt,{member:d||"community",gtmContext:i,gtmType:"profile-click"}),s.jsx(te,{element:"label",showOnFocus:!1,htmlFor:`${$}-input`,children:me(c.formatMessage,`${le}label`,e.type,"action")}),s.jsx(ks,{ref:r,id:`${$}-input`,name:e.type,placeholder:me(c.formatMessage,`${le}placeholder`,e.type,"action"),onChange:j,value:f,maxLength:a,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:l,autoFocus:!!n.isEditing}),s.jsx("small",{children:me(c.formatMessage,`${le}explainer`,e.type,"action",{a:k=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:k})})}),s.jsx(Fe,{buttons:b}),y==="submitted"&&s.jsx(Xe,{className:"success","data-testid":"success",children:me(c.formatMessage,`${le}success`,e.type,"action")}),p&&s.jsx(Xe,{id:"error-message",className:"error","data-testid":"error",children:u.error?u.error:typeof p=="string"?p.includes(" ")?p:c.formatMessage({id:p},{action:c.formatMessage({id:`discussion_action_${e.type}`}),maxLength:a}):p})]})},st=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:l,notMemberStateText:u}})=>r&&!n?s.jsx(Ne,{text:u,button:{component:s.jsx(At,{functions:{join:a,leave:l}})}}):s.jsx(Nt,{content:{type:e,slugs:{}},functions:{create:t}}),Rr={showThread:!1,showForm:!1},Ie=g.createContext(Rr),Qn=({children:e})=>{const[t,n]=g.useState({showThread:!1,showForm:!1});return s.jsx(Ie.Provider,{value:{...t,updateConversation:n},children:e})},Ar=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Dr=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Re=!1;const vt=()=>{Re!==!1&&(clearTimeout(Re),Re=!1)},wt=10,Un=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:l={type:"reply",slugs:{}},canLike:u=!0,functions:{createLike:o=()=>{},deleteLike:i=()=>{}}={}})=>{const c=C.useIntl();g.useEffect(()=>{p(a)},[a]);const[d,f]=g.useState(t),[h,p]=g.useState(a),[x,y]=g.useState(!1),[_,T]=g.useState(!1),j=g.useMemo(()=>Dr(n,wt),[n]),$=A=>{if(A.preventDefault(),A.stopPropagation(),T(!1),Re)return vt(),!1;if(vt(),x||!u)return!1;Re=setTimeout(R,350)},R=async()=>{if(vt(),x||!u)return!1;let A=h?d-1:d+1;A<0&&(A=0),y(!0),f(A),p(!h);try{if(l&&l.slugs){const B=Ar(l.slugs);h?await i(B):await o(B,{contentPath:window.location.pathname})}}catch{f(t),p(a)}finally{y(!1)}};return g.createElement(e,{className:E("likes-wrapper text-medium action-button",{"show-spinner":x,"is-liked":h,disabled:!u}),onClick:$,onMouseEnter:()=>{T(!0)},onMouseLeave:()=>{T(!1)},onFocus:()=>{T(!0)},onBlur:()=>{T(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:E({"do-animation":h&&!a}),screenreaderText:u?c.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:c.formatMessage({id:`discussion_action_${l.type}`})}):!1,onClick:$,disabled:!u,"aria-hidden":!u,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${l.type}-click`}),s.jsx("span",{className:E("number-of-likes",{"no-likes":d===0}),"data-testid":"number-of-likes",children:c.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:d})}),n&&s.jsx(vn,{isOpen:_,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[j.map(A=>typeof A=="string"||!A.name?null:s.jsx("li",{children:s.jsx(Pe,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",children:A.name})},A.id||window.btoa(A.name))),n.length>wt&&s.jsx("li",{children:c.formatMessage({id:"discussion_likes_more"},{number:n.length-wt})})]})})]})})};const Wn=({element:e="section",children:t,className:n,...r})=>g.createElement(e,{className:E("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const It=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:l=()=>{}}={},forceShow:{error:u=!1}={},title:o,children:i,buttons:c,className:d="",gtmContext:f="Modal"})=>{const h=C.useIntl(),[p,x]=g.useState(t),y=T=>{x(T),T?(a(),document.body.classList.add("has-overlay")):(l(),document.body.classList.remove("has-overlay"))};g.useEffect(()=>{y(t)},[t]);const _=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:E("overlay",{open:p}),children:s.jsx(Wn,{id:e,className:E("overlay-modal",d,{"has-max-width":r}),hidden:!p,style:_,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[o&&s.jsx("h2",{className:"modal-title",children:o}),s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>y(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(we,{}),i,c&&s.jsxs("div",{className:"bottom",children:[s.jsx(we,{}),s.jsx(Fe,{buttons:c})]}),u&&s.jsx(Xe,{className:"error",children:u})]})})})},zn=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Fr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:a="Send an invitation to your colleagues below",ctaMessage:l="Send invites",showIcon:u,onClose:o,reportError:i=()=>{},sendInvites:c})=>s.jsx(It,{title:n,isOpen:t,showDivider:!1,showIcon:u,className:E("invite-modal",e,{success:!!n}),children:s.jsx(Hn,{title:r,label:a,ctaMessage:l,onClose:o,sendInvites:c,reportError:i})}),ln=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Lt=(e,t)=>e&&!t;const pe="discussion_",Pr=280,Le=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,functions:{content:{createContent:l,deleteContent:u,updateContent:o}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:i,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:d}={openComments:()=>{}}},links:f={},className:h,gtmContext:p="DiscussionAnswer",children:x,isTruncated:y=!1})=>{const _=C.useIntl(),T=g.useContext(xe),j=g.useContext(Ie),[$,R]=g.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[A,B]=g.useState(!1),[V,b]=g.useState("");if(g.useEffect(()=>{R({...$,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(fe,{className:"discussion-card discussion-post"});const{author:w,canLike:H,createdAt:k,id:Y,likes:N=0,userLiked:I,comments:Q=0}=t,W=y?Ke($.body,Pr):$.body,X=T&&T.id&&typeof w!="string"&&w.id&&w.id===T.id||!1,ne=typeof H=="boolean"?H:n?!X:!1,se=async F=>{F||(F=""),b("");try{if(!js(F,$.body)){const K=t.type==="question"?{title:F}:{body:F};await o(ln(t.slugs),K)}R({body:F,isEditing:!1,didEdit:!0})}catch{b(`${pe}form_error`)}},re=()=>{j&&j.updateConversation&&j.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const K=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,J=document.getElementById(K),ae=document.getElementById(`${K}-input`);ae&&ae.focus(),J&&J.scrollIntoView({behavior:"smooth"})},0)},oe=()=>{try{u(ln(t.slugs))}catch{b("delete-error")}},ee=[{text:_.formatMessage({id:`${pe}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(_.formatMessage({id:`${pe}report_subject`}))}&body=${encodeURI(_.formatMessage({id:`${pe}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&&X&&ee.push({text:_.formatMessage({id:`${pe}moreMenu_edit`}),onClick:()=>R({...$,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:_.formatMessage({id:`${pe}moreMenu_delete`}),onClick:F=>{F.preventDefault(),F.stopPropagation(),B(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...zn(`delete-${t.slug}-modal`,A)}),g.createElement(e,{className:E("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:Y||t.slug,className:E("discussion-card",t.type,{editing:$.isEditing,"has-link":f.post&&!$.isEditing}),onClick:F=>{!f.post||$.isEditing||(F.preventDefault(),F.stopPropagation(),window.location.href=f.post)},children:[!$.isEditing&&s.jsx(nt,{member:w,additionalContent:{createdAt:k,didEdit:$.didEdit},className:typeof w!="string"&&w.id===a?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),$.isEditing?s.jsx(Nt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:$.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?_.formatMessage({id:V},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:l,handleSaveEdit:se,handleCancel:()=>{b(""),R({...$,isEditing:!1})}},gtmContext:`${p}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(St,{options:{overrides:{a:jn}},children:W})}):s.jsx(St,{options:{wrapper:t.type==="question"?"h1":g.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:W}),!$.isEditing&&s.jsxs("ul",{className:E("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(Un,{element:"li",likes:N,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:ne,functions:{createLike:i,deleteLike:c}}),(["question","post"].includes(t.type)||f.comments||typeof d=="function")&&s.jsxs("li",{className:"action-button",onClick:F=>{F.preventDefault(),F.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof d=="function"&&d()},children:[s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:f.comments?f.comments:!1,onClick:f.comments||typeof d!="function"?!1:d,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:_.formatMessage({id:`${pe}comments_screenReader`},{count:Q})}),s.jsx("span",{children:_.formatMessage({id:`${pe}comments`},{count:Q})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:re,children:_.formatMessage({id:`${pe}reply`})})}),s.jsx(Pn,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),x,s.jsx(It,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>B(!1)},forceShow:{error:V==="delete-error"?_.formatMessage({id:"discussion_delete_error"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:_.formatMessage({id:"discussion_delete_title"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>B(!1),children:_.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:oe,children:_.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(C.FormattedMessage,{id:"discussion_delete_text",values:{p:F=>s.jsx("p",{children:F}),action:_.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const kt="discussion_responses_",Nr=({type:e="answer",responses:t=0})=>{const n=C.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${kt}title`},{action:n.formatMessage({id:`${kt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:me(n.formatMessage,`${kt}empty`,e,e)})]})};const Vn=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=C.useIntl(),a=g.useRef(null),l=g.useContext(Ie),[u,o]=g.useState("closed");g.useEffect(()=>{const f=a.current;if(f)return f.addEventListener("transitionend",i),()=>{f.removeEventListener("transitionend",i)}},[]),ve(()=>{u==="closed"&&!l.showThread||o(["opening","open"].includes(u)?"ready-to-close":"opening")},[l.showThread]),g.useEffect(()=>{u==="ready-to-close"&&o("closing")},[u]);const i=({propertyName:f})=>{f==="max-height"&&o(h=>h==="opening"?"open":h==="closing"?"closed":h)},c=["opening","open"].includes(u),d=xn(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(z,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${c?"left":"right"}`},onClick:()=>{var f;(f=l.updateConversation)==null||f.call(l,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${c?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:a,className:E("thread",u),hidden:!l.showThread,children:d})]})},Ir=({user:e,content:t,verb:n="post"})=>({actor:{id:e.id,data:{name:e.name,organization:e==null?void 0:e.organization,jobTitle:e==null?void 0:e.jobTitle}},content:t,latest_reactions:{like:[]},reaction_counts:{like:0},verb:n}),Lr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:o})=>{if(!n)return;const i=Ir({user:n,content:o,verb:"post"});await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return e.setQueryData(t,d=>[...d,i]),{previousActivities:c}},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Br=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:u,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(d=>((d==null?void 0:d.id)===(u==null?void 0:u.activityId)&&(d.content=o),d));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(u,o,i)=>{e.setQueryData(t,i.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Or=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:o})=>{await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(d=>{var f;return(d==null?void 0:d.id)===o&&((f=d.reaction_counts)!=null&&f.like?d.reaction_counts.like+=1:d.reaction_counts.like=1),d});return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivities)},onSuccess:o=>{const i=e.getQueryData(t),c=i==null?void 0:i.map(d=>((d==null?void 0:d.id)===(o==null?void 0:o.activity_id)&&(d.latest_reactions.like?d.latest_reactions.like.push(o):d.latest_reactions.like=[o]),d));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:i}},onSettled:(o,i,c)=>{e.invalidateQueries({queryKey:[...t,c.activityId]})}}),Hr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:i})=>{await e.cancelQueries({queryKey:t});const c=e.getQueryData(t),d=c==null?void 0:c.map(f=>{var h;return(f==null?void 0:f.id)===i&&(h=f.reaction_counts)!=null&&h.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>d&&[...d]),{previousActivities:d}},onError:(i,c,d)=>{e.setQueryData(t,d.previousActivities)},onSuccess:(i,{activityId:c})=>{const d=e.getQueryData(t),f=d==null?void 0:d.map(h=>{var p,x,y,_;if(h.id===c){const T=(y=(x=(p=h.latest_reactions)==null?void 0:p.like)==null?void 0:x.find(j=>j.user_id===(n==null?void 0:n.id)))==null?void 0:y.id;return h.latest_reactions.like=(_=h.latest_reactions.like)==null?void 0:_.filter(j=>j.id!==T),h}else return h});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:d}},onSettled:(i,c,d)=>{e.invalidateQueries({queryKey:[...t,d.activityId]})}}),Qr=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:a,edit:l,like:u,unlike:o,join:i,leave:c}})=>{const d=C.useIntl(),f=G.useQueryClient(),h=g.useContext(xe),{data:p,error:x,isLoading:y,isFetching:_}=G.useQuery({queryKey:[e,t],queryFn:r}),T=Lr({queryClient:f,queryKey:[e,t],user:h,mutationFn:a}),{mutate:j}=G.useMutation(T),$=Br({queryClient:f,queryKey:[e,t],mutationFn:async k=>await l(k)}),{mutate:R}=G.useMutation($),A=Or({queryClient:f,queryKey:[e,t],mutationFn:u}),{mutate:B}=G.useMutation(A),V=Hr({queryClient:f,queryKey:[e,t],user:h,mutationFn:async({activityId:k})=>{var I,Q,W;const Y=p&&(p==null?void 0:p.find(X=>X.id===k)),N=(W=(Q=(I=Y==null?void 0:Y.latest_reactions)==null?void 0:I.like)==null?void 0:Q.find(X=>X.user_id===(h==null?void 0:h.id)))==null?void 0:W.id;await o({reactionId:N||"",activityId:k})}}),{mutate:b}=G.useMutation(V),w=g.useCallback(({activityId:k})=>B({activityId:k}),[B]),H=g.useCallback(({activityId:k})=>b({activityId:k}),[b]);return x?s.jsx(Ne,{variant:"error",text:x.message}):y?s.jsx(fe,{style:{height:"400px"}}):s.jsxs(s.Fragment,{children:[s.jsx(st,{contentType:"post",createPost:j,membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:c,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),!_&&Array.isArray(p)&&(p==null?void 0:p.map(k=>{var I,Q,W,X,ne,se,re,oe,ee,F,K,J;const Y=((I=k==null?void 0:k.actor)==null?void 0:I.id)===(h==null?void 0:h.id),N=Lt(n,Y);return s.jsxs(g.Fragment,{children:[s.jsx(Le,{content:{type:"post",body:k==null?void 0:k.content,canLike:N,createdAt:(k==null?void 0:k.time)||"",slugs:{parentId:t,activityId:k==null?void 0:k.id},slug:k==null?void 0:k.id,author:{id:(Q=k==null?void 0:k.actor)==null?void 0:Q.id,name:`${(X=(W=k==null?void 0:k.actor)==null?void 0:W.data)==null?void 0:X.name}`,organization:(se=(ne=k==null?void 0:k.actor)==null?void 0:ne.data)==null?void 0:se.organization,jobTitle:(oe=(re=k==null?void 0:k.actor)==null?void 0:re.data)==null?void 0:oe.jobTitle,image:{thumbnail:((F=(ee=k==null?void 0:k.actor)==null?void 0:ee.data)==null?void 0:F.thumbnail)||void 0}},userLiked:((K=k==null?void 0:k.own_reactions)==null?void 0:K.like)&&((J=k==null?void 0:k.own_reactions)==null?void 0:J.like.length)>0,likes:(k==null?void 0:k.reaction_counts.like)||0,comments:(k==null?void 0:k.reaction_counts.reply)||0},links:{post:`${e}/${t}/${k==null?void 0:k.id}`,comments:`${e}/${t}/${k==null?void 0:k.id}`},functions:{content:{createContent:()=>null,deleteContent:()=>null,updateContent:(ae,ue)=>R({activityInfo:ae,content:ue})},likes:{createLike:()=>{w({activityId:k==null?void 0:k.id})},deleteLike:()=>{H({activityId:k==null?void 0:k.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(we,{})]},k==null?void 0:k.id)}))]})},Ur=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:o=>{var c;const i=e.getQueryData(t);if(i)return(c=i==null?void 0:i.latest_reactions)!=null&&c.reply?(i.latest_reactions.reply.unshift(o),i&&(i.reaction_counts={reply:i.latest_reactions.reply.length})):(i.latest_reactions={reply:[o]},i.reaction_counts={reply:1}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Wr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:l,content:{body:u}})=>{var c,d,f;if(u.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((c=o==null?void 0:o.latest_reactions)!=null&&c.reply))return;const i=(f=(d=o==null?void 0:o.latest_reactions)==null?void 0:d.reply)==null?void 0:f.map(h=>(h.id===l.replySlug&&(h.data.content=u),h));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:i}})),{previousActivity:o}},onError:(l,u,o)=>{e.setQueryData(t,o.previousActivity)}}),zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:u})=>{var c,d;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),i=(d=(c=o==null?void 0:o.latest_reactions)==null?void 0:c.reply)==null?void 0:d.map(f=>{var h;return f.id===u&&((h=f.children_counts)!=null&&h.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:i}})),{previousActivity:o}},onError:(u,o,i)=>{e.setQueryData(t,i.previousActivity)},onSuccess:u=>{var c;const o=e.getQueryData(t),i=(c=o==null?void 0:o.latest_reactions.reply)==null?void 0:c.map(d=>(d.id===u.id&&(d.latest_children.like?d.latest_children.like.push(u):d.latest_children.like=[u]),d));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:i}})),{previousActivity:o}}}),Vr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:o})=>{var d;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);if(!i)return;const c=(d=i.latest_reactions.reply)==null?void 0:d.map(f=>(f.id===o&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:(o,{replyId:i})=>{var f;const c=e.getQueryData(t);if(!c)return;const d=(f=c.latest_reactions.reply)==null?void 0:f.map(h=>{var p;return h.id===i?(p=h.latest_children.reply)==null?void 0:p.filter(y=>y.user_id!==(n==null?void 0:n.id)):h});return e.setQueryData(t,()=>({...c,latest_reactions:{reply:d}})),{previousActivity:c}}}),Yr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:o=>{var d;const i=e.getQueryData(t),c=(d=i==null?void 0:i.latest_reactions.reply)==null?void 0:d.map(f=>(f.id===o.parent&&(f.latest_children.reply&&f.children_counts.reply?(f.latest_children.reply.push(o),f.children_counts.reply+=1):(f.latest_children.reply=[o],f.children_counts.reply=1)),f));return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Gr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(l,u,o)=>{e.setQueryData(t,o.previousActivity)},onMutate:async({replyInfo:l,content:{body:u}})=>{var c,d,f;if(u.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((c=o==null?void 0:o.latest_reactions)!=null&&c.reply))return;const i=(f=(d=o==null?void 0:o.latest_reactions)==null?void 0:d.reply)==null?void 0:f.map(h=>{var p;return h.id===l.replyParentId&&((p=h.latest_children.reply)==null||p.map(x=>(x.id===l.replySlug&&(x.data.content=u),x))),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:i}})),{previousActivity:o}}}),cn=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:u,replyParentId:o})=>{var d;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=(d=i==null?void 0:i.latest_reactions.reply)==null?void 0:d.map(f=>{var h;return f.id===o&&((h=f.latest_children.reply)==null||h.map(p=>{var x;return p.id===u&&((x=p.children_counts)!=null&&x.like?p.children_counts.like+=1:p.children_counts={like:1}),p})),f});return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}},onError:(u,o,i)=>{e.setQueryData(t,i.previousActivity)},onSuccess:(u,o)=>{var d;const i=e.getQueryData(t),c=(d=i==null?void 0:i.latest_reactions.reply)==null?void 0:d.map(f=>{var h;return f.id===o.replyParentId&&((h=f.latest_children.reply)==null||h.map(p=>(p.id===o.replyId&&(p.latest_children=p.latest_children||{},p.own_children=p.own_children||{},p.latest_children.like=p.latest_children.like||[],p.own_children.like=p.own_children.like||[],p.latest_children.like.push(u),p.own_children.like.push(u)),p))),f});return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}}}),Jr=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:a,replies:l,functions:{create:u,edit:o,join:i,leave:c,like:d,unlike:f}})=>{const h=C.useIntl(),p=G.useQueryClient(),x=g.useContext(Ie),y=Yr({queryClient:p,queryKey:[e,t,r],mutationFn:async w=>u({replyId:n,content:w.body})}),{mutate:_}=G.useMutation(y),T=Gr({queryClient:p,queryKey:[e,t,r],mutationFn:o}),{mutate:j}=G.useMutation(T),$=cn({queryClient:p,queryKey:[e,t,r],mutationFn:d}),{mutate:R}=G.useMutation($),A=cn({queryClient:p,queryKey:[e,t,r],mutationFn:f}),{mutate:B}=G.useMutation(A),V=g.useCallback(({replyId:w,replyParentId:H})=>R({replyId:w,replyParentId:H}),[R]),b=g.useCallback(({replyId:w,replyParentId:H})=>B({replyId:w,replyParentId:H}),[B]);return s.jsx(Vn,{count:a,showRepliesButton:a>0||x.showForm,children:s.jsxs(s.Fragment,{children:[(l==null?void 0:l.length)===0||(l==null?void 0:l.map(w=>{var H,k,Y,N,I,Q,W,X,ne,se,re,oe,ee,F;return s.jsx(Le,{content:{type:"reply",body:typeof w.data.content=="string"?(H=w==null?void 0:w.data)==null?void 0:H.content:((Y=(k=w==null?void 0:w.data)==null?void 0:k.content)==null?void 0:Y.text)||"",createdAt:w==null?void 0:w.created_at,slugs:{parentId:t,activityId:r,replyParentId:w==null?void 0:w.parent,reply:w==null?void 0:w.id},slug:"",author:{id:(N=w==null?void 0:w.user)==null?void 0:N.id,name:(Q=(I=w==null?void 0:w.user)==null?void 0:I.data)==null?void 0:Q.name,organization:(X=(W=w==null?void 0:w.user)==null?void 0:W.data)==null?void 0:X.organization,jobTitle:(se=(ne=w==null?void 0:w.user)==null?void 0:ne.data)==null?void 0:se.jobTitle,image:{thumbnail:((oe=(re=w==null?void 0:w.user)==null?void 0:re.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((ee=w==null?void 0:w.own_children)==null?void 0:ee.like)&&((F=w==null?void 0:w.own_children)==null?void 0:F.like.length)>0,likes:0},functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(K,J)=>j({replyInfo:K,content:J})},likes:{createLike:()=>V({replyId:w==null?void 0:w.id,replyParentId:w==null?void 0:w.parent}),deleteLike:()=>b({replyId:w==null?void 0:w.id,replyParentId:w==null?void 0:w.parent})},comments:{}}},w==null?void 0:w.id)})),x.showForm&&s.jsx(st,{contentType:"reply",createPost:(w,H)=>_(H),membershipRequiredToPost:{isMember:!0,required:!0,join:i,leave:c,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}})]})})},Yn=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:a,functions:{createReply:l,editReply:u,like:o,unlike:i,join:c,leave:d}})=>{const f=C.useIntl(),h=G.useQueryClient(),p=g.useContext(xe),x=Ur({queryClient:h,queryKey:[e,t,n],mutationFn:async b=>l({activityId:n,content:b.body})}),{mutate:y}=G.useMutation(x),_=Wr({queryClient:h,queryKey:[e,t,n],mutationFn:async b=>u(b)}),{mutate:T}=G.useMutation(_),j=zr({queryClient:h,queryKey:[e,t,n],mutationFn:o}),{mutate:$}=G.useMutation(j),R=Vr({queryClient:h,queryKey:[e,t,n],user:p,mutationFn:i}),{mutate:A}=G.useMutation(R),B=g.useCallback(({replyId:b})=>$({replyId:b}),[$]),V=g.useCallback(({replyId:b})=>A({replyId:b}),[A]);return s.jsxs(s.Fragment,{children:[s.jsx(st,{contentType:"reply",createPost:(b,w)=>{y(w)},membershipRequiredToPost:{isMember:a,required:!0,join:c,leave:d,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var k,Y,N,I,Q,W,X,ne,se,re,oe,ee,F,K,J,ae,ue,de;const w=((k=b==null?void 0:b.user)==null?void 0:k.id)===(p==null?void 0:p.id),H=Lt(a,w);return s.jsx(Qn,{children:s.jsx(Le,{content:{type:"reply",body:typeof b.data.content=="string"?(Y=b==null?void 0:b.data)==null?void 0:Y.content:((I=(N=b==null?void 0:b.data)==null?void 0:N.content)==null?void 0:I.text)||"",canLike:H,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(Q=b==null?void 0:b.user)==null?void 0:Q.id,name:(X=(W=b==null?void 0:b.user)==null?void 0:W.data)==null?void 0:X.name,organization:(se=(ne=b==null?void 0:b.user)==null?void 0:ne.data)==null?void 0:se.organization,jobTitle:(oe=(re=b==null?void 0:b.user)==null?void 0:re.data)==null?void 0:oe.jobTitle,image:{thumbnail:((F=(ee=b==null?void 0:b.user)==null?void 0:ee.data)==null?void 0:F.thumbnail)||void 0}},userLiked:((K=b==null?void 0:b.own_children)==null?void 0:K.like)&&((J=b==null?void 0:b.own_children)==null?void 0:J.like.length)>0,likes:((ae=b==null?void 0:b.children_counts)==null?void 0:ae.like)||0},functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(be,ke)=>T({replyInfo:be,content:ke})},likes:{createLike:()=>B({replyId:b==null?void 0:b.id}),deleteLike:()=>V({replyId:b==null?void 0:b.id})},comments:{}},children:s.jsx(Jr,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((ue=b==null?void 0:b.children_counts)==null?void 0:ue.reply)||0,replies:(de=b==null?void 0:b.latest_children)==null?void 0:de.reply,isMember:a,functions:{create:l,edit:u,like:o,unlike:i,join:c,leave:d}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},Xr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:u,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return i&&i.id===(u==null?void 0:u.activityId)&&(i.content=o),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onError:(u,o,i)=>{e.setQueryData(t,i.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var i;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(i=o==null?void 0:o.reaction_counts)!=null&&i.like?o.reaction_counts.like+=1:o&&(o.reaction_counts={like:1}),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:o=>{const i=e.getQueryData(t);return i!=null&&i.latest_reactions.like?i.latest_reactions.like.push(o):i&&(i.latest_reactions={like:[o]}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),qr=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:a})=>({mutationFn:a,onMutate:async()=>{var d;await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return(d=c==null?void 0:c.reaction_counts)!=null&&d.like&&c.reaction_counts.like>0&&(c.reaction_counts.like-=1),e.setQueryData(t,()=>({...c})),{previousActivity:c}},onError:(c,d,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,h,p;if(!r)return;const c=(p=(h=(f=r.latest_reactions)==null?void 0:f.like)==null?void 0:h.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,d=e.getQueryData(t);if(d!=null&&d.latest_reactions.like)return d.latest_reactions.like=d.latest_reactions.like.filter(x=>x.id!==c),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Kr=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:a,editActivity:l,likeActivity:u,unlikeActivity:o,createReply:i,editReply:c,likeReply:d,unlikeReply:f,join:h,leave:p}})=>{var I,Q,W,X,ne,se,re,oe,ee,F,K;const x=g.useContext(xe),y=G.useQueryClient(),{data:_,error:T,isLoading:j,isFetching:$}=G.useQuery({queryKey:[e,t,n],queryFn:a}),R=Xr({queryClient:y,queryKey:[e,t,n],mutationFn:async J=>await l(J)}),{mutate:A}=G.useMutation(R),B=Zr({queryClient:y,queryKey:[e,t,n],mutationFn:u}),{mutate:V}=G.useMutation(B),b=qr({queryClient:y,queryKey:[e,t,n],user:x,mutationFn:async()=>{var ae,ue,de;const J=(de=(ue=(ae=_==null?void 0:_.latest_reactions)==null?void 0:ae.like)==null?void 0:ue.find(be=>be.user_id===(x==null?void 0:x.id)))==null?void 0:de.id;await o({activityId:n,reactionId:J})},activity:_}),{mutate:w}=G.useMutation(b),H=g.useCallback(({activityId:J})=>V({activityId:J}),[V]),k=g.useCallback(async({activityId:J})=>w({activityId:J}),[w]);if(T)return s.jsx(Ne,{variant:"error",text:T.message});if(j||$)return s.jsx(fe,{style:{height:"400px"}});const Y=((I=_==null?void 0:_.actor)==null?void 0:I.id)===(x==null?void 0:x.id),N=Lt(r,Y);return s.jsx(Le,{content:{type:"post",body:_==null?void 0:_.content,canLike:N,createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:_==null?void 0:_.id},slug:n,author:{id:(Q=_==null?void 0:_.actor)==null?void 0:Q.id,name:(W=_==null?void 0:_.actor)==null?void 0:W.data.name,organization:(X=_==null?void 0:_.actor)==null?void 0:X.data.organization,jobTitle:(ne=_==null?void 0:_.actor)==null?void 0:ne.data.jobTitle,image:{thumbnail:((se=_==null?void 0:_.actor)==null?void 0:se.data.thumbnail)||void 0}},userLiked:((re=_==null?void 0:_.own_reactions)==null?void 0:re.like)&&((oe=_==null?void 0:_.own_reactions)==null?void 0:oe.like.length)>0,likes:_&&(_==null?void 0:_.reaction_counts.like),comments:_&&(_==null?void 0:_.reaction_counts.reply)},originalAuthorId:(ee=_==null?void 0:_.actor)==null?void 0:ee.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(J,ae)=>A({activityInfo:J,content:ae})},likes:{createLike:()=>H({activityId:n}),deleteLike:()=>k({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((F=_==null?void 0:_.reaction_counts)==null?void 0:F.reply)||0,")"]}),s.jsx(Yn,{basePath:e,parentId:t,activityId:n,repliesList:(K=_==null?void 0:_.latest_reactions)==null?void 0:K.reply,isMember:r,functions:{createReply:i,like:d,unlike:f,editReply:c,join:h,leave:p}})]})},n)},eo=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}});exports.ASSETS_BUCKET=Je;exports.ActivitiesFeed=Qr;exports.ActivitySection=Kr;exports.AddPost=st;exports.BannerSection=Gs;exports.Breadcrumbs=hr;exports.Button=z;exports.ButtonWrapper=Fe;exports.CacheProvider=Cn;exports.CollapsibleSection=Ct;exports.Columns=br;exports.CommunityDetails=fr;exports.Contributors=Mn;exports.ConversationContext=Ie;exports.CookieBanner=Nn;exports.DiscussionConversation=Qn;exports.DiscussionForm=Nt;exports.DiscussionLikes=Un;exports.DiscussionPost=Le;exports.DiscussionThread=Vn;exports.Divider=we;exports.DownloadSection=Ws;exports.EMAILS=Se;exports.EmailHelperTextBox=vr;exports.EmptyStateBox=Ne;exports.Filters=pr;exports.FlagsProvider=Rn;exports.Footer=Ft;exports.FullWidthSection=Mt;exports.GlobalProviders=mr;exports.Header=Pt;exports.HelperTextBox=kn;exports.HiddenFromScreenReaders=Tt;exports.HideShowTextBox=Zs;exports.HighlightedTextBox=_e;exports.IntlProvider=An;exports.InviteForm=Hn;exports.InviteModal=Fr;exports.JoinButton=At;exports.LanguageSwitcher=_r;exports.Link=Pe;exports.LoadMore=Fn;exports.LoadingBlock=ir;exports.LoadingPlaceholder=fe;exports.LoadingState=Tn;exports.Logo=Dt;exports.LogoSection=zs;exports.MarkdownText=St;exports.MarketingBox=Js;exports.Member=nt;exports.MembersList=Cr;exports.Modal=Wn;exports.MoreMenu=Pn;exports.NUMBER_OF_USERS=Xs;exports.Overlay=It;exports.PageLayout=Tr;exports.PasswordRules=jr;exports.Pill=yn;exports.ProfilePicture=tt;exports.ProgressBar=Sn;exports.Rating=yr;exports.RepliesFeed=Yn;exports.ResponsesHeading=Nr;exports.ResponsiveImage=bn;exports.SearchForm=On;exports.Span=jn;exports.StatusBanner=Xe;exports.Tags=Mr;exports.Tooltip=vn;exports.UserContext=xe;exports.UserProvider=Dn;exports.VisuallyHidden=te;exports.addAriaProps=zn;exports.getMember=Rt;exports.headerData=Ae;exports.mapGetStreamData=eo;exports.useCurrentPath=fn;exports.useEffectAfterMount=ve;exports.useScreenWidth=De;exports.useScrollListener=pn;exports.useScrollToHash=Rs;
|