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